Whamcloud - gitweb
LU-15888 build: Debian dkms-debs requires ed and libkeyutils
[fs/lustre-release.git] / lnet / autoconf / lustre-lnet.m4
index 03cd3c4..90b7700 100644 (file)
@@ -5,7 +5,7 @@
 AC_DEFUN([LN_CONFIG_BACKOFF], [
 AC_MSG_CHECKING([whether to enable tunable backoff TCP support])
 AC_ARG_ENABLE([backoff],
-       AC_HELP_STRING([--disable-backoff],
+       AS_HELP_STRING([--disable-backoff],
                [disable socknal tunable backoff]),
        [], [enable_backoff="yes"])
 AC_MSG_RESULT([$enable_backoff])
@@ -53,7 +53,7 @@ AC_DEFUN([LN_CONFIG_DLC], [
 AC_DEFUN([LN_CONFIG_O2IB], [
 AC_MSG_CHECKING([whether to use Compat RDMA])
 AC_ARG_WITH([o2ib],
-       AC_HELP_STRING([--with-o2ib=[yes|no|<path>]],
+       AS_HELP_STRING([--with-o2ib=[yes|no|<path>]],
                [build o2iblnd against path]),
        [], [with_o2ib="yes"])
 
@@ -66,7 +66,9 @@ case $with_o2ib in
                                OFED_INFO="ofed_info"
                                LSPKG="rpm -ql"
                        ])
-                       O2IBPATHS=$(eval $OFED_INFO | egrep -w 'mlnx-ofed-kernel-dkms|mlnx-ofa_kernel-devel|compat-rdma-devel|kernel-ib-devel|ofa_kernel-devel' | xargs $LSPKG | grep '\(/openib\|/ofa_kernel/default\|/ofa_kernel\)$' | head -n1)
+                       O2IBPATHS=$(eval $OFED_INFO |
+                                   egrep -w 'mlnx-ofed-kernel-dkms|mlnx-ofa_kernel-devel|compat-rdma-devel|kernel-ib-devel|ofa_kernel-devel' |
+                                   xargs $LSPKG | grep -v 'ofa_kernel-' | grep rdma_cm.h | sed 's/\/include\/rdma\/rdma_cm.h//')
                        AS_IF([test -z "$O2IBPATHS"], [
                                AC_MSG_ERROR([
 You seem to have an OFED installed but have not installed it's devel package.
@@ -78,7 +80,7 @@ Instead, if you want to build Lustre for your kernel's built-in I/B stack rather
                                AC_MSG_ERROR([
 It appears that you have multiple OFED versions installed.
 If you still want to build Lustre for your OFED I/B stack, you need to install a single version with its devel headers RPM.
-Instead, if you want to build Lustre for your kernel's built-in I/B stack rather than your installed OFED stack, either remove the OFED package(s) or use --with-o2ib=no.
+Instead, if you want to build Lustre for your in-kernel I/B stack rather than your installed external OFED stack, either remove the OFED package(s) or use --with-o2ib=no.
                                             ])
                        ])
                        if test -e $O2IBPATHS/${LINUXRELEASE}; then
@@ -204,18 +206,20 @@ AS_IF([test $ENABLEO2IB = "no"], [
                ])
                # we know at this point that the found OFED source is good
                O2IB_SYMVER=""
-               if test $ENABLEO2IB = "withpath" -o "x$OFED" = "xyes" ; then
-                       if test -f $O2IBPATH/Module.symvers; then
-                               O2IB_SYMVER=$O2IBPATH/Module.symvers;
-                               break;
-                       fi
-                       if test -n "$O2IB_SYMVER"; then
-                               AC_MSG_NOTICE([adding $O2IB_SYMVER to Symbol Path])
-                               EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IB_SYMVER"
-                               AC_SUBST(EXTRA_SYMBOLS)
-                       else
-                               AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
-                       fi
+               if test -f $O2IBPATH/Module.symvers; then
+                       O2IB_SYMVER=$O2IBPATH/Module.symvers
+               elif test "x$SUSE_KERNEL" = "xyes"; then
+                       O2IB_SYMVER=$(find ${O2IBPATH}* -name Module.symvers)
+               elif test -f $LINUX_OBJ/Module.symvers; then
+                       # Debian symvers is in the arch tree
+                       O2IB_SYMVER=$LINUX_OBJ/Module.symvers
+               fi
+               if test -n "$O2IB_SYMVER"; then
+                       AC_MSG_NOTICE([adding $O2IB_SYMVER to Symbol Path])
+                       EXTRA_SYMBOLS="$EXTRA_SYMBOLS $O2IB_SYMVER"
+                       AC_SUBST(EXTRA_SYMBOLS)
+               else
+                       AC_MSG_ERROR([an external source tree was, either specified or detected, for o2iblnd however I could not find a $O2IBPATH/Module.symvers there])
                fi
 
                LB_CHECK_COMPILE([if Linux kernel has kthread_worker],
@@ -250,6 +254,7 @@ AC_SUBST(ENABLEO2IB)
 
 AS_IF([test $ENABLEO2IB != "no"], [
        EXTRA_CHECK_INCLUDE="$EXTRA_OFED_CONFIG $EXTRA_OFED_INCLUDE"
+       KBUILD_EXTRA_SYMBOLS="$KBUILD_EXTRA_SYMBOLS $O2IBPATH/Module.symvers"
 
        # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
        LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
@@ -569,6 +574,17 @@ AS_IF([test $ENABLEO2IB != "no"], [
                        [rdma_connect_locked is defined])
        ])
 
+       # ethtool_link_settings was added in Linux 4.6
+       LB_CHECK_COMPILE([if 'ethtool_link_settings' exists],
+       ethtool_link_settings, [
+               #include <linux/ethtool.h>
+       ],[
+               struct ethtool_link_ksettings cmd;
+       ],[
+               AC_DEFINE(HAVE_ETHTOOL_LINK_SETTINGS, 1,
+                       [ethtool_link_settings is defined])
+       ])
+
        EXTRA_CHECK_INCLUDE=""
        AC_DEFUN([LN_CONFIG_O2IB_SRC], [])
        AC_DEFUN([LN_CONFIG_O2IB_RESULTS], [])
@@ -583,7 +599,7 @@ AS_IF([test $ENABLEO2IB != "no"], [
 AC_DEFUN([LN_CONFIG_GNILND], [
 AC_MSG_CHECKING([whether to enable GNI lnd])
 AC_ARG_ENABLE([gni],
-       AC_HELP_STRING([--enable-gni],
+       AS_HELP_STRING([--enable-gni],
                [enable GNI lnd]),
        [], [enable_gni="no"])
 AC_MSG_RESULT([$enable_gni])
@@ -606,7 +622,7 @@ AS_IF([test "x$enable_gni" = xyes], [
        ],[
                GNILND="gnilnd"
        ],[
-               AC_MSG_ERROR([can't compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
+               AC_MSG_ERROR([cannot compile gnilnd with given GNICPPFLAGS: $GNICPPFLAGS])
        ])
        # at this point, we have gnilnd basic support,
        # now check for extra features
@@ -635,6 +651,25 @@ AC_SUBST(GNICPPFLAGS)
 AC_SUBST(GNILND)
 ]) # LN_CONFIG_GNILND
 
+# LN_CONFIG_STRSCPY_EXISTS
+#
+# If strscpy exists, prefer it over strlcpy
+#
+AC_DEFUN([LN_CONFIG_STRSCPY_EXISTS], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([kernel strscpy is available],
+strscpy_exists, [
+       #include <linux/string.h>
+],[
+       strscpy((char *)NULL, (const char *)NULL, 0);
+],[
+       AC_DEFINE(HAVE_STRSCPY, 1,
+               [kernel strscpy is available])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LN_CONFIG_STRSCPY_EXISTS
+
 # LN_CONFIG_SOCK_CREATE_KERN
 #
 # 4.x sock_create_kern() added a first parameter as 'struct net *'
@@ -861,6 +896,7 @@ AC_MSG_NOTICE([LNet kernel checks
 LN_CONFIG_BACKOFF
 LN_CONFIG_O2IB
 LN_CONFIG_GNILND
+LN_CONFIG_STRSCPY_EXISTS
 # 3.10
 LN_EXPORT_KMAP_TO_PAGE
 # 3.15
@@ -893,6 +929,78 @@ AC_DEFUN([LN_CONFIGURE], [
 AC_MSG_NOTICE([LNet core checks
 ==============================================================================])
 
+AC_ARG_WITH([cuda],
+       AS_HELP_STRING([--with-cuda=path],
+                       [Use a CUDA sources.]),
+       [LB_ARG_CANON_PATH([cuda], [CUDA_PATH])],
+       [CUDA_PATH=`ls -d1 /usr/src/nvidia-*/nvidia/ | tail -1`]
+)
+
+AC_ARG_WITH([gds],
+       AS_HELP_STRING([--with-gds=path],
+                       [Use a gds sources.]),
+       [LB_ARG_CANON_PATH([gds], [GDS_PATH])],
+       [GDS_PATH=`ls -d1 /usr/src/nvidia-fs* | tail -1`]
+)
+
+AS_IF([test -n "${CUDA_PATH}" && test -n "${GDS_PATH}"],[
+LB_CHECK_FILE([$CUDA_PATH/nv-p2p.h],
+       [
+       AC_MSG_RESULT([CUDA path is $CUDA_PATH])
+       AC_SUBST(CUDA_PATH)
+       ],
+       [AC_MSG_ERROR([CUDA sources don't found. nv-p2p.h don't exit])]
+)
+
+LB_CHECK_FILE([$GDS_PATH/nvfs-dma.h],
+       [
+       LB_CHECK_FILE([$GDS_PATH/config-host.h], [
+       AC_MSG_RESULT([GDS path is $GDS_PATH])
+       AC_SUBST(GDS_PATH)
+       AC_DEFINE(WITH_GDS, 1, "GDS build enabled")
+       ], [])
+       ],
+       [])
+],[
+       AC_MSG_WARN([CUDA or GDS sources not found. GDS support disabled])
+]
+)
+
+# lnet/utils/lnetconfig/liblnetconfig_netlink.c
+AS_IF([test "x$enable_dist" = xno], [
+       PKG_CHECK_MODULES(LIBNL3, [libnl-genl-3.0 >= 3.1])
+])
+
+AC_CHECK_LIB([nl-3], [nla_get_s32], [
+       AC_DEFINE(HAVE_NLA_GET_S32, 1,
+               [libnl3 supports nla_get_s32])
+       ], [
+])
+
+AC_CHECK_LIB([nl-3], [nla_get_s64], [
+       AC_DEFINE(HAVE_NLA_GET_S64, 1,
+               [libnl3 supports nla_get_s64])
+       ], [
+])
+
+#
+# LN_USR_NLMSGERR
+#
+AC_DEFUN([LN_USR_NLMSGERR], [
+AC_MSG_CHECKING([if 'enum nlmsgerr_attrs' exists])
+AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+       #include <linux/netlink.h>
+
+       int main(void) {
+               int x = (int)NLMSGERR_ATTR_MAX;
+               return x;
+       }
+])],[
+       AC_DEFINE(HAVE_USRSPC_NLMSGERR, 1,
+               ['enum nlmsgerr_attrs' exists])
+])
+]) # LN_USR_NLMGSERR
+
 # lnet/utils/portals.c
 AC_CHECK_HEADERS([netdb.h])
 AC_CHECK_FUNCS([gethostbyname])
@@ -904,7 +1012,7 @@ AC_CHECK_FUNCS([strnlen])
 
 AC_MSG_CHECKING([whether to enable 'efence' debugging support])
 AC_ARG_ENABLE(efence,
-       AC_HELP_STRING([--enable-efence],
+       AS_HELP_STRING([--enable-efence],
                [use efence library]),
        [], [enable_efence="no"])
 AC_MSG_RESULT([$enable_efence])
@@ -919,6 +1027,7 @@ AC_SUBST(LIBEFENCE)
 
 LN_CONFIG_DLC
 LN_USR_RDMA
+LN_USR_NLMSGERR
 ]) # LN_CONFIGURE
 
 #