Whamcloud - gitweb
LU-6018 conf: replace RHEL_KERNEL_VERSION with RHEL_RELEASE_NO
[fs/lustre-release.git] / lnet / autoconf / lustre-lnet.m4
index 4611dee..a3f712c 100644 (file)
 #
-# LP_CHECK_GCC_VERSION
+# LN_CONFIG_MAX_PAYLOAD
+#
+# configure maximum payload
+#
+AC_DEFUN([LN_CONFIG_MAX_PAYLOAD], [
+AC_MSG_CHECKING([for non-default maximum LNET payload])
+AC_ARG_WITH([max-payload-mb],
+       AC_HELP_STRING([--with-max-payload-mb=MBytes],
+               [set maximum lnet payload in MBytes]),
+       [
+               AC_MSG_RESULT([$with_max_payload_mb])
+               CONFIG_LNET_MAX_PAYLOAD_MB=$with_max_payload_mb
+               CONFIG_LNET_MAX_PAYLOAD="(($with_max_payload_mb)<<20)"
+       ], [
+               AC_MSG_RESULT([no])
+               CONFIG_LNET_MAX_PAYLOAD="LNET_MTU"
+       ])
+AC_DEFINE_UNQUOTED(CONFIG_LNET_MAX_PAYLOAD, $CONFIG_LNET_MAX_PAYLOAD,
+       [Max LNET payload])
+]) # LN_CONFIG_MAX_PAYLOAD
+
+#
+# LN_CHECK_GCC_VERSION
 #
 # Check compiler version
 #
-AC_DEFUN([LP_CHECK_GCC_VERSION],
-[AC_MSG_CHECKING([compiler version])
+AC_DEFUN([LN_CHECK_GCC_VERSION], [
+AC_MSG_CHECKING([compiler version])
 PTL_CC_VERSION=`$CC --version | awk '/^gcc/{print $ 3}'`
 PTL_MIN_CC_VERSION="3.2.2"
 v2n() {
        awk -F. '{printf "%d\n", (($ 1)*100+($ 2))*100+($ 3)}'
 }
 if test -z "$PTL_CC_VERSION" -o \
-        `echo $PTL_CC_VERSION | v2n` -ge `echo $PTL_MIN_CC_VERSION | v2n`; then
+       $(echo $PTL_CC_VERSION | v2n) -ge $(echo $PTL_MIN_CC_VERSION | v2n); then
        AC_MSG_RESULT([ok])
 else
        AC_MSG_RESULT([Buggy compiler found])
        AC_MSG_ERROR([Need gcc version >= $PTL_MIN_CC_VERSION])
 fi
-])
+]) # LN_CHECK_GCC_VERSION
 
 #
-# LP_CONFIG_ZEROCOPY
-#
-# check if zerocopy is available/wanted
+# LN_FUNC_DEV_GET_BY_NAME_2ARG
 #
-AC_DEFUN([LP_CONFIG_ZEROCOPY],
-[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)
-       else
-               AC_MSG_RESULT([no (no kernel support)])
-       fi
-fi
+AC_DEFUN([LN_FUNC_DEV_GET_BY_NAME_2ARG], [
+LB_CHECK_COMPILE([if 'dev_get_by_name' has two args],
+dev_get_by_name_2args, [
+       #include <linux/netdevice.h>
+],[
+       dev_get_by_name(NULL, NULL);
+],[
+       AC_DEFINE(HAVE_DEV_GET_BY_NAME_2ARG, 1,
+               [dev_get_by_name has 2 args])
 ])
+]) # LN_FUNC_DEV_GET_BY_NAME_2ARG
 
 #
-# LP_CONFIG_AFFINITY
+# LN_CONFIG_AFFINITY
 #
 # check if cpu affinity is available/wanted
 #
-AC_DEFUN([LP_CONFIG_AFFINITY],
-[AC_ARG_ENABLE([affinity],
+AC_DEFUN([LN_CONFIG_AFFINITY], [
+AC_MSG_CHECKING([whether to enable CPU affinity support])
+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
-       LB_LINUX_TRY_COMPILE([
+               [disable process/irq affinity]),
+       [], [enable_affinity="yes"])
+AC_MSG_RESULT([$enable_affinity])
+AS_IF([test "x$enable_affinity" = xyes], [
+       LB_CHECK_COMPILE([if Linux kernel has cpu affinity support],
+       set_cpus_allowed_ptr, [
                #include <linux/sched.h>
        ],[
-               struct task_struct t;
-               #ifdef CPU_ARRAY_SIZE
-               cpumask_t m;
+               struct task_struct *t;
+               #if HAVE_CPUMASK_T
+               cpumask_t     m;
                #else
                unsigned long m;
                #endif
-               set_cpus_allowed(&t, m);
+               set_cpus_allowed_ptr(t, &m);
        ],[
-               AC_DEFINE(CPU_AFFINITY, 1, [kernel has cpu affinity support])
+               AC_DEFINE(CPU_AFFINITY, 1,
+                       [kernel has cpu affinity support])
+       ])
+])
+]) # LN_CONFIG_AFFINITY
+
+#
+# LN_CONFIG_BACKOFF
+#
+# check if tunable tcp backoff is available/wanted
+#
+AC_DEFUN([LN_CONFIG_BACKOFF], [
+AC_MSG_CHECKING([whether to enable tunable backoff TCP support])
+AC_ARG_ENABLE([backoff],
+       AC_HELP_STRING([--disable-backoff],
+               [disable socknal tunable backoff]),
+       [], [enable_backoff="yes"])
+AC_MSG_RESULT([$enable_backoff])
+AS_IF([test "x$enable_backoff" = xyes], [
+       AC_MSG_CHECKING([if Linux kernel has tunable backoff TCP support])
+       AS_IF([grep -c TCP_BACKOFF $LINUX/include/linux/tcp.h >/dev/null], [
                AC_MSG_RESULT([yes])
-       ],[
-               AC_MSG_RESULT([no (no kernel support)])
+               AC_DEFINE(SOCKNAL_BACKOFF, 1, [use tunable backoff TCP])
+               AS_IF([grep rto_max $LINUX/include/linux/tcp.h | grep -q __u16 >/dev/null],
+                       [AC_DEFINE(SOCKNAL_BACKOFF_MS, 1,
+                               [tunable backoff TCP in ms])])
+       ], [
+               AC_MSG_RESULT([no])
        ])
-fi
+])
+]) # LN_CONFIG_BACKOFF
+
+#
+# LN_CONFIG_DLC
+#
+# Configure dlc if enabled
+#
+# if libyaml is set (IE libyaml installed) and enable_dlc = yes then build
+# dlc other wise (IE if libyaml is not set or enable_dlc = no) then don't
+# build dlc.
+#
+AC_DEFUN([LN_CONFIG_DLC], [
+       AC_CHECK_LIB([yaml],  [yaml_parser_initialize],[
+               LIBYAML="libyaml"],[
+               LIBYAML=""],[-lm])
+       AC_MSG_CHECKING([whether to enable dlc])
+       AC_ARG_ENABLE([dlc],
+               AC_HELP_STRING([--disable-dlc],
+                       [disable building dlc]),
+                       [], [enable_dlc="yes"])
+       USE_DLC=""
+       AS_IF([test "x$enable_dlc" = xyes],
+               [AS_IF([test "x$LIBYAML" = xlibyaml], [
+                       USE_DLC="yes"
+                       AC_MSG_RESULT([yes])
+               ], [
+                       AC_MSG_RESULT([no (libyaml not present)])
+               ])
+       ], [
+               AC_MSG_RESULT([no])
+       ])
+       AC_SUBST(USE_DLC)
 ])
 
 #
-# LP_CONFIG_QUADRICS
+# LN_CONFIG_QUADRICS
 #
 # check if quadrics support is in this kernel
 #
-AC_DEFUN([LP_CONFIG_QUADRICS],
-[AC_MSG_CHECKING([for QsNet sources])
+AC_DEFUN([LN_CONFIG_QUADRICS], [
+AC_MSG_CHECKING([for QsNet sources])
 AC_ARG_WITH([qsnet],
        AC_HELP_STRING([--with-qsnet=path],
-                      [set path to qsnet source (default=$LINUX)]),
-       [QSNET=$with_qsnet],
-       [QSNET=$LINUX])
+               [set path to qsnet source (default=$LINUX)]),
+       [QSNET=$with_qsnet], [QSNET=$LINUX])
 AC_MSG_RESULT([$QSNET])
 
+QSWLND=""
+QSWCPPFLAGS=""
 AC_MSG_CHECKING([if quadrics kernel headers are present])
-if test -d $QSNET/drivers/net/qsnet ; then
+AS_IF([test -d $QSNET/drivers/net/qsnet], [
        AC_MSG_RESULT([yes])
-       QSWNAL="qswnal"
+       QSWLND="qswlnd"
        AC_MSG_CHECKING([for multirail EKC])
-       if test -f $QSNET/include/elan/epcomms.h; then
+       AS_IF([test -f $QSNET/include/elan/epcomms.h], [
                AC_MSG_RESULT([supported])
+               QSNET=$(readlink --canonicalize $QSNET)
                QSWCPPFLAGS="-I$QSNET/include -DMULTIRAIL_EKC=1"
-       else
+       ], [
                AC_MSG_RESULT([not supported])
-               if test -d $QSNET/drivers/net/qsnet/include; then
-                       QSWCPPFLAGS="-I$QSNET/drivers/net/qsnet/include"
-               else
-                       QSWCPPFLAGS="-I$QSNET/include/linux"
-               fi
-       fi
-else
-       AC_MSG_RESULT([no])
-       QSWNAL=""
-       QSWCPPFLAGS=""
-fi
-AC_SUBST(QSWCPPFLAGS)
-AC_SUBST(QSWNAL)
-])
-
-#
-# LP_CONFIG_GM
-#
-# check if GM support is available
-#
-AC_DEFUN([LP_CONFIG_GM],
-[LB_ARG_LIBS_INCLUDES([Myrinet],[gm])
-if test x$gm_includes != x ; then
-       GMCPPFLAGS="-I$gm_includes"
-       if test -d "$gm/drivers" ; then
-               GMCPPFLAGS="$GMCPPFLAGS -I$gm/drivers -I$gm/drivers/linux/gm"
-       fi
-fi
-AC_SUBST(GMCPPFLAGS)
-
-if test x$gm_libs != x ; then
-       GMLIBS="-L$gm_libs"
-fi
-AC_SUBST(GMLIBS)
+               AC_MSG_ERROR([Need multirail EKC])
+       ])
 
-ENABLE_GM=0
-if test x$gm != x ; then
-       GMNAL="gmnal"
-       ENABLE_GM=1
-fi
-AC_SUBST(GMNAL)
-AC_SUBST(ENABLE_GM)
+       AS_IF([test x$QSNET = x$LINUX], [
+               LB_CHECK_CONFIG([QSNET], [], [
+                       LB_CHECK_CONFIG([QSNET_MODULE], [], [
+                               AC_MSG_WARN([QSNET is not enabled in this kernel; not building qswlnd.])
+                               QSWLND=""
+                               QSWCPPFLAGS=""
+                       ])
+               ])
+       ])
+], [
+       AC_MSG_RESULT([no])
 ])
+AC_SUBST(QSWLND)
+AC_SUBST(QSWCPPFLAGS)
+]) # LN_CONFIG_QUADRICS
 
 #
-# LP_CONFIG_OPENIB
+# LN_CONFIG_MX
 #
-# check for OpenIB in the kernel
-AC_DEFUN([LP_CONFIG_OPENIB],[
-AC_MSG_CHECKING([whether to enable OpenIB support])
+AC_DEFUN([LN_CONFIG_MX], [
 # set default
-OPENIBPATH="$LINUX/drivers/infiniband"
-AC_ARG_WITH([openib],
-       AC_HELP_STRING([--with-openib=path],
-                      [build openibnal against path]),
+MXPATH="/opt/mx"
+AC_MSG_CHECKING([whether to enable Myrinet MX support])
+AC_ARG_WITH([mx],
+       AC_HELP_STRING([--with-mx=path],
+               [build mxlnd against path]),
        [
-               case $with_openib in
-               yes)    ENABLEOPENIB=2
-                       ;;
-               no)     ENABLEOPENIB=0
-                       ;;
-               *)      OPENIBPATH="$with_openib"
-                       ENABLEOPENIB=3
-                       ;;
+               case $with_mx in
+               yes) ENABLEMX=2 ;;
+               no)  ENABLEMX=0 ;;
+               *)   ENABLEMX=3; MXPATH=$with_mx ;;
                esac
        ],[
-               ENABLEOPENIB=1
+               ENABLEMX=1
        ])
-if test $ENABLEOPENIB -eq 0; then
+AS_IF([test $ENABLEMX -eq 0], [
        AC_MSG_RESULT([disabled])
-elif test ! \( -f ${OPENIBPATH}/include/ts_ib_core.h -a \
-               -f ${OPENIBPATH}/include/ts_ib_cm.h -a\
-              -f ${OPENIBPATH}/include/ts_ib_sa_client.h \); then
+], [test ! \( -f ${MXPATH}/include/myriexpress.h -a \
+             -f ${MXPATH}/include/mx_kernel_api.h -a \
+             -f ${MXPATH}/include/mx_pin.h \)], [
        AC_MSG_RESULT([no])
-       case $ENABLEOPENIB in
+       case $ENABLEMX in
        1) ;;
-       2) AC_MSG_ERROR([kernel OpenIB headers not present]);;
-       3) AC_MSG_ERROR([bad --with-openib path]);;
-       *) AC_MSG_ERROR([internal error]);;
-       esac
-else
-       case $ENABLEOPENIB in
-       1|2) OPENIBCPPFLAGS="-I$OPENIBPATH/include -DIN_TREE_BUILD";;
-       3)   OPENIBCPPFLAGS="-I$OPENIBPATH/include";;
-       *)   AC_MSG_RESULT([no])
-            AC_MSG_ERROR([internal error]);;
+       2) AC_MSG_ERROR([Myrinet MX kernel headers not present]) ;;
+       3) AC_MSG_ERROR([bad --with-mx path]) ;;
+       *) AC_MSG_ERROR([internal error]) ;;
        esac
+], [
+       AC_MSG_RESULT([check])
+       MXPATH=$(readlink --canonicalize $MXPATH)
+       MXCPPFLAGS="-I$MXPATH/include"
+       MXLIBS="-L$MXPATH/lib"
        EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $OPENIBCPPFLAGS"
-       LB_LINUX_TRY_COMPILE([
-               #include <ts_ib_core.h>
-               #include <ts_ib_cm.h>
-               #include <ts_ib_sa_client.h>
+       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $MXCPPFLAGS"
+       LB_CHECK_COMPILE([if have Myrinet MX support],
+       myrinet_mx_support, [
+               #define MX_KERNEL 1
+               #include <mx_extensions.h>
+               #include <myriexpress.h>
        ],[
-                       struct ib_device_properties dev_props;
-               struct ib_cm_active_param   cm_active_params;
-               tTS_IB_CLIENT_QUERY_TID     tid;
-               int                         enum1 = IB_QP_ATTRIBUTE_STATE;
-               int                         enum2 = IB_ACCESS_LOCAL_WRITE;
-               int                         enum3 = IB_CQ_CALLBACK_INTERRUPT;
-               int                         enum4 = IB_CQ_PROVIDER_REARM;
+               mx_endpoint_t   end;
+               mx_status_t     status;
+               mx_request_t    request;
+               int             result;
+               mx_init();
+               mx_open_endpoint(MX_ANY_NIC, MX_ANY_ENDPOINT, 0, NULL, 0, &end);
+               mx_register_unexp_handler(end, (mx_unexp_handler_t) NULL, NULL);
+               mx_wait_any(end, MX_INFINITE, 0LL, 0LL, &status, &result);
+               mx_iconnect(end, 0LL, 0, 0, 0, NULL, &request);
                return 0;
        ],[
-               AC_MSG_RESULT([yes])
-               OPENIBNAL="openibnal"
+               MXLND="mxlnd"
        ],[
-               AC_MSG_RESULT([no])
-               case $ENABLEOPENIB in
+               case $ENABLEMX in
                1) ;;
-               2) AC_MSG_ERROR([can't compile with kernel OpenIB headers]);;
-               3) AC_MSG_ERROR([can't compile with OpenIB headers under $OPENIBPATH]);;
-               *) AC_MSG_ERROR([internal error]);;
+               2) AC_MSG_ERROR([can't compile with Myrinet MX kernel headers]) ;;
+               3) AC_MSG_ERROR([can't compile with Myrinet MX headers under $MXPATH]) ;;
+               *) AC_MSG_ERROR([internal error]) ;;
                esac
-               OPENIBNAL=""
-               OPENIBCPPFLAGS=""
+               MXCPPFLAGS=""
+               MXLIBS=""
+               MXLND=""
        ])
        EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
-fi
-AC_SUBST(OPENIBCPPFLAGS)
-AC_SUBST(OPENIBNAL)
 ])
+AC_SUBST(MXCPPFLAGS)
+AC_SUBST(MXLIBS)
+AC_SUBST(MXLND)
+]) # LN_CONFIG_MX
 
 #
-# LP_CONFIG_IIB
-#
-# check for infinicon infiniband support
-#
-#
-# LP_CONFIG_IIB
+# LN_CONFIG_O2IB
 #
-# check for infinicon infiniband support
-#
-AC_DEFUN([LP_CONFIG_IIB],[
-AC_MSG_CHECKING([whether to enable Infinicon support])
-# set default
-IIBPATH="/usr/include"
-AC_ARG_WITH([iib],
-       AC_HELP_STRING([--with-iib=path],
-                      [build iibnal against path]),
+AC_DEFUN([LN_CONFIG_O2IB], [
+AC_MSG_CHECKING([whether to use Compat RDMA])
+AC_ARG_WITH([o2ib],
+       AC_HELP_STRING([--with-o2ib=path],
+               [build o2iblnd against path]),
        [
-               case $with_iib in
-               yes)    ENABLEIIB=2
+               case $with_o2ib in
+               yes)    O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
+                       ENABLEO2IB=2
                        ;;
-               no)     ENABLEIIB=0
+               no)     ENABLEO2IB=0
                        ;;
-               *)      IIBPATH="${with_iib}/include"
-                       ENABLEIIB=3
+               *)      O2IBPATHS=$with_o2ib
+                       ENABLEO2IB=3
                        ;;
                esac
        ],[
-               ENABLEIIB=1
+               O2IBPATHS="$LINUX $LINUX/drivers/infiniband"
+               ENABLEO2IB=1
        ])
-if test $ENABLEIIB -eq 0; then
-       AC_MSG_RESULT([disabled])
-elif test ! \( -f ${IIBPATH}/linux/iba/ibt.h \); then
+AS_IF([test $ENABLEO2IB -eq 0], [
        AC_MSG_RESULT([no])
-       case $ENABLEIIB in
-       1) ;;
-       2) AC_MSG_ERROR([default Infinicon headers not present]);;
-       3) AC_MSG_ERROR([bad --with-iib path]);;
-       *) AC_MSG_ERROR([internal error]);;
-       esac
-else
-       IIBCPPFLAGS="-I$IIBPATH"
-       if test $IIBPATH != "/usr/include"; then
-               # we need /usr/include come what may
-               IIBCPPFLAGS="$IIBCPPFLAGS -I/usr/include"
-        fi
-       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $IIBCPPFLAGS"
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/iba/ibt.h>
-       ],[
-               IBT_INTERFACE_UNION interfaces;
-               FSTATUS             rc;
-
-                rc = IbtGetInterfaceByVersion(IBT_INTERFACE_VERSION_2,
-                                              &interfaces);
+], [
+       o2ib_found=false
+       for O2IBPATH in $O2IBPATHS; do
+               AS_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 \)], [
+                       AS_IF([test \( -d ${O2IBPATH}/kernel_patches -a \
+                                  -f ${O2IBPATH}/Makefile \)], [
+                               AC_MSG_RESULT([no])
+                               AC_MSG_ERROR([
 
-               return rc == FSUCCESS ? 0 : 1;
-       ],[
-               AC_MSG_RESULT([yes])
-               IIBNAL="iibnal"
-       ],[
+you appear to be trying to use the OFED distribution's source
+directory (${O2IBPATH}) rather than the "development/headers"
+directory which is likely in ${O2IBPATH%-*}
+])
+                       ])
+                       o2ib_found=true
+                       break
+               ])
+       done
+       if ! $o2ib_found; then
                AC_MSG_RESULT([no])
-               case $ENABLEIIB in
-               1) ;;
-               2) AC_MSG_ERROR([can't compile with default Infinicon headers]);;
-               3) AC_MSG_ERROR([can't compile with Infinicon headers under $IIBPATH]);;
-               *) AC_MSG_ERROR([internal error]);;
+               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
-               IIBNAL=""
-               IIBCPPFLAGS=""
-       ])
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
-fi
-AC_SUBST(IIBCPPFLAGS)
-AC_SUBST(IIBNAL)
-])
+       else
+               compatrdma_found=false
+               if test -f ${O2IBPATH}/include/linux/compat-2.6.h; then
+                       AC_MSG_RESULT([yes])
+                       compatrdma_found=true
+                       AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
+               else
+                       AC_MSG_RESULT([no])
+               fi
+               if ! $compatrdma_found; then
+                       if test -f "$O2IBPATH/config.mk"; then
+                               . "$O2IBPATH/config.mk"
+                       elif test -f "$O2IBPATH/ofed_patch.mk"; then
+                               . "$O2IBPATH/ofed_patch.mk"
+                       fi
+               else
+                       if test "x$RHEL_KERNEL" = xyes; then
+                               case "$RHEL_RELEASE_NO" in
+                                       64)
+                                               EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4" ;;
+                                       65)
+                                               EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_RHEL_6_4 -DCONFIG_COMPAT_RHEL_6_5" ;;
+                               esac
+                       elif test "x$SUSE_KERNEL" = xyes; then
+                               SP=$(grep PATCHLEVEL /etc/SuSE-release | sed -e 's/.*= *//')
+                               EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -DCONFIG_COMPAT_SLES_11_$SP"
+                       fi
+               fi
+               AC_MSG_CHECKING([whether to use any OFED backport headers])
+               if test -n "$BACKPORT_INCLUDES"; then
+                       AC_MSG_RESULT([yes])
+                       OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
+                       EXTRA_OFED_INCLUDE="-I$OFED_BACKPORT_PATH $EXTRA_OFED_INCLUDE"
+               else
+                       AC_MSG_RESULT([no])
+               fi
 
-#
-# LP_CONFIG_VIB
-#
-# check for Voltaire infiniband support
-#
-AC_DEFUN([LP_CONFIG_VIB],
-[AC_MSG_CHECKING([whether to enable Voltaire IB support])
-VIBPATH=""
-AC_ARG_WITH([vib],
-       AC_HELP_STRING([--with-vib=path],
-                      [build vibnal against path]),
-       [
-               case $with_vib in
-               no)     AC_MSG_RESULT([no]);;
-               *)      VIBPATH="${with_vib}/src/nvigor/ib-code"
-                       if test -d "$with_vib" -a -d "$VIBPATH"; then
-                               AC_MSG_RESULT([yes])
+               O2IBLND=""
+               O2IBPATH=$(readlink --canonicalize $O2IBPATH)
+               EXTRA_OFED_INCLUDE="$EXTRA_OFED_INCLUDE -I$O2IBPATH/include"
+               LB_CHECK_COMPILE([whether to enable OpenIB gen2 support],
+               openib_gen2_support, [
+                       #include <linux/version.h>
+                       #include <linux/pci.h>
+                       #include <linux/gfp.h>
+                       #ifdef HAVE_COMPAT_RDMA
+                       #include <linux/compat-2.6.h>
+                       #endif
+                       #include <rdma/rdma_cm.h>
+                       #include <rdma/ib_cm.h>
+                       #include <rdma/ib_verbs.h>
+                       #include <rdma/ib_fmr_pool.h>
+               ],[
+                       struct rdma_cm_id      *cm_idi __attribute__ ((unused));
+                       struct rdma_conn_param  conn_param __attribute__ ((unused));
+                       struct ib_device_attr   device_attr __attribute__ ((unused));
+                       struct ib_qp_attr       qp_attr __attribute__ ((unused));
+                       struct ib_pool_fmr      pool_fmr __attribute__ ((unused));
+                       enum   ib_cm_rej_reason rej_reason __attribute__ ((unused));
+                       rdma_destroy_id(NULL);
+               ],[
+                       O2IBLND="o2iblnd"
+               ],[
+                       case $ENABLEO2IB in
+                       1) ;;
+                       2) AC_MSG_ERROR([can't compile with kernel OpenIB gen2 headers]) ;;
+                       3) AC_MSG_ERROR([can't compile with OpenIB gen2 headers under $O2IBPATH]) ;;
+                       *) AC_MSG_ERROR([internal error]) ;;
+                       esac
+               ])
+               # we know at this point that the found OFED source is good
+               O2IB_SYMVER=""
+               if test $ENABLEO2IB -eq 3 ; then
+                       # OFED default rpm not handle sles10 Modules.symvers name
+                       for name in Module.symvers Modules.symvers; do
+                               if test -f $O2IBPATH/$name; then
+                                       O2IB_SYMVER=$name;
+                                       break;
+                               fi
+                       done
+                       if test -n "$O2IB_SYMVER"; then
+                               AC_MSG_NOTICE([adding $O2IBPATH/$O2IB_SYMVER to $PWD/$SYMVERFILE])
+                               # strip out the existing symbols versions first
+                               if test -f $PWD/$SYMVERFILE; then
+                               egrep -v $(echo $(awk '{ print $2 }' $O2IBPATH/$O2IB_SYMVER) | tr ' ' '|') $PWD/$SYMVERFILE > $PWD/$SYMVERFILE.old
+                               else
+                                       touch $PWD/$SYMVERFILE.old
+                               fi
+                               cat $PWD/$SYMVERFILE.old $O2IBPATH/$O2IB_SYMVER > $PWD/$SYMVERFILE
+                               rm $PWD/$SYMVERFILE.old
                        else
-                               AC_MSG_RESULT([no])
-                               AC_MSG_ERROR([No directory $VIBPATH])
-                        fi;;
-               esac
-       ],[
-               AC_MSG_RESULT([no])
-       ])
-if test -z "$VIBPATH"; then
-       VIBNAL=""
-else
-       VIBCPPFLAGS="-I${VIBPATH}/include -I${VIBPATH}/cm"
-       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/list.h>
-               #include <asm/byteorder.h>
-               #ifdef __BIG_ENDIAN
-               # define CPU_BE 1
-                # define CPU_LE 0
-               #endif
-               #ifdef __LITTLE_ENDIAN
-               # define CPU_BE 0
-               # define CPU_LE 1
-               #endif
-               #include <vverbs.h>
-               #include <ib-cm.h>
-               #include <ibat.h>
-       ],[
-               vv_hca_h_t       kib_hca;
-               vv_return_t      vvrc;
-               cm_cep_handle_t  cep;
-               ibat_arp_data_t  arp_data;
-               ibat_stat_t      ibatrc;
-
-               vvrc = vv_hca_open("ANY_HCA", NULL, &kib_hca);
-               cep = cm_create_cep(cm_cep_transp_rc);
-               ibatrc = ibat_get_ib_data((uint32_t)0, (uint32_t)0,
-                                          ibat_paths_primary, &arp_data,
-                                         (ibat_get_ib_data_reply_fn_t)NULL,
-                                          NULL, 0);
-               return 0;
-       ],[
-               VIBNAL="vibnal"
-       ],[
-               AC_MSG_ERROR([can't compile vibnal with given path])
-       ])
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
-fi
-if test -n "$VIBNAL"; then
-       AC_MSG_CHECKING([if Voltaire still uses void * sg addresses])
-       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $VIBCPPFLAGS"
-       LB_LINUX_TRY_COMPILE([
-               #include <linux/list.h>
-               #include <asm/byteorder.h>
-               #ifdef __BIG_ENDIAN
-               # define CPU_BE 1
-                # define CPU_LE 0
-               #endif
-               #ifdef __LITTLE_ENDIAN
-               # define CPU_BE 0
-               # define CPU_LE 1
-               #endif
-               #include <vverbs.h>
-               #include <ib-cm.h>
-               #include <ibat.h>
-       ],[
-               vv_scatgat_t  sg;
+                               AC_MSG_ERROR([an external source tree was specified for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
+                       fi
+               fi
 
-               return &sg.v_address[3] == NULL;
+               LN_CONFIG_OFED_SPEC
+       fi
+])
+AC_SUBST(EXTRA_OFED_INCLUDE)
+AC_SUBST(O2IBLND)
+
+# In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
+AS_IF([test $ENABLEO2IB -ne 0], [
+       LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
+       rdma_create_id_4args, [
+               #ifdef HAVE_COMPAT_RDMA
+               #include <linux/compat-2.6.h>
+               #endif
+               #include <rdma/rdma_cm.h>
        ],[
-               AC_MSG_RESULT([yes])
-               VIBCPPFLAGS="$VIBCPPFLAGS -DIBNAL_VOIDSTAR_SGADDR=1"
+               rdma_create_id(NULL, NULL, 0, 0);
        ],[
-               AC_MSG_RESULT([no])
+               AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
+                       [rdma_create_id wants 4 args])
        ])
-       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
-fi
-AC_SUBST(VIBCPPFLAGS)
-AC_SUBST(VIBNAL)
 ])
+]) # LN_CONFIG_O2IB
 
 #
-# LP_CONFIG_RANAL
+# LN_CONFIG_RALND
 #
-# check whether to use the RapidArray nal
+# check whether to use the RapidArray lnd
 #
-AC_DEFUN([LP_CONFIG_RANAL],
-[#### Rapid Array
-AC_MSG_CHECKING([if RapidArray kernel headers are present])
-# placeholder
+AC_DEFUN([LN_CONFIG_RALND], [
+RALND=""
 RACPPFLAGS="-I${LINUX}/drivers/xd1/include"
 EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
 EXTRA_KCFLAGS="$EXTRA_KCFLAGS $RACPPFLAGS"
-LB_LINUX_TRY_COMPILE([
+LB_CHECK_COMPILE([if 'RapidArray' kernel headers are present],
+RapkGetDeviceByIndex, [
        #include <linux/types.h>
        #include <rapl.h>
 ],[
-        RAP_RETURN          rc;
-       RAP_PVOID           dev_handle;
-
-        rc = RapkGetDeviceByIndex(0, NULL, &dev_handle);
-
+       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"
+       RALND="ralnd"
 ],[
-       AC_MSG_RESULT([no])
-       RANAL=""
        RACPPFLAGS=""
 ])
 EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
 AC_SUBST(RACPPFLAGS)
-AC_SUBST(RANAL)
-])
+AC_SUBST(RALND)
+]) # LN_CONFIG_RALND
 
 #
-# LP_STRUCT_PAGE_LIST
+# LN_CONFIG_GNILND
 #
-# 2.6.4 no longer has page->list
+# check whether to use the Gemini Network Interface lnd
 #
-AC_DEFUN([LP_STRUCT_PAGE_LIST],
-[AC_MSG_CHECKING([if struct page has a list field])
-LB_LINUX_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_DEFUN([LN_CONFIG_GNILND], [
+AC_MSG_CHECKING([whether to enable GNI lnd])
+AC_ARG_ENABLE([gni],
+       AC_HELP_STRING([--enable-gni],
+               [enable GNI lnd]),
+       [], [enable_gni="no"])
+AC_MSG_RESULT([$enable_gni])
+
+AS_IF([test "x$enable_gni" = xyes], [
+       # GNICPPFLAGS was set in spec file
+       EXTRA_KCFLAGS_save="$EXTRA_KCFLAGS"
+       EXTRA_KCFLAGS="$EXTRA_KCFLAGS $GNICPPFLAGS"
+       LB_CHECK_COMPILE([if GNI kernel headers are present],
+       GNI_header, [
+               #include <linux/types.h>
+               #include <gni_pub.h>
+       ],[
+               gni_cdm_handle_t kgni_domain;
+               gni_return_t     rc;
+               int              rrc;
+               rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
+               rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
+               return rrc;
+       ],[
+               GNILND="gnilnd"
+       ],[
+               AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
+       ])
+       # at this point, we have gnilnd basic support,
+       # now check for extra features
+       LB_CHECK_COMPILE([to use RCA in gnilnd],
+       RCA_gnilnd, [
+               #include <linux/types.h>
+               #include <gni_pub.h>
+               #include <krca_lib.h>
+       ],[
+               gni_cdm_handle_t kgni_domain;
+               gni_return_t     rc;
+               krca_ticket_t    ticket = KRCA_NULL_TICKET;
+               int              rrc;
+               __u32            nid = 0, nic_addr;
+               rc = gni_cdm_create(0, 1, 1, 0, &kgni_domain);
+               rrc = (rc == GNI_RC_SUCCESS) ? 0 : 1;
+               rrc += krca_nid_to_nicaddrs(nid, 1, &nic_addr);
+               rrc += krca_register(&ticket, RCA_MAKE_SERVICE_INDEX(RCA_IO_CLASS, 9), 99, 0);
+               return rrc;
+       ],[
+               GNICPPFLAGS="$GNICPPFLAGS -DGNILND_USE_RCA=1"
+               GNILNDRCA="gnilndrca"
+       ])
+       EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
 ])
+AC_SUBST(GNICPPFLAGS)
+AC_SUBST(GNILNDRCA)
+AC_SUBST(GNILND)
+]) # LN_CONFIG_GNILND
 
 #
-# LP_STRUCT_SIGHAND
+# LN_CONFIG_USERSPACE
 #
-# red hat 2.4 adds sighand to struct task_struct
+# This is defined but empty because it is called from
+# build/autconf/lustre-build.m4 which is shared by all branches.
 #
-AC_DEFUN([LP_STRUCT_SIGHAND],
-[AC_MSG_CHECKING([if task_struct has a sighand field])
-LB_LINUX_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_DEFUN([LN_CONFIG_USERSPACE], [
+]) # LN_CONFIG_USERSPACE
 
 #
-# LP_FUNC_CPU_ONLINE
+# LN_CONFIG_TCP_SENDPAGE
 #
-# cpu_online is different in rh 2.4, vanilla 2.4, and 2.6
+# 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
 #
-AC_DEFUN([LP_FUNC_CPU_ONLINE],
-[AC_MSG_CHECKING([if kernel defines cpu_online()])
-LB_LINUX_TRY_COMPILE([
-       #include <linux/sched.h>
+AC_DEFUN([LN_CONFIG_TCP_SENDPAGE], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if 'tcp_sendpage' first parameter is socket],
+tcp_sendpage_socket, [
+       #include <linux/net.h>
+       #include <net/tcp.h>
 ],[
-       cpu_online(0);
+       tcp_sendpage((struct socket*)0, NULL, 0, 0, 0);
 ],[
-       AC_MSG_RESULT([yes])
-       AC_DEFINE(HAVE_CPU_ONLINE, 1, [cpu_online found])
-],[
-       AC_MSG_RESULT([no])
-])
+       AC_DEFINE(HAVE_TCP_SENDPAGE_USE_SOCKET, 1,
+               [tcp_sendpage use socket as first parameter])
 ])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LN_CONFIG_TCP_SENDPAGE
 
 #
-# LP_TYPE_CPUMASK_T
+# LN_CONFIG_SK_DATA_READY
 #
-# same goes for cpumask_t
+# 2.6.36 tcp_sendpage() first parameter is 'struct sock' instead of 'struct socket'.
 #
-AC_DEFUN([LP_TYPE_CPUMASK_T],
-[AC_MSG_CHECKING([if kernel defines cpumask_t])
-LB_LINUX_TRY_COMPILE([
-       #include <linux/sched.h>
+AC_DEFUN([LN_CONFIG_SK_DATA_READY], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if 'sk_data_ready' takes only one argument],
+sk_data_ready, [
+       #include <linux/net.h>
+       #include <net/sock.h>
 ],[
-       return sizeof (cpumask_t);
+       ((struct sock *)0)->sk_data_ready(NULL);
 ],[
-       AC_MSG_RESULT([yes])
-       AC_DEFINE(HAVE_CPUMASK_T, 1, [cpumask_t found])
-],[
-       AC_MSG_RESULT([no])
-])
-])
-
-#
-# LP_FUNC_SHOW_TASK
-#
-# we export show_task(), but not all kernels have it (yet)
-#
-AC_DEFUN([LP_FUNC_SHOW_TASK],
-[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
+       AC_DEFINE(HAVE_SK_DATA_READY_ONE_ARG, 1,
+               [sk_data_ready uses only one argument])
 ])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LN_CONFIG_SK_DATA_READY
 
 #
-# LP_PROG_LINUX
+# LN_PROG_LINUX
 #
-# Portals linux kernel checks
+# LNet linux kernel checks
 #
-AC_DEFUN([LP_PROG_LINUX],
-[LP_CHECK_GCC_VERSION
-
-LP_CONFIG_ZEROCOPY
-LP_CONFIG_AFFINITY
-LP_CONFIG_QUADRICS
-LP_CONFIG_GM
-LP_CONFIG_OPENIB
-LP_CONFIG_VIB
-LP_CONFIG_IIB
-LP_CONFIG_RANAL
+AC_DEFUN([LN_PROG_LINUX], [
+AC_MSG_NOTICE([LNet kernel checks
+==============================================================================])
 
-LP_STRUCT_PAGE_LIST
-LP_STRUCT_SIGHAND
-LP_FUNC_CPU_ONLINE
-LP_TYPE_CPUMASK_T
-LP_FUNC_SHOW_TASK
-])
-
-#
-# LP_PROG_DARWIN
-#
-# Darwin checks
-#
-AC_DEFUN([LP_PROG_DARWIN],
-[LB_DARWIN_CHECK_FUNCS([get_preemption_level])
-])
+LN_FUNC_DEV_GET_BY_NAME_2ARG
+LN_CONFIG_AFFINITY
+LN_CONFIG_BACKOFF
+LN_CONFIG_QUADRICS
+LN_CONFIG_O2IB
+LN_CONFIG_RALND
+LN_CONFIG_GNILND
+LN_CONFIG_MX
+# 2.6.36
+LN_CONFIG_TCP_SENDPAGE
+# 3.15
+LN_CONFIG_SK_DATA_READY
+]) # LN_PROG_LINUX
 
 #
-# LP_PATH_DEFAULTS
+# LN_PATH_DEFAULTS
 #
 # default paths for installed files
 #
-AC_DEFUN([LP_PATH_DEFAULTS],
-[
-])
+AC_DEFUN([LN_PATH_DEFAULTS], [
+]) # LN_PATH_DEFAULTS
 
 #
-# LP_CONFIGURE
+# LN_CONFIGURE
 #
 # other configure checks
 #
-AC_DEFUN([LP_CONFIGURE],
-[# portals/utils/portals.c
-AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h])
+AC_DEFUN([LN_CONFIGURE], [
+AC_MSG_NOTICE([LNet core checks
+==============================================================================])
+
+# lnet/utils/portals.c
+AC_CHECK_HEADERS([netdb.h netinet/tcp.h asm/types.h endian.h sys/ioctl.h])
 AC_CHECK_FUNCS([gethostbyname socket connect])
 
-# portals/utils/debug.c
+# lnet/utils/debug.c
 AC_CHECK_HEADERS([linux/version.h])
 
-AC_CHECK_TYPE([spinlock_t],
-       [AC_DEFINE(HAVE_SPINLOCK_T, 1, [spinlock_t is defined])],
-       [],
-       [#include <linux/spinlock.h>])
-
-# portals/utils/wirecheck.c
+# lnet/utils/wirecheck.c
 AC_CHECK_FUNCS([strnlen])
 
 # --------  Check for required packages  --------------
 
-LIBS_save="$LIBS"
-LIBS="-lncurses $LIBS"
-AC_CHECK_LIB([readline],[readline],[
-       LIBREADLINE="-lreadline -lncurses"
-       AC_DEFINE(HAVE_LIBREADLINE, 1, [readline library is available])
-],[
-       LIBREADLINE=""
+#
+# LC_CONFIG_READLINE
+#
+# Build with readline
+#
+AC_MSG_CHECKING([whether to enable readline support])
+AC_ARG_ENABLE(readline,
+       AC_HELP_STRING([--disable-readline],
+               [disable readline support]),
+       [], [enable_readline="yes"])
+AC_MSG_RESULT([$enable_readline])
+
+# -------- check for readline if enabled ----
+
+LIBREADLINE=""
+AS_IF([test "x$enable_readline" = xyes], [
+       AC_CHECK_LIB([readline], [readline], [
+               LIBREADLINE="-lreadline"
+               AC_DEFINE(HAVE_LIBREADLINE, 1,
+                       [readline library is available])])
 ])
-LIBS="$LIBS_save"
 AC_SUBST(LIBREADLINE)
 
-AC_MSG_CHECKING([if efence debugging support is requested])
-AC_ARG_ENABLE(efence,
-       AC_HELP_STRING([--enable-efence],
-                       [use efence library]),
-       [],[enable_efence='no'])
-AC_MSG_RESULT([$enable_efence])
-if test "$enable_efence" = "yes" ; then
-       LIBEFENCE="-lefence"
-       AC_DEFINE(HAVE_LIBEFENCE, 1, [libefence support is requested])
-else 
-       LIBEFENCE=""
-fi
-AC_SUBST(LIBEFENCE)
-
 # -------- enable acceptor libwrap (TCP wrappers) support? -------
+
 AC_MSG_CHECKING([if libwrap support is requested])
 AC_ARG_ENABLE([libwrap],
        AC_HELP_STRING([--enable-libwrap], [use TCP wrappers]),
        [case "${enableval}" in
-               yes) enable_libwrap=yes ;;
-               no) enable_libwrap=no ;;
+               yes) enable_libwrap="yes" ;;
+               no)  enable_libwrap="no" ;;
                *) AC_MSG_ERROR(bad value ${enableval} for --enable-libwrap) ;;
-       esac],[enable_libwrap=no])
+       esac], [enable_libwrap="no"])
 AC_MSG_RESULT([$enable_libwrap])
-if test x$enable_libwrap = xyes ; then
+LIBWRAP=""
+AS_IF([test "x$enable_libwrap" = xyes], [
        LIBWRAP="-lwrap"
-       AC_DEFINE(HAVE_LIBWRAP, 1, [libwrap support is requested])
-else
-       LIBWRAP=""
-fi
+       AC_DEFINE(HAVE_LIBWRAP, 1,
+               [libwrap support is requested])
+])
 AC_SUBST(LIBWRAP)
 
-# ----------------------------------------
-# 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
-])
+LN_CONFIG_MAX_PAYLOAD
+LN_CONFIG_DLC
+]) # LN_CONFIGURE
 
 #
-# LP_CONDITIONALS
+# LN_CONDITIONALS
 #
-# AM_CONDITOINAL defines for portals
+# AM_CONDITOINAL defines for lnet
 #
-AC_DEFUN([LP_CONDITIONALS],
-[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_VIBNAL, test x$VIBNAL = "xvibnal")
-AM_CONDITIONAL(BUILD_RANAL, test x$RANAL = "xranal")
-])
+AC_DEFUN([LN_CONDITIONALS], [
+AM_CONDITIONAL(BUILD_QSWLND,     test x$QSWLND = "xqswlnd")
+AM_CONDITIONAL(BUILD_MXLND,      test x$MXLND = "xmxlnd")
+AM_CONDITIONAL(BUILD_O2IBLND,    test x$O2IBLND = "xo2iblnd")
+AM_CONDITIONAL(BUILD_RALND,      test x$RALND = "xralnd")
+AM_CONDITIONAL(BUILD_GNILND,     test x$GNILND = "xgnilnd")
+AM_CONDITIONAL(BUILD_GNILND_RCA, test x$GNILNDRCA = "xgnilndrca")
+AM_CONDITIONAL(BUILD_DLC,        test x$USE_DLC = "xyes")
+]) # LN_CONDITIONALS
 
 #
-# LP_CONFIG_FILES
+# LN_CONFIG_FILES
 #
 # files that should be generated with AC_OUTPUT
 #
-AC_DEFUN([LP_CONFIG_FILES],
-[AC_CONFIG_FILES([
-portals/Kernelenv
-portals/Makefile
-portals/autoMakefile
-portals/autoconf/Makefile
-portals/doc/Makefile
-portals/include/Makefile
-portals/include/libcfs/Makefile
-portals/include/libcfs/linux/Makefile
-portals/include/portals/Makefile
-portals/include/portals/linux/Makefile
-portals/knals/Makefile
-portals/knals/autoMakefile
-portals/knals/gmnal/Makefile
-portals/knals/gmnal/autoMakefile
-portals/knals/openibnal/Makefile
-portals/knals/openibnal/autoMakefile
-portals/knals/iibnal/Makefile
-portals/knals/iibnal/autoMakefile
-portals/knals/vibnal/Makefile
-portals/knals/vibnal/autoMakefile
-portals/knals/lonal/Makefile
-portals/knals/lonal/autoMakefile
-portals/knals/qswnal/Makefile
-portals/knals/qswnal/autoMakefile
-portals/knals/ranal/Makefile
-portals/knals/ranal/autoMakefile
-portals/knals/socknal/Makefile
-portals/knals/socknal/autoMakefile
-portals/libcfs/Makefile
-portals/libcfs/autoMakefile
-portals/libcfs/linux/Makefile
-portals/portals/Makefile
-portals/portals/autoMakefile
-portals/router/Makefile
-portals/router/autoMakefile
-portals/tests/Makefile
-portals/tests/autoMakefile
-portals/unals/Makefile
-portals/utils/Makefile
-])
-case $lb_target_os in
-       darwin)
-               AC_CONFIG_FILES([
-portals/include/libcfs/darwin/Makefile
-portals/include/portals/darwin/Makefile
-portals/libcfs/darwin/Makefile
-])
-               ;;
-esac
+AC_DEFUN([LN_CONFIG_FILES], [
+AC_CONFIG_FILES([
+lnet/Makefile
+lnet/autoMakefile
+lnet/autoconf/Makefile
+lnet/doc/Makefile
+lnet/include/Makefile
+lnet/include/lnet/Makefile
+lnet/klnds/Makefile
+lnet/klnds/autoMakefile
+lnet/klnds/mxlnd/autoMakefile
+lnet/klnds/mxlnd/Makefile
+lnet/klnds/o2iblnd/Makefile
+lnet/klnds/o2iblnd/autoMakefile
+lnet/klnds/qswlnd/Makefile
+lnet/klnds/qswlnd/autoMakefile
+lnet/klnds/ralnd/Makefile
+lnet/klnds/ralnd/autoMakefile
+lnet/klnds/gnilnd/Makefile
+lnet/klnds/gnilnd/autoMakefile
+lnet/klnds/socklnd/Makefile
+lnet/klnds/socklnd/autoMakefile
+lnet/lnet/Makefile
+lnet/lnet/autoMakefile
+lnet/selftest/Makefile
+lnet/selftest/autoMakefile
+lnet/utils/Makefile
+lnet/utils/lnetconfig/Makefile
 ])
+]) # LN_CONFIG_FILES