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 ZFS_AC_KERNEL_SRC_CONFIG_MODULES
8 ZFS_AC_KERNEL_SRC_CONFIG_BLOCK
9 ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC
10 ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS
11 ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_DEFLATE
12 ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE
14 AC_MSG_CHECKING([for kernel config option compatibility])
15 ZFS_LINUX_TEST_COMPILE_ALL([config])
18 ZFS_AC_KERNEL_CONFIG_MODULES
19 ZFS_AC_KERNEL_CONFIG_BLOCK
20 ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC
21 ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS
22 ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE
23 ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE
27 dnl # Check CONFIG_BLOCK
29 dnl # Verify the kernel has CONFIG_BLOCK support enabled.
31 AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_BLOCK], [
32 ZFS_LINUX_TEST_SRC([config_block], [
33 #if !defined(CONFIG_BLOCK)
34 #error CONFIG_BLOCK not defined
39 AC_DEFUN([ZFS_AC_KERNEL_CONFIG_BLOCK], [
40 AC_MSG_CHECKING([whether CONFIG_BLOCK is defined])
41 ZFS_LINUX_TEST_RESULT([config_block], [
46 *** This kernel does not include the required block device support.
47 *** Rebuild the kernel with CONFIG_BLOCK=y set.])
52 dnl # Check CONFIG_DEBUG_LOCK_ALLOC
54 dnl # This is typically only set for debug kernels because it comes with
55 dnl # a performance penalty. However, when it is set it maps the non-GPL
56 dnl # symbol mutex_lock() to the GPL-only mutex_lock_nested() symbol.
57 dnl # This will cause a failure at link time which we'd rather know about
58 dnl # at compile time.
60 dnl # Since we plan to pursue making mutex_lock_nested() a non-GPL symbol
61 dnl # with the upstream community we add a check to detect this case.
63 AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC], [
64 ZFS_LINUX_TEST_SRC([config_debug_lock_alloc], [
65 #include <linux/mutex.h>
72 ], [], [ZFS_META_LICENSE])
75 AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [
76 AC_MSG_CHECKING([whether mutex_lock() is GPL-only])
77 ZFS_LINUX_TEST_RESULT([config_debug_lock_alloc_license], [
82 *** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible
83 *** with the CDDL license and will prevent the module linking stage
84 *** from succeeding. You must rebuild your kernel without this
90 dnl # Check CONFIG_MODULES
92 dnl # Verify the kernel has CONFIG_MODULES support enabled.
94 AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_MODULES], [
95 ZFS_LINUX_TEST_SRC([config_modules], [
96 #if !defined(CONFIG_MODULES)
97 #error CONFIG_MODULES not defined
102 AC_DEFUN([ZFS_AC_KERNEL_CONFIG_MODULES], [
103 AC_MSG_CHECKING([whether CONFIG_MODULES is defined])
104 AS_IF([test "x$enable_linux_builtin" != xyes], [
105 ZFS_LINUX_TEST_RESULT([config_modules], [
110 *** This kernel does not include the required loadable module
113 *** To build OpenZFS as a loadable Linux kernel module
114 *** enable loadable module support by setting
115 *** `CONFIG_MODULES=y` in the kernel configuration and run
116 *** `make modules_prepare` in the Linux source tree.
118 *** If you don't intend to enable loadable kernel module
119 *** support, please compile OpenZFS as a Linux kernel built-in.
121 *** Prepare the Linux source tree by running `make prepare`,
122 *** use the OpenZFS `--enable-linux-builtin` configure option,
123 *** copy the OpenZFS sources into the Linux source tree using
124 *** `./copy-builtin <linux source directory>`,
125 *** set `CONFIG_ZFS=y` in the kernel configuration and compile
130 ZFS_LINUX_TRY_COMPILE([], [], [
131 AC_MSG_RESULT([not needed])
133 AC_MSG_RESULT([error])
135 *** This kernel is unable to compile object files.
137 *** Please make sure you prepared the Linux source tree
138 *** by running `make prepare` there.
145 dnl # Check CONFIG_TRIM_UNUSED_KSYMS
147 dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS disabled.
149 AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS], [
150 ZFS_LINUX_TEST_SRC([config_trim_unusued_ksyms], [
151 #if defined(CONFIG_TRIM_UNUSED_KSYMS)
152 #error CONFIG_TRIM_UNUSED_KSYMS not defined
157 AC_DEFUN([ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS], [
158 AC_MSG_CHECKING([whether CONFIG_TRIM_UNUSED_KSYM is disabled])
159 ZFS_LINUX_TEST_RESULT([config_trim_unusued_ksyms], [
163 AS_IF([test "x$enable_linux_builtin" != xyes], [
165 *** This kernel has unused symbols trimming enabled, please disable.
166 *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.])
172 dnl # Check CONFIG_ZLIB_INFLATE
174 dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled.
176 AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE], [
177 ZFS_LINUX_TEST_SRC([config_zlib_inflate], [
178 #if !defined(CONFIG_ZLIB_INFLATE) && \
179 !defined(CONFIG_ZLIB_INFLATE_MODULE)
180 #error CONFIG_ZLIB_INFLATE not defined
185 AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE], [
186 AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined])
187 ZFS_LINUX_TEST_RESULT([config_zlib_inflate], [
192 *** This kernel does not include the required zlib inflate support.
193 *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.])
198 dnl # Check CONFIG_ZLIB_DEFLATE
200 dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled.
202 AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_DEFLATE], [
203 ZFS_LINUX_TEST_SRC([config_zlib_deflate], [
204 #if !defined(CONFIG_ZLIB_DEFLATE) && \
205 !defined(CONFIG_ZLIB_DEFLATE_MODULE)
206 #error CONFIG_ZLIB_DEFLATE not defined
211 AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE], [
212 AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined])
213 ZFS_LINUX_TEST_RESULT([config_zlib_deflate], [
218 *** This kernel does not include the required zlib deflate support.
219 *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.])