Whamcloud - gitweb
LU-3953 build: configure output improvments
[fs/lustre-release.git] / config / lustre-build-linux.m4
index 02e9d86..416cb66 100644 (file)
@@ -56,13 +56,16 @@ AC_DEFUN([LB_LINUX_UTSRELEASE], [
                              ${utsrelease})
                AS_IF([test -z "$UTS_RELEASE"], [
                        AC_MSG_RESULT([Not found])
-                       AC_MSG_ERROR([*** Cannot determine kernel version.])
+                       AC_MSG_ERROR([Cannot determine kernel version.])
                ])
        ], [
                AC_MSG_RESULT([Not found])
                AC_MSG_ERROR([
-       *** Cannot find UTS_RELEASE definition.
-       *** This is often provided by the kernel-devel package.])
+
+Cannot find UTS_RELEASE definition.
+
+This is often provided by the kernel-devel package.
+])
        ])
 
        AC_MSG_RESULT([${UTS_RELEASE}])
@@ -83,27 +86,17 @@ AC_DEFUN([LB_LINUX_RELEASE],
 [
 LB_LINUX_UTSRELEASE
 
-moduledir='$(CROSS_PATH)/lib/modules/$(LINUXRELEASE)/updates/kernel'
-AC_SUBST(moduledir)
-
-modulefsdir='$(moduledir)/fs/$(PACKAGE)'
-AC_SUBST(modulefsdir)
-
-modulenetdir='$(moduledir)/net/$(PACKAGE)'
-AC_SUBST(modulenetdir)
-
 # ------------ RELEASE --------------------------------
 AC_MSG_CHECKING([for Lustre release])
-AC_ARG_WITH([release],[
+AC_ARG_WITH([release],
        AC_HELP_STRING([--with-release=string],
                       [set the release string (default=$kvers_YYYYMMDDhhmm)]),
-       [RELEASE=$withval],
+       [RELEASE=$withval],[
        RELEASE=""
        if test -n "$DOWNSTREAM_RELEASE"; then
                RELEASE="${DOWNSTREAM_RELEASE}_"
        fi
-       RELEASE="$RELEASE`echo ${LINUXRELEASE} | tr '-' '_'`_$BUILDID"
-])
+       RELEASE="$RELEASE`echo ${LINUXRELEASE} | tr '-' '_'`_$BUILDID"])
 AC_MSG_RESULT($RELEASE)
 AC_SUBST(RELEASE)
 
@@ -121,6 +114,27 @@ AC_MSG_CHECKING([for RedHat kernel version])
                AC_MSG_RESULT([not found])
                LB_LINUX_CONFIG([SUSE_KERNEL],[SUSE_KERNEL="yes"],[])
        ])
+
+AC_MSG_CHECKING([for kernel module package directory])
+AC_ARG_WITH([kmp-moddir],
+       AC_HELP_STRING([--with-kmp-moddir=string],
+                      [set the kmod updates or extra directory]),
+       [KMP_MODDIR=$withval],[
+       AS_IF([test x$RHEL_KERNEL = xyes], [KMP_MODDIR="extra"],
+             [test x$SUSE_KERNEL = xyes], [KMP_MODDIR="updates"])])
+
+AC_MSG_RESULT($KMP_MODDIR)
+AC_SUBST(KMP_MODDIR)
+
+moduledir='$(CROSS_PATH)/lib/modules/$(LINUXRELEASE)/$(KMP_MODDIR)/kernel'
+AC_SUBST(moduledir)
+
+modulefsdir='$(moduledir)/fs/$(PACKAGE)'
+AC_SUBST(modulefsdir)
+
+modulenetdir='$(moduledir)/net/$(PACKAGE)'
+AC_SUBST(modulenetdir)
+
 ])
 
 # LB_ARG_REPLACE_PATH(PACKAGE, PATH)
@@ -223,7 +237,13 @@ AC_ARG_WITH([kernel-source-header],
 
 # ------------ .config exists ----------------
 LB_CHECK_FILE([$LINUX_CONFIG],[],
-       [AC_MSG_ERROR([Kernel config could not be found.  If you are building from a kernel-source rpm consult build/README.kernel-source])])
+       [AC_MSG_ERROR([
+
+Kernel config could not be found.
+
+If you are building from a kernel-source rpm consult build/README.kernel-source
+])
+])
 
 # ----------- make dep run? ------------------
 # at 2.6.19 # $LINUX/include/linux/config.h is removed
@@ -261,9 +281,13 @@ if grep rhconfig $LINUX_OBJ/include/$VERSION_HDIR/version.h >/dev/null ; then
        # modules
        LB_CHECK_FILE([$KERNEL_SOURCE_HEADER],
                [if test $KERNEL_SOURCE_HEADER = '/boot/kernel.h' ; then
-                       AC_MSG_WARN([Using /boot/kernel.h from RUNNING kernel.])
-                       AC_MSG_WARN([If this is not what you want, use --with-kernel-source-header.])
-                       AC_MSG_WARN([Consult build/README.kernel-source for details.])
+                       AC_MSG_WARN([
+
+Using /boot/kernel.h from RUNNING kernel.
+
+If this is not what you want, use --with-kernel-source-header.
+Consult build/README.kernel-source for details.
+])
                fi],
                [AC_MSG_ERROR([$KERNEL_SOURCE_HEADER not found.  Consult build/README.kernel-source for details.])])
        EXTRA_KCFLAGS="-include $KERNEL_SOURCE_HEADER $EXTRA_KCFLAGS"
@@ -279,9 +303,13 @@ LB_LINUX_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 build/README.kernel-source])
-       AC_MSG_ERROR([Kernel modules cannot be built.])
+       AC_MSG_ERROR([
+
+Kernel modules cannot be built. Consult config.log for details.
+
+If you are trying to build with a kernel-source rpm,
+consult build/README.kernel-source
+])
 ])
 
 LB_LINUX_RELEASE
@@ -308,26 +336,28 @@ AC_DEFUN([LB_LINUX_SYMVERFILE],
 #
 AC_DEFUN([LB_LINUX_CROSS],
        [AC_MSG_CHECKING([for cross compilation])
-CROSS_VARS=
-CROSS_PATH=
 AS_IF([test "x$cross_compiling" = xno], [AC_MSG_RESULT([no])],
        [case $host_vendor in
-               # The K1OM architecture is an extension of the x86 architecture.
-               # So, the $host_arch is x86_64.
-               k1om)
+               # The K1OM architecture is an extension of the x86 architecture
+               # and in MPSS 2.1 it's defined in $host_vendor. But in MPSS 3.x
+               # it's defined in $host_arch. So, try to support both case.
+               k1om | mpss)
                        AC_MSG_RESULT([Intel(R) Xeon Phi(TM)])
                        CC_TARGET_ARCH=`$CC -v 2>&1 | grep Target: | sed -e 's/Target: //'`
-                       if test $CC_TARGET_ARCH != x86_64-$host_vendor-linux ; then
+                       AC_SUBST(CC_TARGET_ARCH)
+                       if test \( $CC_TARGET_ARCH != x86_64-k1om-linux \
+                               -a $CC_TARGET_ARCH != k1om-mpss-linux \)
+                       then
                                AC_MSG_ERROR([Cross compiler not found in PATH.])
                        fi
-                       CROSS_VARS="ARCH=$host_vendor CROSS_COMPILE=x86_64-$host_vendor-linux-"
-                       CROSS_PATH=${CROSS_PATH:=/opt/intel/mic/lustre/device-k1om}
+                       CROSS_VARS="ARCH=k1om CROSS_COMPILE=${CC_TARGET_ARCH}-"
+                       CROSS_PATH="${CROSS_PATH:=/opt/lustre/${VERSION}/${CC_TARGET_ARCH}}"
                        CCAS=$CC
                        # need to produce special section for debuginfo extraction
                        LDFLAGS="${LDFLAGS} -Wl,--build-id"
                        EXTRA_KLDFLAGS="${EXTRA_KLDFLAGS} -Wl,--build-id"
                        if test x$enable_server != xno ; then
-                               AC_MSG_WARN([Disabling server (not supported for x86_64-$host_vendor-linux).])
+                               AC_MSG_WARN([Disabling server (not supported for k1om architecture).])
                                enable_server='no'
                        fi
                        ;;
@@ -367,8 +397,8 @@ $2
 AC_DEFUN([LB_LINUX_COMPILE_IFELSE],
 [m4_ifvaln([$1], [AC_LANG_CONFTEST([$1])])dnl
 rm -f build/conftest.o build/conftest.mod.c build/conftest.ko
-SUBARCH=$(echo $target_cpu | sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/')
-AS_IF([AC_TRY_COMMAND(cp conftest.c build && make -d [$2] ${LD:+"LD=$LD"} CC="$CC" -f $PWD/build/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG LINUXINCLUDE="$EXTRA_LNET_INCLUDE -I$LINUX/arch/$SUBARCH/include -I$LINUX/arch/$SUBARCH/include/generated -Iinclude -I$LINUX/include -Iinclude2 -I$LINUX/include/uapi -I$LINUX/include/generated -I$LINUX/arch/$SUBARCH/include/uapi -Iarch/$SUBARCH/include/generated/uapi -I$LINUX/include/uapi -Iinclude/generated/uapi -include $CONFIG_INCLUDE" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $CROSS_VARS $MODULE_TARGET=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
+SUBARCH=$(echo $target_cpu | sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/' -e 's/k1om/x86/')
+AS_IF([AC_TRY_COMMAND(cp conftest.c build && make -d [$2] ${LD:+"LD=$LD"} CC="$CC" -f $PWD/build/Makefile LUSTRE_LINUX_CONFIG=$LINUX_CONFIG LINUXINCLUDE="$EXTRA_OFED_INCLUDE -I$LINUX/arch/$SUBARCH/include -I$LINUX/arch/$SUBARCH/include/generated -Iinclude -I$LINUX/include -Iinclude2 -I$LINUX/include/uapi -I$LINUX/include/generated -I$LINUX/arch/$SUBARCH/include/uapi -Iarch/$SUBARCH/include/generated/uapi -I$LINUX/include/uapi -Iinclude/generated/uapi ${SPL_OBJ:+-include $SPL_OBJ/spl_config.h} ${ZFS_OBJ:+-include $ZFS_OBJ/zfs_config.h} ${SPL:+-I$SPL -I$SPL/include } ${ZFS:+-I$ZFS -I$ZFS/include} -include $CONFIG_INCLUDE" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $CROSS_VARS $MODULE_TARGET=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
        [$4],
        [_AC_MSG_LOG_CONFTEST
 m4_ifvaln([$5],[$5])dnl])
@@ -458,99 +488,6 @@ AC_DEFUN([LB_LINUX_TRY_MAKE],
        )]
 )
 
-#
-# LB_CONFIG_COMPAT_RDMA
-#
-AC_DEFUN([LB_CONFIG_COMPAT_RDMA],
-[AC_MSG_CHECKING([whether to use Compat RDMA])
-# 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
-       compatrdma_found=false
-       if $o2ib_found; then
-               if test \( -f ${O2IBPATH}/include/linux/compat-2.6.h \); then
-                       compatrdma_found=true
-                       AC_MSG_RESULT([yes])
-                       AC_DEFINE(HAVE_COMPAT_RDMA, 1, [compat rdma found])
-               else
-                       AC_MSG_RESULT([no])
-               fi
-       fi
-fi
-])
-
-#
-# 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])
-if test $ENABLEO2IB -eq 0; then
-       AC_MSG_RESULT([no])
-else
-       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 ! $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
-                       case $RHEL_KERNEL_VERSION in
-                               2.6.32-358*)
-                                       EXTRA_LNET_INCLUDE="$EXTRA_LNET_INCLUDE -DCONFIG_COMPAT_RHEL_6_4";;
-                       esac
-               fi
-               if test -n "$BACKPORT_INCLUDES"; then
-                       OFED_BACKPORT_PATH="$O2IBPATH/${BACKPORT_INCLUDES/*\/kernel_addons/kernel_addons}/"
-                       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
@@ -574,9 +511,10 @@ LB_LINUX_TRY_MAKE([
                  [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([])
+       AC_MSG_WARN([
+
+Kernel module loading support is highly recommended.
+])
 ])
 ])
 
@@ -592,24 +530,23 @@ LB_LINUX_SYMVERFILE
 
 
 LB_LINUX_CONFIG([MODULES],[],[
-       AC_MSG_ERROR([module support is required to build Lustre kernel modules.])
+       AC_MSG_ERROR([
+
+module support is required to build Lustre kernel modules.
+])
 ])
 
 LB_LINUX_CONFIG([MODVERSIONS])
 
 LB_LINUX_CONFIG([KALLSYMS],[],[
-       AC_MSG_ERROR([Lustre requires that CONFIG_KALLSYMS is enabled in your kernel.])
+       AC_MSG_ERROR([
+
+Lustre requires that CONFIG_KALLSYMS is enabled in your kernel.
+])
 ])
 
 # 2.6.28
 LC_MODULE_LOADING
-
-LB_CONFIG_COMPAT_RDMA
-
-# it's ugly to be doing anything with OFED outside of the lnet module, but
-# this has to be done here so that the backports path is set before all of
-# the LN_PROG_LINUX checks are done
-LB_CONFIG_OFED_BACKPORTS
 ])
 
 #
@@ -624,7 +561,7 @@ LB_CONFIG_OFED_BACKPORTS
 # or check
 AC_DEFUN([LB_CHECK_SYMBOL_EXPORT],
 [AC_MSG_CHECKING([if Linux was built with symbol $1 exported])
-grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX/$SYMVERFILE 2>/dev/null
+grep -q -E '[[[:space:]]]$1[[[:space:]]]' $LINUX_OBJ/$SYMVERFILE 2>/dev/null
 rc=$?
 if test $rc -ne 0; then
        export=0