4 AM_INIT_AUTOMAKE(spl, 0.0.1)
5 AC_CONFIG_HEADERS([config.h])
16 [ --with-linux=PATH Path to kernel source ],
17 [kernelsrc="$withval"; kernelbuild="$withval"])
18 AC_ARG_WITH(kernel-build,
19 [ --with-linux-obj=PATH Path to kernel build objects ],
20 [kernelbuild="$withval"])
22 AC_MSG_CHECKING([kernel source directory])
23 if test -z "$kernelsrc"; then
25 sourcelink=/lib/modules/${ver}/source
26 buildlink=/lib/modules/${ver}/build
28 if test -e $sourcelink; then
29 kernelsrc=`(cd $sourcelink; /bin/pwd)`
31 if test -e $buildlink; then
32 kernelbuild=`(cd $buildlink; /bin/pwd)`
34 if test -z "$kernelsrc"; then
35 kernelsrc=$kernelbuild
37 if test -z "$kernelsrc" -o -z "$kernelbuild"; then
38 AC_MSG_RESULT([Not found])
40 *** Please specify the location of the kernel source
41 *** with the '--with-kernel=PATH' option])
45 AC_MSG_RESULT([$kernelsrc])
46 AC_MSG_CHECKING([kernel build directory])
47 AC_MSG_RESULT([$kernelbuild])
49 AC_MSG_CHECKING([kernel source version])
50 if test -r $kernelbuild/include/linux/version.h &&
51 fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then
53 kernsrcver=`(echo "#include <linux/version.h>";
54 echo "kernsrcver=UTS_RELEASE") |
55 cpp -I $kernelbuild/include |
56 grep "^kernsrcver=" | cut -d \" -f 2`
58 elif test -r $kernelbuild/include/linux/utsrelease.h &&
59 fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then
61 kernsrcver=`(echo "#include <linux/utsrelease.h>";
62 echo "kernsrcver=UTS_RELEASE") |
63 cpp -I $kernelbuild/include |
64 grep "^kernsrcver=" | cut -d \" -f 2`
67 if test -z "$kernsrcver"; then
68 AC_MSG_RESULT([Not found])
70 *** Cannot determine the version of the linux kernel source.
71 *** Please prepare the kernel before running this script])
74 AC_MSG_RESULT([$kernsrcver])
75 kmoduledir=${INSTALL_MOD_PATH}/lib/modules/$kernsrcver
80 # Each version of the kernel provides a slightly different
81 # ABI, so figure out what we have to work with and adapt.
83 AC_MSG_CHECKING([if kernel defines kzalloc function])
84 if egrep -qw "kzalloc" $kernelsrc/include/linux/slab.h; then
85 AC_DEFINE(HAVE_KZALLOC, 1, [kzalloc() is defined])
91 AC_MSG_CHECKING([if inode has i_private field])
92 if egrep -qw "i_private" $kernelsrc/include/linux/fs.h; then
93 AC_DEFINE(HAVE_I_PRIVATE, 1, [inode has i_private field])
99 AC_MSG_CHECKING([if inode has i_mutex field ])
100 if egrep -qw "i_mutex" $kernelsrc/include/linux/fs.h; then
101 AC_DEFINE(HAVE_I_MUTEX, 1, [inode has i_mutex field])
107 AC_MSG_CHECKING([if kernel has mutex.h ])
108 if test -f $kernelsrc/include/linux/mutex.h; then
109 AC_DEFINE(HAVE_MUTEX_H, 1, [kernel has mutex.h])
115 if test "$kernelbuild" != "$kernelsrc"; then
116 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$kernelbuild"
119 AC_SUBST(KERNELMAKE_PARAMS)
120 AC_SUBST(KERNELCPPFLAGS)
121 AC_SUBST(KERNELCFLAGS)
123 AC_CONFIG_FILES([ Makefile