Verify --with-linux source directory exists
authorBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 30 Nov 2012 04:19:25 +0000 (20:19 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 29 Nov 2012 23:08:35 +0000 (15:08 -0800)
Previously this check was only performed when ./configure was
attempting to autodetect your kernel source directory.  But we
should also handle the case where --with-linux was provided
and is obviously wrong.  This way we catch the error before
invoking make and compiling the source with an incorrect
autoconf results.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes zfsonlinux/spl#162

config/kernel.m4

index 34969c3..2312730 100644 (file)
@@ -146,11 +146,7 @@ AC_DEFUN([ZFS_AC_KERNEL], [
                AS_IF([test -n "$sourcelink" && test -e ${sourcelink}], [
                        kernelsrc=`readlink -f ${sourcelink}`
                ], [
-                       AC_MSG_RESULT([Not found])
-                       AC_MSG_ERROR([
-       *** Please make sure the kernel devel package for your distribution
-       *** is installed then try again.  If that fails you can specify the
-       *** location of the kernel source with the '--with-linux=PATH' option.])
+                       kernelsrc="[Not found]"
                ])
        ], [
                AS_IF([test "$kernelsrc" = "NONE"], [
@@ -159,6 +155,13 @@ AC_DEFUN([ZFS_AC_KERNEL], [
        ])
 
        AC_MSG_RESULT([$kernelsrc])
+       AS_IF([test ! -d "$kernelsrc"], [
+               AC_MSG_ERROR([
+       *** Please make sure the kernel devel package for your distribution
+       *** is installed then try again.  If that fails you can specify the
+       *** location of the kernel source with the '--with-linux=PATH' option.])
+       ])
+
        AC_MSG_CHECKING([kernel build directory])
        AS_IF([test -z "$kernelbuild"], [
                AS_IF([test -e "/lib/modules/$(uname -r)/build"], [