]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Linux compat: fix DECLARE_EVENT_CLASS() test when ZFS is built-in
authorAlexander <solbjorn@users.noreply.github.com>
Mon, 17 Oct 2022 18:08:36 +0000 (20:08 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 1 Nov 2022 19:43:29 +0000 (12:43 -0700)
ZFS_LINUX_TRY_COMPILE_HEADER macro doesn't take CONFIG_ZFS=y into
account. As a result, on several latest Linux versions, configure
script marks DECLARE_EVENT_CLASS() available for non-GPL when ZFS
is being built as a module, but marks it unavailable when ZFS is
built-in.
Follow the logic of the neighbor macros and adjust
ZFS_LINUX_TRY_COMPILE_HEADER accordingly, so that it doesn't try
to look for a .ko when ZFS is built-in.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
Closes #14006

config/kernel.m4

index 4a5e2a8dd01d5c056c61bf9a183846dcd2fd53e5..a3806221687fd651c4259c5cbcfaa11ba96bac09 100644 (file)
@@ -932,8 +932,15 @@ dnl # like ZFS_LINUX_TRY_COMPILE, except the contents conftest.h are
 dnl # provided via the fifth parameter
 dnl #
 AC_DEFUN([ZFS_LINUX_TRY_COMPILE_HEADER], [
-       ZFS_LINUX_COMPILE_IFELSE(
-           [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]], [[ZFS_META_LICENSE]])],
-           [test -f build/conftest/conftest.ko],
-           [$3], [$4], [$5])
+       AS_IF([test "x$enable_linux_builtin" = "xyes"], [
+               ZFS_LINUX_COMPILE_IFELSE(
+                   [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]],
+                   [[ZFS_META_LICENSE]])],
+                   [test -f build/conftest/conftest.o], [$3], [$4], [$5])
+       ], [
+               ZFS_LINUX_COMPILE_IFELSE(
+                   [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]],
+                   [[ZFS_META_LICENSE]])],
+                   [test -f build/conftest/conftest.ko], [$3], [$4], [$5])
+       ])
 ])