Whamcloud - gitweb
b=16098
[fs/lustre-release.git] / build / autoconf / lustre-build-linux.m4
index f26375d..9ce393e 100644 (file)
@@ -98,6 +98,36 @@ AC_MSG_CHECKING([for Lustre release])
 RELEASE="`echo ${LINUXRELEASE} | tr '-' '_'`_`date +%Y%m%d%H%M`"
 AC_MSG_RESULT($RELEASE)
 AC_SUBST(RELEASE)
+
+# check is redhat/suse kernels
+AC_MSG_CHECKING([that RedHat kernel])
+LB_LINUX_TRY_COMPILE([
+               #include <linux/version.h>
+       ],[
+               #ifndef RHEL_MAJOR
+               #error "not redhat kernel"
+               #endif
+       ],[
+               RHEL_KENEL="yes"
+               AC_MSG_RESULT([yes])
+       ],[
+               AC_MSG_RESULT([no])
+])
+
+AC_MSG_CHECKING([that SuSe kernel])
+LB_LINUX_TRY_COMPILE([
+               #include <linux/version.h>
+       ],[
+               #ifndef SLE_VERSION_CODE
+               #error "not sles kernel"
+               #endif
+       ],[
+               SUSE_KERNEL="yes"
+               AC_MSG_RESULT([yes])
+       ],[
+               AC_MSG_RESULT([no])
+])
+
 ])
 
 #
@@ -200,6 +230,20 @@ LB_LINUX_TRY_COMPILE([],[],[
 LB_LINUX_RELEASE
 ]) # end of LB_LINUX_PATH
 
+# LB_LINUX_SYMVERFILE
+# SLES 9 uses a different name for this file - unsure about vanilla kernels
+# around this version, but it matters for servers only.
+AC_DEFUN([LB_LINUX_SYMVERFILE],
+       [AC_MSG_CHECKING([name of module symbol version file])
+       if grep -q Modules.symvers $LINUX/scripts/Makefile.modpost ; then
+               SYMVERFILE=Modules.symvers
+       else
+               SYMVERFILE=Module.symvers
+       fi
+       AC_MSG_RESULT($SYMVERFILE)
+       AC_SUBST(SYMVERFILE)
+])
+
 #
 #
 # LB_LINUX_MODPOST
@@ -209,9 +253,9 @@ LB_LINUX_RELEASE
 AC_DEFUN([LB_LINUX_MODPOST],
 [
 # Find the modpost utility
-AC_CHECK_FILE([$LINUX_OBJ/scripts/mod/modpost],
+LB_CHECK_FILE([$LINUX_OBJ/scripts/mod/modpost],
        [MODPOST=$LINUX_OBJ/scripts/mod/modpost],
-       [AC_CHECK_FILE([$LINUX_OBJ/scripts/modpost],
+       [LB_CHECK_FILE([$LINUX_OBJ/scripts/modpost],
                [MODPOST=$LINUX_OBJ/scripts/modpost],
                AC_MSG_ERROR([modpost not found.])
        )]
@@ -415,6 +459,12 @@ fi
 #
 AC_DEFUN([LB_PROG_LINUX],
 [LB_LINUX_PATH
+LB_LINUX_ARCH
+LB_LINUX_SYMVERFILE
+
+if test $LINUX_ARCH == "powerpc64"; then
+       CFLAGS="$CFLAGS -m64"
+fi
 
 LB_LINUX_CONFIG([MODULES],[],[
        AC_MSG_ERROR([module support is required to build Lustre kernel modules.])
@@ -464,7 +514,7 @@ AC_DEFUN([LB_LINUX_CONDITIONALS],
 # or check 
 AC_DEFUN([LB_CHECK_SYMBOL_EXPORT],
 [AC_MSG_CHECKING([if Linux was built with symbol $1 is exported])
-grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX/Module.symvers 2>/dev/null
+grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX/$SYMVERFILE 2>/dev/null
 rc=$?
 if test $rc -ne 0; then
     export=0