summaryrefslogtreecommitdiffstats
path: root/config/kernel.m4
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2011-02-10 14:54:33 -0800
committerBrian Behlendorf <[email protected]>2011-02-10 14:54:33 -0800
commit1b94c25ceb12649b4b2ffb9a016e4f51cfa91736 (patch)
tree761eeed38af4139e8316f62596c3f95db43c29a0 /config/kernel.m4
parentafffb5cd102f340f3879f4d7af8988dd209b9b72 (diff)
Prefer /lib/modules/$(uname -r)/ links
Preferentially use the /lib/modules/$(uname -r)/source and /lib/modules/$(uname -r)/build links. Only if neither of these links exist fallback to alternate methods for deducing which kernel to build with. This resolves the need to manually specify --with-linux= and --with-linux-obj= on Debian systems.
Diffstat (limited to 'config/kernel.m4')
-rw-r--r--config/kernel.m411
1 files changed, 8 insertions, 3 deletions
diff --git a/config/kernel.m4 b/config/kernel.m4
index c2fc5a098..2c83dc590 100644
--- a/config/kernel.m4
+++ b/config/kernel.m4
@@ -78,8 +78,11 @@ AC_DEFUN([ZFS_AC_KERNEL], [
AC_MSG_CHECKING([kernel source directory])
if test -z "$kernelsrc"; then
- headersdir="/lib/modules/$(uname -r)/build"
- if test -e "$headersdir"; then
+ if test -e "/lib/modules/$(uname -r)/source"; then
+ headersdir="/lib/modules/$(uname -r)/source"
+ sourcelink=$(readlink -f "$headersdir")
+ elif test -e "/lib/modules/$(uname -r)/build"; then
+ headersdir="/lib/modules/$(uname -r)/build"
sourcelink=$(readlink -f "$headersdir")
else
sourcelink=$(ls -1d /usr/src/kernels/* \
@@ -105,7 +108,9 @@ AC_DEFUN([ZFS_AC_KERNEL], [
AC_MSG_RESULT([$kernelsrc])
AC_MSG_CHECKING([kernel build directory])
if test -z "$kernelbuild"; then
- if test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}; then
+ if test -e "/lib/modules/$(uname -r)/build"; then
+ kernelbuild=`readlink -f /lib/modules/$(uname -r)/build`
+ elif test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}; then
kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu}
elif test -d ${kernelsrc}-obj/${target_cpu}/default; then
kernelbuild=${kernelsrc}-obj/${target_cpu}/default