summaryrefslogtreecommitdiffstats
path: root/config/spl-build.m4
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2009-03-09 16:50:37 -0700
committerBrian Behlendorf <[email protected]>2009-03-09 16:57:10 -0700
commitd4326403de5f1fe9634c3d9468a51076eff702b6 (patch)
treead4f30dcb1fee1d1582fdd267d0f72fc0f40df9c /config/spl-build.m4
parentc5f704607bbdc5e6a89b4ac088dff16a6c1eeb5e (diff)
Build System Default Kernel
Update the method used for determining which kernel to build against when not specified. Previous 'uname -r' was used but this makes the assumption that the running kernel is the one you want to use, this is often not the case. It is better to examine the usual kernel-devel install locations and select one of the installed kernels.
Diffstat (limited to 'config/spl-build.m4')
-rw-r--r--config/spl-build.m423
1 files changed, 7 insertions, 16 deletions
diff --git a/config/spl-build.m4 b/config/spl-build.m4
index b6e44a7f2..f2dc7fa9e 100644
--- a/config/spl-build.m4
+++ b/config/spl-build.m4
@@ -1,6 +1,4 @@
AC_DEFUN([SPL_AC_KERNEL], [
- ver=`uname -r`
-
AC_ARG_WITH([linux],
AS_HELP_STRING([--with-linux=PATH],
[Path to kernel source]),
@@ -14,19 +12,12 @@ AC_DEFUN([SPL_AC_KERNEL], [
AC_MSG_CHECKING([kernel source directory])
if test -z "$kernelsrc"; then
kernelbuild=
- sourcelink=/lib/modules/${ver}/source
- buildlink=/lib/modules/${ver}/build
+ sourcelink=`ls -1d /usr/src/kernels/* /usr/src/linux-* 2>/dev/null | tail -1`
- if test -e $sourcelink; then
- kernelsrc=`(cd $sourcelink; /bin/pwd)`
- fi
- if test -e $buildlink; then
- kernelbuild=`(cd $buildlink; /bin/pwd)`
- fi
- if test -z "$kernelsrc"; then
- kernelsrc=$kernelbuild
- fi
- if test -z "$kernelsrc" -o -z "$kernelbuild"; then
+ if test -e ${sourcelink}; then
+ kernelsrc=`readlink -f ${sourcelink}`
+ kernelbuild=${kernelsrc}
+ else
AC_MSG_RESULT([Not found])
AC_MSG_ERROR([
*** Please specify the location of the kernel source
@@ -48,7 +39,7 @@ AC_DEFUN([SPL_AC_KERNEL], [
kernsrcver=`(echo "#include <linux/version.h>";
echo "kernsrcver=UTS_RELEASE") |
- cpp -I $kernelbuild/include |
+ cpp -I $kernelbuild/include |
grep "^kernsrcver=" | cut -d \" -f 2`
elif test -r $kernelbuild/include/linux/utsrelease.h &&
@@ -56,7 +47,7 @@ AC_DEFUN([SPL_AC_KERNEL], [
kernsrcver=`(echo "#include <linux/utsrelease.h>";
echo "kernsrcver=UTS_RELEASE") |
- cpp -I $kernelbuild/include |
+ cpp -I $kernelbuild/include |
grep "^kernsrcver=" | cut -d \" -f 2`
fi