]> git.proxmox.com Git - mirror_spl.git/commitdiff
When no kernel source has been pointed to, first attempt to use
authorBrian J. Murrell <brian@sun.com>
Mon, 8 Mar 2010 22:19:30 +0000 (14:19 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 8 Mar 2010 22:19:30 +0000 (14:19 -0800)
/lib/modules/$(uname -r)/source.  This will likely fail when building
under a mock (http://fedoraproject.org/wiki/Projects/Mock) chroot
environment since `uname -r` will report the running kernel which
likely is not the kernel in your chroot.  To cleanly handle this
we fallback to using the first kernel in your chroot.

The kernel-devel package which contains all the kernel headers and
a few build products such as Module.symver{s} is all the is required.
Full source is not needed.

config/spl-build.m4
configure

index e2e2112e73fbb19c6c4f7441c4012c04d2049435..9d0361028848098372608913ab4744fafc80e170 100644 (file)
@@ -104,8 +104,14 @@ AC_DEFUN([SPL_AC_KERNEL], [
 
        AC_MSG_CHECKING([kernel source directory])
        if test -z "$kernelsrc"; then
-               sourcelink=`ls -1d /usr/src/kernels/* /usr/src/linux-* \
-                            2>/dev/null | grep -v obj | tail -1`
+               headersdir="/lib/modules/$(uname -r)/build"
+               if test -e "$headersdir"; then
+                       sourcelink=$(readlink -f "$headersdir")
+               else
+                       sourcelink=$(ls -1d /usr/src/kernels/* \
+                                    /usr/src/linux-* \
+                                    2>/dev/null | grep -v obj | tail -1)
+               fi
 
                if test -e ${sourcelink}; then
                        kernelsrc=`readlink -f ${sourcelink}`
index 99c064d4395da80cc5d53749d60368da4988e299..98b92a9d0f31a5b11017b1ddebc89666c5c64376 100755 (executable)
--- a/configure
+++ b/configure
@@ -18971,8 +18971,14 @@ fi;
        echo "$as_me:$LINENO: checking kernel source directory" >&5
 echo $ECHO_N "checking kernel source directory... $ECHO_C" >&6
        if test -z "$kernelsrc"; then
-               sourcelink=`ls -1d /usr/src/kernels/* /usr/src/linux-* \
-                            2>/dev/null | grep -v obj | tail -1`
+               headersdir="/lib/modules/$(uname -r)/build"
+               if test -e "$headersdir"; then
+                       sourcelink=$(readlink -f "$headersdir")
+               else
+                       sourcelink=$(ls -1d /usr/src/kernels/* \
+                                    /usr/src/linux-* \
+                                    2>/dev/null | grep -v obj | tail -1)
+               fi
 
                if test -e ${sourcelink}; then
                        kernelsrc=`readlink -f ${sourcelink}`
@@ -22317,8 +22323,14 @@ fi;
        echo "$as_me:$LINENO: checking kernel source directory" >&5
 echo $ECHO_N "checking kernel source directory... $ECHO_C" >&6
        if test -z "$kernelsrc"; then
-               sourcelink=`ls -1d /usr/src/kernels/* /usr/src/linux-* \
-                            2>/dev/null | grep -v obj | tail -1`
+               headersdir="/lib/modules/$(uname -r)/build"
+               if test -e "$headersdir"; then
+                       sourcelink=$(readlink -f "$headersdir")
+               else
+                       sourcelink=$(ls -1d /usr/src/kernels/* \
+                                    /usr/src/linux-* \
+                                    2>/dev/null | grep -v obj | tail -1)
+               fi
 
                if test -e ${sourcelink}; then
                        kernelsrc=`readlink -f ${sourcelink}`