diff options
author | Brian J. Murrell <brian@sun.com> | 2010-03-08 14:19:30 -0800 |
---|---|---|
committer | Brian Behlendorf <behlendorf1@llnl.gov> | 2010-03-08 14:19:30 -0800 |
commit | 534c4e38cb2e070e8502798e3eecf297ff82f480 (patch) | |
tree | 3d91ca5c9ca6c01b3024e3469c0a1352705e5f5c /config | |
parent | 21006d08af406344fafc97d2eb43b73e781e49ff (diff) |
When no kernel source has been pointed to, first attempt to use
/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.
Diffstat (limited to 'config')
-rw-r--r-- | config/spl-build.m4 | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/config/spl-build.m4 b/config/spl-build.m4 index e2e2112e7..9d0361028 100644 --- a/config/spl-build.m4 +++ b/config/spl-build.m4 @@ -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}` |