2 # -------- in kernel compilation? (2.5 only) -------------
3 AC_ARG_ENABLE(inkernel, [ --enable-inkernel set up 2.5 kernel makefiles])
4 AM_CONDITIONAL(INKERNEL, test x$enable_inkernel = xyes)
5 echo "Makefile for in kernel build: $INKERNEL"
7 # -------- liblustre compilation --------------
8 AC_ARG_WITH(lib, [ --with-lib compile lustre library], host_cpu="lib")
10 # -------- set linuxdir ------------
12 AC_ARG_WITH(linux, [ --with-linux=[path] set path to Linux source (default=/usr/src/linux)],LINUX=$with_linux,LINUX=/usr/src/linux)
14 if test x$enable_inkernel = xyes ; then
15 echo ln -s `pwd` $LINUX/fs/lustre
17 ln -s `pwd` $LINUX/fs/lustre
20 # --------------------
21 AC_MSG_CHECKING(if you are running user mode linux for $host_cpu ...)
22 if test $host_cpu = "lib" ; then
24 AC_MSG_RESULT(no building Lustre library)
26 if test -e $LINUX/include/asm-um ; then
27 if test X`ls -id $LINUX/include/asm/ | awk '{print $1}'` = X`ls -id $LINUX/include/asm-um | awk '{print $1}'` ; then
31 AC_MSG_RESULT(no (asm doesn't point at asm-um))
35 AC_MSG_RESULT(no (asm-um missing))
39 # --------- Linux 25 ------------------
41 AC_MSG_CHECKING(if you are running linux 2.5)
42 if test -e $LINUX/include/linux/namei.h ; then
49 AM_CONDITIONAL(LINUX25, test x$linux25 = xyes)
50 echo "Makefiles for in linux 2.5 build: $LINUX25"
52 # ------- Makeflags ------------------
54 AC_MSG_CHECKING(setting make flags system architecture: )
57 AC_MSG_RESULT($host_cpu)
59 KCPPFLAGS='-D__arch_lib__ '
60 libdir='${exec_prefix}/lib/lustre'
64 AC_MSG_RESULT($host_cpu)
65 KCFLAGS='-g -Wall -pipe -Wno-trigraphs -Wstrict-prototypes -fno-strict-aliasing -fno-common '
68 KCPPFLAGS='-D__KERNEL__ -U__i386__ -Ui386 -DUM_FASTCALL -D__arch_um__ -DSUBARCH="i386" -DNESTING=0 -D_LARGEFILE64_SOURCE -Derrno=kernel_errno -DPATCHLEVEL=4 -DMODULE -I$(LINUX)/arch/um/include -I$(LINUX)/arch/um/kernel/tt/include -I$(LINUX)/arch/um/kernel/skas/include -O2 -nostdinc -iwithprefix include'
71 KCPPFLAGS='-D__KERNEL__ -U__i386__ -Ui386 -DUM_FASTCALL -D__arch_um__ -DSUBARCH="i386" -DNESTING=0 -D_LARGEFILE64_SOURCE -Derrno=kernel_errno -DPATCHLEVEL=4 -DMODULE -I$(LINUX)/arch/um/kernel/tt/include -I$(LINUX)/arch/um/include '
78 AC_MSG_RESULT($host_cpu)
79 KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -pipe'
82 KCPPFLAGS='-D__KERNEL__ -DMODULE -march=i686 -I$(LINUX)/include/asm-i386/mach-default -nostdinc -iwithprefix include '
85 KCPPFLAGS='-D__KERNEL__ -DMODULE '
92 AC_MSG_RESULT($host_cpu)
93 KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mno-fp-regs -ffixed-8 -mcpu=ev5 -Wa,-mev6'
94 KCPPFLAGS='-D__KERNEL__ -DMODULE '
99 AC_MSG_RESULT($host_cpu)
100 KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mno-fp-regs -ffixed-8 -mcpu=ev5 -Wa,-mev6'
101 KCPPFLAGS='-D__KERNEL__ -DMODULE '
106 AC_MSG_RESULT($host_cpu)
107 KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -pipe -mno-fp-regs -ffixed-8 -mcpu=ev5 -Wa,-mev5'
108 KCPPFLAGS='-D__KERNEL__ -DMODULE '
113 AC_MSG_RESULT($host_cpu)
114 KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -pipe -ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -mb-step'
115 KCPPFLAGS='-D__KERNEL__ -DMODULE'
120 AC_MSG_RESULT($host_cpu)
121 KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fomit-frame-pointer -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -finline-limit=2000 -fno-strength-reduce -fno-asynchronous-unwind-tables'
122 KCPPFLAGS='-D__KERNEL__ -DMODULE'
127 AC_MSG_RESULT($host_cpu)
128 KCFLAGS='-O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -Wno-unused -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare -Wa,--undeclared-regs'
129 KCPPFLAGS='-D__KERNEL__'
135 AC_MSG_RESULT($host_cpu)
136 KCFLAGS='-O2 -g -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -D__powerpc__ -fsigned-char -msoft-float -pipe -ffixed-r2 -Wno-uninitialized -mmultiple -mstring'
137 KCPPFLAGS='-D__KERNEL__ -DMODULE'
138 MOD_LINK=elf32ppclinux
142 AC_ERROR("Unknown Linux Platform: $host_cpu")
146 # ----------- make dep run? ------------------
148 if test $host_cpu != "lib" ; then
149 AC_MSG_CHECKING(if make dep has been run in kernel source (host $host_cpu) )
150 if test -f $LINUX/include/linux/config.h ; then
153 AC_MSG_ERROR(** cannot find $LINUX/include/linux/config.h. Run make dep in $LINUX.)
157 # ------------ include paths ------------------
159 if test $host_cpu != "lib" ; then
160 KINCFLAGS="-I\$(top_srcdir)/include -I\$(top_srcdir)/portals/include -I$LINUX/include"
162 KINCFLAGS='-I$(top_srcdir)/include -I$(top_srcdir)/portals/include'
164 CPPFLAGS="$KINCFLAGS $ARCHCPPFLAGS"
166 if test $host_cpu != "lib" ; then
167 # ------------ autoconf.h ------------------
168 AC_MSG_CHECKING(if autoconf.h is in kernel source)
169 if test -f $LINUX/include/linux/autoconf.h ; then
172 AC_MSG_ERROR(** cannot find $LINUX/include/linux/autoconf.h. Run make config in $LINUX.)
175 # ------------ LINUXRELEASE and moduledir ------------------
176 AC_MSG_CHECKING(for Linux release)
178 dnl We need to rid ourselves of the nasty [ ] quotes.
180 dnl Get release from version.h
181 LINUXRELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`"
184 moduledir='$(libdir)/modules/'$LINUXRELEASE/kernel
187 modulefsdir='$(moduledir)/fs/$(PACKAGE)'
188 AC_SUBST(modulefsdir)
190 AC_MSG_RESULT($LINUXRELEASE)
191 AC_SUBST(LINUXRELEASE)
193 # ------------ RELEASE --------------------------------
194 AC_MSG_CHECKING(lustre release)
196 dnl We need to rid ourselves of the nasty [ ] quotes.
198 dnl Get release from version.h
199 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`"
202 AC_MSG_RESULT($RELEASE)
205 # ---------- modversions? --------------------
206 AC_MSG_CHECKING(for MODVERSIONS)
207 if egrep -e 'MODVERSIONS.*1' $LINUX/include/linux/autoconf.h >/dev/null 2>&1;
209 if test $linux25 != "yes"; then
210 MFLAGS="-DMODULE -DMODVERSIONS -include $LINUX/include/linux/modversions.h -DEXPORT_SYMTAB"
216 # ---------- Portals flags --------------------
218 #AC_PREFIX_DEFAULT([])
219 #if test "x$prefix" = xNONE || test "x$prefix" = x; then
222 # usrprefix='${prefix}'
226 AC_MSG_CHECKING(if kernel has CPU affinity support)
227 SET_CPUS_ALLOW="`grep -c set_cpus_allowed $LINUX/kernel/softirq.c`"
228 if test "$SET_CPUS_ALLOW" != 0 ; then
229 enable_affinity_temp="-DCPU_AFFINITY=1"
232 enable_affinity_temp=""
236 AC_MSG_CHECKING(if kernel has zero-copy TCP support)
237 ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
238 if test "$ZCCD" != 0 ; then
239 enable_zerocopy_temp="-DSOCKNAL_ZC=1"
242 enable_zerocopy_temp=""
246 AC_ARG_ENABLE(zerocopy, [ --disable-zerocopy disable socknal zerocopy],enable_zerocopy="", enable_zerocopy=$enable_zerocopy_temp)
248 AC_ARG_ENABLE(affinity, [ --disable-affinity disable process/irq affinity],enable_affinity="", enable_affinity=$enable_affinity_temp)
249 #####################################
251 AC_MSG_CHECKING(if quadrics kernel headers are present)
252 if test -d $LINUX/drivers/net/qsnet ; then
255 AC_MSG_CHECKING(for multirail EKC)
256 if test -f $LINUX/include/elan/epcomms.h; then
257 AC_MSG_RESULT(supported)
258 with_quadrics="-DMULTIRAIL_EKC=1"
260 AC_MSG_RESULT(not supported)
261 with_quadrics="-I$LINUX/drivers/net/qsnet/include"
270 AC_SUBST(with_quadrics)
275 echo "checking with-gm=" ${with_gm}
276 if test "${with_gm+set}" = set; then
277 if test "${with_gm}" = yes; then
278 with_gm="-I/usr/local/gm/include"
280 with_gm="-I$with_gm/include -I$with_gm/drivers -I$with_gm/drivers/linux/gm"
284 # default case - no GM
291 #fixme: where are the default IB includes?
292 default_ib_include_dir=/usr/local/ib/include
293 an_ib_include_file=vapi.h
295 AC_ARG_WITH(ib, [ --with-ib=[yes/no/path] Path to IB includes], with_ib=$withval, with_ib=$default_ib)
296 AC_MSG_CHECKING(if IB headers are present)
297 if test "$with_ib" = yes; then
298 with_ib=$default_ib_include_dir
300 if test "$with_ib" != no -a -f ${with_ib}/${an_ib_include_file}; then
303 with_ib="-I${with_ib}"
313 def_scamac=/opt/scali/include
314 AC_ARG_WITH(scamac, [ --with-scamac=[yes/no/path] Path to ScaMAC includes (default=/opt/scali/include)], with_scamac=$withval, with_scamac=$def_scamac)
315 AC_MSG_CHECKING(if ScaMAC headers are present)
316 if test "$with_scamac" = yes; then
317 with_scamac=$def_scamac
319 if test "$with_scamac" != no -a -f ${with_scamac}/scamac.h; then
321 SCIMACNAL="scimacnal"
322 with_scamac="-I${with_scamac} -I${with_scamac}/icm"
329 AC_SUBST(with_scamac)
333 CPPFLAGS="$KINCFLAGS $KCPPFLAGS $MFLAGS $enable_zerocopy $enable_affinity $with_quadrics $with_gm $with_scamac $with_ib"
334 if test $host_cpu == "lib" ; then
335 CPPFLAGS="$CPPFLAGS -fPIC -D_LARGEFILE64_SOURCE=1 -g"
338 AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib)
341 AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib)
343 # ---------- Red Hat 2.4.18 has iobuf->dovary --------------
344 # But other kernels don't
346 AC_MSG_CHECKING([if struct kiobuf has a dovary field])
347 AC_TRY_COMPILE([#define __KERNEL__
348 #include <linux/iobuf.h>],
349 [struct kiobuf iobuf;
351 [AC_MSG_RESULT([yes])
352 CPPFLAGS="$CPPFLAGS -DHAVE_KIOBUF_DOVARY"],
353 [AC_MSG_RESULT([no])])
355 # ---------- Red Hat 2.4.20 backports some 2.5 bits --------
356 # This needs to run after we've defined the KCPPFLAGS
358 AC_MSG_CHECKING(for kernel version)
359 AC_TRY_COMPILE([#define __KERNEL__
360 #include <linux/sched.h>],
361 [struct task_struct p;
366 if test $RH_2_4_20 = 1; then
367 AC_MSG_RESULT(redhat-2.4.20)
368 CPPFLAGS="$CPPFLAGS -DCONFIG_RH_2_4_20"
370 AC_MSG_RESULT($LINUXRELEASE)
373 # ---------- Red Hat 2.4.21 backports some more 2.5 bits --------
375 AC_MSG_CHECKING(if kernel defines PDE)
376 HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"
377 if test "$HAVE_PDE" != 0 ; then
378 CPPFLAGS="$CPPFLAGS -DHAVE_PDE"
384 AC_MSG_CHECKING(if kernel passes struct file to direct_IO)
385 HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"
386 if test "$HAVE_DIO_FILE" != 0 ; then
387 CPPFLAGS="$CPPFLAGS -DHAVE_DIO_FILE"
393 # --- Check that ext3 and ext3 xattr are enabled in the kernel
394 if test "$host_cpu" != "lib" ; then
395 AC_MSG_CHECKING([that ext3 is enabled in the kernel])
398 #include <linux/config.h>
401 #ifdef CONFIG_EXT3_FS
404 #error CONFIG_EXT3_FS not #defined
406 ],[AC_MSG_RESULT([yes])],
408 AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel (CONFIG_EXT3_FS)])
410 # disable this check until our xattr patches define it!
411 # AC_MSG_CHECKING([that extended attributes for ext3 are enabled in the kernel])
414 ##include <linux/config.h>
417 ##ifdef CONFIG_EXT3_FS_XATTR
420 ##error CONFIG_EXT3_FS_XATTR not #defined
422 # ],[AC_MSG_RESULT([yes])],
423 # [AC_MSG_RESULT([no])
424 # AC_MSG_ERROR([Lustre requires that extended attributes for ext3 are enabled in the kernel (CONFIG_EXT3_FS_XATTR)])