4 AM_INIT_AUTOMAKE(spl, 0.2.2)
5 AC_CONFIG_HEADERS([config.h])
14 AC_DEFUN([SPL_AC_KERNEL], [
18 AS_HELP_STRING([--with-linux=PATH],
19 [Path to kernel source]),
20 [kernelsrc="$withval"; kernelbuild="$withval"])
22 AC_ARG_WITH([linux-build],
23 AS_HELP_STRING([--with-linux-obj=PATH],
24 [Path to kernel build objects]),
25 [kernelbuild="$withval"])
27 AC_MSG_CHECKING([kernel source directory])
28 if test -z "$kernelsrc"; then
30 sourcelink=/lib/modules/${ver}/source
31 buildlink=/lib/modules/${ver}/build
33 if test -e $sourcelink; then
34 kernelsrc=`(cd $sourcelink; /bin/pwd)`
36 if test -e $buildlink; then
37 kernelbuild=`(cd $buildlink; /bin/pwd)`
39 if test -z "$kernelsrc"; then
40 kernelsrc=$kernelbuild
42 if test -z "$kernelsrc" -o -z "$kernelbuild"; then
43 AC_MSG_RESULT([Not found])
45 *** Please specify the location of the kernel source
46 *** with the '--with-kernel=PATH' option])
50 AC_MSG_RESULT([$kernelsrc])
51 AC_MSG_CHECKING([kernel build directory])
52 AC_MSG_RESULT([$kernelbuild])
54 AC_MSG_CHECKING([kernel source version])
55 if test -r $kernelbuild/include/linux/version.h &&
56 fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then
58 kernsrcver=`(echo "#include <linux/version.h>";
59 echo "kernsrcver=UTS_RELEASE") |
60 cpp -I $kernelbuild/include |
61 grep "^kernsrcver=" | cut -d \" -f 2`
63 elif test -r $kernelbuild/include/linux/utsrelease.h &&
64 fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then
66 kernsrcver=`(echo "#include <linux/utsrelease.h>";
67 echo "kernsrcver=UTS_RELEASE") |
68 cpp -I $kernelbuild/include |
69 grep "^kernsrcver=" | cut -d \" -f 2`
72 if test -z "$kernsrcver"; then
73 AC_MSG_RESULT([Not found])
75 *** Cannot determine the version of the linux kernel source.
76 *** Please prepare the kernel before running this script])
79 AC_MSG_RESULT([$kernsrcver])
80 kmoduledir=${INSTALL_MOD_PATH}/lib/modules/$kernsrcver
85 AC_DEFUN([SPL_AC_DEBUG], [
86 AC_MSG_CHECKING([whether debugging is enabled])
87 AC_ARG_ENABLE( [debug],
88 AS_HELP_STRING([--enable-debug],
89 [Enable generic debug support (default off)]),
90 [ case "$enableval" in
91 yes) spl_ac_debug=yes ;;
92 no) spl_ac_debug=no ;;
93 *) AC_MSG_RESULT([Error!])
94 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug]) ;;
97 if test "$spl_ac_debug" = yes; then
98 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG"
100 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
101 AC_DEFINE([NDEBUG], [1],
102 [Define to 1 to disable debug tracing])
104 AC_MSG_RESULT([${spl_ac_debug=no}])
107 AC_DEFUN([SPL_AC_DEBUG_KMEM], [
108 AC_MSG_CHECKING([whether kmem debugging is enabled])
109 AC_ARG_ENABLE( [debug-kmem],
110 AS_HELP_STRING([--enable-debug-kmem],
111 [Enable kmem debug support (default off)]),
112 [ case "$enableval" in
113 yes) spl_ac_debug=yes ;;
114 no) spl_ac_debug=no ;;
115 *) AC_MSG_RESULT([Error!])
116 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kmem]) ;;
119 if test "$spl_ac_debug" = yes; then
120 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"
121 AC_DEFINE([DEBUG_KMEM], [1],
122 [Define to 1 to enable kmem debugging])
124 AC_MSG_RESULT([${spl_ac_debug=no}])
127 AC_DEFUN([SPL_AC_DEBUG_MUTEX], [
128 AC_MSG_CHECKING([whether mutex debugging is enabled])
129 AC_ARG_ENABLE( [debug-mutex],
130 AS_HELP_STRING([--enable-debug-mutex],
131 [Enable mutex debug support (default off)]),
132 [ case "$enableval" in
133 yes) spl_ac_debug=yes ;;
134 no) spl_ac_debug=no ;;
135 *) AC_MSG_RESULT([Error!])
136 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-mutex]) ;;
139 if test "$spl_ac_debug" = yes; then
140 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_MUTEX"
141 AC_DEFINE([DEBUG_MUTEX], [1],
142 [Define to 1 to enable mutex debugging])
144 AC_MSG_RESULT([${spl_ac_debug=no}])
147 AC_DEFUN([SPL_AC_DEBUG_KSTAT], [
148 AC_MSG_CHECKING([whether kstat debugging is enabled])
149 AC_ARG_ENABLE( [debug-kstat],
150 AS_HELP_STRING([--enable-debug-kstat],
151 [Enable kstat debug support (default off)]),
152 [ case "$enableval" in
153 yes) spl_ac_debug=yes ;;
154 no) spl_ac_debug=no ;;
155 *) AC_MSG_RESULT([Error!])
156 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kstat]) ;;
159 if test "$spl_ac_debug" = yes; then
160 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KSTAT"
161 AC_DEFINE([DEBUG_KSTAT], [1],
162 [Define to 1 to enable kstat debugging])
164 AC_MSG_RESULT([${spl_ac_debug=no}])
167 AC_DEFUN([SPL_AC_DEBUG_CALLB], [
168 AC_MSG_CHECKING([whether callb debugging is enabled])
169 AC_ARG_ENABLE( [debug-callb],
170 AS_HELP_STRING([--enable-debug-callb],
171 [Enable callb debug support (default off)]),
172 [ case "$enableval" in
173 yes) spl_ac_debug=yes ;;
174 no) spl_ac_debug=no ;;
175 *) AC_MSG_RESULT([Error!])
176 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-callb]) ;;
179 if test "$spl_ac_debug" = yes; then
180 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_CALLB"
181 AC_DEFINE([DEBUG_CALLB], [1],
182 [Define to 1 to enable callb debugging])
184 AC_MSG_RESULT([${spl_ac_debug=no}])
196 # Add "V=1" to KERNELMAKE_PARAMS to enable verbose module build
198 KERNELCPPFLAGS="${KERNELCPPFLAGS} -I$TOPDIR -I$TOPDIR/include"
200 if test "$kernelbuild" != "$kernelsrc"; then
201 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$kernelbuild"
204 AC_SUBST(KERNELMAKE_PARAMS)
205 AC_SUBST(KERNELCPPFLAGS)
206 AC_SUBST(KERNELCFLAGS)
208 AC_CONFIG_FILES([ Makefile
213 modules/splat/Makefile