4 AM_INIT_AUTOMAKE(spl, 0.0.1)
5 AC_CONFIG_HEADERS([config.h])
17 [ --with-linux=PATH Path to kernel source ],
18 [kernelsrc="$withval"; kernelbuild="$withval"])
19 AC_ARG_WITH(kernel-build,
20 [ --with-linux-obj=PATH Path to kernel build objects ],
21 [kernelbuild="$withval"])
23 AC_MSG_CHECKING([kernel source directory])
24 if test -z "$kernelsrc"; then
26 sourcelink=/lib/modules/${ver}/source
27 buildlink=/lib/modules/${ver}/build
29 if test -e $sourcelink; then
30 kernelsrc=`(cd $sourcelink; /bin/pwd)`
32 if test -e $buildlink; then
33 kernelbuild=`(cd $buildlink; /bin/pwd)`
35 if test -z "$kernelsrc"; then
36 kernelsrc=$kernelbuild
38 if test -z "$kernelsrc" -o -z "$kernelbuild"; then
39 AC_MSG_RESULT([Not found])
41 *** Please specify the location of the kernel source
42 *** with the '--with-kernel=PATH' option])
46 AC_MSG_RESULT([$kernelsrc])
47 AC_MSG_CHECKING([kernel build directory])
48 AC_MSG_RESULT([$kernelbuild])
50 AC_MSG_CHECKING([kernel source version])
51 if test -r $kernelbuild/include/linux/version.h &&
52 fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then
54 kernsrcver=`(echo "#include <linux/version.h>";
55 echo "kernsrcver=UTS_RELEASE") |
56 cpp -I $kernelbuild/include |
57 grep "^kernsrcver=" | cut -d \" -f 2`
59 elif test -r $kernelbuild/include/linux/utsrelease.h &&
60 fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then
62 kernsrcver=`(echo "#include <linux/utsrelease.h>";
63 echo "kernsrcver=UTS_RELEASE") |
64 cpp -I $kernelbuild/include |
65 grep "^kernsrcver=" | cut -d \" -f 2`
68 if test -z "$kernsrcver"; then
69 AC_MSG_RESULT([Not found])
71 *** Cannot determine the version of the linux kernel source.
72 *** Please prepare the kernel before running this script])
75 AC_MSG_RESULT([$kernsrcver])
76 kmoduledir=${INSTALL_MOD_PATH}/lib/modules/$kernsrcver
81 # Each version of the kernel provides a slightly different
82 # ABI, so figure out what we have to work with and adapt.
84 AC_MSG_CHECKING([if kernel defines kzalloc function])
85 if egrep -qw "kzalloc" $kernelsrc/include/linux/slab.h; then
86 AC_DEFINE(HAVE_KZALLOC, 1, [kzalloc() is defined])
93 AC_MSG_CHECKING([if kernel has mutex.h ])
94 if test -f $kernelsrc/include/linux/mutex.h; then
95 AC_DEFINE(HAVE_MUTEX_H, 1, [kernel has mutex.h])
101 if test "$kernelbuild" != "$kernelsrc"; then
102 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$kernelbuild"
105 AC_SUBST(KERNELMAKE_PARAMS)
106 AC_SUBST(KERNELCPPFLAGS)
107 AC_SUBST(KERNELCFLAGS)
109 AC_CONFIG_FILES([ Makefile