Whamcloud - gitweb
Branch: b1_2
[fs/lustre-release.git] / lnet / archdep.m4
1 # -------- we can't build modules unless srcdir = builddir
2 if test x$enable_modules != xno ; then
3         AC_CHECK_FILE([autoMakefile.am],[],
4                 [AC_MSG_ERROR([At this time, Lustre does not support building kernel modules with srcdir != buildir.])])
5 fi
6
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)
15
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]),
21         [
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])
29         enable_tests=no
30 fi
31 if test x$enable_utils = xno ; then
32         AC_MSG_NOTICE([disabling utilities])
33         enable_utils=no
34 fi
35
36 if test x$enable_modules != xno ; then
37         # -------- set linuxdir ------------
38         AC_MSG_CHECKING([for Linux sources])
39         AC_ARG_WITH([linux],
40                 AC_HELP_STRING([--with-linux=path],
41                                [set path to Linux source (default=/usr/src/linux)]),
42                 [LINUX=$with_linux],
43                 [LINUX=/usr/src/linux])
44         AC_MSG_RESULT([$LINUX])
45         AC_SUBST(LINUX)
46         if test x$enable_inkernel = xyes ; then
47                 echo ln -s `pwd` $LINUX/fs/lustre
48                 rm $LINUX/fs/lustre
49                 ln -s `pwd` $LINUX/fs/lustre
50         fi
51
52         # -------- check for .confg --------
53         AC_ARG_WITH([linux-config],
54                 [AC_HELP_STRING([--with-linux-config=path],
55                                 [set path to Linux .conf (default=\$LINUX/.config)])],
56                 [LINUX_CONFIG=$with_linux_config],
57                 [LINUX_CONFIG=$LINUX/.config])
58         AC_SUBST(LINUX_CONFIG)
59
60         AC_CHECK_FILE([/boot/kernel.h],
61                 [KERNEL_SOURCE_HEADER='/boot/kernel.h'],
62                 [AC_CHECK_FILE([/var/adm/running-kernel.h]),
63                         [KERNEL_SOURCE_HEADER='/var/adm/running-kernel.h']])
64
65         AC_ARG_WITH([kernel-source-header],
66                 AC_HELP_STRING([--with-kernel-source-header=path],
67                                 [Use a different kernel version header.  Consult README.kernel-source for details.]),
68                 [KERNEL_SOURCE_HEADER=$with_kernel_source_header])
69
70         #  --------------------
71         ARCH_UM=
72         UML_CFLAGS=
73
74         AC_MSG_CHECKING([if you are running user mode linux for $host_cpu])
75         if test -e $LINUX/include/asm-um ; then
76                 if test  X`ls -id $LINUX/include/asm/ | awk '{print $1}'` = X`ls -id $LINUX/include/asm-um | awk '{print $1}'` ; then
77                         ARCH_UM='ARCH=um'
78                         # see notes in Rules.in
79                         UML_CFLAGS='-O0'
80                         AC_MSG_RESULT(yes)
81                 else
82                         AC_MSG_RESULT([no (asm doesn't point at asm-um)])
83                 fi
84         else
85                 AC_MSG_RESULT([no (asm-um missing)])
86         fi
87
88         AC_SUBST(ARCH_UM)
89         AC_SUBST(UML_CFLAGS)
90
91         # --------- Linux 25 ------------------
92         AC_CHECK_FILE([$LINUX/include/linux/namei.h],
93                 [
94                         linux25="yes"
95                         KMODEXT=".ko"
96                         enable_ldiskfs="yes"
97                         BACKINGFS="ldiskfs"
98                 ],[
99                         KMODEXT=".o"
100                         linux25="no"
101                 ])
102         AC_MSG_CHECKING([if you are using Linux 2.6])
103         AC_MSG_RESULT([$linux25])
104
105         AC_SUBST(LINUX25)
106         AC_SUBST(KMODEXT)
107
108         AC_PATH_PROG(PATCH, patch, [no])
109         AC_PATH_PROG(QUILT, quilt, [no])
110
111         if test x$enable_ldiskfs$PATCH$QUILT = xyesnono ; then
112                 AC_MSG_ERROR([Quilt or patch are needed to build the ldiskfs module (for Linux 2.6)])
113         fi
114 fi
115 AM_CONDITIONAL(LINUX25, test x$linux25 = xyes)
116 AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
117
118 # -------  Makeflags ------------------
119
120 CPPFLAGS="$CRAY_PORTALS_INCLUDE $CRAY_PORTALS_COMMANDLINE -I\$(top_srcdir)/include -I\$(top_srcdir)/portals/include"
121
122 # liblustre are all the same
123 LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
124 AC_SUBST(LLCPPFLAGS)
125
126 LLCFLAGS="-g -Wall -fPIC"
127 AC_SUBST(LLCFLAGS)
128
129 # everyone builds against portals and lustre
130
131 if test x$enable_ldiskfs = xyes ; then
132         AC_DEFINE(CONFIG_LDISKFS_FS_MODULE, 1, [build ldiskfs as a module])
133         AC_DEFINE(CONFIG_LDISKFS_FS_XATTR, 1, [enable extended attributes for ldiskfs])
134         AC_DEFINE(CONFIG_LDISKFS_FS_POSIX_ACL, 1, [enable posix acls])
135         AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [enable fs security])
136 fi
137
138 EXTRA_KCFLAGS="-g $CRAY_PORTALS_INCLUDE $CRAY_PORTALS_COMMANDLINE -I$PWD/portals/include -I$PWD/include"
139
140 # these are like AC_TRY_COMPILE, but try to build modules against the
141 # kernel, inside the kernel-tests directory
142
143 AC_DEFUN([LUSTRE_MODULE_CONFTEST],
144 [cat >conftest.c <<_ACEOF
145 $1
146 _ACEOF
147 ])
148
149 AC_DEFUN([LUSTRE_MODULE_COMPILE_IFELSE],
150 [m4_ifvaln([$1], [LUSTRE_MODULE_CONFTEST([$1])])dnl
151 rm -f kernel-tests/conftest.o kernel-tests/conftest.mod.c kernel-tests/conftest.ko
152 AS_IF([AC_TRY_COMMAND(cp conftest.c kernel-tests && make [$2] -f $PWD/kernel-tests/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM SUBDIRS=$PWD/kernel-tests) >/dev/null && AC_TRY_COMMAND([$3])],
153         [$4],
154         [_AC_MSG_LOG_CONFTEST
155 m4_ifvaln([$5],[$5])dnl])dnl
156 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
157 ])
158
159 AC_DEFUN([LUSTRE_MODULE_TRY_COMPILE],
160 [LUSTRE_MODULE_COMPILE_IFELSE(
161         [AC_LANG_PROGRAM([[$1]], [[$2]])],
162         [modules],
163         [test -s kernel-tests/conftest.o],
164         [$3], [$4])])
165
166 AC_DEFUN([LUSTRE_MODULE_TRY_MAKE],
167 [LUSTRE_MODULE_COMPILE_IFELSE([AC_LANG_PROGRAM([[$1]], [[$2]])], [$3], [$4], [$5], [$6])])
168
169 # ------------ include paths ------------------
170
171 if test x$enable_modules != xno ; then
172         # ------------ .config exists ----------------
173         AC_CHECK_FILE([$LINUX_CONFIG],[],
174                 [AC_MSG_ERROR([Kernel config could not be found.  If you are building from a kernel-source rpm consult README.kernel-source])])
175
176         # ----------- make dep run? ------------------
177         AC_CHECK_FILES([$LINUX/include/linux/autoconf.h
178                         $LINUX/include/linux/version.h
179                         $LINUX/include/linux/config.h],[],
180                 [AC_MSG_ERROR([Run make config in $LINUX.])])
181
182         # ------------ rhconfig.h includes runtime-generated bits --
183         # red hat kernel-source checks
184
185         # we know this exists after the check above.  if the user
186         # tarred up the tree and ran make dep etc. in it, then
187         # version.h gets overwritten with a standard linux one.
188
189         if grep rhconfig $LINUX/include/linux/version.h >/dev/null ; then
190                 # This is a clean kernel-source tree, we need to
191                 # enable extensive workarounds to get this to build
192                 # modules
193                 AC_CHECK_FILE([$KERNEL_SOURCE_HEADER],
194                         [if test $KERNEL_SOURCE_HEADER = '/boot/kernel.h' ; then
195                                 AC_MSG_WARN([Using /boot/kernel.h from RUNNING kernel.])
196                                 AC_MSG_WARN([If this is not what you want, use --with-kernel-source-header.])
197                                 AC_MSG_WARN([Consult README.kernel-source for details.])
198                         fi],
199                         [AC_MSG_ERROR([$KERNEL_SOURCE_HEADER not found.  Consult README.kernel-source for details.])])
200                 EXTRA_KCFLAGS="-include $KERNEL_SOURCE_HEADER $EXTRA_KCFLAGS"
201         fi
202
203         # --- check that we can build modules at all
204         AC_MSG_CHECKING([that modules can be built])
205         LUSTRE_MODULE_TRY_COMPILE([],[],
206                 [
207                         AC_MSG_RESULT([yes])
208                 ],[
209                         AC_MSG_RESULT([no])
210                         AC_MSG_WARN([Consult config.log for details.])
211                         AC_MSG_WARN([If you are trying to build with a kernel-source rpm, consult README.kernel-source])
212                         AC_MSG_ERROR([Kernel modules could not be built.])
213                 ])
214
215         # ------------ LINUXRELEASE and moduledir ------------------
216         MODULE_TARGET="SUBDIRS"
217         if test $linux25 = 'yes' ; then
218                 # ------------ external module support ---------------------
219                 makerule="$PWD/kernel-tests"
220                 AC_MSG_CHECKING([for external module build support])
221                 rm -f kernel-tests/conftest.i
222                 LUSTRE_MODULE_TRY_MAKE([],[],
223                         [$makerule LUSTRE_KERNEL_TEST=conftest.i],
224                         [test -s kernel-tests/conftest.i],
225                         [
226                                 AC_MSG_RESULT([no])
227                         ],[
228                                 AC_MSG_RESULT([yes])
229                                 makerule="_module_$makerule"
230                                 MODULE_TARGET="M"
231                         ])
232         else
233                 makerule="_dir_$PWD/kernel-tests"
234         fi
235         AC_SUBST(MODULE_TARGET)
236         LINUXRELEASE=
237         rm -f kernel-tests/conftest.i
238         AC_MSG_CHECKING([for Linux release])
239         LUSTRE_MODULE_TRY_MAKE(
240                 [#include <linux/version.h>],
241                 [char *LINUXRELEASE;
242                  LINUXRELEASE=UTS_RELEASE;],
243                 [$makerule LUSTRE_KERNEL_TEST=conftest.i],
244                 [test -s kernel-tests/conftest.i],
245                 [
246                         # LINUXRELEASE="UTS_RELEASE"
247                         eval $(grep "LINUXRELEASE=" kernel-tests/conftest.i)
248                 ],[
249                         AC_MSG_RESULT([unknown])
250                         AC_MSG_ERROR([Could not preprocess test program.  Consult config.log for details.])
251                 ])
252         rm -f kernel-tests/conftest.i
253         if test x$LINUXRELEASE = x ; then
254                 AC_MSG_RESULT([unknown])
255                 AC_MSG_ERROR([Could not determine Linux release version from linux/version.h.])
256         fi
257         AC_MSG_RESULT([$LINUXRELEASE])
258         AC_SUBST(LINUXRELEASE)
259
260         moduledir='/lib/modules/'$LINUXRELEASE/kernel
261         modulefsdir='$(moduledir)/fs/$(PACKAGE)'
262         modulenetdir='$(moduledir)/net/$(PACKAGE)'
263
264         AC_SUBST(moduledir)
265         AC_SUBST(modulefsdir)
266         AC_SUBST(modulenetdir)
267
268         # ------------ RELEASE --------------------------------
269         AC_MSG_CHECKING([for Lustre release])
270         RELEASE="`echo ${LINUXRELEASE} | tr '-' '_'`_`date +%Y%m%d%H%M`"
271         AC_MSG_RESULT($RELEASE)
272         AC_SUBST(RELEASE)
273
274         # ---------- Portals flags --------------------
275
276         AC_MSG_CHECKING([for zero-copy TCP support])
277         AC_ARG_ENABLE([zerocopy],
278                 AC_HELP_STRING([--disable-zerocopy],
279                                [disable socknal zerocopy]),
280                 [],[enable_zerocopy='yes'])
281         if test x$enable_zerocopy = xno ; then
282                 AC_MSG_RESULT([no (by request)])
283         else
284                 ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
285                 if test "$ZCCD" != 0 ; then
286                         AC_DEFINE(SOCKNAL_ZC, 1, [use zero-copy TCP])
287                         AC_MSG_RESULT(yes)
288                 else
289                         AC_MSG_RESULT([no (no kernel support)])
290                 fi
291         fi
292
293         AC_ARG_ENABLE([affinity],
294                 AC_HELP_STRING([--disable-affinity],
295                                [disable process/irq affinity]),
296                 [],[enable_affinity='yes'])
297
298         AC_MSG_CHECKING([for CPU affinity support])
299         if test x$enable_affinity = xno ; then
300                 AC_MSG_RESULT([no (by request)])
301         else
302                 LUSTRE_MODULE_TRY_COMPILE(
303                         [
304                                 #include <linux/sched.h>
305                         ],[
306                                 struct task_struct t;
307                                 #ifdef CPU_ARRAY_SIZE
308                                 cpumask_t m;
309                                 #else
310                                 unsigned long m;
311                                 #endif
312                                 set_cpus_allowed(&t, m);
313                         ],[
314                                 AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
315                                 AC_MSG_RESULT([yes])
316                         ],[
317                                 AC_MSG_RESULT([no (no kernel support)])
318                         ])
319         fi
320
321         #####################################
322
323         AC_MSG_CHECKING([if quadrics kernel headers are present])
324         if test -d $LINUX/drivers/net/qsnet ; then
325                 AC_MSG_RESULT([yes])
326                 QSWNAL="qswnal"
327                 AC_MSG_CHECKING([for multirail EKC])
328                 if test -f $LINUX/include/elan/epcomms.h; then
329                         AC_MSG_RESULT([supported])
330                         QSWCPPFLAGS="-DMULTIRAIL_EKC=1"
331                 else
332                         AC_MSG_RESULT([not supported])
333                         QSWCPPFLAGS="-I$LINUX/drivers/net/qsnet/include"
334                 fi
335         else
336                 AC_MSG_RESULT([no])
337                 QSWNAL=""
338                 QSWCPPFLAGS=""
339         fi
340         AC_SUBST(QSWCPPFLAGS)
341         AC_SUBST(QSWNAL)
342
343         AC_MSG_CHECKING([if gm support was requested])
344         AC_ARG_WITH([gm],
345                 AC_HELP_STRING([--with-gm=path],
346                                [build gmnal against path]),
347                 [
348                         case $with_gm in 
349                                 yes)
350                                         AC_MSG_RESULT([yes])
351                                         GMCPPFLAGS="-I/usr/local/gm/include"
352                                         GMNAL="gmnal"
353                                         ;;
354                                 no)
355                                         AC_MSG_RESULT([no])
356                                         GMCPPFLAGS=""
357                                         GMNAL=""
358                                         ;;
359                                 *)
360                                         AC_MSG_RESULT([yes])
361                                         GMCPPFLAGS="-I$with_gm/include -I$with_gm/drivers -I$with_gm/drivers/linux/gm"
362                                         GMNAL="gmnal"
363                                         ;;
364                         esac
365                 ],[
366                         AC_MSG_RESULT([no])
367                         GMCPPFLAGS=""
368                         GMNAL=""
369                 ])
370         AC_SUBST(GMCPPFLAGS)
371         AC_SUBST(GMNAL)
372
373         #fixme: where are the default IB includes?
374         default_ib_include_dir=/usr/local/ib/include
375         an_ib_include_file=vapi.h
376
377         AC_MSG_CHECKING([if ib nal support was requested])
378         AC_ARG_WITH([ib],
379                 AC_HELP_STRING([--with-ib=yes/no/path],
380                                [Path to IB includes]),
381                 [
382                         case $with_ib in
383                                 yes)
384                                         AC_MSG_RESULT([yes])
385                                         IBCPPFLAGS="-I/usr/local/ib/include"
386                                         IBNAL="ibnal"
387                                         ;;
388                                 no)
389                                         AC_MSG_RESULT([no])
390                                         IBCPPFLAGS=""
391                                         IBNAL=""
392                                         ;;
393                                 *)
394                                         AC_MSG_RESULT([yes])
395                                         IBCPPFLAGS="-I$with_ib"
396                                         IBNAL=""
397                                         ;;
398                         esac
399                 ],[
400                         AC_MSG_RESULT([no])
401                         IBFLAGS=""
402                         IBNAL=""
403                 ])
404         AC_SUBST(IBNAL)
405         AC_SUBST(IBCPPFLAGS)
406
407         # ---------- Red Hat 2.4.18 has iobuf->dovary --------------
408         # But other kernels don't
409
410         AC_MSG_CHECKING([if struct kiobuf has a dovary field])
411         LUSTRE_MODULE_TRY_COMPILE(
412                 [
413                         #include <linux/iobuf.h>
414                 ],[
415                         struct kiobuf iobuf;
416                         iobuf.dovary = 1;
417                 ],[
418                         AC_MSG_RESULT([yes])
419                         AC_DEFINE(HAVE_KIOBUF_DOVARY, 1, [struct kiobuf has a dovary field])
420                 ],[
421                         AC_MSG_RESULT([no])
422                 ])
423
424         # ----------- 2.6.4 no longer has page->list ---------------
425         AC_MSG_CHECKING([if struct page has a list field])
426         LUSTRE_MODULE_TRY_COMPILE(
427                 [
428                         #include <linux/mm.h>
429                 ],[
430                         struct page page;
431                         &page.list;
432                 ],[
433                         AC_MSG_RESULT([yes])
434                         AC_DEFINE(HAVE_PAGE_LIST, 1, [struct page has a list field])
435                 ],[
436                         AC_MSG_RESULT([no])
437                 ])
438
439         # ---------- Red Hat 2.4.20 backports some 2.5 bits --------
440         # This needs to run after we've defined the KCPPFLAGS
441
442         AC_MSG_CHECKING([if task_struct has a sighand field])
443         LUSTRE_MODULE_TRY_COMPILE(
444                 [
445                         #include <linux/sched.h>
446                 ],[
447                         struct task_struct p;
448                         p.sighand = NULL;
449                 ],[
450                         AC_DEFINE(CONFIG_RH_2_4_20, 1, [this kernel contains Red Hat 2.4.20 patches])
451                         AC_MSG_RESULT([yes])
452                 ],[
453                         AC_MSG_RESULT([no])
454                 ])
455
456         # ---------- 2.4.20 introduced cond_resched --------------
457
458         AC_MSG_CHECKING([if kernel offers cond_resched])
459         LUSTRE_MODULE_TRY_COMPILE(
460                 [
461                         #include <linux/sched.h>
462                 ],[
463                         cond_resched();
464                 ],[
465                         AC_MSG_RESULT([yes])
466                         AC_DEFINE(HAVE_COND_RESCHED, 1, [cond_resched found])
467                 ],[
468                         AC_MSG_RESULT([no])
469                 ])
470
471         # ---------- Red Hat 2.4.21 backports some more 2.5 bits --------
472
473         AC_MSG_CHECKING([if kernel defines PDE])
474         HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"
475         if test "$HAVE_PDE" != 0 ; then
476                 AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE])
477                 AC_MSG_RESULT([yes])
478         else
479                 AC_MSG_RESULT([no])
480         fi
481
482         AC_MSG_CHECKING([if kernel passes struct file to direct_IO])
483         HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"
484         if test "$HAVE_DIO_FILE" != 0 ; then
485                 AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO])
486                 AC_MSG_RESULT(yes)
487         else
488                 AC_MSG_RESULT(no)
489         fi
490
491         AC_MSG_CHECKING([if kernel defines cpu_online()])
492         LUSTRE_MODULE_TRY_COMPILE(
493                 [
494                         #include <linux/sched.h>
495                 ],[
496                         cpu_online(0);
497                 ],[
498                         AC_MSG_RESULT([yes])
499                         AC_DEFINE(HAVE_CPU_ONLINE, 1, [cpu_online found])
500                 ],[
501                         AC_MSG_RESULT([no])
502                 ])
503
504         AC_MSG_CHECKING([if kernel defines cpumask_t])
505         LUSTRE_MODULE_TRY_COMPILE(
506                 [
507                         #include <linux/sched.h>
508                 ],[
509                         return sizeof (cpumask_t);
510                 ],[
511                         AC_MSG_RESULT([yes])
512                         AC_DEFINE(HAVE_CPUMASK_T, 1, [cpumask_t found])
513                 ],[
514                         AC_MSG_RESULT([no])
515                 ])
516
517         # ---------- RHEL kernels define page_count in mm_inline.h
518         AC_MSG_CHECKING([if kernel has mm_inline.h header])
519         LUSTRE_MODULE_TRY_COMPILE(
520                 [
521                         #include <linux/mm_inline.h>
522                 ],[
523                         #ifndef page_count
524                         #error mm_inline.h does not define page_count
525                         #endif
526                 ],[
527                         AC_MSG_RESULT([yes])
528                         AC_DEFINE(HAVE_MM_INLINE, 1, [mm_inline found])
529                 ],[
530                         AC_MSG_RESULT([no])
531                 ])
532
533         # ---------- inode->i_alloc_sem --------------
534         AC_MSG_CHECKING([if struct inode has i_alloc_sem])
535         LUSTRE_MODULE_TRY_COMPILE(
536                 [
537                         #include <linux/fs.h>
538                         #include <linux/version.h>
539                 ],[
540                         #if defined(CONFIG_X86_64) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
541                         #error "x86_64 down_read_trylock broken before 2.4.24"
542                         #endif
543                         struct inode i;
544                         return (char *)&i.i_alloc_sem - (char *)&i;
545                 ],[
546                         AC_MSG_RESULT([yes])
547                         AC_DEFINE(HAVE_I_ALLOC_SEM, 1, [struct inode has i_alloc_sem])
548                 ],[
549                         AC_MSG_RESULT([no])
550                 ])
551
552         # ---------- modules? ------------------------
553         AC_MSG_CHECKING([for module support])
554         LUSTRE_MODULE_TRY_COMPILE(
555                 [
556                         #include <linux/config.h>
557                 ],[
558                         #ifndef CONFIG_MODULES
559                         #error CONFIG_MODULES not #defined
560                         #endif
561                 ],[
562                         AC_MSG_RESULT([yes])
563                 ],[
564                         AC_MSG_RESULT([no])
565                         AC_MSG_ERROR([module support is required to build Lustre kernel modules.])
566                 ])
567
568         # ---------- modversions? --------------------
569         AC_MSG_CHECKING([for MODVERSIONS])
570         LUSTRE_MODULE_TRY_COMPILE(
571                 [
572                         #include <linux/config.h>
573                 ],[
574                         #ifndef CONFIG_MODVERSIONS
575                         #error CONFIG_MODVERSIONS not #defined
576                         #endif
577                 ],[
578                         AC_MSG_RESULT([yes])
579                 ],[
580                         AC_MSG_RESULT([no])
581                 ])
582
583         # ------------ preempt -----------------------
584         AC_MSG_CHECKING([if preempt is enabled])
585         LUSTRE_MODULE_TRY_COMPILE(
586                 [
587                         #include <linux/config.h>
588                 ],[
589                         #ifndef CONFIG_PREEMPT
590                         #error CONFIG_PREEMPT is not #defined
591                         #endif
592                 ],[
593                         AC_MSG_RESULT([yes])
594                         AC_MSG_ERROR([Lustre does not support kernels with preempt enabled.])
595                 ],[
596                         AC_MSG_RESULT([no])
597                 ])
598
599         case $BACKINGFS in
600                 ext3)
601                         # --- Check that ext3 and ext3 xattr are enabled in the kernel
602                         AC_MSG_CHECKING([that ext3 is enabled in the kernel])
603                         LUSTRE_MODULE_TRY_COMPILE(
604                                 [
605                                         #include <linux/config.h>
606                                 ],[
607                                         #ifndef CONFIG_EXT3_FS
608                                         #ifndef CONFIG_EXT3_FS_MODULE
609                                         #error CONFIG_EXT3_FS not #defined
610                                         #endif
611                                         #endif
612                                 ],[
613                                         AC_MSG_RESULT([yes])
614                                 ],[
615                                         AC_MSG_RESULT([no])
616                                         AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel (CONFIG_EXT3_FS)])
617                                 ])
618         
619                         AC_MSG_CHECKING([that extended attributes for ext3 are enabled in the kernel])
620                         LUSTRE_MODULE_TRY_COMPILE(
621                                 [
622                                         #include <linux/config.h>
623                                 ],[
624                                         #ifndef CONFIG_EXT3_FS_XATTR
625                                         #error CONFIG_EXT3_FS_XATTR not #defined
626                                         #endif
627                                 ],[
628                                         AC_MSG_RESULT([yes])
629                                 ],[
630                                         AC_MSG_RESULT([no])
631                                         AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel (CONFIG_EXT3_FS_XATTR.)])
632                                         AC_MSG_WARN([This build may fail.])
633                                 ])
634                         ;;
635                 ldiskfs)
636                         AC_MSG_CHECKING([if fshooks are present])
637                         LUSTRE_MODULE_TRY_COMPILE(
638                                 [
639                                         #include <linux/fshooks.h>
640                                 ],[],[
641                                         AC_MSG_RESULT([yes])
642                                         LDISKFS_SERIES="2.6-suse.series"
643                                 ],[
644                                         AC_MSG_RESULT([no])
645                                         LDISKFS_SERIES="2.6-vanilla.series"
646                                 ])
647                         AC_SUBST(LDISKFS_SERIES)
648                         # --- check which ldiskfs series we should use
649                         ;;
650         esac # $BACKINGFS
651 fi
652
653 AM_CONDITIONAL(BUILD_IBNAL, test x$IBNAL = "xibnal")
654 AM_CONDITIONAL(BUILD_GMNAL, test x$GMNAL = "xgmnal")
655 AM_CONDITIONAL(BUILD_QSWNAL, test x$QSWNAL = "xqswnal")
656
657 CPPFLAGS="-include \$(top_builddir)/include/config.h $CPPFLAGS"
658 EXTRA_KCFLAGS="-include $PWD/include/config.h $EXTRA_KCFLAGS"
659 AC_SUBST(EXTRA_KCFLAGS)
660
661 #echo "KCPPFLAGS: $KCPPFLAGS"
662 #echo "KCFLAGS: $KCFLAGS"
663 #echo "LLCPPFLAGS: $LLCPPFLAGS"
664 #echo "LLCFLAGS: $LLCFLAGS"
665 #echo "MOD_LINK: $MOD_LINK"
666 #echo "CFLAGS: $CFLAGS"
667 #echo "CPPFLAGS: $CPPFLAGS"