]>
Commit | Line | Data |
---|---|---|
608f8749 BB |
1 | dnl # |
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. | |
5 | dnl # | |
6 | AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEFINED], [ | |
7 | AS_IF([test "x$cross_compiling" != xyes], [ | |
8 | AC_RUN_IFELSE([ | |
9 | AC_LANG_PROGRAM([ | |
10 | #include "$LINUX/include/linux/license.h" | |
11 | ], [ | |
12 | return !license_is_gpl_compatible( | |
13 | "$ZFS_META_LICENSE"); | |
14 | ]) | |
15 | ], [ | |
16 | AC_DEFINE([ZFS_IS_GPL_COMPATIBLE], [1], | |
17 | [Define to 1 if GPL-only symbols can be used]) | |
18 | ], [ | |
19 | ]) | |
20 | ]) | |
21 | ||
a0dfd98a | 22 | ZFS_AC_KERNEL_SRC_CONFIG_MODULES |
2f31b585 | 23 | ZFS_AC_KERNEL_SRC_CONFIG_BLOCK |
608f8749 BB |
24 | ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC |
25 | ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS | |
608f8749 | 26 | ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_DEFLATE |
2f31b585 | 27 | ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE |
608f8749 BB |
28 | |
29 | AC_MSG_CHECKING([for kernel config option compatibility]) | |
30 | ZFS_LINUX_TEST_COMPILE_ALL([config]) | |
31 | AC_MSG_RESULT([done]) | |
32 | ||
a0dfd98a | 33 | ZFS_AC_KERNEL_CONFIG_MODULES |
2f31b585 | 34 | ZFS_AC_KERNEL_CONFIG_BLOCK |
608f8749 BB |
35 | ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC |
36 | ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS | |
608f8749 | 37 | ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE |
2f31b585 DS |
38 | ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE |
39 | ]) | |
40 | ||
41 | dnl # | |
42 | dnl # Check CONFIG_BLOCK | |
43 | dnl # | |
44 | dnl # Verify the kernel has CONFIG_BLOCK support enabled. | |
45 | dnl # | |
46 | AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_BLOCK], [ | |
47 | ZFS_LINUX_TEST_SRC([config_block], [ | |
48 | #if !defined(CONFIG_BLOCK) | |
49 | #error CONFIG_BLOCK not defined | |
50 | #endif | |
51 | ],[]) | |
52 | ]) | |
53 | ||
54 | AC_DEFUN([ZFS_AC_KERNEL_CONFIG_BLOCK], [ | |
55 | AC_MSG_CHECKING([whether CONFIG_BLOCK is defined]) | |
56 | ZFS_LINUX_TEST_RESULT([config_block], [ | |
57 | AC_MSG_RESULT([yes]) | |
58 | ],[ | |
59 | AC_MSG_RESULT([no]) | |
60 | AC_MSG_ERROR([ | |
61 | *** This kernel does not include the required block device support. | |
62 | *** Rebuild the kernel with CONFIG_BLOCK=y set.]) | |
63 | ]) | |
608f8749 BB |
64 | ]) |
65 | ||
608f8749 BB |
66 | dnl # |
67 | dnl # Check CONFIG_DEBUG_LOCK_ALLOC | |
68 | dnl # | |
69 | dnl # This is typically only set for debug kernels because it comes with | |
70 | dnl # a performance penalty. However, when it is set it maps the non-GPL | |
71 | dnl # symbol mutex_lock() to the GPL-only mutex_lock_nested() symbol. | |
72 | dnl # This will cause a failure at link time which we'd rather know about | |
73 | dnl # at compile time. | |
74 | dnl # | |
75 | dnl # Since we plan to pursue making mutex_lock_nested() a non-GPL symbol | |
76 | dnl # with the upstream community we add a check to detect this case. | |
77 | dnl # | |
78 | AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_DEBUG_LOCK_ALLOC], [ | |
79 | ZFS_LINUX_TEST_SRC([config_debug_lock_alloc], [ | |
80 | #include <linux/mutex.h> | |
81 | ],[ | |
82 | struct mutex lock; | |
83 | ||
84 | mutex_init(&lock); | |
85 | mutex_lock(&lock); | |
86 | mutex_unlock(&lock); | |
c347fac5 | 87 | ], [], [ZFS_META_LICENSE]) |
608f8749 BB |
88 | ]) |
89 | ||
90 | AC_DEFUN([ZFS_AC_KERNEL_CONFIG_DEBUG_LOCK_ALLOC], [ | |
91 | AC_MSG_CHECKING([whether mutex_lock() is GPL-only]) | |
4c5159cc | 92 | ZFS_LINUX_TEST_RESULT([config_debug_lock_alloc_license], [ |
608f8749 BB |
93 | AC_MSG_RESULT(no) |
94 | ],[ | |
95 | AC_MSG_RESULT(yes) | |
96 | AC_MSG_ERROR([ | |
97 | *** Kernel built with CONFIG_DEBUG_LOCK_ALLOC which is incompatible | |
98 | *** with the CDDL license and will prevent the module linking stage | |
99 | *** from succeeding. You must rebuild your kernel without this | |
100 | *** option enabled.]) | |
101 | ]) | |
102 | ]) | |
103 | ||
a0dfd98a DS |
104 | dnl # |
105 | dnl # Check CONFIG_MODULES | |
106 | dnl # | |
107 | dnl # Verify the kernel has CONFIG_MODULES support enabled. | |
108 | dnl # | |
109 | AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_MODULES], [ | |
110 | ZFS_LINUX_TEST_SRC([config_modules], [ | |
111 | #if !defined(CONFIG_MODULES) | |
112 | #error CONFIG_MODULES not defined | |
113 | #endif | |
114 | ],[]) | |
115 | ]) | |
116 | ||
117 | AC_DEFUN([ZFS_AC_KERNEL_CONFIG_MODULES], [ | |
118 | AC_MSG_CHECKING([whether CONFIG_MODULES is defined]) | |
119 | AS_IF([test "x$enable_linux_builtin" != xyes], [ | |
120 | ZFS_LINUX_TEST_RESULT([config_modules], [ | |
121 | AC_MSG_RESULT([yes]) | |
122 | ],[ | |
123 | AC_MSG_RESULT([no]) | |
124 | AC_MSG_ERROR([ | |
125 | *** This kernel does not include the required loadable module | |
126 | *** support! | |
127 | *** | |
128 | *** To build OpenZFS as a loadable Linux kernel module | |
129 | *** enable loadable module support by setting | |
130 | *** `CONFIG_MODULES=y` in the kernel configuration and run | |
131 | *** `make modules_prepare` in the Linux source tree. | |
132 | *** | |
133 | *** If you don't intend to enable loadable kernel module | |
134 | *** support, please compile OpenZFS as a Linux kernel built-in. | |
135 | *** | |
136 | *** Prepare the Linux source tree by running `make prepare`, | |
137 | *** use the OpenZFS `--enable-linux-builtin` configure option, | |
138 | *** copy the OpenZFS sources into the Linux source tree using | |
139 | *** `./copy-builtin <linux source directory>`, | |
140 | *** set `CONFIG_ZFS=y` in the kernel configuration and compile | |
141 | *** kernel as usual. | |
142 | ]) | |
143 | ]) | |
144 | ], [ | |
145 | ZFS_LINUX_TRY_COMPILE([], [], [ | |
146 | AC_MSG_RESULT([not needed]) | |
147 | ],[ | |
148 | AC_MSG_RESULT([error]) | |
149 | AC_MSG_ERROR([ | |
150 | *** This kernel is unable to compile object files. | |
151 | *** | |
152 | *** Please make sure you prepared the Linux source tree | |
153 | *** by running `make prepare` there. | |
154 | ]) | |
155 | ]) | |
156 | ]) | |
157 | ]) | |
158 | ||
608f8749 BB |
159 | dnl # |
160 | dnl # Check CONFIG_TRIM_UNUSED_KSYMS | |
161 | dnl # | |
162 | dnl # Verify the kernel has CONFIG_TRIM_UNUSED_KSYMS disabled. | |
163 | dnl # | |
164 | AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_TRIM_UNUSED_KSYMS], [ | |
165 | ZFS_LINUX_TEST_SRC([config_trim_unusued_ksyms], [ | |
166 | #if defined(CONFIG_TRIM_UNUSED_KSYMS) | |
167 | #error CONFIG_TRIM_UNUSED_KSYMS not defined | |
168 | #endif | |
169 | ],[]) | |
170 | ]) | |
171 | ||
172 | AC_DEFUN([ZFS_AC_KERNEL_CONFIG_TRIM_UNUSED_KSYMS], [ | |
173 | AC_MSG_CHECKING([whether CONFIG_TRIM_UNUSED_KSYM is disabled]) | |
174 | ZFS_LINUX_TEST_RESULT([config_trim_unusued_ksyms], [ | |
175 | AC_MSG_RESULT([yes]) | |
176 | ],[ | |
177 | AC_MSG_RESULT([no]) | |
178 | AS_IF([test "x$enable_linux_builtin" != xyes], [ | |
179 | AC_MSG_ERROR([ | |
180 | *** This kernel has unused symbols trimming enabled, please disable. | |
181 | *** Rebuild the kernel with CONFIG_TRIM_UNUSED_KSYMS=n set.]) | |
182 | ]) | |
183 | ]) | |
184 | ]) | |
185 | ||
186 | dnl # | |
187 | dnl # Check CONFIG_ZLIB_INFLATE | |
188 | dnl # | |
189 | dnl # Verify the kernel has CONFIG_ZLIB_INFLATE support enabled. | |
190 | dnl # | |
191 | AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_INFLATE], [ | |
192 | ZFS_LINUX_TEST_SRC([config_zlib_inflate], [ | |
193 | #if !defined(CONFIG_ZLIB_INFLATE) && \ | |
194 | !defined(CONFIG_ZLIB_INFLATE_MODULE) | |
195 | #error CONFIG_ZLIB_INFLATE not defined | |
196 | #endif | |
197 | ],[]) | |
198 | ]) | |
199 | ||
200 | AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_INFLATE], [ | |
201 | AC_MSG_CHECKING([whether CONFIG_ZLIB_INFLATE is defined]) | |
202 | ZFS_LINUX_TEST_RESULT([config_zlib_inflate], [ | |
203 | AC_MSG_RESULT([yes]) | |
204 | ],[ | |
205 | AC_MSG_RESULT([no]) | |
206 | AC_MSG_ERROR([ | |
207 | *** This kernel does not include the required zlib inflate support. | |
208 | *** Rebuild the kernel with CONFIG_ZLIB_INFLATE=y|m set.]) | |
209 | ]) | |
210 | ]) | |
211 | ||
212 | dnl # | |
213 | dnl # Check CONFIG_ZLIB_DEFLATE | |
214 | dnl # | |
215 | dnl # Verify the kernel has CONFIG_ZLIB_DEFLATE support enabled. | |
216 | dnl # | |
217 | AC_DEFUN([ZFS_AC_KERNEL_SRC_CONFIG_ZLIB_DEFLATE], [ | |
218 | ZFS_LINUX_TEST_SRC([config_zlib_deflate], [ | |
219 | #if !defined(CONFIG_ZLIB_DEFLATE) && \ | |
220 | !defined(CONFIG_ZLIB_DEFLATE_MODULE) | |
221 | #error CONFIG_ZLIB_DEFLATE not defined | |
222 | #endif | |
223 | ],[]) | |
224 | ]) | |
225 | ||
226 | AC_DEFUN([ZFS_AC_KERNEL_CONFIG_ZLIB_DEFLATE], [ | |
227 | AC_MSG_CHECKING([whether CONFIG_ZLIB_DEFLATE is defined]) | |
228 | ZFS_LINUX_TEST_RESULT([config_zlib_deflate], [ | |
229 | AC_MSG_RESULT([yes]) | |
230 | ],[ | |
231 | AC_MSG_RESULT([no]) | |
232 | AC_MSG_ERROR([ | |
233 | *** This kernel does not include the required zlib deflate support. | |
234 | *** Rebuild the kernel with CONFIG_ZLIB_DEFLATE=y|m set.]) | |
235 | ]) | |
236 | ]) |