]> git.proxmox.com Git - mirror_spl.git/blobdiff - config/spl-build.m4
When no kernel source has been pointed to, first attempt to use
[mirror_spl.git] / config / spl-build.m4
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}`