2 dnl # Certain kernel build options are not supported. These must be
3 dnl # detected at configure time and cause a build failure. Otherwise
4 dnl # modules may be successfully built that behave incorrectly.
6 AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEFINED], [
7 AS_IF([test "x$cross_compiling" != xyes], [
10 #include "$LINUX/include/linux/license.h"
12 return !license_is_gpl_compatible(
16 AC_DEFINE([ZFS_IS_GPL_COMPATIBLE], [1],
17 [Define to 1 if GPL-only symbols can be used])
22 ZFS_AC_KERNEL_SRC_CONFIG_THREAD_SIZE
23 ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC
24 ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS
25 ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE
26 ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_DEFLATE
28 AC_MSG_CHECKING([for kernel config option compatibility])
29 ZFS_LINUX_TEST_COMPILE_ALL([config])
32 ZFS_AC_KERNEL_CONFIG_THREAD_SIZE
33 ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC
34 ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS
35 ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE
36 ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE
40 dnl # Check configured THREAD_SIZE
42 dnl # The stack size will vary by architecture, but as of Linux 3.15 on x86_64
43 dnl # the default thread stack size was increased to 16K from 8K. Therefore,
44 dnl # on newer kernels and some architectures stack usage optimizations can be
45 dnl # conditionally applied to improve performance without negatively impacting
48 AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_THREAD_SIZE], [
49 ZFS_LINUX_TEST_SRC([config_thread_size], [
50 #include <linux/module.h>
52 #if (THREAD_SIZE < 16384)
53 #error "THREAD_SIZE is less than 16K"
58 AC_DEFUN([ZFS_AC_KERNEL_CONFIG_THREAD_SIZE], [
59 AC_MSG_CHECKING([whether kernel was built with 16K or larger stacks])
60 ZFS_LINUX_TEST_RESULT([config_thread_size], [
62 AC_DEFINE(HAVE_LARGE_STACKS, 1, [kernel has large stacks])
69 dnl # Check CONFIG_DEBUG_LOCK_ALLOC
71 dnl # This is typically only set for debug kernels because it comes with
72 dnl # a performance penalty. However, when it is set it maps the non-GPL
73 dnl # symbol mutex_lock() to the GPL-only mutex_lock_nested() symbol.
74 dnl # This will cause a failure at link time which we'd rather know about
75 dnl # at compile time.
77 dnl # Since we plan to pursue making mutex_lock_nested() a non-GPL symbol
78 dnl # with the upstream community we add a check to detect this case.
80 AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC], [
81 ZFS_LINUX_TEST_SRC([config_debug_lock_alloc], [
82 #include <linux/mutex.h>
89 ], [], [$ZFS_META_LICENSE])
92 AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [
93 AC_MSG_CHECKING([whether mutex_lock() is GPL-only])
94 ZFS_LINUX_TEST_RESULT([config_debug_lock_alloc], [
99 *** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible
100 *** with the CDDL license and will prevent the module linking stage
101 *** from succeeding. You must rebuild your kernel without this
102 *** option enabled.])
107 dnl # Check CONFIG_TRIM_UNUSED_KSYMS
109 dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS disabled.
111 AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS], [
112 ZFS_LINUX_TEST_SRC([config_trim_unusued_ksyms], [
113 #if defined(CONFIG_TRIM_UNUSED_KSYMS)
114 #error CONFIG_TRIM_UNUSED_KSYMS not defined
119 AC_DEFUN([ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS], [
120 AC_MSG_CHECKING([whether CONFIG_TRIM_UNUSED_KSYM is disabled])
121 ZFS_LINUX_TEST_RESULT([config_trim_unusued_ksyms], [
125 AS_IF([test "x$enable_linux_builtin" != xyes], [
127 *** This kernel has unused symbols trimming enabled, please disable.
128 *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.])
134 dnl # Check CONFIG_ZLIB_INFLATE
136 dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
138 AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE], [
139 ZFS_LINUX_TEST_SRC([config_zlib_inflate], [
140 #if !defined(CONFIG_ZLIB_INFLATE) && \
141 !defined(CONFIG_ZLIB_INFLATE_MODULE)
142 #error CONFIG_ZLIB_INFLATE not defined
147 AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE], [
148 AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined])
149 ZFS_LINUX_TEST_RESULT([config_zlib_inflate], [
154 *** This kernel does not include the required zlib inflate support.
155 *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.])
160 dnl # Check CONFIG_ZLIB_DEFLATE
162 dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
164 AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_DEFLATE], [
165 ZFS_LINUX_TEST_SRC([config_zlib_deflate], [
166 #if !defined(CONFIG_ZLIB_DEFLATE) && \
167 !defined(CONFIG_ZLIB_DEFLATE_MODULE)
168 #error CONFIG_ZLIB_DEFLATE not defined
173 AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE], [
174 AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined])
175 ZFS_LINUX_TEST_RESULT([config_zlib_deflate], [
180 *** This kernel does not include the required zlib deflate support.
181 *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.])