Skip to content

Commit 69b65dd

Browse files
authored
config: Add warning if ARCH environment variable is set
If ARCH environment variable is set it can cause the failure of the kernel modules check during the configure step. The resulting error will be confusing, and may looks like this: > checking for kernel config option compatibility... done > checking whether CONFIG_MODULES is defined... no > configure: error: > *** This kernel does not include the required loadable module > *** support! Detect when ARCH is print a warning. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Maksym Shkolnyi <[email protected]> Closes #17680
1 parent 64d3143 commit 69b65dd

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

config/always-arch.m4

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,20 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_ARCH], [
3939
AM_CONDITIONAL([TARGET_CPU_SPARC64], test $TARGET_CPU = sparc64)
4040
AM_CONDITIONAL([TARGET_CPU_ARM], test $TARGET_CPU = arm)
4141
])
42+
dnl #
43+
dnl # Check for conflicting environment variables
44+
dnl #
45+
dnl # If ARCH env variable is set up, then kernel Makefile in the /usr/src/kernel
46+
dnl # can misbehave during the zfs ./configure test of the module compilation.
47+
AC_DEFUN([ZFS_AC_CONFIG_CHECK_ARCH_VAR], [
48+
AC_MSG_CHECKING([for conflicting environment variables])
49+
if test -n "$ARCH"; then
50+
AC_MSG_RESULT([warning])
51+
AC_MSG_WARN(m4_normalize([ARCH environment variable is set to "$ARCH".
52+
This can cause build kernel modules support check failure.
53+
Please unset it.]))
54+
else
55+
AC_MSG_RESULT([done])
56+
fi
57+
])
58+

config/zfs-build.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
266266
ZFS_AC_CONFIG_ALWAYS_TOOLCHAIN_SIMD
267267
ZFS_AC_CONFIG_ALWAYS_SYSTEM
268268
ZFS_AC_CONFIG_ALWAYS_ARCH
269+
ZFS_AC_CONFIG_CHECK_ARCH_VAR
269270
ZFS_AC_CONFIG_ALWAYS_PYTHON
270271
ZFS_AC_CONFIG_ALWAYS_PYZFS
271272
ZFS_AC_CONFIG_ALWAYS_SED

0 commit comments

Comments
 (0)