Some distros (I'm looking at you, SUSE) keep the kernel headers in a
directory separate from the build directory. If we end up trying to use
such a directory, the build will fail since the other necessary build
files don't exist.

The kernel makefile requires that a config file be present before it
will bother compiling. Check to make sure that one of them exists, and
assume that if the distro keeps the headers elsewhere that the kernel
will still be able to find them (which is the case on SUSE).

Signed-off-by: Jason Gerecke <jason.gere...@wacom.com>
---
 configure.ac | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/configure.ac b/configure.ac
index d061fde..d16ba0a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -66,6 +66,12 @@ else
 fi
 
 dnl Check for kernel build environment
+AC_DEFUN([WCM_ISBUILDDIR], [\
+    \( -f "$1/.config" -o \
+       -f "$1/include/config/auto.conf" -o \
+       -f "$1/include/generated/autoconf.h" \) \
+])
+
 AC_ARG_WITH(kernel,
        AS_HELP_STRING([--with-kernel=dir], [Specify kernel source directory]),
        [WCM_KERNEL_DIR="$withval"])
@@ -83,16 +89,7 @@ if test "$WCM_KERNEL_DIR" = "yes" -o -z "$WCM_KERNEL_DIR"; 
then
        dnl Kernel source not specified, guess where it is
        m4_foreach([ROOTDIR], SEARCH_DIRECTORIES, [
                if test -z "$WCM_KERNEL_DIR"; then
-                       if test -f "ROOTDIR/.config"; then
-                               WCM_KERNEL_DIR="ROOTDIR"
-                               AC_MSG_RESULT($WCM_KERNEL_DIR)
-                       fi
-               fi
-       ])
-
-       m4_foreach([ROOTDIR], SEARCH_DIRECTORIES, [
-               if test -z "$WCM_KERNEL_DIR"; then
-                       if test -f "ROOTDIR/include/linux/input.h"; then
+                       if test WCM_ISBUILDDIR(ROOTDIR); then
                                WCM_KERNEL_DIR="ROOTDIR"
                                AC_MSG_RESULT($WCM_KERNEL_DIR)
                        fi
@@ -101,12 +98,12 @@ if test "$WCM_KERNEL_DIR" = "yes" -o -z "$WCM_KERNEL_DIR"; 
then
 
        if test -z "$WCM_KERNEL_DIR"; then
                AC_MSG_RESULT([not found])
-               AC_MSG_NOTICE([Unable to find headers in any of: 
SEARCH_DIRECTORIES])
+               AC_MSG_NOTICE([Unable to find build config in any of: 
SEARCH_DIRECTORIES])
        fi
 elif test "$WCM_KERNEL_DIR" != "no"; then
        AC_MSG_RESULT([$WCM_KERNEL_DIR])
-       if test \! -f "$WCM_KERNEL_DIR/include/linux/input.h"; then
-               AC_MSG_NOTICE([Kernel directory does not appear to contain 
headers])
+       if test \! WCM_ISBUILDDIR($WCM_KERNEL_DIR); then
+               AC_MSG_NOTICE([Kernel directory does not appear to have needed 
config files])
        fi
 fi
 
-- 
2.3.5


------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

Reply via email to