Whamcloud - gitweb
LU-3441 build: Allow for native KNC compilation 58/6558/2
authorChris Horn <hornc@cray.com>
Wed, 5 Jun 2013 19:52:50 +0000 (14:52 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 10 Jul 2013 02:40:56 +0000 (02:40 +0000)
The cross-compilation support (LU-2752) assumes that K1OM will
only be built in a cross-compile environment. To allow for
native compilation we only perform the cross compilation check
if $cross_compile is defined to yes.

Signed-off-by: Chris Horn <hornc@cray.com>
Change-Id: I93fd9c2f7d29dd9567cfcd93013df09271d65dc2
Reviewed-on: http://review.whamcloud.com/6558
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Minh Diep <minh.diep@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
config/lustre-build-linux.m4
libsysio/configure.in

index 59609da..95d20e2 100644 (file)
@@ -295,30 +295,32 @@ AC_DEFUN([LB_LINUX_CROSS],
        [AC_MSG_CHECKING([for cross compilation])
 CROSS_VARS=
 CROSS_PATH=
-case $target_vendor in
-       # The K1OM architecture is an extension of the x86 architecture.
-       # So, the $target_arch is x86_64.
-       k1om)
-               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-$target_vendor-linux ; then
-                       AC_MSG_ERROR([Cross compiler not found in PATH.])
-               fi
-               CROSS_VARS="ARCH=$target_vendor CROSS_COMPILE=x86_64-$target_vendor-linux-"
-               CROSS_PATH=${CROSS_PATH:=/opt/intel/mic/lustre/device-k1om}
-               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 = xyes ; then
-                       AC_MSG_WARN([Disabling server (not supported for x86_64-$target_vendor-linux).])
-                       enable_server='no'
-               fi
-               ;;
-       *)
-               AC_MSG_RESULT([no])
-               ;;
-esac
+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)
+                       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_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}
+                       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 = xyes ; then
+                               AC_MSG_WARN([Disabling server (not supported for x86_64-$host_vendor-linux).])
+                               enable_server='no'
+                       fi
+                       ;;
+               *)
+                       AC_MSG_RESULT([yes, but no changes])
+                       ;;
+       esac
+       ])
 AC_SUBST(CROSS_VARS)
 AC_SUBST(CROSS_PATH)
 ])
index 80013b6..890b7ee 100644 (file)
@@ -27,19 +27,21 @@ AC_HEADER_STDC
 AC_HEADER_STAT
 AC_HEADER_TIME
 
-case $target_vendor in
-       # The K1OM architecture is an extension of the x86 architecture.
-       # So, the $target_arch is x86_64.
-       k1om)
-               CC_TARGET_ARCH=`$CC -v 2>&1 | grep Target: | sed -e 's/Target: //'`
-               if test $CC_TARGET_ARCH != x86_64-$target_vendor-linux ; then
-                       AC_MSG_ERROR([Cross compiler not found in PATH.])
-               fi
-               CCAS=$CC
-               ;;
-       *)
-               ;;
-esac
+AS_IF([test "x$cross_compiling" = xyes],
+       [case $host_vendor in
+               # The K1OM architecture is an extension of the x86 architecture.
+               # So, the $host_arch is x86_64.
+               k1om)
+                       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_MSG_ERROR([Cross compiler not found in PATH.])
+                       fi
+                       CCAS=$CC
+                       ;;
+               *)
+                       ;;
+       esac]
+)
 
 if test ${target_cpu} == "powerpc64"; then
        AC_MSG_WARN([set compiler with -m64])