4 AM_INIT_AUTOMAKE(spl, 0.0.1)
5 AC_CONFIG_HEADERS([config.h])
15 [ --with-linux=PATH Path to kernel source ],
16 [kernelsrc="$withval"; kernelbuild="$withval"])
17 AC_ARG_WITH(kernel-build,
18 [ --with-linux-obj=PATH Path to kernel build objects ],
19 [kernelbuild="$withval"])
21 AC_MSG_CHECKING([kernel source directory])
22 if test -z "$kernelsrc"; then
24 sourcelink=/lib/modules/${ver}/source
25 buildlink=/lib/modules/${ver}/build
27 if test -e $sourcelink; then
28 kernelsrc=`(cd $sourcelink; /bin/pwd)`
30 if test -e $buildlink; then
31 kernelbuild=`(cd $buildlink; /bin/pwd)`
33 if test -z "$kernelsrc"; then
34 kernelsrc=$kernelbuild
36 if test -z "$kernelsrc" -o -z "$kernelbuild"; then
37 AC_MSG_RESULT([Not found])
39 *** Please specify the location of the kernel source
40 *** with the '--with-kernel=PATH' option])
44 AC_MSG_RESULT([$kernelsrc])
45 AC_MSG_CHECKING([kernel build directory])
46 AC_MSG_RESULT([$kernelbuild])
48 AC_MSG_CHECKING([kernel source version])
49 if test -r $kernelbuild/include/linux/version.h &&
50 fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then
52 kernsrcver=`(echo "#include <linux/version.h>";
53 echo "kernsrcver=UTS_RELEASE") |
54 cpp -I $kernelbuild/include |
55 grep "^kernsrcver=" | cut -d \" -f 2`
57 elif test -r $kernelbuild/include/linux/utsrelease.h &&
58 fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then
60 kernsrcver=`(echo "#include <linux/utsrelease.h>";
61 echo "kernsrcver=UTS_RELEASE") |
62 cpp -I $kernelbuild/include |
63 grep "^kernsrcver=" | cut -d \" -f 2`
66 if test -z "$kernsrcver"; then
67 AC_MSG_RESULT([Not found])
69 *** Cannot determine the version of the linux kernel source.
70 *** Please prepare the kernel before running this script])
73 AC_MSG_RESULT([$kernsrcver])
74 kmoduledir=${INSTALL_MOD_PATH}/lib/modules/$kernsrcver
79 # Each version of the kernel provides a slightly different
80 # ABI, so figure out what we have to work with and adapt.
82 AC_MSG_CHECKING([if kernel defines kzalloc function])
83 if egrep -qw "kzalloc" $kernelsrc/include/linux/slab.h; then
84 AC_DEFINE(HAVE_KZALLOC, 1, [kzalloc() is defined])
91 AC_MSG_CHECKING([if kernel has mutex.h ])
92 if test -f $kernelsrc/include/linux/mutex.h; then
93 AC_DEFINE(HAVE_MUTEX_H, 1, [kernel has mutex.h])
99 # Add "V=1" to KERNELMAKE_PARAMS to enable verbose module build
101 KERNELCPPFLAGS="-I`/bin/pwd`/include"
103 if test "$kernelbuild" != "$kernelsrc"; then
104 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$kernelbuild"
107 AC_SUBST(KERNELMAKE_PARAMS)
108 AC_SUBST(KERNELCPPFLAGS)
109 AC_SUBST(KERNELCFLAGS)
111 AC_CONFIG_FILES([ Makefile
116 modules/splat/Makefile