1 m4_pattern_allow(AC_KERBEROS_V5)
6 # Set things accordingly for a 2.5 kernel
8 AC_DEFUN([LB_LINUX_VERSION],
9 [LB_CHECK_FILE([$LINUX/include/linux/namei.h],
17 AC_MSG_CHECKING([if you are using Linux 2.6])
18 AC_MSG_RESULT([$linux25])
20 MODULE_TARGET="SUBDIRS"
21 if test $linux25 = "yes" ; then
23 AC_MSG_CHECKING([for external module build support])
24 rm -f build/conftest.i
25 LB_LINUX_TRY_MAKE([],[],
26 [$makerule LUSTRE_KERNEL_TEST=conftest.i],
27 [test -s build/conftest.i],
31 makerule="_module_$makerule"
33 LB_LINUX_TRY_MAKE([],[],
34 [$makerule LUSTRE_KERNEL_TEST=conftest.i],
35 [test -s build/conftest.i],
39 AC_MSG_ERROR([unknown; check config.log for details])
43 makerule="_dir_$PWD/build"
46 AC_SUBST(MODULE_TARGET)
54 # get the release version of linux
56 AC_DEFUN([LB_LINUX_RELEASE],
58 rm -f build/conftest.i
59 AC_MSG_CHECKING([for Linux release])
60 if test -s $LINUX_OBJ/include/linux/utsrelease.h ; then
61 LINUXRELEASEHEADER=utsrelease.h
63 LINUXRELEASEHEADER=version.h
66 #include <linux/$LINUXRELEASEHEADER>
69 LINUXRELEASE=UTS_RELEASE;
71 $makerule LUSTRE_KERNEL_TEST=conftest.i
73 test -s build/conftest.i
75 # LINUXRELEASE="UTS_RELEASE"
76 eval $(grep "LINUXRELEASE=" build/conftest.i)
78 AC_MSG_RESULT([unknown])
79 AC_MSG_ERROR([Could not preprocess test program. Consult config.log for details.])
81 rm -f build/conftest.i
82 if test x$LINUXRELEASE = x ; then
83 AC_MSG_RESULT([unknown])
84 AC_MSG_ERROR([Could not determine Linux release version from linux/version.h.])
86 AC_MSG_RESULT([$LINUXRELEASE])
87 AC_SUBST(LINUXRELEASE)
89 moduledir='/lib/modules/'$LINUXRELEASE/kernel
92 modulefsdir='$(moduledir)/fs/$(PACKAGE)'
95 modulenetdir='$(moduledir)/net/$(PACKAGE)'
96 AC_SUBST(modulenetdir)
98 # ------------ RELEASE --------------------------------
99 AC_MSG_CHECKING([for Lustre release])
100 RELEASE="`echo ${LINUXRELEASE} | tr '-' '_'`_`date +%Y%m%d%H%M`"
101 AC_MSG_RESULT($RELEASE)
108 # Find paths for linux, handling kernel-source rpms
110 AC_DEFUN([LB_LINUX_PATH],
111 [AC_MSG_CHECKING([for Linux sources])
113 AC_HELP_STRING([--with-linux=path],
114 [set path to Linux source (default=/usr/src/linux)]),
116 [LINUX=/usr/src/linux])
117 AC_MSG_RESULT([$LINUX])
120 # -------- check for linux --------
121 LB_CHECK_FILE([$LINUX],[],
122 [AC_MSG_ERROR([Kernel source $LINUX could not be found.])])
124 # -------- linux objects (for 2.6) --
125 AC_MSG_CHECKING([for Linux objects dir])
126 AC_ARG_WITH([linux-obj],
127 AC_HELP_STRING([--with-linux-obj=path],
128 [set path to Linux objects dir (default=$LINUX)]),
129 [LINUX_OBJ=$with_linux_obj],
131 AC_MSG_RESULT([$LINUX_OBJ])
134 # -------- check for .config --------
135 AC_ARG_WITH([linux-config],
136 [AC_HELP_STRING([--with-linux-config=path],
137 [set path to Linux .conf (default=$LINUX_OBJ/.config)])],
138 [LINUX_CONFIG=$with_linux_config],
139 [LINUX_CONFIG=$LINUX_OBJ/.config])
140 AC_SUBST(LINUX_CONFIG)
142 LB_CHECK_FILE([/boot/kernel.h],
143 [KERNEL_SOURCE_HEADER='/boot/kernel.h'],
144 [LB_CHECK_FILE([/var/adm/running-kernel.h],
145 [KERNEL_SOURCE_HEADER='/var/adm/running-kernel.h'])])
147 AC_ARG_WITH([kernel-source-header],
148 AC_HELP_STRING([--with-kernel-source-header=path],
149 [Use a different kernel version header. Consult build/README.kernel-source for details.]),
150 [KERNEL_SOURCE_HEADER=$with_kernel_source_header])
152 # ------------ .config exists ----------------
153 LB_CHECK_FILE([$LINUX_CONFIG],[],
154 [AC_MSG_ERROR([Kernel config could not be found. If you are building from a kernel-source rpm consult build/README.kernel-source])])
156 # ----------- make dep run? ------------------
157 LB_CHECK_FILES([$LINUX_OBJ/include/linux/autoconf.h
158 $LINUX_OBJ/include/linux/version.h
159 $LINUX/include/linux/config.h],[],
160 [AC_MSG_ERROR([Run make config in $LINUX.])])
162 # ------------ rhconfig.h includes runtime-generated bits --
163 # red hat kernel-source checks
165 # we know this exists after the check above. if the user
166 # tarred up the tree and ran make dep etc. in it, then
167 # version.h gets overwritten with a standard linux one.
169 if grep rhconfig $LINUX_OBJ/include/linux/version.h >/dev/null ; then
170 # This is a clean kernel-source tree, we need to
171 # enable extensive workarounds to get this to build
173 LB_CHECK_FILE([$KERNEL_SOURCE_HEADER],
174 [if test $KERNEL_SOURCE_HEADER = '/boot/kernel.h' ; then
175 AC_MSG_WARN([Using /boot/kernel.h from RUNNING kernel.])
176 AC_MSG_WARN([If this is not what you want, use --with-kernel-source-header.])
177 AC_MSG_WARN([Consult build/README.kernel-source for details.])
179 [AC_MSG_ERROR([$KERNEL_SOURCE_HEADER not found. Consult build/README.kernel-source for details.])])
180 EXTRA_KCFLAGS="-include $KERNEL_SOURCE_HEADER $EXTRA_KCFLAGS"
183 # this is needed before we can build modules
187 # --- check that we can build modules at all
188 AC_MSG_CHECKING([that modules can be built at all])
189 LB_LINUX_TRY_COMPILE([],[],[
193 AC_MSG_WARN([Consult config.log for details.])
194 AC_MSG_WARN([If you are trying to build with a kernel-source rpm, consult build/README.kernel-source])
195 AC_MSG_ERROR([Kernel modules cannot be build.])
204 # check for a uml kernel
206 AC_DEFUN([LB_LINUX_UML],
210 AC_MSG_CHECKING([if you are running user mode linux for $target_cpu])
211 if test -e $LINUX/include/asm-um ; then
212 if test X`ls -id $LINUX/include/asm/ 2>/dev/null | awk '{print [$]1}'` = X`ls -id $LINUX/include/asm-um 2>/dev/null | awk '{print [$]1}'` ; then
214 # see notes in Rules.in
218 AC_MSG_RESULT([no (asm doesn't point at asm-um)])
221 AC_MSG_RESULT([no (asm-um missing)])
227 # these are like AC_TRY_COMPILE, but try to build modules against the
228 # kernel, inside the build directory
233 # create a conftest.c file
235 AC_DEFUN([LB_LINUX_CONFTEST],
236 [cat >conftest.c <<_ACEOF
242 # LB_LINUX_COMPILE_IFELSE
244 # like AC_COMPILE_IFELSE
246 AC_DEFUN([LB_LINUX_COMPILE_IFELSE],
247 [m4_ifvaln([$1], [LB_LINUX_CONFTEST([$1])])dnl
248 rm -f build/conftest.o build/conftest.mod.c build/conftest.ko
249 AS_IF([AC_TRY_COMMAND(cp conftest.c build && make [$2] CC="$CC" -f $PWD/build/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM $MODULE_TARGET=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
251 [_AC_MSG_LOG_CONFTEST
252 m4_ifvaln([$5],[$5])dnl])dnl
253 rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.ko m4_ifval([$1], [build/conftest.c conftest.c])[]dnl
257 # LB_LINUX_TRY_COMPILE
259 # like AC_TRY_COMPILE
261 AC_DEFUN([LB_LINUX_TRY_COMPILE],
262 [LB_LINUX_COMPILE_IFELSE(
263 [AC_LANG_PROGRAM([[$1]], [[$2]])],
265 [test -s build/conftest.o],
271 # check if a given config option is defined
273 AC_DEFUN([LB_LINUX_CONFIG],
274 [AC_MSG_CHECKING([if Linux was built with CONFIG_$1])
275 LB_LINUX_TRY_COMPILE([#include <linux/config.h>],[
277 #error CONFIG_$1 not #defined
291 # check if a given config option is builtin or as module
293 AC_DEFUN([LB_LINUX_CONFIG_IM],
294 [AC_MSG_CHECKING([if Linux was built with CONFIG_$1 in or as module])
295 LB_LINUX_TRY_COMPILE([#include <linux/config.h>],[
296 #if !(defined(CONFIG_$1) || defined(CONFIG_$1_MODULE))
297 #error CONFIG_$1 and CONFIG_$1_MODULE not #defined
311 # like LB_LINUX_TRY_COMPILE, but with different arguments
313 AC_DEFUN([LB_LINUX_TRY_MAKE],
314 [LB_LINUX_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4], [$5], [$6])])
317 # LB_LINUX_CONFIG_BIG_STACK
319 # check for big stack patch
321 AC_DEFUN([LB_LINUX_CONFIG_BIG_STACK],
322 [if test "x$ARCH_UM" = "x" -a "x$linux25" = "xno" ; then
325 LB_LINUX_CONFIG([STACK_SIZE_16KB],[],[
326 LB_LINUX_CONFIG([STACK_SIZE_32KB],[],[
327 LB_LINUX_CONFIG([STACK_SIZE_64KB],[],[
328 AC_MSG_ERROR([Lustre requires that Linux is configured with at least a 16KB stack.])
342 AC_DEFUN([LB_PROG_LINUX],
345 LB_LINUX_CONFIG([MODULES],[],[
346 AC_MSG_ERROR([module support is required to build Lustre kernel modules.])
349 LB_LINUX_CONFIG([MODVERSIONS])
351 LB_LINUX_CONFIG([PREEMPT],[
352 AC_MSG_ERROR([Lustre does not support kernels with preempt enabled.])
355 LB_LINUX_CONFIG([KALLSYMS],[],[
356 if test "x$ARCH_UM" = "x" ; then
357 AC_MSG_ERROR([Lustre requires that CONFIG_KALLSYMS is enabled in your kernel.])
361 LB_LINUX_CONFIG([KMOD],[],[
363 AC_MSG_WARN([Kernel module loading support is highly recommended.])
367 #LB_LINUX_CONFIG_BIG_STACK
376 if test "$PORTALS" ; then
382 # LB_LINUX_CONDITIONALS
384 # AM_CONDITIONALS for linux
386 AC_DEFUN([LB_LINUX_CONDITIONALS],
387 [AM_CONDITIONAL(LINUX25, test x$linux25 = xyes)
388 AM_CONDITIONAL(GSS, test x$enable_gss = xyes)
392 # LB_LINUX_CONFIG_PAG
394 AC_DEFUN([LB_LINUX_CONFIG_PAG],
395 [AC_MSG_CHECKING([if Linux is patched with basic PAG support])
396 LB_LINUX_TRY_COMPILE([#include <linux/sched.h>],[
397 unsigned long pag = current->pag;
398 ],[AC_MSG_RESULT([yes])
399 AC_DEFINE(HAVE_LINUX_PAG, 1, [linux has basic PAG support for Lustre])],[
405 # LC_LINUX_CONFIG_GSS
407 # Build gss and related tools of Lustre. Currently both kernel and user space
408 # parts are depend on linux platform.
410 AC_DEFUN([LC_LINUX_CONFIG_GSS],
411 [AC_MSG_CHECKING([whether to enable gss/krb5 support])
413 AC_HELP_STRING([--enable-gss], [enable gss/krb5 support]),
414 [],[enable_gss='no'])
415 AC_MSG_RESULT([$enable_gss])
417 if test x$enable_gss == xyes; then
418 LB_LINUX_CONFIG_IM([SUNRPC],[],[
419 AC_MSG_ERROR([GSS require that CONFIG_SUNRPC is enabled in your kernel.])
421 LB_LINUX_CONFIG_IM([CRYPTO_DES],[],[
422 AC_MSG_WARN([DES support is recommended by using GSS.])
424 LB_LINUX_CONFIG_IM([CRYPTO_MD5],[],[
425 AC_MSG_WARN([MD5 support is recommended by using GSS.])
427 LB_LINUX_CONFIG_IM([CRYPTO_SHA256],[],[
428 AC_MSG_WARN([SHA256 support is recommended by using GSS.])
430 LB_LINUX_CONFIG_IM([CRYPTO_SHA512],[],[
431 AC_MSG_WARN([SHA512 support is recommended by using GSS.])
433 LB_LINUX_CONFIG_IM([CRYPTO_ARC4],[],[
434 AC_MSG_WARN([ARC4 support is recommended by using GSS.])
437 # unfortunately AES symbol is depend (optimized) on arch
440 AC_CHECK_LIB(gssapi, gss_init_sec_context, [
441 GSSAPI_LIBS="$GSSAPI_LDFLAGS -lgssapi"
443 AC_MSG_ERROR([libgssapi is not found, consider --disable-gss.])
447 AC_SUBST(GSSAPI_LIBS)