Detect Kbuild in Linux kernel source directory, and use it to
authorFrank Mori Hess <fmhess@speakeasy.net>
Wed, 28 Jun 2006 01:00:55 +0000 (01:00 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Wed, 28 Jun 2006 01:00:55 +0000 (01:00 +0000)
automatically decide whether to use Kbuild to build modules.
--enable-kbuild can still be used to override.

configure.ac
m4/as-linux.m4

index cd4d921bc173b90d33388115cb7b6b37ad6094e2..f69d02f3d8c5251133caf7fba299753233eca6c9 100644 (file)
@@ -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)
index 14c724b628460fd3ab3ff5cf83170bf75aa1985a..ab8ef36ea227c3356e92b514c6b4ee292a27e6ea 100644 (file)
@@ -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
+])