Whamcloud - gitweb
- landing of b_hd_cleanup_merge to HEAD.
[fs/lustre-release.git] / lnet / archdep.m4
index db70ec0..d2bd1a1 100644 (file)
@@ -1,7 +1,7 @@
 # -------- we can't build modules unless srcdir = builddir
 if test x$enable_modules != xno ; then
-AC_CHECK_FILE([autoMakefile.am],[],
-       [AC_MSG_ERROR([At this time, Lustre does not support building kernel modules with srcdir != buildir.])])
+       AC_CHECK_FILE([autoMakefile.am],[],
+               [AC_MSG_ERROR([At this time, Lustre does not support building kernel modules with srcdir != buildir.])])
 fi
 
 # -------- in kernel compilation? (2.5 only) -------------
@@ -21,13 +21,15 @@ AC_ARG_WITH([cray-portals],
        [
                if test "$with_cray_portals" != no; then
                        if test -r $with_cray_portals/include/portals/api.h ; then
+                               CRAY_PORTALS_PATH=$with_cray_portals
                                CRAY_PORTALS_INCLUDE="-I$with_cray_portals/include"
                                AC_DEFINE(CRAY_PORTALS, 1, [Building with Cray Portals])
                        else
                                AC_MSG_ERROR([--with-cray-portals specified badly])
-                        fi
-                fi
+                       fi
+               fi
        ],[with_cray_portals=no])
+AC_SUBST(CRAY_PORTALS_PATH)
 AC_MSG_RESULT([$with_cray_portals])
 
 AM_CONDITIONAL(CRAY_PORTALS, test x$with_cray_portals != xno)
@@ -42,43 +44,44 @@ if test x$enable_utils = xno ; then
        enable_utils=no
 fi
 
-# -------- set linuxdir ------------
-AC_MSG_CHECKING([for Linux sources])
-AC_ARG_WITH([linux],
-       AC_HELP_STRING([--with-linux=path],
-                      [set path to Linux source (default=/usr/src/linux)]),
-       [LINUX=$with_linux],
-       [LINUX=/usr/src/linux])
-AC_MSG_RESULT([$LINUX])
-AC_SUBST(LINUX)
-if test x$enable_inkernel = xyes ; then
-        echo ln -s `pwd` $LINUX/fs/lustre
-        rm $LINUX/fs/lustre
-        ln -s `pwd` $LINUX/fs/lustre
-fi
-
-# -------- check for .confg --------
-AC_ARG_WITH([linux-config],
-       [AC_HELP_STRING([--with-linux-config=path],
-                       [set path to Linux .conf (default=\$LINUX/.config)])],
-       [LINUX_CONFIG=$with_linux_config],
-       [LINUX_CONFIG=$LINUX/.config])
-AC_SUBST(LINUX_CONFIG)
-
-AC_CHECK_FILE([/boot/kernel.h],
-       [KERNEL_SOURCE_HEADER='/boot/kernel.h'],
-       [AC_CHECK_FILE([/var/adm/running-kernel.h]),
-               [KERNEL_SOURCE_HEADER='/var/adm/running-kernel.h']])
-
-AC_ARG_WITH([kernel-source-header],
-       AC_HELP_STRING([--with-kernel-source-header=path],
-                       [Use a different kernel version header.  Consult README.kernel-source for details.]),
-       [KERNEL_SOURCE_HEADER=$with_kernel_source_header])
-
-#  --------------------
-ARCH_UM=
-UML_CFLAGS=
 if test x$enable_modules != xno ; then
+       # -------- set linuxdir ------------
+       AC_MSG_CHECKING([for Linux sources])
+       AC_ARG_WITH([linux],
+               AC_HELP_STRING([--with-linux=path],
+                              [set path to Linux source (default=/usr/src/linux)]),
+               [LINUX=$with_linux],
+               [LINUX=/usr/src/linux])
+       AC_MSG_RESULT([$LINUX])
+       AC_SUBST(LINUX)
+       if test x$enable_inkernel = xyes ; then
+               echo ln -s `pwd` $LINUX/fs/lustre
+               rm $LINUX/fs/lustre
+               ln -s `pwd` $LINUX/fs/lustre
+       fi
+
+       # -------- check for .confg --------
+       AC_ARG_WITH([linux-config],
+               [AC_HELP_STRING([--with-linux-config=path],
+                               [set path to Linux .conf (default=\$LINUX/.config)])],
+               [LINUX_CONFIG=$with_linux_config],
+               [LINUX_CONFIG=$LINUX/.config])
+       AC_SUBST(LINUX_CONFIG)
+
+       AC_CHECK_FILE([/boot/kernel.h],
+               [KERNEL_SOURCE_HEADER='/boot/kernel.h'],
+               [AC_CHECK_FILE([/var/adm/running-kernel.h]),
+                       [KERNEL_SOURCE_HEADER='/var/adm/running-kernel.h']])
+
+       AC_ARG_WITH([kernel-source-header],
+               AC_HELP_STRING([--with-kernel-source-header=path],
+                               [Use a different kernel version header.  Consult README.kernel-source for details.]),
+               [KERNEL_SOURCE_HEADER=$with_kernel_source_header])
+
+       #  --------------------
+       ARCH_UM=
+       UML_CFLAGS=
+
        AC_MSG_CHECKING([if you are running user mode linux for $host_cpu])
        if test -e $LINUX/include/asm-um ; then
                if test  X`ls -id $LINUX/include/asm/ | awk '{print $1}'` = X`ls -id $LINUX/include/asm-um | awk '{print $1}'` ; then
@@ -92,23 +95,36 @@ if test x$enable_modules != xno ; then
        else
                AC_MSG_RESULT([no (asm-um missing)])
        fi
-fi
-AC_SUBST(ARCH_UM)
-AC_SUBST(UML_CFLAGS)
-# --------- Linux 25 ------------------
 
-AC_CHECK_FILE([$LINUX/include/linux/namei.h],
-       [
-               linux25="yes"
-               KMODEXT=".ko"
-       ],[
-               KMODEXT=".o"
-               linux25="no"
-       ])
-AC_MSG_CHECKING([if you are using Linux 2.6])
-AC_MSG_RESULT([$linux25])
+       AC_SUBST(ARCH_UM)
+       AC_SUBST(UML_CFLAGS)
+
+       # --------- Linux 25 ------------------
+       AC_CHECK_FILE([$LINUX/include/linux/namei.h],
+               [
+                       linux25="yes"
+                       KMODEXT=".ko"
+                       enable_ldiskfs="yes"
+                       BACKINGFS="ldiskfs"
+               ],[
+                       KMODEXT=".o"
+                       linux25="no"
+               ])
+       AC_MSG_CHECKING([if you are using Linux 2.6])
+       AC_MSG_RESULT([$linux25])
+
+       AC_SUBST(LINUX25)
+       AC_SUBST(KMODEXT)
+
+       AC_PATH_PROG(PATCH, patch, [no])
+       AC_PATH_PROG(QUILT, quilt, [no])
+
+       if test x$enable_ldiskfs$PATCH$QUILT = xyesnono ; then
+               AC_MSG_ERROR([Quilt or patch are needed to build the ldiskfs module (for Linux 2.6)])
+       fi
+fi
 AM_CONDITIONAL(LINUX25, test x$linux25 = xyes)
-AC_SUBST(KMODEXT)
+AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
 
 # -------  Makeflags ------------------
 
@@ -208,14 +224,29 @@ if test x$enable_modules != xno ; then
                ])
 
        # ------------ LINUXRELEASE and moduledir ------------------
-       AC_MSG_CHECKING([for Linux release])
-       rm -f kernel-tests/conftest.i
-       LINUXRELEASE=
+       MODULE_TARGET="SUBDIRS"
        if test $linux25 = 'yes' ; then
+               # ------------ external module support ---------------------
                makerule="$PWD/kernel-tests"
+               AC_MSG_CHECKING([for external module build support])
+               rm -f kernel-tests/conftest.i
+               LUSTRE_MODULE_TRY_MAKE([],[],
+                       [$makerule LUSTRE_KERNEL_TEST=conftest.i],
+                       [test -s kernel-tests/conftest.i],
+                       [
+                               AC_MSG_RESULT([no])
+                       ],[
+                               AC_MSG_RESULT([yes])
+                               makerule="_module_$makerule"
+                               MODULE_TARGET="M"
+                       ])
        else
                makerule="_dir_$PWD/kernel-tests"
        fi
+       AC_SUBST(MODULE_TARGET)
+       LINUXRELEASE=
+       rm -f kernel-tests/conftest.i
+       AC_MSG_CHECKING([for Linux release])
        LUSTRE_MODULE_TRY_MAKE(
                [#include <linux/version.h>],
                [char *LINUXRELEASE;
@@ -237,244 +268,301 @@ if test x$enable_modules != xno ; then
        AC_MSG_RESULT([$LINUXRELEASE])
        AC_SUBST(LINUXRELEASE)
 
-       moduledir='$(libdir)/modules/'$LINUXRELEASE/kernel
-       AC_SUBST(moduledir)
-
+       moduledir='/lib/modules/'$LINUXRELEASE/kernel
        modulefsdir='$(moduledir)/fs/$(PACKAGE)'
+       modulenetdir='$(moduledir)/net/$(PACKAGE)'
+
+       AC_SUBST(moduledir)
        AC_SUBST(modulefsdir)
+       AC_SUBST(modulenetdir)
 
        # ------------ RELEASE --------------------------------
        AC_MSG_CHECKING([for Lustre release])
        RELEASE="`echo ${LINUXRELEASE} | tr '-' '_'`_`date +%Y%m%d%H%M`"
        AC_MSG_RESULT($RELEASE)
        AC_SUBST(RELEASE)
-fi
 
-# ---------- Portals flags --------------------
-
-#AC_PREFIX_DEFAULT([])
-#if test "x$prefix" = xNONE || test "x$prefix" = x; then
-#  usrprefix=/usr
-#else
-#  usrprefix='${prefix}'
-#fi
-#AC_SUBST(usrprefix)
-
-AC_MSG_CHECKING([for zero-copy TCP support])
-AC_ARG_ENABLE([zerocopy],
-       AC_HELP_STRING([--disable-zerocopy],
-                      [disable socknal zerocopy]),
-       [],[enable_zerocopy='yes'])
-if test x$enable_zerocopy = xno ; then
-       AC_MSG_RESULT([no (by request)])
-else
-       ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
-       if test "$ZCCD" != 0 ; then
-               AC_DEFINE(SOCKNAL_ZC, 1, [use zero-copy TCP])
-               AC_MSG_RESULT(yes)
+       # ---------- Portals flags --------------------
+
+       AC_MSG_CHECKING([for zero-copy TCP support])
+       AC_ARG_ENABLE([zerocopy],
+               AC_HELP_STRING([--disable-zerocopy],
+                              [disable socknal zerocopy]),
+               [],[enable_zerocopy='yes'])
+       if test x$enable_zerocopy = xno ; then
+               AC_MSG_RESULT([no (by request)])
        else
-               AC_MSG_RESULT([no (no kernel support)])
+               ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
+               if test "$ZCCD" != 0 ; then
+                       AC_DEFINE(SOCKNAL_ZC, 1, [use zero-copy TCP])
+                       AC_MSG_RESULT(yes)
+               else
+                       AC_MSG_RESULT([no (no kernel support)])
+               fi
        fi
-fi
 
-AC_MSG_CHECKING([for CPU affinity support])
-AC_ARG_ENABLE([affinity],
-       AC_HELP_STRING([--disable-affinity],
-                      [disable process/irq affinity]),
-       [],[enable_affinity='yes'])
-if test x$enable_affinity = xno ; then
-       AC_MSG_RESULT([no (by request)])
-else
-       SET_CPUS_ALLOW="`grep -c set_cpus_allowed $LINUX/kernel/softirq.c`"
-       if test "$SET_CPUS_ALLOW" != 0 ; then
-               AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
-               AC_MSG_RESULT([yes])
+       AC_ARG_ENABLE([affinity],
+               AC_HELP_STRING([--disable-affinity],
+                              [disable process/irq affinity]),
+               [],[enable_affinity='yes'])
+
+       AC_MSG_CHECKING([for CPU affinity support])
+       if test x$enable_affinity = xno ; then
+               AC_MSG_RESULT([no (by request)])
        else
-               AC_MSG_RESULT([no (no kernel support)])
+               LUSTRE_MODULE_TRY_COMPILE(
+                       [
+                               #include <linux/sched.h>
+                       ],[
+                               struct task_struct t;
+                               #ifdef CPU_ARRAY_SIZE
+                               cpumask_t m;
+                               #else
+                               unsigned long m;
+                               #endif
+                               set_cpus_allowed(&t, m);
+                       ],[
+                               AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
+                               AC_MSG_RESULT([yes])
+                       ],[
+                               AC_MSG_RESULT([no (no kernel support)])
+                       ])
        fi
-fi
-
 
-#####################################
+       #####################################
 
-AC_MSG_CHECKING([if quadrics kernel headers are present])
-if test -d $LINUX/drivers/net/qsnet ; then
-       AC_MSG_RESULT([yes])
-       QSWNAL="qswnal"
-       AC_MSG_CHECKING([for multirail EKC])
-       if test -f $LINUX/include/elan/epcomms.h; then
-               AC_MSG_RESULT([supported])
-               QSWCPPFLAGS="-DMULTIRAIL_EKC=1"
-       else
-               AC_MSG_RESULT([not supported])
-               if test -d $LINUX/drivers/net/qsnet/include; then
-                       QSWCPPFLAGS="-I$LINUX/drivers/net/qsnet/include"
+       AC_MSG_CHECKING([if quadrics kernel headers are present])
+       if test -d $LINUX/drivers/net/qsnet ; then
+               AC_MSG_RESULT([yes])
+               QSWNAL="qswnal"
+               AC_MSG_CHECKING([for multirail EKC])
+               if test -f $LINUX/include/elan/epcomms.h; then
+                       AC_MSG_RESULT([supported])
+                       QSWCPPFLAGS="-DMULTIRAIL_EKC=1"
                else
-                       QSWCPPFLAGS="-I$LINUX/include/linux"
+                       AC_MSG_RESULT([not supported])
+                       if test -d $LINUX/drivers/net/qsnet/include; then
+                               QSWCPPFLAGS="-I$LINUX/drivers/net/qsnet/include"
+                       else
+                               QSWCPPFLAGS="-I$LINUX/include/linux"
+                       fi
                fi
+       else
+               AC_MSG_RESULT([no])
+               QSWNAL=""
+               QSWCPPFLAGS=""
        fi
-else
-       AC_MSG_RESULT([no])
-       QSWNAL=""
-       QSWCPPFLAGS=""
-fi
-AC_SUBST(QSWCPPFLAGS)
-AC_SUBST(QSWNAL)
-AM_CONDITIONAL(BUILD_QSWNAL, test x$QSWNAL = "xqswnal")
+       AC_SUBST(QSWCPPFLAGS)
+       AC_SUBST(QSWNAL)
 
-AC_MSG_CHECKING([if gm support was requested])
-AC_ARG_WITH([gm],
-       AC_HELP_STRING([--with-gm=path],
-                      [build gmnal against path]),
-       [
-               case $with_gm in 
-                       yes)
-                               AC_MSG_RESULT([yes])
-                               GMCPPFLAGS="-I/usr/local/gm/include"
-                               GMNAL="gmnal"
-                               ;;
-                       no)
-                               AC_MSG_RESULT([no])
-                               GMCPPFLAGS=""
-                               GMNAL=""
-                               ;;
-                       *)
-                               AC_MSG_RESULT([yes])
-                               GMCPPFLAGS="-I$with_gm/include -I$with_gm/drivers -I$with_gm/drivers/linux/gm"
-                               GMNAL="gmnal"
-                               ;;
-               esac
-       ],[
-               AC_MSG_RESULT([no])
-               GMCPPFLAGS=""
-               GMNAL=""
-       ])
-AC_SUBST(GMCPPFLAGS)
-AC_SUBST(GMNAL)
-AM_CONDITIONAL(BUILD_GMNAL, test x$GMNAL = "xgmnal")
+       AC_MSG_CHECKING([if gm support was requested])
+       AC_ARG_WITH([gm],
+               AC_HELP_STRING([--with-gm=path],
+                              [build gmnal against path]),
+               [
+                       case $with_gm in 
+                               yes)
+                                       AC_MSG_RESULT([yes])
+                                       GMCPPFLAGS="-I/usr/local/gm/include"
+                                       GMNAL="gmnal"
+                                       ;;
+                               no)
+                                       AC_MSG_RESULT([no])
+                                       GMCPPFLAGS=""
+                                       GMNAL=""
+                                       ;;
+                               *)
+                                       AC_MSG_RESULT([yes])
+                                       GMCPPFLAGS="-I$with_gm/include -I$with_gm/drivers -I$with_gm/drivers/linux/gm"
+                                       GMNAL="gmnal"
+                                       ;;
+                       esac
+               ],[
+                       AC_MSG_RESULT([no])
+                       GMCPPFLAGS=""
+                       GMNAL=""
+               ])
+       AC_SUBST(GMCPPFLAGS)
+       AC_SUBST(GMNAL)
+
+       #### OpenIB 
+       AC_MSG_CHECKING([if OpenIB kernel headers are present])
+       OPENIBCPPFLAGS="-I$LINUX/drivers/infiniband/include -DIN_TREE_BUILD"
+       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
+       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $OPENIBCPPFLAGS"
+       LUSTRE_MODULE_TRY_COMPILE(
+               [
+                       #include <ts_ib_core.h>
+               ],[
+                       struct ib_device_properties props;
+                       return 0;
+               ],[
+                       AC_MSG_RESULT([yes])
+                       OPENIBNAL="openibnal"
+               ],[
+                       AC_MSG_RESULT([no])
+                       OPENIBNAL=""
+                       OPENIBCPPFLAGS=""
+               ])
+       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
+       AC_SUBST(OPENIBCPPFLAGS)
+       AC_SUBST(OPENIBNAL)
 
-#fixme: where are the default IB includes?
-default_ib_include_dir=/usr/local/ib/include
-an_ib_include_file=vapi.h
+       # ---------- Red Hat 2.4.18 has iobuf->dovary --------------
+       # But other kernels don't
 
-AC_MSG_CHECKING([if ib nal support was requested])
-AC_ARG_WITH([ib],
-       AC_HELP_STRING([--with-ib=yes/no/path],
-                      [Path to IB includes]),
-       [
-               case $with_ib in
-                       yes)
-                               AC_MSG_RESULT([yes])
-                               IBCPPFLAGS="-I/usr/local/ib/include"
-                               IBNAL="ibnal"
-                               ;;
-                       no)
-                               AC_MSG_RESULT([no])
-                               IBCPPFLAGS=""
-                               IBNAL=""
-                               ;;
-                       *)
-                               AC_MSG_RESULT([yes])
-                               IBCPPFLAGS="-I$with_ib"
-                               IBNAL=""
-                               ;;
-               esac
-       ],[
-               AC_MSG_RESULT([no])
-               IBFLAGS=""
-               IBNAL=""
-       ])
-AC_SUBST(IBNAL)
-AC_SUBST(IBCPPFLAGS)
-AM_CONDITIONAL(BUILD_IBNAL, test x$IBNAL = "xibnal")
+       AC_MSG_CHECKING([if struct kiobuf has a dovary field])
+       LUSTRE_MODULE_TRY_COMPILE(
+               [
+                       #include <linux/iobuf.h>
+               ],[
+                       struct kiobuf iobuf;
+                       iobuf.dovary = 1;
+               ],[
+                       AC_MSG_RESULT([yes])
+                       AC_DEFINE(HAVE_KIOBUF_DOVARY, 1, [struct kiobuf has a dovary field])
+               ],[
+                       AC_MSG_RESULT([no])
+               ])      
+
+       # ----------- 2.6.4 no longer has page->list ---------------
+       AC_MSG_CHECKING([if struct page has a list field])
+       LUSTRE_MODULE_TRY_COMPILE(
+               [
+                       #include <linux/mm.h>
+               ],[
+                       struct page page;
+                       &page.list;
+               ],[
+                       AC_MSG_RESULT([yes])
+                       AC_DEFINE(HAVE_PAGE_LIST, 1, [struct page has a list field])
+               ],[
+                       AC_MSG_RESULT([no])
+               ])
 
-AC_SUBST(MOD_LINK)
-AC_SUBST(LINUX25)
+       # ---------- Red Hat 2.4.20 backports some 2.5 bits --------
+       # This needs to run after we've defined the KCPPFLAGS
 
-# ---------- Red Hat 2.4.18 has iobuf->dovary --------------
-# But other kernels don't
+       AC_MSG_CHECKING([if task_struct has a sighand field])
+       LUSTRE_MODULE_TRY_COMPILE(
+               [
+                       #include <linux/sched.h>
+               ],[
+                       struct task_struct p;
+                       p.sighand = NULL;
+               ],[
+                       AC_DEFINE(CONFIG_RH_2_4_20, 1, [this kernel contains Red Hat 2.4.20 patches])
+                       AC_MSG_RESULT([yes])
+               ],[
+                       AC_MSG_RESULT([no])
+               ])
 
-AC_MSG_CHECKING([if struct kiobuf has a dovary field])
-LUSTRE_MODULE_TRY_COMPILE(
-       [
-               #include <linux/iobuf.h>
-       ],[
-               struct kiobuf iobuf;
-               iobuf.dovary = 1;
-       ],[
+       # ---------- 2.4.20 introduced cond_resched --------------
+
+       AC_MSG_CHECKING([if kernel offers cond_resched])
+       LUSTRE_MODULE_TRY_COMPILE(
+               [
+                       #include <linux/sched.h>
+               ],[
+                       cond_resched();
+               ],[
+                       AC_MSG_RESULT([yes])
+                       AC_DEFINE(HAVE_COND_RESCHED, 1, [cond_resched found])
+               ],[
+                       AC_MSG_RESULT([no])
+               ])
+
+       # --------- zap_page_range(vma) --------------------------------
+       AC_MSG_CHECKING([if zap_pag_range with vma parameter])
+       ZAP_PAGE_RANGE_VMA="`grep -c 'zap_page_range.*struct vm_area_struct' $LINUX/include/linux/mm.h`"
+       if test "$ZAP_PAGE_RANGE_VMA" != 0 ; then
+               AC_DEFINE(ZAP_PAGE_RANGE_VMA, 1, [zap_page_range with vma parameter])
                AC_MSG_RESULT([yes])
-               AC_DEFINE(HAVE_KIOBUF_DOVARY, 1, [struct kiobuf has a dovary field])
-       ],[
+       else
                AC_MSG_RESULT([no])
-       ])
+       fi
 
-# ----------- 2.6.4 no longer has page->list ---------------
-AC_MSG_CHECKING([if struct page has a list field])
-LUSTRE_MODULE_TRY_COMPILE(
-       [
-               #include <linux/mm.h>
-       ],[
-               struct page page;
-               &page.list;
-       ],[
+       # ---------- Red Hat 2.4.21 backports some more 2.5 bits --------
+
+       AC_MSG_CHECKING([if kernel defines PDE])
+       HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"
+       if test "$HAVE_PDE" != 0 ; then
+               AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE])
                AC_MSG_RESULT([yes])
-               AC_DEFINE(HAVE_PAGE_LIST, 1, [struct page has a list field])
-       ],[
+       else
                AC_MSG_RESULT([no])
-       ])
+       fi
 
-# ---------- Red Hat 2.4.20 backports some 2.5 bits --------
-# This needs to run after we've defined the KCPPFLAGS
+       AC_MSG_CHECKING([if kernel passes struct file to direct_IO])
+       HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"
+       if test "$HAVE_DIO_FILE" != 0 ; then
+               AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO])
+               AC_MSG_RESULT(yes)
+       else
+               AC_MSG_RESULT(no)
+       fi
 
-AC_MSG_CHECKING([for kernel version])
-LUSTRE_MODULE_TRY_COMPILE(
-       [
-               #include <linux/sched.h>
-       ],[
-               struct task_struct p;
-               p.sighand = NULL;
-       ],[
-               AC_DEFINE(CONFIG_RH_2_4_20, 1, [this kernel contains Red Hat 2.4.20 patches])
-               AC_MSG_RESULT([redhat-2.4.20])
-       ],[
-               AC_MSG_RESULT([$LINUXRELEASE])
-       ])
-
-# ---------- 2.4.20 introduced cond_resched --------------
-
-AC_MSG_CHECKING([if kernel offers cond_resched])
-LUSTRE_MODULE_TRY_COMPILE(
-       [
-               #include <linux/sched.h>
-       ],[
-               cond_resched();
-       ],[
-       AC_MSG_RESULT([yes])
-               AC_DEFINE(HAVE_COND_RESCHED, 1, [cond_resched found])
-       ],[
-               AC_MSG_RESULT([no])
-       ])
-# ---------- Red Hat 2.4.21 backports some more 2.5 bits --------
-
-AC_MSG_CHECKING([if kernel defines PDE])
-HAVE_PDE="`grep -c 'proc_dir_entry..PDE' $LINUX/include/linux/proc_fs.h`"
-if test "$HAVE_PDE" != 0 ; then
-       AC_DEFINE(HAVE_PDE, 1, [the kernel defines PDE])
-       AC_MSG_RESULT([yes])
-else
-       AC_MSG_RESULT([no])
-fi
+       AC_MSG_CHECKING([if kernel defines cpu_online()])
+       LUSTRE_MODULE_TRY_COMPILE(
+               [
+                       #include <linux/sched.h>
+               ],[
+                       cpu_online(0);
+               ],[
+                       AC_MSG_RESULT([yes])
+                       AC_DEFINE(HAVE_CPU_ONLINE, 1, [cpu_online found])
+               ],[
+                       AC_MSG_RESULT([no])
+               ])
+       AC_MSG_CHECKING([if kernel defines cpumask_t])
+       LUSTRE_MODULE_TRY_COMPILE(
+               [
+                       #include <linux/sched.h>
+               ],[
+                       return sizeof (cpumask_t);
+               ],[
+                       AC_MSG_RESULT([yes])
+                       AC_DEFINE(HAVE_CPUMASK_T, 1, [cpumask_t found])
+               ],[
+                       AC_MSG_RESULT([no])
+               ])
+
+       # ---------- RHEL kernels define page_count in mm_inline.h
+       AC_MSG_CHECKING([if kernel has mm_inline.h header])
+       LUSTRE_MODULE_TRY_COMPILE(
+               [
+                       #include <linux/mm_inline.h>
+               ],[
+                       #ifndef page_count
+                       #error mm_inline.h does not define page_count
+                       #endif
+               ],[
+                       AC_MSG_RESULT([yes])
+                       AC_DEFINE(HAVE_MM_INLINE, 1, [mm_inline found])
+               ],[
+                       AC_MSG_RESULT([no])
+               ])
+
+       # ---------- inode->i_alloc_sem --------------
+       AC_MSG_CHECKING([if struct inode has i_alloc_sem])
+       LUSTRE_MODULE_TRY_COMPILE(
+               [
+                       #include <linux/fs.h>
+                       #include <linux/version.h>
+               ],[
+                       #if defined(CONFIG_X86_64) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
+                       #error "x86_64 down_read_trylock broken before 2.4.24"
+                       #endif
+                       struct inode i;
+                       return (char *)&i.i_alloc_sem - (char *)&i;
+               ],[
+                       AC_MSG_RESULT([yes])
+                       AC_DEFINE(HAVE_I_ALLOC_SEM, 1, [struct inode has i_alloc_sem])
+               ],[
+                       AC_MSG_RESULT([no])
+               ])
 
-AC_MSG_CHECKING([if kernel passes struct file to direct_IO])
-HAVE_DIO_FILE="`grep -c 'direct_IO.*struct file' $LINUX/include/linux/fs.h`"
-if test "$HAVE_DIO_FILE" != 0 ; then
-       AC_DEFINE(HAVE_DIO_FILE, 1, [the kernel passes struct file to direct_IO])
-       AC_MSG_RESULT(yes)
-else
-       AC_MSG_RESULT(no)
-fi
 
-if test x$enable_modules != xno ; then
        # ---------- modules? ------------------------
        AC_MSG_CHECKING([for module support])
        LUSTRE_MODULE_TRY_COMPILE(
@@ -522,53 +610,63 @@ if test x$enable_modules != xno ; then
                        AC_MSG_RESULT([no])
                ])
 
-       if test $BACKINGFS = 'ext3' ; then
-               # --- Check that ext3 and ext3 xattr are enabled in the kernel
-               AC_MSG_CHECKING([that ext3 is enabled in the kernel])
-               LUSTRE_MODULE_TRY_COMPILE(
-                       [
-                               #include <linux/config.h>
-                       ],[
-                               #ifndef CONFIG_EXT3_FS
-                               #ifndef CONFIG_EXT3_FS_MODULE
-                               #error CONFIG_EXT3_FS not #defined
-                               #endif
-                               #endif
-                       ],[
-                               AC_MSG_RESULT([yes])
-                       ],[
-                               AC_MSG_RESULT([no])
-                               AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel (CONFIG_EXT3_FS)])
-                       ])
-
-               AC_MSG_CHECKING([that extended attributes for ext3 are enabled in the kernel])
-               LUSTRE_MODULE_TRY_COMPILE(
-                       [
-                               #include <linux/config.h>
-                       ],[
-                               #ifndef CONFIG_EXT3_FS_XATTR
-                               #error CONFIG_EXT3_FS_XATTR not #defined
-                               #endif
-                       ],[
-                               AC_MSG_RESULT([yes])
-                       ],[
-                               AC_MSG_RESULT([no])
-                               AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel (CONFIG_EXT3_FS_XATTR.)])
-                               AC_MSG_WARN([This build may fail.])
-                       ])
-       fi # BACKINGFS = ext3
+       case $BACKINGFS in
+               ext3)
+                       # --- Check that ext3 and ext3 xattr are enabled in the kernel
+                       AC_MSG_CHECKING([that ext3 is enabled in the kernel])
+                       LUSTRE_MODULE_TRY_COMPILE(
+                               [
+                                       #include <linux/config.h>
+                               ],[
+                                       #ifndef CONFIG_EXT3_FS
+                                       #ifndef CONFIG_EXT3_FS_MODULE
+                                       #error CONFIG_EXT3_FS not #defined
+                                       #endif
+                                       #endif
+                               ],[
+                                       AC_MSG_RESULT([yes])
+                               ],[
+                                       AC_MSG_RESULT([no])
+                                       AC_MSG_ERROR([Lustre requires that ext3 is enabled in the kernel (CONFIG_EXT3_FS)])
+                               ])
+       
+                       AC_MSG_CHECKING([that extended attributes for ext3 are enabled in the kernel])
+                       LUSTRE_MODULE_TRY_COMPILE(
+                               [
+                                       #include <linux/config.h>
+                               ],[
+                                       #ifndef CONFIG_EXT3_FS_XATTR
+                                       #error CONFIG_EXT3_FS_XATTR not #defined
+                                       #endif
+                               ],[
+                                       AC_MSG_RESULT([yes])
+                               ],[
+                                       AC_MSG_RESULT([no])
+                                       AC_MSG_WARN([Lustre requires that extended attributes for ext3 are enabled in the kernel (CONFIG_EXT3_FS_XATTR.)])
+                                       AC_MSG_WARN([This build may fail.])
+                               ])
+                       ;;
+               ldiskfs)
+                       AC_MSG_CHECKING([if fshooks are present])
+                       LUSTRE_MODULE_TRY_COMPILE(
+                               [
+                                       #include <linux/fshooks.h>
+                               ],[],[
+                                       AC_MSG_RESULT([yes])
+                                       LDISKFS_SERIES="2.6-suse.series"
+                               ],[
+                                       AC_MSG_RESULT([no])
+                                       LDISKFS_SERIES="2.6-vanilla.series"
+                               ])
+                       AC_SUBST(LDISKFS_SERIES)
+                       # --- check which ldiskfs series we should use
+                       ;;
+       esac # $BACKINGFS
 fi
 
-# ---------- check ->lookup_raw() support --------
-
-AC_MSG_CHECKING([if kernel supports ->lookup_raw()])
-HAVE_LOOKUP_RAW="`grep -c 'lookup_raw.*struct inode' $LINUX/include/linux/fs.h`"
-if test "$HAVE_LOOKUP_RAW" != 0 ; then
-       AC_DEFINE(HAVE_LOOKUP_RAW, 1, [the kernel supports ->lookup_raw()])
-       AC_MSG_RESULT([yes])
-else
-       AC_MSG_RESULT([no])
-fi
+AM_CONDITIONAL(BUILD_QSWNAL, test x$QSWNAL = "xqswnal")
+AM_CONDITIONAL(BUILD_GMNAL, test x$GMNAL = "xgmnal")
+AM_CONDITIONAL(BUILD_OPENIBNAL, test x$OPENIBNAL = "xopenibnal")
 
 CPPFLAGS="-include \$(top_builddir)/include/config.h $CPPFLAGS"
 EXTRA_KCFLAGS="-include $PWD/include/config.h $EXTRA_KCFLAGS"