mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 01:51:00 +03:00
Make configure builtin-aware.
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 <surya1@llnl.gov> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Issue #851
This commit is contained in:
parent
b2c5198b19
commit
319a99a3d4
@ -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
|
||||
@ -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
|
||||
], [
|
||||
@ -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])
|
||||
@ -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
|
||||
|
@ -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]);
|
||||
@ -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 #
|
||||
|
209
configure
vendored
209
configure
vendored
@ -981,6 +981,7 @@ enable_fast_install
|
||||
with_gnu_ld
|
||||
enable_libtool_lock
|
||||
with_config
|
||||
enable_linux_builtin
|
||||
with_linux
|
||||
with_linux_obj
|
||||
with_spl
|
||||
@ -1643,6 +1644,8 @@ Optional Features:
|
||||
--enable-fast-install[=PKGS]
|
||||
optimize for fast installation [default=yes]
|
||||
--disable-libtool-lock avoid locking (might break parallel builds)
|
||||
--enable-linux-builtin Configure for builtin in-tree kernel modules
|
||||
[default=no]
|
||||
--enable-debug Enable generic debug support [default=no]
|
||||
--enable-debug-dmu-tx Enable dmu tx validation [default=no]
|
||||
|
||||
@ -4839,13 +4842,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
|
||||
else
|
||||
lt_cv_nm_interface="BSD nm"
|
||||
echo "int some_variable = 0;" > conftest.$ac_ext
|
||||
(eval echo "\"\$as_me:4842: $ac_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:4845: $ac_compile\"" >&5)
|
||||
(eval "$ac_compile" 2>conftest.err)
|
||||
cat conftest.err >&5
|
||||
(eval echo "\"\$as_me:4845: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
||||
(eval echo "\"\$as_me:4848: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
|
||||
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
|
||||
cat conftest.err >&5
|
||||
(eval echo "\"\$as_me:4848: output\"" >&5)
|
||||
(eval echo "\"\$as_me:4851: output\"" >&5)
|
||||
cat conftest.out >&5
|
||||
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
|
||||
lt_cv_nm_interface="MS dumpbin"
|
||||
@ -6051,7 +6054,7 @@ ia64-*-hpux*)
|
||||
;;
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '#line 6054 "configure"' > conftest.$ac_ext
|
||||
echo '#line 6057 "configure"' > conftest.$ac_ext
|
||||
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
|
||||
(eval $ac_compile) 2>&5
|
||||
ac_status=$?
|
||||
@ -7904,11 +7907,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:7907: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:7910: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:7911: \$? = $ac_status" >&5
|
||||
echo "$as_me:7914: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@ -8243,11 +8246,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:8246: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:8249: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:8250: \$? = $ac_status" >&5
|
||||
echo "$as_me:8253: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
@ -8348,11 +8351,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:8351: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:8354: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:8355: \$? = $ac_status" >&5
|
||||
echo "$as_me:8358: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -8403,11 +8406,11 @@ else
|
||||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:8406: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:8409: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:8410: \$? = $ac_status" >&5
|
||||
echo "$as_me:8413: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
@ -11206,7 +11209,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11209 "configure"
|
||||
#line 11212 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -11302,7 +11305,7 @@ else
|
||||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11305 "configure"
|
||||
#line 11308 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
@ -11945,6 +11948,13 @@ if test "${with_config+set}" = set; then
|
||||
withval=$with_config; ZFS_CONFIG="$withval"
|
||||
fi
|
||||
|
||||
# Check whether --enable-linux-builtin was given.
|
||||
if test "${enable_linux_builtin+set}" = set; then
|
||||
enableval=$enable_linux_builtin;
|
||||
else
|
||||
enable_linux_builtin=no
|
||||
fi
|
||||
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: checking zfs config" >&5
|
||||
$as_echo_n "checking zfs config... " >&6; }
|
||||
@ -12183,9 +12193,19 @@ else
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: result: Not found" >&5
|
||||
$as_echo "Not found" >&6; }
|
||||
{ { $as_echo "$as_me:$LINENO: error: *** Cannot find UTS_RELEASE definition." >&5
|
||||
if test "x$enable_linux_builtin" != xyes; then
|
||||
{ { $as_echo "$as_me:$LINENO: error: *** Cannot find UTS_RELEASE definition." >&5
|
||||
$as_echo "$as_me: error: *** Cannot find UTS_RELEASE definition." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
else
|
||||
{ { $as_echo "$as_me:$LINENO: error:
|
||||
*** Cannot find UTS_RELEASE definition.
|
||||
*** Please run 'make prepare' inside the kernel source tree." >&5
|
||||
$as_echo "$as_me: error:
|
||||
*** Cannot find UTS_RELEASE definition.
|
||||
*** Please run 'make prepare' inside the kernel source tree." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
@ -12205,7 +12225,7 @@ $as_echo "$kernsrcver" >&6; }
|
||||
modpost=$LINUX/scripts/Makefile.modpost
|
||||
{ $as_echo "$as_me:$LINENO: checking kernel file name for module symbols" >&5
|
||||
$as_echo_n "checking kernel file name for module symbols... " >&6; }
|
||||
if test -f "$modpost"; then
|
||||
if test "x$enable_linux_builtin" != xyes -a -f "$modpost"; then
|
||||
|
||||
if grep -q Modules.symvers $modpost; then
|
||||
|
||||
@ -12394,6 +12414,74 @@ $as_echo "$SPL_SYMBOLS" >&6; }
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: checking whether modules can be built" >&5
|
||||
$as_echo_n "checking whether modules can be built... " >&6; }
|
||||
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.c
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
|
||||
|
||||
rm -Rf build && mkdir -p build
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
if test "x$enable_linux_builtin" != xyes; then
|
||||
{ { $as_echo "$as_me:$LINENO: error: *** Unable to build an empty module." >&5
|
||||
$as_echo "$as_me: error: *** Unable to build an empty module." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
else
|
||||
{ { $as_echo "$as_me:$LINENO: error:
|
||||
*** Unable to build an empty module.
|
||||
*** Please run 'make scripts' inside the kernel source tree." >&5
|
||||
$as_echo "$as_me: error:
|
||||
*** Unable to build an empty module.
|
||||
*** Please run 'make scripts' inside the kernel source tree." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
|
||||
|
||||
fi
|
||||
|
||||
rm -Rf build
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if test "$ZFS_META_LICENSE" = GPL; then
|
||||
@ -18902,9 +18990,19 @@ else
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: result: Not found" >&5
|
||||
$as_echo "Not found" >&6; }
|
||||
{ { $as_echo "$as_me:$LINENO: error: *** Cannot find UTS_RELEASE definition." >&5
|
||||
if test "x$enable_linux_builtin" != xyes; then
|
||||
{ { $as_echo "$as_me:$LINENO: error: *** Cannot find UTS_RELEASE definition." >&5
|
||||
$as_echo "$as_me: error: *** Cannot find UTS_RELEASE definition." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
else
|
||||
{ { $as_echo "$as_me:$LINENO: error:
|
||||
*** Cannot find UTS_RELEASE definition.
|
||||
*** Please run 'make prepare' inside the kernel source tree." >&5
|
||||
$as_echo "$as_me: error:
|
||||
*** Cannot find UTS_RELEASE definition.
|
||||
*** Please run 'make prepare' inside the kernel source tree." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
@ -18924,7 +19022,7 @@ $as_echo "$kernsrcver" >&6; }
|
||||
modpost=$LINUX/scripts/Makefile.modpost
|
||||
{ $as_echo "$as_me:$LINENO: checking kernel file name for module symbols" >&5
|
||||
$as_echo_n "checking kernel file name for module symbols... " >&6; }
|
||||
if test -f "$modpost"; then
|
||||
if test "x$enable_linux_builtin" != xyes -a -f "$modpost"; then
|
||||
|
||||
if grep -q Modules.symvers $modpost; then
|
||||
|
||||
@ -19113,6 +19211,74 @@ $as_echo "$SPL_SYMBOLS" >&6; }
|
||||
|
||||
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: checking whether modules can be built" >&5
|
||||
$as_echo_n "checking whether modules can be built... " >&6; }
|
||||
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.c
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
|
||||
|
||||
rm -Rf build && mkdir -p build
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
|
||||
else
|
||||
$as_echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
{ $as_echo "$as_me:$LINENO: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
if test "x$enable_linux_builtin" != xyes; then
|
||||
{ { $as_echo "$as_me:$LINENO: error: *** Unable to build an empty module." >&5
|
||||
$as_echo "$as_me: error: *** Unable to build an empty module." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
else
|
||||
{ { $as_echo "$as_me:$LINENO: error:
|
||||
*** Unable to build an empty module.
|
||||
*** Please run 'make scripts' inside the kernel source tree." >&5
|
||||
$as_echo "$as_me: error:
|
||||
*** Unable to build an empty module.
|
||||
*** Please run 'make scripts' inside the kernel source tree." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
|
||||
|
||||
|
||||
fi
|
||||
|
||||
rm -Rf build
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if test "$ZFS_META_LICENSE" = GPL; then
|
||||
@ -25484,8 +25650,7 @@ $as_echo "$as_me: error: Bad value \"$ZFS_CONFIG\" for --with-config,
|
||||
{ (exit 1); exit 1; }; } ;;
|
||||
esac
|
||||
|
||||
if test "$ZFS_CONFIG" = user ||
|
||||
test "$ZFS_CONFIG" = all; then
|
||||
if test "$ZFS_CONFIG" = user -o "$ZFS_CONFIG" = all; then
|
||||
CONFIG_USER_TRUE=
|
||||
CONFIG_USER_FALSE='#'
|
||||
else
|
||||
@ -25493,8 +25658,8 @@ else
|
||||
CONFIG_USER_FALSE=
|
||||
fi
|
||||
|
||||
if test "$ZFS_CONFIG" = kernel ||
|
||||
test "$ZFS_CONFIG" = all; then
|
||||
if test "$ZFS_CONFIG" = kernel -o "$ZFS_CONFIG" = all &&
|
||||
test "x$enable_linux_builtin" != xyes ; then
|
||||
CONFIG_KERNEL_TRUE=
|
||||
CONFIG_KERNEL_FALSE='#'
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user