2 * This file is part of the SPL: Solaris Porting Layer.
4 * Copyright (c) 2008 Lawrence Livermore National Security, LLC.
5 * Produced at Lawrence Livermore National Laboratory
7 * Brian Behlendorf <behlendorf1@llnl.gov>,
8 * Herb Wartens <wartens2@llnl.gov>,
9 * Jim Garlick <garlick@llnl.gov>
12 * This is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This is distributed in the hope that it will be useful, but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 AM_INIT_AUTOMAKE(spl, 0.3.0)
31 AC_CONFIG_HEADERS([config.h])
40 AC_DEFUN([SPL_AC_KERNEL], [
44 AS_HELP_STRING([--with-linux=PATH],
45 [Path to kernel source]),
46 [kernelsrc="$withval"; kernelbuild="$withval"])
48 AC_ARG_WITH([linux-obj],
49 AS_HELP_STRING([--with-linux-obj=PATH],
50 [Path to kernel build objects]),
51 [kernelbuild="$withval"])
53 AC_MSG_CHECKING([kernel source directory])
54 if test -z "$kernelsrc"; then
56 sourcelink=/lib/modules/${ver}/source
57 buildlink=/lib/modules/${ver}/build
59 if test -e $sourcelink; then
60 kernelsrc=`(cd $sourcelink; /bin/pwd)`
62 if test -e $buildlink; then
63 kernelbuild=`(cd $buildlink; /bin/pwd)`
65 if test -z "$kernelsrc"; then
66 kernelsrc=$kernelbuild
68 if test -z "$kernelsrc" -o -z "$kernelbuild"; then
69 AC_MSG_RESULT([Not found])
71 *** Please specify the location of the kernel source
72 *** with the '--with-kernel=PATH' option])
76 AC_MSG_RESULT([$kernelsrc])
77 AC_MSG_CHECKING([kernel build directory])
78 AC_MSG_RESULT([$kernelbuild])
80 AC_MSG_CHECKING([kernel source version])
81 if test -r $kernelbuild/include/linux/version.h &&
82 fgrep -q UTS_RELEASE $kernelbuild/include/linux/version.h; then
84 kernsrcver=`(echo "#include <linux/version.h>";
85 echo "kernsrcver=UTS_RELEASE") |
86 cpp -I $kernelbuild/include |
87 grep "^kernsrcver=" | cut -d \" -f 2`
89 elif test -r $kernelbuild/include/linux/utsrelease.h &&
90 fgrep -q UTS_RELEASE $kernelbuild/include/linux/utsrelease.h; then
92 kernsrcver=`(echo "#include <linux/utsrelease.h>";
93 echo "kernsrcver=UTS_RELEASE") |
94 cpp -I $kernelbuild/include |
95 grep "^kernsrcver=" | cut -d \" -f 2`
98 if test -z "$kernsrcver"; then
99 AC_MSG_RESULT([Not found])
101 *** Cannot determine the version of the linux kernel source.
102 *** Please prepare the kernel before running this script])
105 AC_MSG_RESULT([$kernsrcver])
106 kmoduledir=${INSTALL_MOD_PATH}/lib/modules/$kernsrcver
111 AC_DEFUN([SPL_AC_DEBUG], [
112 AC_MSG_CHECKING([whether debugging is enabled])
113 AC_ARG_ENABLE( [debug],
114 AS_HELP_STRING([--enable-debug],
115 [Enable generic debug support (default off)]),
116 [ case "$enableval" in
117 yes) spl_ac_debug=yes ;;
118 no) spl_ac_debug=no ;;
119 *) AC_MSG_RESULT([Error!])
120 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug]) ;;
123 if test "$spl_ac_debug" = yes; then
124 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG"
126 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG"
127 AC_DEFINE([NDEBUG], [1],
128 [Define to 1 to disable debug tracing])
130 AC_MSG_RESULT([${spl_ac_debug=no}])
133 AC_DEFUN([SPL_AC_DEBUG_KMEM], [
134 AC_MSG_CHECKING([whether kmem debugging is enabled])
135 AC_ARG_ENABLE( [debug-kmem],
136 AS_HELP_STRING([--enable-debug-kmem],
137 [Enable kmem debug support (default off)]),
138 [ case "$enableval" in
139 yes) spl_ac_debug=yes ;;
140 no) spl_ac_debug=no ;;
141 *) AC_MSG_RESULT([Error!])
142 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kmem]) ;;
145 if test "$spl_ac_debug" = yes; then
146 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KMEM"
147 AC_DEFINE([DEBUG_KMEM], [1],
148 [Define to 1 to enable kmem debugging])
150 AC_MSG_RESULT([${spl_ac_debug=no}])
153 AC_DEFUN([SPL_AC_DEBUG_MUTEX], [
154 AC_MSG_CHECKING([whether mutex debugging is enabled])
155 AC_ARG_ENABLE( [debug-mutex],
156 AS_HELP_STRING([--enable-debug-mutex],
157 [Enable mutex debug support (default off)]),
158 [ case "$enableval" in
159 yes) spl_ac_debug=yes ;;
160 no) spl_ac_debug=no ;;
161 *) AC_MSG_RESULT([Error!])
162 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-mutex]) ;;
165 if test "$spl_ac_debug" = yes; then
166 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_MUTEX"
167 AC_DEFINE([DEBUG_MUTEX], [1],
168 [Define to 1 to enable mutex debugging])
170 AC_MSG_RESULT([${spl_ac_debug=no}])
173 AC_DEFUN([SPL_AC_DEBUG_KSTAT], [
174 AC_MSG_CHECKING([whether kstat debugging is enabled])
175 AC_ARG_ENABLE( [debug-kstat],
176 AS_HELP_STRING([--enable-debug-kstat],
177 [Enable kstat debug support (default off)]),
178 [ case "$enableval" in
179 yes) spl_ac_debug=yes ;;
180 no) spl_ac_debug=no ;;
181 *) AC_MSG_RESULT([Error!])
182 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-kstat]) ;;
185 if test "$spl_ac_debug" = yes; then
186 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_KSTAT"
187 AC_DEFINE([DEBUG_KSTAT], [1],
188 [Define to 1 to enable kstat debugging])
190 AC_MSG_RESULT([${spl_ac_debug=no}])
193 AC_DEFUN([SPL_AC_DEBUG_CALLB], [
194 AC_MSG_CHECKING([whether callb debugging is enabled])
195 AC_ARG_ENABLE( [debug-callb],
196 AS_HELP_STRING([--enable-debug-callb],
197 [Enable callb debug support (default off)]),
198 [ case "$enableval" in
199 yes) spl_ac_debug=yes ;;
200 no) spl_ac_debug=no ;;
201 *) AC_MSG_RESULT([Error!])
202 AC_MSG_ERROR([Bad value "$enableval" for --enable-debug-callb]) ;;
205 if test "$spl_ac_debug" = yes; then
206 KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG_CALLB"
207 AC_DEFINE([DEBUG_CALLB], [1],
208 [Define to 1 to enable callb debugging])
210 AC_MSG_RESULT([${spl_ac_debug=no}])
222 # Add "V=1" to KERNELMAKE_PARAMS to enable verbose module build
224 KERNELCPPFLAGS="${KERNELCPPFLAGS} -I$TOPDIR -I$TOPDIR/include"
226 if test "$kernelbuild" != "$kernelsrc"; then
227 KERNELMAKE_PARAMS="$KERNELMAKE_PARAMS O=$kernelbuild"
230 AC_SUBST(KERNELMAKE_PARAMS)
231 AC_SUBST(KERNELCPPFLAGS)
232 AC_SUBST(KERNELCFLAGS)
234 AC_CONFIG_FILES([ Makefile
239 modules/splat/Makefile