+# LB_CONFIG_OFED_BACKPORTS
+#
+# include any OFED backport headers in all compile commands
+# NOTE: this does only include the backport paths, not the OFED headers
+# adding the OFED headers is done in the lnet portion
+AC_DEFUN([LB_CONFIG_OFED_BACKPORTS],
+[AC_MSG_CHECKING([whether to use any OFED backport headers])
+# set default
+AC_ARG_WITH([o2ib],
+ AC_HELP_STRING([--with-o2ib=path],
+ [build o2iblnd against path]),
+ [
+ case $with_o2ib in
+ yes) O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
+ ENABLEO2IB=2
+ ;;
+ no) ENABLEO2IB=0
+ ;;
+ *) O2IBPATHS=$with_o2ib
+ ENABLEO2IB=3
+ ;;
+ esac
+ ],[
+ O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
+ ENABLEO2IB=1
+ ])
+if test $ENABLEO2IB -eq 0; then
+ AC_MSG_RESULT([no])
+else
+ o2ib_found=false
+ for O2IBPATH in $O2IBPATHS; do
+ if test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
+ -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
+ -f ${O2IBPATH}/include/rdma/ib_verbs.h -a \
+ -f ${O2IBPATH}/include/rdma/ib_fmr_pool.h \); then
+ o2ib_found=true
+ break
+ fi
+ done
+ if ! $o2ib_found; then
+ AC_MSG_RESULT([no])
+ case $ENABLEO2IB in
+ 1) ;;
+ 2) AC_MSG_ERROR([kernel OpenIB gen2 headers not present]);;
+ 3) AC_MSG_ERROR([bad --with-o2ib path]);;
+ *) AC_MSG_ERROR([internal error]);;
+ esac
+ else
+ if test -f $O2IBPATH/config.mk; then
+ . $O2IBPATH/config.mk
+ elif test -f $O2IBPATH/ofed_patch.mk; then
+ . $O2IBPATH/ofed_patch.mk
+ fi
+ if test -n "$BACKPORT_INCLUDES"; then
+ OFED_BACKPORT_PATH=`echo $BACKPORT_INCLUDES | sed "s#.*/src/ofa_kernel/#$O2IBPATH/#"`
+ EXTRA_LNET_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_LNET_INCLUDE"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+fi
+])
+
+# LC_MODULE_LOADING
+# after 2.6.28 CONFIG_KMOD is removed, and only CONFIG_MODULES remains
+# so we test if request_module is implemented or not
+AC_DEFUN([LC_MODULE_LOADING],
+[AC_MSG_CHECKING([if kernel module loading is possible])
+LB_LINUX_TRY_MAKE([
+ #include <linux/kmod.h>
+],[
+ int myretval=ENOSYS ;
+ return myretval;
+],[
+ $makerule LUSTRE_KERNEL_TEST=conftest.i
+],[
+ grep request_module build/conftest.i | grep -v `grep "int myretval=" build/conftest.i | cut -d= -f2 | cut -d" " -f1` >/dev/null
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_MODULE_LOADING_SUPPORT, 1,
+ [kernel module loading is possible])
+],[
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN([])
+ AC_MSG_WARN([Kernel module loading support is highly recommended.])
+ AC_MSG_WARN([])
+])
+])
+
+# LC_MODULE_LOADING
+# after 2.6.28 CONFIG_KMOD is removed, and only CONFIG_MODULES remains
+# so we test if request_module is implemented or not
+AC_DEFUN([LC_MODULE_LOADING],
+[AC_MSG_CHECKING([if kernel module loading is possible])
+LB_LINUX_TRY_MAKE([
+ #include <linux/kmod.h>
+],[
+ int myretval=ENOSYS ;
+ return myretval;
+],[
+ $makerule LUSTRE_KERNEL_TEST=conftest.i
+],[
+ grep request_module build/conftest.i | grep -v `grep "int myretval=" build/conftest.i | cut -d= -f2 | cut -d" " -f1` >/dev/null
+],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_MODULE_LOADING_SUPPORT, 1,
+ [kernel module loading is possible])
+],[
+ AC_MSG_RESULT(no)
+ AC_MSG_WARN([])
+ AC_MSG_WARN([Kernel module loading support is highly recommended.])
+ AC_MSG_WARN([])
+])
+])
+
+#