diff --git a/build/Makefile b/build/Makefile index c0538bdfd24fc298b3d3677deb18a316c5e34762..11c9c6ec622f7ada91842460be81ac2ff46e649b 100644 --- a/build/Makefile +++ b/build/Makefile @@ -1,5 +1,5 @@ # -# There are three ways this Makefile can be called: +# There are four ways this Makefile can be called: # # # 1. As a subdirectory from the toplevel, for automake @@ -10,6 +10,8 @@ # 3. At configure time, as the toplevel module dir for building # kernel tests # +# 4. At configure time, to determine the kernel's idea of $(ARCH) +# ifeq ($(PATCHLEVEL),) @@ -47,3 +49,8 @@ include $(TOPDIR)/Rules.make endif endif # PATCHLEVEL + +# case 4 + +echoarch: + echo $(ARCH) >$(ARCHFILE) diff --git a/build/autoconf/lustre-build-linux.m4 b/build/autoconf/lustre-build-linux.m4 index 8e7c8c142014f0d02a93a4bee381b4d2b36fb6ea..272833476b25abfb06857b99fa0c4c9510950b48 100644 --- a/build/autoconf/lustre-build-linux.m4 +++ b/build/autoconf/lustre-build-linux.m4 @@ -308,6 +308,21 @@ m4_ifvaln([$5],[$5])dnl])dnl rm -f build/conftest.o build/conftest.mod.c build/conftest.mod.o build/conftest.ko m4_ifval([$1], [build/conftest.c conftest.c])[]dnl ]) +# +# LB_LINUX_ARCH +# +# Determine the kernel's idea of the current architecture +# +AC_DEFUN([LB_LINUX_ARCH], + [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_OBJ $ARCH_UM \ + ARCHFILE=$PWD/build/arch && LINUX_ARCH=`cat $PWD/build/arch`], + [AC_MSG_RESULT([$LINUX_ARCH])], + [AC_MSG_ERROR([Could not determine the kernel architecture.])]) + rm -f build/arch]) + # # LB_LINUX_TRY_COMPILE #