From 0927c5faca198d952e401f29fa1f80671c945fb9 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Wed, 28 Jun 2006 01:00:55 +0000 Subject: [PATCH] Detect Kbuild in Linux kernel source directory, and use it to automatically decide whether to use Kbuild to build modules. --enable-kbuild can still be used to override. --- configure.ac | 5 +++-- m4/as-linux.m4 | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index cd4d921b..f69d02f3 100644 --- a/configure.ac +++ b/configure.ac @@ -82,8 +82,9 @@ else AC_MSG_NOTICE([USB support disabled]) AM_CONDITIONAL(CONFIG_USB,false) fi -AC_ARG_ENABLE([kbuild], [ --enable-kbuild Build modules using kernel's kbuild system (needs recent 2.6 kernel)], - [ENABLE_KBUILD=$enableval], [ENABLE_KBUILD="no"]) +COMEDI_CHECK_LINUX_KBUILD([$LINUX_DIR], [ENABLE_KBUILD="yes"], [ENABLE_KBUILD="no"]) +AC_ARG_ENABLE([kbuild], [ --enable-kbuild Force use (or not) of kernel's Kbuild system to build modules (needs recent 2.6 kernel)], + [ENABLE_KBUILD=$enableval], []) AM_CONDITIONAL([CONFIG_KBUILD], [test ${ENABLE_KBUILD} = "yes"]) AS_LINUX_CONFIG_OPTION_MODULE(CONFIG_ISA) AS_LINUX_CONFIG_OPTION_MODULE(CONFIG_PCI) diff --git a/m4/as-linux.m4 b/m4/as-linux.m4 index 14c724b6..ab8ef36e 100644 --- a/m4/as-linux.m4 +++ b/m4/as-linux.m4 @@ -703,3 +703,18 @@ int code = LINUX_VERSION_CODE; CFLAGS="$ac_save_CFLAGS" ]) +# COMEDI_CHECK_LINUX_KBUILD([LINUX_SOURCE_PATH], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------------------------- +# +# 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_RESULT([yes]) + $2 + else + AC_MSG_RESULT([no]) + $3 + fi +]) -- 2.26.2