1 # -------- we can't build modules unless srcdir = builddir
2 if test x$enable_modules != xno ; then
3 AC_CHECK_FILE([Makefile.am],[],
4 [AC_ERROR([At this time, Lustre does not support building kernel modules with srcdir != buildir.])])
7 # -------- in kernel compilation? (2.5 only) -------------
8 AC_MSG_CHECKING([if inkernel build support is requested])
9 AC_ARG_ENABLE([inkernel],
10 AC_HELP_STRING([--enable-inkernel],
11 [set up 2.5 kernel makefiles]),
12 [],[enable_inkernel=no])
13 AC_MSG_RESULT([$enable_inkernel])
14 AM_CONDITIONAL(INKERNEL, test x$enable_inkernel = xyes)
16 # -------- are we building against an external portals? -------
17 AC_MSG_CHECKING([if Cray portals should be used])
18 AC_ARG_WITH([cray-portals],
19 AC_HELP_STRING([--with-cray-portals=path],
20 [path to cray portals]),
22 CRAY_PORTALS_INCLUDE="-I$with_cray_portals"
23 AC_DEFINE(CRAY_PORTALS, 1, [Building with Cray Portals])
24 ],[with_cray_portals=no])
25 AC_MSG_RESULT([$with_cray_portals])
26 AM_CONDITIONAL(CRAY_PORTALS, test x$with_cray_portals != xno)
27 if test x$enable_tests = xno ; then
28 AC_MSG_NOTICE([disabling tests])
31 if test x$enable_utils = xno ; then
32 AC_MSG_NOTICE([disabling utilities])
36 # -------- set linuxdir ------------
37 AC_MSG_CHECKING([for Linux sources])
39 AC_HELP_STRING([--with-linux=path],
40 [set path to Linux source (default=/usr/src/linux)]),
42 [LINUX=/usr/src/linux])
43 AC_MSG_RESULT([$LINUX])
45 if test x$enable_inkernel = xyes ; then
46 echo ln -s `pwd` $LINUX/fs/lustre
48 ln -s `pwd` $LINUX/fs/lustre
51 # --------------------
54 if test x$enable_modules != xno ; then
55 AC_MSG_CHECKING([if you are running user mode linux for $host_cpu])
56 if test -e $LINUX/include/asm-um ; then
57 if test X`ls -id $LINUX/include/asm/ | awk '{print $1}'` = X`ls -id $LINUX/include/asm-um | awk '{print $1}'` ; then
59 # see notes in Rules.in
63 AC_MSG_RESULT([no (asm doesn't point at asm-um)])
66 AC_MSG_RESULT([no (asm-um missing)])
71 # --------- Linux 25 ------------------
73 AC_MSG_CHECKING([if you are running linux 2.5])
74 if test -e $LINUX/include/linux/namei.h ; then
81 AC_MSG_RESULT([$linux25])
82 AM_CONDITIONAL(LINUX25, test x$linux25 = xyes)
85 # ------- Makeflags ------------------
87 CPPFLAGS="$CRAY_PORTALS_INCLUDE $CRAY_PORTALS_COMMANDLINE -I\$(top_srcdir)/include -I\$(top_srcdir)/portals/include"
89 # liblustre are all the same
90 LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
93 LLCFLAGS="-g -Wall -fPIC"
96 # everyone builds against portals and lustre
98 if test x$enable_ldiskfs = xyes ; then
99 AC_DEFINE(CONFIG_LDISKFS_FS_MODULE, 1, [build ldiskfs as a module])
100 AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [enable extended attributes for ldiskfs])
101 AC_DEFINE(CONFIG_LDISKFS_POSIX_ACL, 1, [enable posix acls])
102 AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [enable fs security])
105 EXTRA_KCFLAGS="-g -I$PWD/portals/include -I$PWD/include $CRAY_PORTALS_INCLUDE $CRAY_PORTALS_COMMANDLINE"
107 # ----------- make dep run? ------------------
109 if test x$enable_modules != xno ; then
110 AC_MSG_CHECKING([if make dep has been run in kernel source (host $host_cpu)])
111 if test -f $LINUX/include/linux/config.h ; then
115 AC_MSG_ERROR([** cannot find $LINUX/include/linux/config.h. Run make dep in $LINUX.])
119 # ------------ include paths ------------------
121 if test x$enable_modules != xno ; then
122 # ------------ autoconf.h ------------------
123 AC_MSG_CHECKING([if autoconf.h is in kernel source])
124 if test -f $LINUX/include/linux/autoconf.h ; then
128 AC_MSG_ERROR([** cannot find $LINUX/include/linux/autoconf.h. Run make config in $LINUX.])
131 # ------------ LINUXRELEASE and moduledir ------------------
132 AC_MSG_CHECKING([for Linux release])
134 # this is bogus, as it doesn't work against kernel-source rpms
135 dnl We need to rid ourselves of the nasty [ ] quotes.
137 dnl Get release from version.h
138 LINUXRELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`"
141 moduledir='$(libdir)/modules/'$LINUXRELEASE/kernel
144 modulefsdir='$(moduledir)/fs/$(PACKAGE)'
145 AC_SUBST(modulefsdir)
147 AC_MSG_RESULT($LINUXRELEASE)
148 AC_SUBST(LINUXRELEASE)
150 # ------------ RELEASE --------------------------------
151 AC_MSG_CHECKING([lustre release])
153 dnl We need to rid ourselves of the nasty [ ] quotes.
155 dnl Get release from version.h
156 RELEASE="`sed -ne 's/-/_/g' -e 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_]*\).*/\1/p' $LINUX/include/linux/version.h`_`date +%Y%m%d%H%M`"
159 AC_MSG_RESULT($RELEASE)
163 # ---------- Portals flags --------------------
165 #AC_PREFIX_DEFAULT([])
166 #if test "x$prefix" = xNONE || test "x$prefix" = x; then
169 # usrprefix='${prefix}'
173 AC_MSG_CHECKING([for zero-copy TCP support])
174 AC_ARG_ENABLE([zerocopy],
175 AC_HELP_STRING([--disable-zerocopy],
176 [disable socknal zerocopy]),
177 [],[enable_zerocopy='yes'])
178 if test x$enable_zerocopy = xno ; then
179 AC_MSG_RESULT([no (by request)])
181 ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
182 if test "$ZCCD" != 0 ; then
183 AC_DEFINE(SOCKNAL_ZC, 1, [use zero-copy TCP])
186 AC_MSG_RESULT([no (no kernel support)])
190 AC_MSG_CHECKING([for CPU affinity support])
191 AC_ARG_ENABLE([affinity],
192 AC_HELP_STRING([--disable-affinity],
193 [disable process/irq affinity]),
194 [],[enable_affinity='yes'])
195 if test x$enable_affinity = xno ; then
196 AC_MSG_RESULT([no (by request)])
198 SET_CPUS_ALLOW="`grep -c set_cpus_allowed $LINUX/kernel/softirq.c`"
199 if test "$SET_CPUS_ALLOW" != 0 ; then
200 AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
203 AC_MSG_RESULT([no (no kernel support)])
208 #####################################
210 AC_MSG_CHECKING([if quadrics kernel headers are present])
211 if test -d $LINUX/drivers/net/qsnet ; then
214 AC_MSG_CHECKING([for multirail EKC])
215 if test -f $LINUX/include/elan/epcomms.h; then
216 AC_MSG_RESULT([supported])
217 QSWCPPFLAGS="-DMULTIRAIL_EKC=1"
219 AC_MSG_RESULT([not supported])
220 QSWCPPFLAGS="-I$LINUX/drivers/net/qsnet/include"
227 AC_SUBST(QSWCPPFLAGS)
230 AC_MSG_CHECKING([if gm support was requested])
232 AC_HELP_STRING([--with-gm=path],
233 [build gmnal against path]),
238 GMCPPFLAGS="-I/usr/local/gm/include"
248 GMCPPFLAGS="-I$with_gm/include -I$with_gm/drivers -I$with_gm/drivers/linux/gm"
261 #fixme: where are the default IB includes?
262 default_ib_include_dir=/usr/local/ib/include
263 an_ib_include_file=vapi.h
265 AC_MSG_CHECKING([if ib nal support was requested])
267 AC_HELP_STRING([--with-ib=yes/no/path],
268 [Path to IB includes]),
273 IBCPPFLAGS="-I/usr/local/ib/include"
283 IBCPPFLAGS="-I$with_ib"
296 def_scamac=/opt/scali/include
297 AC_MSG_CHECKING([if ScaMAC support was requested])
298 AC_ARG_WITH([scamac],
299 AC_HELP_STRING([--with-scamac=yes/no/path],
300 [Path to ScaMAC includes (default=/opt/scali/include)]),
305 SCIMACCPPFLAGS="-I/opt/scali/include"
306 SCIMACNAL="scimacnal"
315 SCIMACCPPFLAGS="-I$with_scamac -I$with_scamac/icm"
316 SCIMACNAL="scimacnal"
324 AC_SUBST(SCIMACCPPFLAGS)
326 # if test "$with_scamac" != no -a -f ${with_scamac}/scamac.h; then
331 # these are like AC_TRY_COMPILE, but try to build modules against the
332 # kernel, inside the kernel-tests directory
334 AC_DEFUN([LUSTRE_MODULE_CONFTEST],
335 [cat >conftest.c <<_ACEOF
340 AC_DEFUN([LUSTRE_MODULE_COMPILE_IFELSE],
341 [m4_ifvaln([$1], [LUSTRE_MODULE_CONFTEST([$1])])dnl
342 rm -f kernel-tests/conftest.o kernel-tests/conftest.mod.c kernel-tests/conftest.ko
343 AS_IF([_AC_EVAL_STDERR([cp conftest.c kernel-tests && make modules -C $LINUX $ARCH_UM SUBDIRS=$PWD/kernel-tests >/dev/null]) &&
344 AC_TRY_COMMAND([test -s kernel-tests/conftest.o])],
346 [_AC_MSG_LOG_CONFTEST
347 m4_ifvaln([$3],[$3])dnl])dnl
348 rm -f kernel-tests/conftest.o kernel-tests/conftest.mod.c kernel-tests/conftest.mod.o kernel-tests/conftest.ko m4_ifval([$1], [kernel-tests/conftest.c conftest.c])[]dnl
351 AC_DEFUN([LUSTRE_MODULE_TRY_COMPILE],
352 [LUSTRE_MODULE_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4])])
354 # ---------- Red Hat 2.4.18 has iobuf->dovary --------------
355 # But other kernels don't
357 AC_MSG_CHECKING([if struct kiobuf has a dovary field])
358 LUSTRE_MODULE_TRY_COMPILE(
360 #include <linux/iobuf.h>
366 AC_DEFINE(HAVE_KIOBUF_DOVARY, 1, [struct kiobuf has a dovary field])
371 # ----------- 2.6.4 no longer has page->list ---------------
372 AC_MSG_CHECKING([if struct page has a list field])
373 LUSTRE_MODULE_TRY_COMPILE(
375 #include <linux/mm.h>
381 AC_DEFINE(HAVE_PAGE_LIST, 1, [struct page has a list field])
386 # ---------- Red Hat 2.4.20 backports some 2.5 bits --------
387 # This needs to run after we've defined the KCPPFLAGS
389 AC_MSG_CHECKING([for kernel version])
390 LUSTRE_MODULE_TRY_COMPILE(
392 #include <linux/sched.h>
394 struct task_struct p;
397 AC_DEFINE(CONFIG_RH_2_4_20, 1, [this kernel contains Red Hat 2.4.20 patches])
398 AC_MSG_RESULT([redhat-2.4.20])
400 AC_MSG_RESULT([$LINUXRELEASE])
403 # ---------- Red Hat 2.4.21 backports some more 2.5 bits --------
405 AC_MSG_CHECKING([if kernel defines PDE])
406 HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"
407 if test "$HAVE_PDE" != 0 ; then
408 AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE])
414 AC_MSG_CHECKING([if kernel passes struct file to direct_IO])
415 HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"
416 if test "$HAVE_DIO_FILE" != 0 ; then
417 AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO])
423 if test x$enable_modules != xno ; then
424 # ---------- modules? ------------------------
425 AC_MSG_CHECKING([for module support])
426 LUSTRE_MODULE_TRY_COMPILE(
428 #include <linux/config.h>
430 #ifndef CONFIG_MODULES
431 #error CONFIG_MODULES not #defined
437 AC_MSG_ERROR([module support is required to build Lustre kernel modules.])
440 # ---------- modversions? --------------------
441 AC_MSG_CHECKING([for MODVERSIONS])
442 LUSTRE_MODULE_TRY_COMPILE(
444 #include <linux/config.h>
446 #ifndef CONFIG_MODVERSIONS
447 #error CONFIG_MODVERSIONS not #defined
455 if test $BACKINGFS = 'ext3' ; then
456 # --- Check that ext3 and ext3 xattr are enabled in the kernel
457 AC_MSG_CHECKING([that ext3 is enabled in the kernel])
458 LUSTRE_MODULE_TRY_COMPILE(
460 #include <linux/config.h>
462 #ifndef CONFIG_EXT3_FS
463 #ifndef CONFIG_EXT3_FS_MODULE
464 #error CONFIG_EXT3_FS not #defined
471 AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel (CONFIG_EXT3_FS)])
474 AC_MSG_CHECKING([that extended attributes for ext3 are enabled in the kernel])
475 LUSTRE_MODULE_TRY_COMPILE(
477 #include <linux/config.h>
479 #ifndef CONFIG_EXT3_FS_XATTR
480 #error CONFIG_EXT3_FS_XATTR not #defined
486 AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel (CONFIG_EXT3_FS_XATTR.)])
487 AC_MSG_WARN([This build may fail.])
489 fi # BACKINGFS = ext3
492 CPPFLAGS="-include \$(top_builddir)/include/config.h $CPPFLAGS"
493 EXTRA_KCFLAGS="-include $PWD/include/config.h $EXTRA_KCFLAGS"
494 AC_SUBST(EXTRA_KCFLAGS)
496 #echo "KCPPFLAGS: $KCPPFLAGS"
497 #echo "KCFLAGS: $KCFLAGS"
498 #echo "LLCPPFLAGS: $LLCPPFLAGS"
499 #echo "LLCFLAGS: $LLCFLAGS"
500 #echo "MOD_LINK: $MOD_LINK"
501 #echo "CFLAGS: $CFLAGS"
502 #echo "CPPFLAGS: $CPPFLAGS"