From 0083d8d5f66340e0d9a22ad7e379e2ee523fd641 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Mon, 10 Jul 2006 15:39:48 +0000 Subject: [PATCH] Extend automatic enabling of Kbuild mechanism back as far as kernel 2.6.10 (which is the first Kbuild enabled kernel supported by Comedi) and also enable Kbuild mechanism if separate kernel source and build directories are in use. It ought to be possible to use the Kbuild mechanism back as far as kernel 2.6.8 by checking for the script/mkmakefile file (that's what I tried first, actually), but use of the Kbuild mechanism for 2.6.8 and 2.6.9 is currently incompatible with Comedi's build mechanism (I tried it). --- m4/as-linux.m4 | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/m4/as-linux.m4 b/m4/as-linux.m4 index 5449fa25..0d9ba40b 100644 --- a/m4/as-linux.m4 +++ b/m4/as-linux.m4 @@ -678,12 +678,23 @@ AC_DEFUN([AS_LINUX_VERSION_MAJOR_MINOR], # Check if kernel source tree is recent enough to support "Kbuild" files. AC_DEFUN([COMEDI_CHECK_LINUX_KBUILD], [ - AC_MSG_CHECKING([for Kbuild in $1]) - if test -a $1/Kbuild; then + AC_MSG_CHECKING([for Kbuild support in $1]) + dnl For combined kernel source and build directory, + dnl if $1/scripts/Makefile.build refers to $()/Kbuild + dnl then we support Kbuild (2.6.10 onwards). + dnl For separate kernel source and build directory, if $1/Makefile + dnl contains KERNELOUTPUT variable then this is from a separate + dnl kernel build directory, so Kbuild is required + dnl (but it will not work prior to 2.6.10). + if grep -q '/Kbuild' "$1/scripts/Makefile.build" 2>/dev/null; then + AC_MSG_RESULT([yes]) + $2 + else if grep -q '^KERNELOUTPUT *:=' "$1/Makefile" 2>/dev/null; then AC_MSG_RESULT([yes]) $2 else AC_MSG_RESULT([no]) $3 fi + fi ]) -- 2.26.2