Miklos Szeredi | 95da860 | 2006-01-06 18:29:40 +0000 | [diff] [blame] | 1 | AC_INIT(fuse-kernel, 2.5.0-pre2) |
Miklos Szeredi | 51ec103 | 2004-11-10 11:52:26 +0000 | [diff] [blame] | 2 | AC_CONFIG_HEADERS([config.h]) |
| 3 | |
Miklos Szeredi | 3a6ea06 | 2004-11-11 10:33:58 +0000 | [diff] [blame] | 4 | AC_PROG_INSTALL |
| 5 | |
Miklos Szeredi | bac4c77 | 2005-11-23 13:35:54 +0000 | [diff] [blame] | 6 | runver=`uname -r` |
| 7 | ENABLE_FUSE_MODULE=y |
Miklos Szeredi | 3cc8a26 | 2005-11-29 11:04:27 +0000 | [diff] [blame] | 8 | KERNELCFLAGS= |
Miklos Szeredi | bac4c77 | 2005-11-23 13:35:54 +0000 | [diff] [blame] | 9 | |
Miklos Szeredi | 51ec103 | 2004-11-10 11:52:26 +0000 | [diff] [blame] | 10 | kernelsrc= |
Miklos Szeredi | 2c65041 | 2005-10-26 15:12:59 +0000 | [diff] [blame] | 11 | kernelbuild= |
Miklos Szeredi | 51ec103 | 2004-11-10 11:52:26 +0000 | [diff] [blame] | 12 | AC_ARG_WITH(kernel, |
| 13 | [ --with-kernel=PATH Specify location of kernel source ], |
Miklos Szeredi | 2c65041 | 2005-10-26 15:12:59 +0000 | [diff] [blame] | 14 | [kernelsrc="$withval"; kernelbuild="$withval"]) |
| 15 | AC_ARG_WITH(kernel-build, |
| 16 | [ --with-kernel-build=PATH Specify location of kernel build ], |
| 17 | [kernelbuild="$withval"]) |
Miklos Szeredi | 8c7da23 | 2005-01-09 12:27:41 +0000 | [diff] [blame] | 18 | AC_ARG_ENABLE(kernel-module, |
| 19 | [ --enable-kernel-module Compile kernel module ]) |
| 20 | |
Miklos Szeredi | bac4c77 | 2005-11-23 13:35:54 +0000 | [diff] [blame] | 21 | if test -z "$enable_kernel_module" -a -z "$kernelbuild" && echo "$runver" | grep -q "^2.6"; then |
| 22 | checkmodule=no |
| 23 | AC_MSG_CHECKING([if FUSE is loaded as a module]) |
| 24 | if cat /proc/modules | grep -q "^fuse "; then |
| 25 | AC_MSG_RESULT([yes]) |
| 26 | checkmodule=yes |
| 27 | else |
| 28 | AC_MSG_RESULT([no]) |
| 29 | AC_MSG_CHECKING([if FUSE module is built into the kernel]) |
| 30 | if test -e /sys/class/misc/fuse; then |
| 31 | AC_MSG_RESULT([yes]) |
| 32 | ENABLE_FUSE_MODULE=n |
| 33 | else |
| 34 | AC_MSG_RESULT([no]) |
| 35 | checkmodule=yes |
Miklos Szeredi | 8c7da23 | 2005-01-09 12:27:41 +0000 | [diff] [blame] | 36 | fi |
| 37 | fi |
Miklos Szeredi | bac4c77 | 2005-11-23 13:35:54 +0000 | [diff] [blame] | 38 | if test "$checkmodule" = yes; then |
| 39 | AC_MSG_CHECKING([if FUSE module is from official kernel]) |
| 40 | if fgrep -q "fuse distribution version: " /lib/modules/${runver}/kernel/fs/fuse/fuse.ko 2> /dev/null; then |
| 41 | AC_MSG_RESULT([no]) |
| 42 | else |
| 43 | AC_MSG_RESULT([yes]) |
| 44 | ENABLE_FUSE_MODULE=n |
| 45 | fi |
Miklos Szeredi | 8c7da23 | 2005-01-09 12:27:41 +0000 | [diff] [blame] | 46 | fi |
| 47 | fi |
Miklos Szeredi | bac4c77 | 2005-11-23 13:35:54 +0000 | [diff] [blame] | 48 | |
| 49 | if test "$ENABLE_FUSE_MODULE" = y; then |
| 50 | AC_MSG_CHECKING([kernel source directory]) |
| 51 | if test -z "$kernelsrc"; then |
| 52 | kernelbuild= |
| 53 | sourcelink=/lib/modules/${runver}/source |
| 54 | buildlink=/lib/modules/${runver}/build |
| 55 | |
| 56 | if test -e $sourcelink; then |
| 57 | kernelsrc=`(cd $sourcelink; /bin/pwd)` |
| 58 | fi |
| 59 | if test -e $buildlink; then |
| 60 | kernelbuild=`(cd $buildlink; /bin/pwd)` |
| 61 | fi |
| 62 | if test -z "$kernelsrc"; then |
| 63 | kernelsrc=$kernelbuild |
| 64 | fi |
| 65 | if test -z "$kernelsrc" -o -z "$kernelbuild"; then |
| 66 | AC_MSG_RESULT([Not found]) |
| 67 | AC_MSG_ERROR([ |
| 68 | *** Please specify the location of the kernel source with |
| 69 | *** the '--with-kernel=SRCDIR' option]) |
| 70 | fi |
| 71 | fi |
| 72 | AC_MSG_RESULT([$kernelsrc]) |
| 73 | AC_MSG_CHECKING([kernel build directory]) |
| 74 | AC_MSG_RESULT([$kernelbuild]) |
| 75 | |
| 76 | AC_MSG_CHECKING([kernel source version]) |
| 77 | if test -r $kernelbuild/include/linux/version.h; then |
| 78 | kernsrcver=`(echo "#include <linux/version.h>"; echo "kernsrcver=UTS_RELEASE") | cpp -I $kernelbuild/include | grep "^kernsrcver=" | cut -d \" -f 2` |
| 79 | fi |
| 80 | if test -z "$kernsrcver"; then |
| 81 | AC_MSG_RESULT([Not found]) |
| 82 | AC_MSG_ERROR([ |
| 83 | *** Cannot determine the version of the linux kernel source. Please |
| 84 | *** prepare the kernel before running this script]) |
| 85 | fi |
| 86 | AC_MSG_RESULT([$kernsrcver]) |
| 87 | majver=`echo "$kernsrcver" | cut -f-2 -d.` |
| 88 | kmoduledir=${INSTALL_MOD_PATH}/lib/modules/$kernsrcver |
| 89 | AC_SUBST(kernelsrc) |
| 90 | AC_SUBST(majver) |
| 91 | AC_SUBST(kmoduledir) |
| 92 | |
| 93 | if echo "$kernsrcver" | grep -q "^2.4"; then |
| 94 | old_cflags="$CFLAGS" |
| 95 | CFLAGS="-I${kernelsrc}/include -Wall -O2 -fno-strict-aliasing -D__KERNEL__" |
| 96 | AC_CHECK_DECL(i_size_read, |
| 97 | AC_DEFINE(HAVE_I_SIZE_FUNC, 1, |
| 98 | [Kernel has i_size_read() and i_size_write() functions]),, |
| 99 | [#include <linux/fs.h>]) |
| 100 | AC_CHECK_DECL(recalc_sigpending_tsk, |
| 101 | AC_DEFINE(HAVE_RECALC_SIGPENDING_TSK, 1, |
| 102 | [Kernel has recalc_sigpending_tsk() function]),, |
| 103 | [#include <linux/sched.h>]) |
Miklos Szeredi | 3cc8a26 | 2005-11-29 11:04:27 +0000 | [diff] [blame] | 104 | AC_MSG_CHECKING([if '-msoft-float' option is valid]) |
| 105 | CFLAGS="-msoft-float" |
| 106 | have_msoft_float=no |
| 107 | AC_TRY_COMPILE([], [], [have_msoft_float=yes]) |
| 108 | AC_MSG_RESULT([$have_msoft_float]) |
| 109 | if test "$have_msoft_float" = yes; then |
| 110 | KERNELCFLAGS="$CFLAGS" |
| 111 | fi |
Miklos Szeredi | bac4c77 | 2005-11-23 13:35:54 +0000 | [diff] [blame] | 112 | CFLAGS="$old_cflags" |
Miklos Szeredi | a982034 | 2006-01-10 10:54:11 +0000 | [diff] [blame^] | 113 | AC_MSG_CHECKING([architecture]) |
| 114 | arch=`/bin/ls -l ${kernelsrc}/include/asm | sed "s/.*-> asm-//"` |
| 115 | AC_MSG_RESULT([$arch]) |
| 116 | if test "$arch" = x86_64; then |
| 117 | KERNELCFLAGS="$KERNELCFLAGS -mno-red-zone -mcmodel=kernel -fno-reorder-blocks -finline-limit=2000" |
| 118 | fi |
Miklos Szeredi | bac4c77 | 2005-11-23 13:35:54 +0000 | [diff] [blame] | 119 | else |
| 120 | fuse_configured=no |
| 121 | kernel_autoconf=$kernelbuild/include/linux/autoconf.h |
| 122 | AC_MSG_CHECKING([if FUSE is configured in the kernel]) |
| 123 | if test -f $kernel_autoconf; then |
| 124 | if grep -q "^#define CONFIG_FUSE_FS 1" $kernel_autoconf || grep -q "^#define CONFIG_FUSE_FS_MODULE 1" $kernel_autoconf; then |
| 125 | fuse_configured=yes |
| 126 | fi |
| 127 | fi |
| 128 | AC_MSG_RESULT([$fuse_configured]) |
| 129 | if test -z "$enable_kernel_module" -a "$fuse_configured" = yes; then |
| 130 | ENABLE_FUSE_MODULE=n |
| 131 | fi |
| 132 | fi |
| 133 | fi |
| 134 | |
| 135 | if test "$ENABLE_FUSE_MODULE" = n; then |
| 136 | AC_MSG_NOTICE([NOTE: Detected that FUSE is already present in the kernel, so]) |
| 137 | AC_MSG_NOTICE([NOTE: building of kernel module is disabled. To force building]) |
| 138 | AC_MSG_NOTICE([NOTE: of kernel module use the '--enable-kernel-module' option.]) |
| 139 | fi |
| 140 | |
Miklos Szeredi | 8c7da23 | 2005-01-09 12:27:41 +0000 | [diff] [blame] | 141 | if test "$enable_kernel_module" = no; then |
| 142 | ENABLE_FUSE_MODULE=n |
Miklos Szeredi | 51ec103 | 2004-11-10 11:52:26 +0000 | [diff] [blame] | 143 | fi |
| 144 | |
Miklos Szeredi | 8c7da23 | 2005-01-09 12:27:41 +0000 | [diff] [blame] | 145 | AC_SUBST(ENABLE_FUSE_MODULE) |
| 146 | |
| 147 | if test "$ENABLE_FUSE_MODULE" = y; then |
| 148 | AC_MSG_CHECKING([if kernel has extended attribute support]) |
| 149 | if test -f $kernelsrc/include/linux/xattr.h; then |
| 150 | AC_DEFINE(HAVE_KERNEL_XATTR, 1, [Kernel has xattr support]) |
| 151 | AC_MSG_RESULT([yes]) |
| 152 | else |
| 153 | AC_MSG_RESULT([no]) |
| 154 | fi |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 155 | |
Miklos Szeredi | d9079a7 | 2005-10-26 15:29:06 +0000 | [diff] [blame] | 156 | AC_MSG_CHECKING([whether lookup_instantiate_filp is defined]) |
| 157 | if test -f $kernelsrc/include/linux/namei.h && egrep -q "lookup_instantiate_filp" $kernelsrc/include/linux/namei.h; then |
| 158 | AC_DEFINE(HAVE_LOOKUP_INSTANTIATE_FILP, 1, [lookup_instantiate_filp() is defined]) |
| 159 | AC_MSG_RESULT([yes]) |
| 160 | else |
| 161 | AC_MSG_RESULT([no]) |
| 162 | fi |
| 163 | |
Miklos Szeredi | 8c7da23 | 2005-01-09 12:27:41 +0000 | [diff] [blame] | 164 | isuml=no |
| 165 | KERNELMAKE_PARAMS= |
| 166 | KERNELCPPFLAGS= |
| 167 | AC_MSG_CHECKING([if this is user mode linux]) |
Miklos Szeredi | 2c65041 | 2005-10-26 15:12:59 +0000 | [diff] [blame] | 168 | if test -f $kernelbuild/include/linux/autoconf.h && egrep -q "^#define CONFIG_(USERMODE|UML) 1" $kernelbuild/include/linux/autoconf.h; then |
Miklos Szeredi | 8c7da23 | 2005-01-09 12:27:41 +0000 | [diff] [blame] | 169 | isuml=yes |
| 170 | KERNELMAKE_PARAMS="ARCH=um" |
| 171 | KERNELCPPFLAGS="-D__arch_um__ -DSUBARCH=\\\"i386\\\" -D_LARGEFILE64_SOURCE -I${kernelsrc}/arch/um/include -Derrno=kernel_errno -I${kernelsrc}/arch/um/kernel/tt/include -I${kernelsrc}/arch/um/kernel/skas/include" |
| 172 | fi |
| 173 | AC_MSG_RESULT([$isuml]) |
Miklos Szeredi | 2c65041 | 2005-10-26 15:12:59 +0000 | [diff] [blame] | 174 | if test "$kernelbuild" != "$kernelsrc"; then |
| 175 | KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$kernelbuild" |
| 176 | fi |
Miklos Szeredi | 8c7da23 | 2005-01-09 12:27:41 +0000 | [diff] [blame] | 177 | AC_SUBST(KERNELMAKE_PARAMS) |
| 178 | AC_SUBST(KERNELCPPFLAGS) |
Miklos Szeredi | 3cc8a26 | 2005-11-29 11:04:27 +0000 | [diff] [blame] | 179 | AC_SUBST(KERNELCFLAGS) |
Miklos Szeredi | 51ec103 | 2004-11-10 11:52:26 +0000 | [diff] [blame] | 180 | fi |
Miklos Szeredi | 51ec103 | 2004-11-10 11:52:26 +0000 | [diff] [blame] | 181 | |
| 182 | AC_CONFIG_FILES([Makefile]) |
| 183 | AC_OUTPUT |