Whamcloud - gitweb
Use the newer libsysio tags.
[fs/lustre-release.git] / lustre / portals / archdep.m4
index d2bd1a1..2f1d563 100644 (file)
@@ -14,26 +14,107 @@ AC_MSG_RESULT([$enable_inkernel])
 AM_CONDITIONAL(INKERNEL, test x$enable_inkernel = xyes)
 
 # -------- are we building against an external portals? -------
-AC_MSG_CHECKING([if Cray portals should be used])
+AC_MSG_CHECKING([for Cray portals])
 AC_ARG_WITH([cray-portals],
        AC_HELP_STRING([--with-cray-portals=path],
                       [path to 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
+                       CRAY_PORTALS_PATH=$with_cray_portals
+                       CRAY_PORTALS_INCLUDES="$with_cray_portals/include"
+                       CRAY_PORTALS_LIBS="$with_cray_portals"
+                fi
        ],[with_cray_portals=no])
 AC_SUBST(CRAY_PORTALS_PATH)
-AC_MSG_RESULT([$with_cray_portals])
+AC_MSG_RESULT([$CRAY_PORTALS_PATH])
 
+AC_MSG_CHECKING([for Cray portals includes])
+AC_ARG_WITH([cray-portals-includes],
+       AC_HELP_STRING([--with-cray-portals-includes=path],
+                      [path to cray portals includes]),
+       [
+               if test "$with_cray_portals_includes" != no; then
+                       CRAY_PORTALS_INCLUDES="$with_cray_portals_includes"
+                fi
+       ])
+AC_SUBST(CRAY_PORTALS_INCLUDES)
+AC_MSG_RESULT([$CRAY_PORTALS_INCLUDES])
+
+AC_MSG_CHECKING([for Cray portals libs])
+AC_ARG_WITH([cray-portals-libs],
+       AC_HELP_STRING([--with-cray-portals-libs=path],
+                      [path to cray portals libs]),
+       [
+               if test "$with_cray_portals_libs" != no; then
+                       CRAY_PORTALS_LIBS="$with_cray_portals_libs"
+                fi
+       ])
+AC_SUBST(CRAY_PORTALS_LIBS)
+AC_MSG_RESULT([$CRAY_PORTALS_LIBS])
+
+if test x$CRAY_PORTALS_INCLUDES != x ; then
+       if test ! -r $CRAY_PORTALS_INCLUDES/portals/api.h ; then
+               AC_MSG_ERROR([Cray portals headers were not found in $CRAY_PORTALS_INCLUDES.  Please check the paths passed to --with-cray-portals or --with-cray-portals-includes.])
+       fi
+fi
+if test x$CRAY_PORTALS_LIBS != x ; then
+       if test ! -r $CRAY_PORTALS_LIBS/libportals.a ; then
+               AC_MSG_ERROR([Cray portals libraries were not found in $CRAY_PORTALS_LIBS.  Please check the paths passed to --with-cray-portals or --with-cray-portals-libs.])
+       fi
+fi
+
+AC_MSG_CHECKING([whether to use Cray portals])
+if test x$CRAY_PORTALS_INCLUDES != x -a x$CRAY_PORTALS_LIBS != x ; then
+       with_cray_portals=yes
+       AC_DEFINE(CRAY_PORTALS, 1, [Building with Cray Portals])
+       CRAY_PORTALS_INCLUDES="-I$CRAY_PORTALS_INCLUDES"
+else
+       with_cray_portals=no
+fi
+AC_MSG_RESULT([$with_cray_portals])
 AM_CONDITIONAL(CRAY_PORTALS, test x$with_cray_portals != xno)
 
+# ----------------------------------------
+# some tests for catamount-like systems
+# ----------------------------------------
+AC_ARG_ENABLE([sysio_init],
+       AC_HELP_STRING([--disable-sysio-init],
+               [call sysio init functions when initializing liblustre]),
+       [],[enable_sysio_init=yes])
+AC_MSG_CHECKING([whether to initialize libsysio])
+AC_MSG_RESULT([$enable_sysio_init])
+if test x$enable_sysio_init != xno ; then
+       AC_DEFINE([INIT_SYSIO], 1, [call sysio init functions])
+fi
+
+AC_ARG_ENABLE([urandom],
+       AC_HELP_STRING([--disable-urandom],
+               [disable use of /dev/urandom for liblustre]),
+       [],[enable_urandom=yes])
+AC_MSG_CHECKING([whether to use /dev/urandom for liblustre])
+AC_MSG_RESULT([$enable_urandom])
+if test x$enable_urandom != xno ; then
+       AC_DEFINE([LIBLUSTRE_USE_URANDOM], 1, [use /dev/urandom for random data])
+fi
+
+# -------- check for -lcap and -lpthread ----
+if test x$enable_liblustre = xyes ; then
+       AC_CHECK_LIB([cap], [cap_get_proc],
+               [
+                       CAP_LIBS="-lcap"
+                       AC_DEFINE([HAVE_LIBCAP], 1, [use libcap])
+               ],
+               [CAP_LIBS=""])
+       AC_SUBST(CAP_LIBS)
+       AC_CHECK_LIB([pthread], [pthread_create],
+               [
+                       PTHREAD_LIBS="-lpthread"
+                       AC_DEFINE([HAVE_LIBPTHREAD], 1, [use libpthread])
+               ],
+               [PTHREAD_LIBS=""])
+       AC_SUBST(PTHREAD_LIBS)
+fi
+
 # -------- enable tests and utils? -------
 if test x$enable_tests = xno ; then
        AC_MSG_NOTICE([disabling tests])
@@ -60,12 +141,22 @@ if test x$enable_modules != xno ; then
                ln -s `pwd` $LINUX/fs/lustre
        fi
 
+       # -------- linux objects (for 2.6) --
+       AC_MSG_CHECKING([for Linux objects dir])
+       AC_ARG_WITH([linux-obj],
+               AC_HELP_STRING([--with-linux-obj=path],
+                               [set path to Linux objects dir (default=\$LINUX)]),
+               [LINUX_OBJ=$with_linux_obj],
+               [LINUX_OBJ=$LINUX])
+       AC_MSG_RESULT([$LINUX_OBJ])
+       AC_SUBST(LINUX_OBJ)
+
        # -------- check for .confg --------
        AC_ARG_WITH([linux-config],
                [AC_HELP_STRING([--with-linux-config=path],
-                               [set path to Linux .conf (default=\$LINUX/.config)])],
+                               [set path to Linux .conf (default=\$LINUX_OBJ/.config)])],
                [LINUX_CONFIG=$with_linux_config],
-               [LINUX_CONFIG=$LINUX/.config])
+               [LINUX_CONFIG=$LINUX_OBJ/.config])
        AC_SUBST(LINUX_CONFIG)
 
        AC_CHECK_FILE([/boot/kernel.h],
@@ -128,7 +219,7 @@ AM_CONDITIONAL(USE_QUILT, test x$QUILT != xno)
 
 # -------  Makeflags ------------------
 
-CPPFLAGS="$CRAY_PORTALS_INCLUDE $CRAY_PORTALS_COMMANDLINE -I\$(top_srcdir)/include -I\$(top_srcdir)/portals/include"
+CPPFLAGS="$CPPFLAGS $CRAY_PORTALS_INCLUDES -I\$(top_srcdir)/include -I\$(top_srcdir)/portals/include"
 
 # liblustre are all the same
 LLCPPFLAGS="-D__arch_lib__ -D_LARGEFILE64_SOURCE=1"
@@ -146,7 +237,7 @@ if test x$enable_ldiskfs = xyes ; then
        AC_DEFINE(CONFIG_LDISKFS_FS_SECURITY, 1, [enable fs security])
 fi
 
-EXTRA_KCFLAGS="-g $CRAY_PORTALS_INCLUDE $CRAY_PORTALS_COMMANDLINE -I$PWD/portals/include -I$PWD/include"
+EXTRA_KCFLAGS="-g $CRAY_PORTALS_INCLUDES -I$PWD/portals/include -I$PWD/include"
 
 # these are like AC_TRY_COMPILE, but try to build modules against the
 # kernel, inside the kernel-tests directory
@@ -160,7 +251,7 @@ _ACEOF
 AC_DEFUN([LUSTRE_MODULE_COMPILE_IFELSE],
 [m4_ifvaln([$1], [LUSTRE_MODULE_CONFTEST([$1])])dnl
 rm -f kernel-tests/conftest.o kernel-tests/conftest.mod.c kernel-tests/conftest.ko
-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])],
+AS_IF([AC_TRY_COMMAND(cp conftest.c kernel-tests && make [$2] CC="$CC" -f $PWD/kernel-tests/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM $MODULE_TARGET=$PWD/kernel-tests) >/dev/null && AC_TRY_COMMAND([$3])],
        [$4],
        [_AC_MSG_LOG_CONFTEST
 m4_ifvaln([$5],[$5])dnl])dnl
@@ -185,8 +276,8 @@ if test x$enable_modules != xno ; then
                [AC_MSG_ERROR([Kernel config could not be found.  If you are building from a kernel-source rpm consult README.kernel-source])])
 
        # ----------- make dep run? ------------------
-       AC_CHECK_FILES([$LINUX/include/linux/autoconf.h
-                       $LINUX/include/linux/version.h
+       AC_CHECK_FILES([$LINUX_OBJ/include/linux/autoconf.h
+                       $LINUX_OBJ/include/linux/version.h
                        $LINUX/include/linux/config.h],[],
                [AC_MSG_ERROR([Run make config in $LINUX.])])
 
@@ -197,7 +288,7 @@ if test x$enable_modules != xno ; then
        # tarred up the tree and ran make dep etc. in it, then
        # version.h gets overwritten with a standard linux one.
 
-       if grep rhconfig $LINUX/include/linux/version.h >/dev/null ; then
+       if grep rhconfig $LINUX_OBJ/include/linux/version.h >/dev/null ; then
                # This is a clean kernel-source tree, we need to
                # enable extensive workarounds to get this to build
                # modules
@@ -211,22 +302,9 @@ if test x$enable_modules != xno ; then
                EXTRA_KCFLAGS="-include $KERNEL_SOURCE_HEADER $EXTRA_KCFLAGS"
        fi
 
-       # --- check that we can build modules at all
-       AC_MSG_CHECKING([that modules can be built])
-       LUSTRE_MODULE_TRY_COMPILE([],[],
-               [
-                       AC_MSG_RESULT([yes])
-               ],[
-                       AC_MSG_RESULT([no])
-                       AC_MSG_WARN([Consult config.log for details.])
-                       AC_MSG_WARN([If you are trying to build with a kernel-source rpm, consult README.kernel-source])
-                       AC_MSG_ERROR([Kernel modules could not be built.])
-               ])
-
-       # ------------ LINUXRELEASE and moduledir ------------------
+       # ------------ external module support ---------------------
        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
@@ -244,6 +322,20 @@ if test x$enable_modules != xno ; then
                makerule="_dir_$PWD/kernel-tests"
        fi
        AC_SUBST(MODULE_TARGET)
+
+       # --- check that we can build modules at all
+       AC_MSG_CHECKING([that modules can be built])
+       LUSTRE_MODULE_TRY_COMPILE([],[],
+               [
+                       AC_MSG_RESULT([yes])
+               ],[
+                       AC_MSG_RESULT([no])
+                       AC_MSG_WARN([Consult config.log for details.])
+                       AC_MSG_WARN([If you are trying to build with a kernel-source rpm, consult README.kernel-source])
+                       AC_MSG_ERROR([Kernel modules could not be built.])
+               ])
+
+       # ------------ LINUXRELEASE and moduledir ------------------
        LINUXRELEASE=
        rm -f kernel-tests/conftest.i
        AC_MSG_CHECKING([for Linux release])
@@ -385,6 +477,7 @@ if test x$enable_modules != xno ; then
        AC_SUBST(GMCPPFLAGS)
        AC_SUBST(GMNAL)
 
+       if test $linux25 = 'no' ; then
        #### OpenIB 
        AC_MSG_CHECKING([if OpenIB kernel headers are present])
        OPENIBCPPFLAGS="-I$LINUX/drivers/infiniband/include -DIN_TREE_BUILD"
@@ -407,6 +500,65 @@ if test x$enable_modules != xno ; then
        EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
        AC_SUBST(OPENIBCPPFLAGS)
        AC_SUBST(OPENIBNAL)
+       fi
+
+       #### Infinicon IB
+       AC_MSG_CHECKING([if Infinicon IB kernel headers are present])
+       # for how the only infinicon ib build has headers in /usr/include/iba
+       IIBCPPFLAGS="-I/usr/include -DIN_TREE_BUILD"
+       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
+       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $IIBCPPFLAGS"
+       LUSTRE_MODULE_TRY_COMPILE(
+               [
+                       #include <linux/iba/ibt.h>
+               ],[
+                       IBT_INTERFACE_UNION interfaces;
+                       FSTATUS             rc;
+
+                       rc = IbtGetInterfaceByVersion(IBT_INTERFACE_VERSION_2,
+                                                     &interfaces);
+
+                       return rc == FSUCCESS ? 0 : 1;
+               ],[
+                       AC_MSG_RESULT([yes])
+                       IIBNAL="iibnal"
+               ],[
+                       AC_MSG_RESULT([no])
+                       IIBNAL=""
+                       IIBCPPFLAGS=""
+               ])
+       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
+       AC_SUBST(IIBCPPFLAGS)
+       AC_SUBST(IIBNAL)
+
+       #### Rapid Array
+       AC_MSG_CHECKING([if RapidArray kernel headers are present])
+       # placeholder
+       RACPPFLAGS="-I/tmp"
+       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
+       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
+       LUSTRE_MODULE_TRY_COMPILE(
+               [
+                       #include <linux/types.h>
+                       #include <rapl.h>
+               ],[
+                       RAP_RETURN          rc;
+                       RAP_PVOID           dev_handle;
+
+                       rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
+
+                       return rc == RAP_SUCCESS ? 0 : 1;
+               ],[
+                       AC_MSG_RESULT([yes])
+                       RANAL="ranal"
+               ],[
+                       AC_MSG_RESULT([no])
+                       RANAL=""
+                       RACPPFLAGS=""
+               ])
+       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
+       AC_SUBST(RACPPFLAGS)
+       AC_SUBST(RANAL)
 
        # ---------- Red Hat 2.4.18 has iobuf->dovary --------------
        # But other kernels don't
@@ -550,8 +702,8 @@ if test x$enable_modules != xno ; then
                        #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"
+                       #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24))
+                       #error "down_read_trylock broken before 2.4.24"
                        #endif
                        struct inode i;
                        return (char *)&i.i_alloc_sem - (char *)&i;
@@ -610,6 +762,41 @@ if test x$enable_modules != xno ; then
                        AC_MSG_RESULT([no])
                ])
 
+       # ------------ kallsyms (so software watchdogs produce useful stacks)
+       AC_MSG_CHECKING([if kallsyms is enabled])
+       LUSTRE_MODULE_TRY_COMPILE(
+               [
+                       #include <linux/config.h>
+               ],[
+                       #ifndef CONFIG_KALLSYMS
+                       #error CONFIG_KALLSYMS is not #defined
+                       #endif
+               ],[
+                       AC_MSG_RESULT([yes])
+               ],[
+                       AC_MSG_RESULT([no])
+                       if test "x$ARCH_UM" = "x" ; then
+                               AC_MSG_ERROR([Lustre requires that CONFIG_KALLSYMS is enabled in your kernel.])
+                       fi
+               ])
+
+       # ------------ check for our show_task patch
+       AC_MSG_CHECKING([if kernel exports show_task])
+       have_show_task=0
+       for file in ksyms sched ; do
+               if grep -q "EXPORT_SYMBOL(show_task)" \
+                        "$LINUX/kernel/$file.c" 2>/dev/null ; then
+                       have_show_task=1
+                       break
+               fi
+       done
+       if test x$have_show_task = x1 ; then
+               AC_DEFINE(HAVE_SHOW_TASK, 1, [show_task is exported])
+               AC_MSG_RESULT(yes)
+       else
+               AC_MSG_RESULT(no)
+       fi
+
        case $BACKINGFS in
                ext3)
                        # --- Check that ext3 and ext3 xattr are enabled in the kernel
@@ -667,15 +854,49 @@ 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")
+AM_CONDITIONAL(BUILD_IIBNAL, test x$IIBNAL = "xiibnal")
+AM_CONDITIONAL(BUILD_RANAL, test x$RANAL = "xranal")
+
+# portals/utils/portals.c
+AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h])
+AC_CHECK_FUNCS([gethostbyname socket connect])
+
+# portals/utils/debug.c
+AC_CHECK_HEADERS([linux/version.h])
+
+# include/liblustre.h
+AC_CHECK_HEADERS([asm/page.h sys/user.h stdint.h])
+
+# liblustre/llite_lib.h
+AC_CHECK_HEADERS([xtio.h file.h])
+
+# liblustre/dir.c
+AC_CHECK_HEADERS([linux/types.h sys/types.h linux/unistd.h unistd.h])
+
+# liblustre/lutil.c
+AC_CHECK_HEADERS([netinet/in.h arpa/inet.h catamount/data.h])
+AC_CHECK_FUNCS([inet_ntoa])
 
 CPPFLAGS="-include \$(top_builddir)/include/config.h $CPPFLAGS"
 EXTRA_KCFLAGS="-include $PWD/include/config.h $EXTRA_KCFLAGS"
 AC_SUBST(EXTRA_KCFLAGS)
 
-#echo "KCPPFLAGS: $KCPPFLAGS"
-#echo "KCFLAGS: $KCFLAGS"
-#echo "LLCPPFLAGS: $LLCPPFLAGS"
-#echo "LLCFLAGS: $LLCFLAGS"
-#echo "MOD_LINK: $MOD_LINK"
-#echo "CFLAGS: $CFLAGS"
-#echo "CPPFLAGS: $CPPFLAGS"
+echo "CPPFLAGS: $CPPFLAGS"
+echo "LLCPPFLAGS: $LLCPPFLAGS"
+echo "CFLAGS: $CFLAGS"
+echo "EXTRA_KCFLAGS: $EXTRA_KCFLAGS"
+echo "LLCFLAGS: $LLCFLAGS"
+
+ENABLE_INIT_SCRIPTS=0
+if test x$enable_utils = xyes ; then
+        AC_MSG_CHECKING([whether to install init scripts])
+        # our scripts only work on red hat systems
+        if test -f /etc/init.d/functions -a -f /etc/sysconfig/network ; then
+                ENABLE_INIT_SCRIPTS=1
+                AC_MSG_RESULT([yes])
+        else
+                AC_MSG_RESULT([no])
+        fi
+fi
+AM_CONDITIONAL(INIT_SCRIPTS, test x$ENABLE_INIT_SCRIPTS = "x1")
+AC_SUBST(ENABLE_INIT_SCRIPTS)