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.
This commit is contained in:
Brian Behlendorf 2009-03-09 16:50:37 -07:00
parent c5f704607b
commit d4326403de
2 changed files with 14 additions and 32 deletions

View File

@ -1,6 +1,4 @@
AC_DEFUN([SPL_AC_KERNEL], [ AC_DEFUN([SPL_AC_KERNEL], [
ver=`uname -r`
AC_ARG_WITH([linux], AC_ARG_WITH([linux],
AS_HELP_STRING([--with-linux=PATH], AS_HELP_STRING([--with-linux=PATH],
[Path to kernel source]), [Path to kernel source]),
@ -14,19 +12,12 @@ AC_DEFUN([SPL_AC_KERNEL], [
AC_MSG_CHECKING([kernel source directory]) AC_MSG_CHECKING([kernel source directory])
if test -z "$kernelsrc"; then if test -z "$kernelsrc"; then
kernelbuild= kernelbuild=
sourcelink=/lib/modules/${ver}/source sourcelink=`ls -1d /usr/src/kernels/* /usr/src/linux-* 2>/dev/null | tail -1`
buildlink=/lib/modules/${ver}/build
if test -e $sourcelink; then if test -e ${sourcelink}; then
kernelsrc=`(cd $sourcelink; /bin/pwd)` kernelsrc=`readlink -f ${sourcelink}`
fi kernelbuild=${kernelsrc}
if test -e $buildlink; then else
kernelbuild=`(cd $buildlink; /bin/pwd)`
fi
if test -z "$kernelsrc"; then
kernelsrc=$kernelbuild
fi
if test -z "$kernelsrc" -o -z "$kernelbuild"; then
AC_MSG_RESULT([Not found]) AC_MSG_RESULT([Not found])
AC_MSG_ERROR([ AC_MSG_ERROR([
*** Please specify the location of the kernel source *** Please specify the location of the kernel source
@ -48,7 +39,7 @@ AC_DEFUN([SPL_AC_KERNEL], [
kernsrcver=`(echo "#include <linux/version.h>"; kernsrcver=`(echo "#include <linux/version.h>";
echo "kernsrcver=UTS_RELEASE") | echo "kernsrcver=UTS_RELEASE") |
cpp -I $kernelbuild/include | cpp -I $kernelbuild/include |
grep "^kernsrcver=" | cut -d \" -f 2` grep "^kernsrcver=" | cut -d \" -f 2`
elif test -r $kernelbuild/include/linux/utsrelease.h && elif test -r $kernelbuild/include/linux/utsrelease.h &&
@ -56,7 +47,7 @@ AC_DEFUN([SPL_AC_KERNEL], [
kernsrcver=`(echo "#include <linux/utsrelease.h>"; kernsrcver=`(echo "#include <linux/utsrelease.h>";
echo "kernsrcver=UTS_RELEASE") | echo "kernsrcver=UTS_RELEASE") |
cpp -I $kernelbuild/include | cpp -I $kernelbuild/include |
grep "^kernsrcver=" | cut -d \" -f 2` grep "^kernsrcver=" | cut -d \" -f 2`
fi fi

23
configure vendored
View File

@ -18921,8 +18921,6 @@ LINUX=
LINUX_OBJ= LINUX_OBJ=
ver=`uname -r`
# Check whether --with-linux or --without-linux was given. # Check whether --with-linux or --without-linux was given.
if test "${with_linux+set}" = set; then if test "${with_linux+set}" = set; then
@ -18941,19 +18939,12 @@ fi;
echo $ECHO_N "checking kernel source directory... $ECHO_C" >&6 echo $ECHO_N "checking kernel source directory... $ECHO_C" >&6
if test -z "$kernelsrc"; then if test -z "$kernelsrc"; then
kernelbuild= kernelbuild=
sourcelink=/lib/modules/${ver}/source sourcelink=`ls -1d /usr/src/kernels/* /usr/src/linux-* 2>/dev/null | tail -1`
buildlink=/lib/modules/${ver}/build
if test -e $sourcelink; then if test -e ${sourcelink}; then
kernelsrc=`(cd $sourcelink; /bin/pwd)` kernelsrc=`readlink -f ${sourcelink}`
fi kernelbuild=${kernelsrc}
if test -e $buildlink; then else
kernelbuild=`(cd $buildlink; /bin/pwd)`
fi
if test -z "$kernelsrc"; then
kernelsrc=$kernelbuild
fi
if test -z "$kernelsrc" -o -z "$kernelbuild"; then
echo "$as_me:$LINENO: result: Not found" >&5 echo "$as_me:$LINENO: result: Not found" >&5
echo "${ECHO_T}Not found" >&6 echo "${ECHO_T}Not found" >&6
{ { echo "$as_me:$LINENO: error: { { echo "$as_me:$LINENO: error:
@ -18984,7 +18975,7 @@ echo $ECHO_N "checking kernel source version... $ECHO_C" >&6
kernsrcver=`(echo "#include <linux/version.h>"; kernsrcver=`(echo "#include <linux/version.h>";
echo "kernsrcver=UTS_RELEASE") | echo "kernsrcver=UTS_RELEASE") |
cpp -I $kernelbuild/include | cpp -I $kernelbuild/include |
grep "^kernsrcver=" | cut -d \" -f 2` grep "^kernsrcver=" | cut -d \" -f 2`
elif test -r $kernelbuild/include/linux/utsrelease.h && elif test -r $kernelbuild/include/linux/utsrelease.h &&
@ -18992,7 +18983,7 @@ echo $ECHO_N "checking kernel source version... $ECHO_C" >&6
kernsrcver=`(echo "#include <linux/utsrelease.h>"; kernsrcver=`(echo "#include <linux/utsrelease.h>";
echo "kernsrcver=UTS_RELEASE") | echo "kernsrcver=UTS_RELEASE") |
cpp -I $kernelbuild/include | cpp -I $kernelbuild/include |
grep "^kernsrcver=" | cut -d \" -f 2` grep "^kernsrcver=" | cut -d \" -f 2`
fi fi