all-am: modules
modules: $(DEP) all-sources
- $(MAKE) CC="$(CC)" -C $(LINUX_OBJ) \
+ $(MAKE) CC="$(CC)" $(CROSS_VARS) -C $(LINUX_OBJ) \
-f $(PWD)/build/Makefile LUSTRE_LINUX_CONFIG=$(LINUX_CONFIG) \
- LINUXINCLUDE='$(EXTRA_LNET_INCLUDE) -I$$(srctree)/arch/$$(SRCARCH)/include -I$$(srctree)/arch/$$(SRCARCH)/include/generated -Iinclude $$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) -include $(CONFIG_INCLUDE)' \
+ LINUXINCLUDE='$(EXTRA_LNET_INCLUDE) -I$$(srctree)/arch/$$(SRCARCH)/include -I$$(srctree)/arch/$$(SRCARCH)/include/generated -Iinclude $$(if $$(KBUILD_SRC),-Iinclude2 -I$$(srctree)/include) -include $(CONFIG_INCLUDE)' \
$(MODULE_TARGET)=$(PWD) -o tmp_include_depends -o scripts -o \
include/config/MARKER $@
endif # LINUX
fi
# this is needed before we can build modules
+LB_LINUX_CROSS
LB_LINUX_VERSION
# --- check that we can build modules at all
AC_SUBST(SYMVERFILE)
])
+#
+# LB_LINUX_CROSS
+#
+# check for cross compilation
+#
+AC_DEFUN([LB_LINUX_CROSS],
+ [AC_MSG_CHECKING([for cross compilation])
+CROSS_VARS=
+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-"
+ CCAS=$CC
+ 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
+AC_SUBST(CROSS_VARS)
+])
+
# these are like AC_TRY_COMPILE, but try to build modules against the
# kernel, inside the build directory
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
-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/`echo $target_cpu|sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include -I$LINUX/arch/`echo $target_cpu|sed -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include/generated -I$LINUX_OBJ/include -I$LINUX/include -I$LINUX_OBJ/include2 -include $CONFIG_INCLUDE" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $MODULE_TARGET=$PWD/build) >/dev/null && AC_TRY_COMMAND([$3])],
+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/`echo $target_cpu|sed -e 's/powerpc64/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include -I$LINUX/arch/`echo $target_cpu|sed -e 's/ppc.*/powerpc/' -e 's/x86_64/x86/' -e 's/i.86/x86/'`/include/generated -I$LINUX_OBJ/include -I$LINUX/include -I$LINUX_OBJ/include2 -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])
[AC_MSG_CHECKING([Linux kernel architecture])
AS_IF([rm -f $PWD/build/arch
make -s --no-print-directory echoarch -f $PWD/build/Makefile \
- LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -C $LINUX \
+ LUSTRE_LINUX_CONFIG=$LINUX_CONFIG -C $LINUX $CROSS_VARS \
ARCHFILE=$PWD/build/arch && LINUX_ARCH=`cat $PWD/build/arch`],
[AC_MSG_RESULT([$LINUX_ARCH])],
[AC_MSG_ERROR([Could not determine the kernel architecture.])])
#
AC_DEFUN([LB_PROG_CC],
[AC_PROG_RANLIB
+AC_CHECK_TOOL(LD, ld, [no])
+AC_CHECK_TOOL(OBJDUMP, objdump, [no])
+AC_CHECK_TOOL(STRIP, strip, [no])
# --------- unsigned long long sane? -------
AC_CHECK_SIZEOF(unsigned long long, 0)
AM_CONDITIONAL(USES_DPKG, test x$uses_dpkg = "xyes")
AM_CONDITIONAL(ARCH_x86, test x$target_cpu = "xx86_64" -o x$target_cpu = "xi686")
+# Sanity check for PCLMULQDQ instruction availability
+# PCLMULQDQ instruction is a new instruction available beginning with
+# the all new Core processor family based on the 32nm microarchitecture
+# codename Westmere. So, $target_cpu = x86_64 should have this instruction
+# except MIC microarchitecture (k1om).
+AM_CONDITIONAL(HAVE_PCLMULQDQ, test x$target_cpu = "xx86_64" -a x$target_vendor != "xk1om")
+if test x$target_cpu = "xx86_64" -a x$target_vendor != "xk1om" ; then
+ AC_DEFINE(HAVE_PCLMULQDQ, 1, [have PCLMULQDQ instruction])
+fi
+
# this lets lustre cancel libsysio, per-branch or if liblustre is
# disabled
if test "x$LIBSYSIO_SUBDIR" = xlibsysio ; then
posix/rbtree.c user-crypto.c posix/posix-crc32.c \
posix/posix-adler.c heap.c
-if ARCH_x86
+if HAVE_PCLMULQDQ
libcfs_a_SOURCES += user-crc32pclmul.c crc32-pclmul_asm.S
endif
static int crc32, adler32;
-#ifdef CONFIG_X86
+#ifdef HAVE_PCLMULQDQ
static int crc32pclmul;
#endif
crc32 = cfs_crypto_crc32_register();
adler32 = cfs_crypto_adler32_register();
-#ifdef CONFIG_X86
+#ifdef HAVE_PCLMULQDQ
crc32pclmul = cfs_crypto_crc32_pclmul_register();
#endif
if (adler32 == 0)
cfs_crypto_adler32_unregister();
-#ifdef CONFIG_X86
+#ifdef HAVE_PCLMULQDQ
if (crc32pclmul == 0)
cfs_crypto_crc32_pclmul_unregister();
#endif
return 0;
}
-#if (defined i386) || (defined __amd64__)
+#ifdef HAVE_PCLMULQDQ
static int crc32_pclmul_wrapper(void *ctx, const unsigned char *p,
unsigned int len)
{
.start = start_generic,
.final = final_generic,
.fini = NULL},
-#if (defined i386) || (defined __amd64__)
+#ifdef HAVE_PCLMULQDQ
{.ha_id = CFS_HASH_ALG_CRC32,
.ha_ctx_size = sizeof(unsigned int),
.ha_priority = 100,
AC_CANONICAL_SYSTEM
case "$host_os" in
- aix*)
- ;;
- linux*)
- ;;
- *)
- AC_MSG_WARN('***' ${host_os}: Unsupported OS target)
- ;;
+ aix*)
+ ;;
+ linux*)
+ ;;
+ *)
+ AC_MSG_WARN('***' ${host_os}: Unsupported OS target)
+ ;;
esac
AM_INIT_AUTOMAKE([subdir-objects 1.9 tar-ustar])
AM_MAINTAINER_MODE([enable])
AC_PROG_CC
AM_PROG_CC_C_O
-
AC_PROG_RANLIB
+AC_CHECK_TOOL(CC, gcc, [no])
+AC_CHECK_TOOL(LD, ld, [no])
+AC_CHECK_TOOL(AR, ar, [no])
+AC_CHECK_TOOL(OBJDUMP, objdump, [no])
+AC_CHECK_TOOL(STRIP, strip, [no])
AC_PROG_MAKE_SET
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
+
if test ${target_cpu} == "powerpc64"; then
AC_MSG_WARN([set compiler with -m64])
CC="$CC -m64"
AC_OUTPUT(
Makefile
tests/Makefile)
-
if LIBLUSTRE
LIB_SELFTEST = $(top_builddir)/libcfs/libcfs/libcfs.a $(top_builddir)/lnet/lnet/liblnet.a $(top_builddir)/lnet/selftest/libselftest.a
+
+export AR
+export RANLIB
+
liblst.a : $(LIB_SELFTEST) $(LND_LIBS)
sh $(srcdir)/genlib.sh "$(LIBS)" "$(LND_LIBS)" "$(PTHREAD_LIBS)"
#set -xv
set -e
-AR=/usr/bin/ar
-LD=/usr/bin/ld
-RANLIB=/usr/bin/ranlib
-
CWD=`pwd`
LIBS=$1
liblustre_a_SOURCES = llite_lib.c super.c namei.c rw.c file.c dir.c \
llite_lib.h llite_cl.c
+export CC
+export LDFLAGS
+export AR
+export RANLIB
+
liblustre.a : $(LUSTRE_LIBS) $(LND_LIBS) $(LNET_LIBS) $(SYSIO_LIBS)
sh $(srcdir)/genlib.sh "$(SYSIO)" "$(LIBS)" "$(LND_LIBS)" "$(PTHREAD_LIBS)" "$(CAP_LIBS)" "$(ZLIB)"
# FIXME: How to do this cleanly use makefile?
#
-AR=/usr/bin/ar
# see http://osdir.com/ml/gmane.comp.gnu.binutils.bugs/2006-01/msg00016.php
ppc64_CPU=`uname -p`
if [ "x${ppc64_CPU}" = "xppc64" ]; then
- LD="gcc -m64"
+ LD="$CC -m64"
else
- LD="gcc"
+ LD=$CC
fi
-RANLIB=/usr/bin/ranlib
CWD=`pwd`
# if libsysio is already in our LIBS we don't need to link against it here
if $(echo "$LIBS" | grep -v -- "-lsysio" >/dev/null) ; then
- build_sysio_obj_list $SYSIO/lib/libsysio.a
+ build_sysio_obj_list $SYSIO/lib/libsysio.a
fi
# create static lib lustre
rm -f $CWD/liblustre.so
OS=`uname`
if test x$OS = xAIX; then
-$LD -shared -o $CWD/liblustre.so $ALL_OBJS -lpthread -Xlinker -bnoipath ../../libsyscall.so
+ $LD $LDFLAGS -shared -o $CWD/liblustre.so $ALL_OBJS -lpthread -Xlinker -bnoipath ../../libsyscall.so
else
# using -nostdlib on Ubuntu causes errors such as:
#./llite_lib.o: In function `liblustre_process_log':
#/home/brian/rpm/BUILD/lustre-1.8.2.50/lustre/liblustre/llite_lib.c:234: undefined reference to `__stack_chk_fail_local'
# due to the use of SSP
#$LD -shared -nostdlib -o $CWD/liblustre.so $ALL_OBJS $CAP_LIBS $PTHREAD_LIBS $ZLIB
-$LD -shared -o $CWD/liblustre.so $ALL_OBJS $CAP_LIBS $PTHREAD_LIBS $ZLIB
+ $LD $LDFLAGS -shared -o $CWD/liblustre.so $ALL_OBJS $CAP_LIBS $PTHREAD_LIBS $ZLIB
fi
rm -rf $sysio_tmp