Skip to content

Commit

Permalink
Make configure builtin-aware.
Browse files Browse the repository at this point in the history
This patch adds a new option to configure: --enable-linux-builtin. When
this option is used, the following happens:

 - Compilation of kernel modules is disabled.

 - A failure to find UTS_RELEASE is followed by a suggestion to run
   "make prepare" on the kernel source tree.

This patch also adds a new test which tries to compile an empty module
as a basic toolchain sanity test. If it fails and the option was
specified, the error is followed by a suggestion to run "make scripts"
on the kernel source tree.

Signed-off-by: Prakash Surya <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#851
  • Loading branch information
dechamps authored and behlendorf committed Jul 26, 2012
1 parent b2c5198 commit 319a99a
Show file tree
Hide file tree
Showing 3 changed files with 223 additions and 28 deletions.
30 changes: 28 additions & 2 deletions config/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dnl #
AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [
ZFS_AC_KERNEL
ZFS_AC_SPL
ZFS_AC_TEST_MODULE
ZFS_AC_KERNEL_CONFIG
ZFS_AC_KERNEL_BDEV_BLOCK_DEVICE_OPERATIONS
ZFS_AC_KERNEL_TYPE_FMODE_T
Expand Down Expand Up @@ -86,7 +87,7 @@ dnl #
AC_DEFUN([ZFS_AC_MODULE_SYMVERS], [
modpost=$LINUX/scripts/Makefile.modpost
AC_MSG_CHECKING([kernel file name for module symbols])
AS_IF([test -f "$modpost"], [
AS_IF([test "x$enable_linux_builtin" != xyes -a -f "$modpost"], [
AS_IF([grep -q Modules.symvers $modpost], [
LINUX_SYMBOLS=Modules.symvers
], [
Expand Down Expand Up @@ -191,7 +192,13 @@ AC_DEFUN([ZFS_AC_KERNEL], [
])
], [
AC_MSG_RESULT([Not found])
AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
if test "x$enable_linux_builtin" != xyes; then
AC_MSG_ERROR([*** Cannot find UTS_RELEASE definition.])
else
AC_MSG_ERROR([
*** Cannot find UTS_RELEASE definition.
*** Please run 'make prepare' inside the kernel source tree.])
fi
])
AC_MSG_RESULT([$kernsrcver])
Expand Down Expand Up @@ -312,6 +319,25 @@ AC_DEFUN([ZFS_AC_SPL], [
ZFS_AC_SPL_MODULE_SYMVERS
])

dnl #
dnl # Basic toolchain sanity check.
dnl #
AC_DEFUN([ZFS_AC_TEST_MODULE],
[AC_MSG_CHECKING([whether modules can be built])
ZFS_LINUX_TRY_COMPILE([],[],[
AC_MSG_RESULT([yes])
],[
AC_MSG_RESULT([no])
if test "x$enable_linux_builtin" != xyes; then
AC_MSG_ERROR([*** Unable to build an empty module.])
else
AC_MSG_ERROR([
*** Unable to build an empty module.
*** Please run 'make scripts' inside the kernel source tree.])
fi
])
])

dnl #
dnl # Certain kernel build options are not supported. These must be
dnl # detected at configure time and cause a build failure. Otherwise
Expand Down
12 changes: 8 additions & 4 deletions config/zfs-build.m4
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ AC_DEFUN([ZFS_AC_CONFIG], [
AS_HELP_STRING([--with-config=CONFIG],
[Config file 'kernel|user|all|srpm']),
[ZFS_CONFIG="$withval"])
AC_ARG_ENABLE([linux-builtin],
[AC_HELP_STRING([--enable-linux-builtin],
[Configure for builtin in-tree kernel modules @<:@default=no@:>@])],
[],
[enable_linux_builtin=no])
AC_MSG_CHECKING([zfs config])
AC_MSG_RESULT([$ZFS_CONFIG]);
Expand All @@ -93,11 +98,10 @@ AC_DEFUN([ZFS_AC_CONFIG], [
esac
AM_CONDITIONAL([CONFIG_USER],
[test "$ZFS_CONFIG" = user] ||
[test "$ZFS_CONFIG" = all])
[test "$ZFS_CONFIG" = user -o "$ZFS_CONFIG" = all])
AM_CONDITIONAL([CONFIG_KERNEL],
[test "$ZFS_CONFIG" = kernel] ||
[test "$ZFS_CONFIG" = all])
[test "$ZFS_CONFIG" = kernel -o "$ZFS_CONFIG" = all] &&
[test "x$enable_linux_builtin" != xyes ])
])

dnl #
Expand Down
Loading

0 comments on commit 319a99a

Please sign in to comment.