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" |
| 113 | else |
| 114 | fuse_configured=no |
| 115 | kernel_autoconf=$kernelbuild/include/linux/autoconf.h |
| 116 | AC_MSG_CHECKING([if FUSE is configured in the kernel]) |
| 117 | if test -f $kernel_autoconf; then |
| 118 | if grep -q "^#define CONFIG_FUSE_FS 1" $kernel_autoconf || grep -q "^#define CONFIG_FUSE_FS_MODULE 1" $kernel_autoconf; then |
| 119 | fuse_configured=yes |
| 120 | fi |
| 121 | fi |
| 122 | AC_MSG_RESULT([$fuse_configured]) |
| 123 | if test -z "$enable_kernel_module" -a "$fuse_configured" = yes; then |
| 124 | ENABLE_FUSE_MODULE=n |
| 125 | fi |
| 126 | fi |
| 127 | fi |
| 128 | |
| 129 | if test "$ENABLE_FUSE_MODULE" = n; then |
| 130 | AC_MSG_NOTICE([NOTE: Detected that FUSE is already present in the kernel, so]) |
| 131 | AC_MSG_NOTICE([NOTE: building of kernel module is disabled. To force building]) |
| 132 | AC_MSG_NOTICE([NOTE: of kernel module use the '--enable-kernel-module' option.]) |
| 133 | fi |
| 134 | |
Miklos Szeredi | 8c7da23 | 2005-01-09 12:27:41 +0000 | [diff] [blame] | 135 | if test "$enable_kernel_module" = no; then |
| 136 | ENABLE_FUSE_MODULE=n |
Miklos Szeredi | 51ec103 | 2004-11-10 11:52:26 +0000 | [diff] [blame] | 137 | fi |
| 138 | |
Miklos Szeredi | 8c7da23 | 2005-01-09 12:27:41 +0000 | [diff] [blame] | 139 | AC_SUBST(ENABLE_FUSE_MODULE) |
| 140 | |
| 141 | if test "$ENABLE_FUSE_MODULE" = y; then |
| 142 | AC_MSG_CHECKING([if kernel has extended attribute support]) |
| 143 | if test -f $kernelsrc/include/linux/xattr.h; then |
| 144 | AC_DEFINE(HAVE_KERNEL_XATTR, 1, [Kernel has xattr support]) |
| 145 | AC_MSG_RESULT([yes]) |
| 146 | else |
| 147 | AC_MSG_RESULT([no]) |
| 148 | fi |
Miklos Szeredi | e518374 | 2005-02-02 11:14:04 +0000 | [diff] [blame] | 149 | |
Miklos Szeredi | d9079a7 | 2005-10-26 15:29:06 +0000 | [diff] [blame] | 150 | AC_MSG_CHECKING([whether lookup_instantiate_filp is defined]) |
| 151 | if test -f $kernelsrc/include/linux/namei.h && egrep -q "lookup_instantiate_filp" $kernelsrc/include/linux/namei.h; then |
| 152 | AC_DEFINE(HAVE_LOOKUP_INSTANTIATE_FILP, 1, [lookup_instantiate_filp() is defined]) |
| 153 | AC_MSG_RESULT([yes]) |
| 154 | else |
| 155 | AC_MSG_RESULT([no]) |
| 156 | fi |
| 157 | |
Miklos Szeredi | 8c7da23 | 2005-01-09 12:27:41 +0000 | [diff] [blame] | 158 | isuml=no |
| 159 | KERNELMAKE_PARAMS= |
| 160 | KERNELCPPFLAGS= |
| 161 | AC_MSG_CHECKING([if this is user mode linux]) |
Miklos Szeredi | 2c65041 | 2005-10-26 15:12:59 +0000 | [diff] [blame] | 162 | 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] | 163 | isuml=yes |
| 164 | KERNELMAKE_PARAMS="ARCH=um" |
| 165 | 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" |
| 166 | fi |
| 167 | AC_MSG_RESULT([$isuml]) |
Miklos Szeredi | 2c65041 | 2005-10-26 15:12:59 +0000 | [diff] [blame] | 168 | if test "$kernelbuild" != "$kernelsrc"; then |
| 169 | KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$kernelbuild" |
| 170 | fi |
Miklos Szeredi | 8c7da23 | 2005-01-09 12:27:41 +0000 | [diff] [blame] | 171 | AC_SUBST(KERNELMAKE_PARAMS) |
| 172 | AC_SUBST(KERNELCPPFLAGS) |
Miklos Szeredi | 3cc8a26 | 2005-11-29 11:04:27 +0000 | [diff] [blame] | 173 | AC_SUBST(KERNELCFLAGS) |
Miklos Szeredi | 51ec103 | 2004-11-10 11:52:26 +0000 | [diff] [blame] | 174 | fi |
Miklos Szeredi | 51ec103 | 2004-11-10 11:52:26 +0000 | [diff] [blame] | 175 | |
| 176 | AC_CONFIG_FILES([Makefile]) |
| 177 | AC_OUTPUT |