From 13bfad0c9615574ff08947e755decb9f30409d3f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 28 Feb 2020 09:23:48 -0800 Subject: [PATCH] Fix CONFIG_MODULES=no Linux kernel config When configuring as builtin (--enable-linux-builtin) for kernels without loadable module support (CONFIG_MODULES=n) only the object file is created. Never a loadable kmod. Update ZFS_LINUX_TRY_COMPILE to handle this in a manor similar to the ZFS_LINUX_TEST_COMPILE_ALL macro. Reviewed-by: George Melikov Reviewed-by: Tony Hutter Signed-off-by: Brian Behlendorf Closes #9887 Closes #10063 --- config/kernel.m4 | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/config/kernel.m4 b/config/kernel.m4 index 16cc4568b..7f3e18d59 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -811,11 +811,20 @@ dnl # $2 - source dnl # $3 - run on success (valid .ko generated) dnl # $4 - run on failure (unable to compile) dnl # +dnl # When configuring as builtin (--enable-linux-builtin) for kernels +dnl # without loadable module support (CONFIG_MODULES=n) only the object +dnl # file is created. See ZFS_LINUX_TEST_COMPILE_ALL for details. +dnl # AC_DEFUN([ZFS_LINUX_TRY_COMPILE], [ - ZFS_LINUX_COMPILE_IFELSE( - [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]])], - [test -f build/conftest/conftest.ko], - [$3], [$4]) + AS_IF([test "x$enable_linux_builtin" = "xyes"], [ + ZFS_LINUX_COMPILE_IFELSE( + [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]])], + [test -f build/conftest/conftest.o], [$3], [$4]) + ], [ + ZFS_LINUX_COMPILE_IFELSE( + [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]])], + [test -f build/conftest/conftest.ko], [$3], [$4]) + ]) ]) dnl #