From d4d0c44755c9adbe015280adf36f3a20f2413557 Mon Sep 17 00:00:00 2001 From: Stefaan De Roeck Date: Sun, 12 Oct 2008 19:02:18 +0000 Subject: [PATCH] DEVEL15-linux-alternate-kernel-builddir-20081012 LICENSE IPL10 FIXES 121354 add support for KBUILD_OUTPUT=... builds. (cherry picked from commit 726fc5b8425eb7bbaab4bdde38d977382dc17a9d) --- acinclude.m4 | 24 +++++++++++++++++------- src/cf/linux-test1.m4 | 4 ++-- src/config/Makefile.config.in | 1 + src/libafs/MakefileProto.LINUX.in | 3 ++- 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/acinclude.m4 b/acinclude.m4 index 17b2996234..2205bf11d7 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -195,6 +195,10 @@ AC_ARG_WITH([linux-kernel-headers], [AS_HELP_STRING([--with-linux-kernel-headers=path], [use the kernel headers found at path (optional, defaults to /usr/src/linux-2.4, then /usr/src/linux)])]) +AC_ARG_WITH([linux-kernel-build], + [AS_HELP_STRING([--with-linux-kernel-build=path], + [use the kernel build found at path(optional, defaults to + /usr/src/linux-2.4, then /usr/src/linux)])]) AC_ARG_WITH([bsd-kernel-headers], [AS_HELP_STRING([--with-bsd-kernel-headers=path], [use the kernel headers found at path (optional, defaults to @@ -339,15 +343,20 @@ case $system in LINUX_KERNEL_PATH="/usr/src/linux" fi fi - if test -f "$LINUX_KERNEL_PATH/include/linux/utsrelease.h"; then - linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/utsrelease.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1` + if test "$with_linux_kernel_build" != "x"; then + LINUX_KERNEL_BUILD="$with_linux_kernel_build" + else + LINUX_KERNEL_BUILD=$LINUX_KERNEL_PATH + fi + if test -f "$LINUX_KERNEL_BUILD/include/linux/utsrelease.h"; then + linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/utsrelease.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1` LINUX_VERSION="$linux_kvers" else - if test -f "$LINUX_KERNEL_PATH/include/linux/version.h"; then - linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1` + if test -f "$LINUX_KERNEL_BUILD/include/linux/version.h"; then + linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/version.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1` if test "x$linux_kvers" = "x"; then - if test -f "$LINUX_KERNEL_PATH/include/linux/version-up.h"; then - linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_PATH/include/linux/version-up.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1` + if test -f "$LINUX_KERNEL_BUILD/include/linux/version-up.h"; then + linux_kvers=`fgrep UTS_RELEASE $LINUX_KERNEL_BUILD/include/linux/version-up.h |awk 'BEGIN { FS="\"" } { print $[]2 }'|tail -n 1` if test "x$linux_kvers" = "x"; then AC_MSG_ERROR(Linux headers lack version definition [2]) @@ -366,7 +375,7 @@ case $system in enable_kernel_module="no" fi fi - if test ! -f "$LINUX_KERNEL_PATH/include/linux/autoconf.h"; then + if test ! -f "$LINUX_KERNEL_BUILD/include/linux/autoconf.h"; then enable_kernel_module="no" fi if test "x$enable_kernel_module" = "xno"; then @@ -1583,6 +1592,7 @@ AC_SUBST(ENABLE_KERNEL_MODULE) AC_SUBST(ENABLE_PTHREADED_UBIK) AC_SUBST(LIB_AFSDB) AC_SUBST(LINUX_KERNEL_PATH) +AC_SUBST(LINUX_KERNEL_BUILD) AC_SUBST(HOST_CPU) AC_SUBST(BSD_KERNEL_PATH) AC_SUBST(BSD_KERNEL_BUILD) diff --git a/src/cf/linux-test1.m4 b/src/cf/linux-test1.m4 index 8c82baa87a..98bdc45c93 100644 --- a/src/cf/linux-test1.m4 +++ b/src/cf/linux-test1.m4 @@ -27,8 +27,8 @@ $2 MODULE_LICENSE("http://www.openafs.org/dl/license10.html"); _ACEOF - echo make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&AS_MESSAGE_LOG_FD && - make -C $LINUX_KERNEL_PATH M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&AS_MESSAGE_LOG_FD 2>conftest.err && + echo make -C $LINUX_KERNEL_BUILD M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&AS_MESSAGE_LOG_FD && + make -C $LINUX_KERNEL_BUILD M=$SRCDIR_PARENT/conftest.dir modules KBUILD_VERBOSE=1 >&AS_MESSAGE_LOG_FD 2>conftest.err && ! grep -i "^WARNING: .* undefined!$" conftest.err >/dev/null 2>&1 then [$3] else diff --git a/src/config/Makefile.config.in b/src/config/Makefile.config.in index eeeb59d4fc..28f8a622ed 100644 --- a/src/config/Makefile.config.in +++ b/src/config/Makefile.config.in @@ -48,6 +48,7 @@ LEX = @LEX@ LIB_AFSDB = @LIB_AFSDB@ LIBS = @LIBS@ LINUX_KERNEL_PATH = @LINUX_KERNEL_PATH@ +LINUX_KERNEL_BUILD = @LINUX_KERNEL_BUILD@ LINUX_LIBAFS_NAME=@LINUX_LIBAFS_NAME@ LINUX_KERNEL_PACKAGING=@LINUX_KERNEL_PACKAGING@ LINUX_VERSION = @LINUX_VERSION@ diff --git a/src/libafs/MakefileProto.LINUX.in b/src/libafs/MakefileProto.LINUX.in index cd32bf1262..5458061548 100644 --- a/src/libafs/MakefileProto.LINUX.in +++ b/src/libafs/MakefileProto.LINUX.in @@ -60,6 +60,7 @@ COMMON_KERN_CFLAGS=$(KERN_DBG) $(KERN_OPTMZ) @LINUX_GCC_KOPTS@ COMMON_DEFINES=-D__KERNEL__ -DKERNEL -D_KERNEL -DMODULE ${SMP_DEF} LINUX_KERNEL_PATH=@LINUX_KERNEL_PATH@ +LINUX_KERNEL_BUILD=@LINUX_KERNEL_BUILD@ # System specific build commands and flags @@ -295,7 +296,7 @@ ${LIBAFS} ${LIBAFS_MP} ${LIBAFS_EP} ${LIBAFS_BM}: ${LINUX_LIBAFS_NAME}.ko .FORCE: ${LINUX_LIBAFS_NAME}.ko afspag.ko: .FORCE env EXTRA_CFLAGS="${EXTRA_CFLAGS}" @TOP_SRCDIR@/libafs/make_kbuild_makefile.pl ${KDIR} $@ @TOP_OBJDIR@/src/config/Makefile.config Makefile.afs Makefile.common - env EXTRA_CFLAGS="${EXTRA_CFLAGS}" $(MAKE) -C ${LINUX_KERNEL_PATH} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules + env EXTRA_CFLAGS="${EXTRA_CFLAGS}" $(MAKE) -C ${LINUX_KERNEL_BUILD} M=@TOP_OBJDIR@/src/libafs/${KDIR} modules ${LIBAFS}: $(AFSAOBJS) $(AFSNONFSOBJS)