]>
Commit | Line | Data |
---|---|---|
c9c0d073 | 1 | dnl # |
fc0c72b1 | 2 | dnl # Default ZFS kernel configuration |
c9c0d073 BB |
3 | dnl # |
4 | AC_DEFUN([ZFS_AC_CONFIG_KERNEL], [ | |
9f0a21e6 MM |
5 | AM_COND_IF([BUILD_LINUX], [ |
6 | dnl # Setup the kernel build environment. | |
7 | ZFS_AC_KERNEL | |
8 | ZFS_AC_QAT | |
608f8749 | 9 | |
9f0a21e6 MM |
10 | dnl # Sanity checks for module building and CONFIG_* defines |
11 | ZFS_AC_KERNEL_TEST_MODULE | |
12 | ZFS_AC_KERNEL_CONFIG_DEFINED | |
608f8749 | 13 | |
9f0a21e6 MM |
14 | dnl # Sequential ZFS_LINUX_TRY_COMPILE tests |
15 | ZFS_AC_KERNEL_FPU_HEADER | |
8c7d604c | 16 | ZFS_AC_KERNEL_OBJTOOL_HEADER |
9f0a21e6 MM |
17 | ZFS_AC_KERNEL_WAIT_QUEUE_ENTRY_T |
18 | ZFS_AC_KERNEL_MISC_MINOR | |
19 | ZFS_AC_KERNEL_DECLARE_EVENT_CLASS | |
608f8749 | 20 | |
9f0a21e6 MM |
21 | dnl # Parallel ZFS_LINUX_TEST_SRC / ZFS_LINUX_TEST_RESULT tests |
22 | ZFS_AC_KERNEL_TEST_SRC | |
23 | ZFS_AC_KERNEL_TEST_RESULT | |
608f8749 | 24 | |
9f0a21e6 MM |
25 | AS_IF([test "$LINUX_OBJ" != "$LINUX"], [ |
26 | KERNEL_MAKE="$KERNEL_MAKE O=$LINUX_OBJ" | |
27 | ]) | |
608f8749 | 28 | |
9f0a21e6 MM |
29 | AC_SUBST(KERNEL_MAKE) |
30 | ]) | |
608f8749 BB |
31 | ]) |
32 | ||
33 | dnl # | |
34 | dnl # Generate and compile all of the kernel API test cases to determine | |
35 | dnl # which interfaces are available. By invoking the kernel build system | |
36 | dnl # only once the compilation can be done in parallel significantly | |
37 | dnl # speeding up the process. | |
38 | dnl # | |
39 | AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [ | |
40 | ZFS_AC_KERNEL_SRC_OBJTOOL | |
41 | ZFS_AC_KERNEL_SRC_GLOBAL_PAGE_STATE | |
42 | ZFS_AC_KERNEL_SRC_ACCESS_OK_TYPE | |
608f8749 BB |
43 | ZFS_AC_KERNEL_SRC_PDE_DATA |
44 | ZFS_AC_KERNEL_SRC_FALLOCATE | |
45 | ZFS_AC_KERNEL_SRC_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE | |
46 | ZFS_AC_KERNEL_SRC_RWSEM | |
47 | ZFS_AC_KERNEL_SRC_SCHED | |
48 | ZFS_AC_KERNEL_SRC_USLEEP_RANGE | |
49 | ZFS_AC_KERNEL_SRC_KMEM_CACHE | |
66955885 | 50 | ZFS_AC_KERNEL_SRC_KVMALLOC |
080102a1 | 51 | ZFS_AC_KERNEL_SRC_VMALLOC_PAGE_KERNEL |
608f8749 BB |
52 | ZFS_AC_KERNEL_SRC_WAIT |
53 | ZFS_AC_KERNEL_SRC_INODE_TIMES | |
54 | ZFS_AC_KERNEL_SRC_INODE_LOCK | |
55 | ZFS_AC_KERNEL_SRC_GROUP_INFO_GID | |
56 | ZFS_AC_KERNEL_SRC_RW | |
57 | ZFS_AC_KERNEL_SRC_TIMER_SETUP | |
608f8749 | 58 | ZFS_AC_KERNEL_SRC_SUPER_USER_NS |
0dd73648 | 59 | ZFS_AC_KERNEL_SRC_PROC_OPERATIONS |
608f8749 | 60 | ZFS_AC_KERNEL_SRC_BLOCK_DEVICE_OPERATIONS |
066e8252 BB |
61 | ZFS_AC_KERNEL_SRC_BIO |
62 | ZFS_AC_KERNEL_SRC_BLKDEV | |
63 | ZFS_AC_KERNEL_SRC_BLK_QUEUE | |
19697e45 | 64 | ZFS_AC_KERNEL_SRC_REVALIDATE_DISK |
608f8749 BB |
65 | ZFS_AC_KERNEL_SRC_GET_DISK_RO |
66 | ZFS_AC_KERNEL_SRC_GENERIC_READLINK_GLOBAL | |
67 | ZFS_AC_KERNEL_SRC_DISCARD_GRANULARITY | |
68 | ZFS_AC_KERNEL_SRC_INODE_OWNER_OR_CAPABLE | |
69 | ZFS_AC_KERNEL_SRC_XATTR | |
70 | ZFS_AC_KERNEL_SRC_ACL | |
71 | ZFS_AC_KERNEL_SRC_INODE_GETATTR | |
72 | ZFS_AC_KERNEL_SRC_INODE_SET_FLAGS | |
73 | ZFS_AC_KERNEL_SRC_INODE_SET_IVERSION | |
74 | ZFS_AC_KERNEL_SRC_SHOW_OPTIONS | |
75 | ZFS_AC_KERNEL_SRC_FILE_INODE | |
76 | ZFS_AC_KERNEL_SRC_FILE_DENTRY | |
77 | ZFS_AC_KERNEL_SRC_FSYNC | |
78 | ZFS_AC_KERNEL_SRC_AIO_FSYNC | |
79 | ZFS_AC_KERNEL_SRC_EVICT_INODE | |
80 | ZFS_AC_KERNEL_SRC_DIRTY_INODE | |
81 | ZFS_AC_KERNEL_SRC_SHRINKER | |
e2a82961 | 82 | ZFS_AC_KERNEL_SRC_MKDIR |
066e8252 | 83 | ZFS_AC_KERNEL_SRC_LOOKUP_FLAGS |
e2a82961 | 84 | ZFS_AC_KERNEL_SRC_CREATE |
608f8749 BB |
85 | ZFS_AC_KERNEL_SRC_GET_LINK |
86 | ZFS_AC_KERNEL_SRC_PUT_LINK | |
87 | ZFS_AC_KERNEL_SRC_TMPFILE | |
608f8749 BB |
88 | ZFS_AC_KERNEL_SRC_AUTOMOUNT |
89 | ZFS_AC_KERNEL_SRC_ENCODE_FH_WITH_INODE | |
90 | ZFS_AC_KERNEL_SRC_COMMIT_METADATA | |
91 | ZFS_AC_KERNEL_SRC_CLEAR_INODE | |
92 | ZFS_AC_KERNEL_SRC_SETATTR_PREPARE | |
93 | ZFS_AC_KERNEL_SRC_INSERT_INODE_LOCKED | |
94 | ZFS_AC_KERNEL_SRC_DENTRY | |
95 | ZFS_AC_KERNEL_SRC_TRUNCATE_SETSIZE | |
96 | ZFS_AC_KERNEL_SRC_SECURITY_INODE | |
97 | ZFS_AC_KERNEL_SRC_FST_MOUNT | |
98 | ZFS_AC_KERNEL_SRC_BDI | |
99 | ZFS_AC_KERNEL_SRC_SET_NLINK | |
608f8749 BB |
100 | ZFS_AC_KERNEL_SRC_SGET |
101 | ZFS_AC_KERNEL_SRC_LSEEK_EXECUTE | |
102 | ZFS_AC_KERNEL_SRC_VFS_GETATTR | |
103 | ZFS_AC_KERNEL_SRC_VFS_FSYNC_2ARGS | |
104 | ZFS_AC_KERNEL_SRC_VFS_ITERATE | |
105 | ZFS_AC_KERNEL_SRC_VFS_DIRECT_IO | |
106 | ZFS_AC_KERNEL_SRC_VFS_RW_ITERATE | |
107 | ZFS_AC_KERNEL_SRC_VFS_GENERIC_WRITE_CHECKS | |
1c2358c1 | 108 | ZFS_AC_KERNEL_SRC_VFS_IOV_ITER |
608f8749 BB |
109 | ZFS_AC_KERNEL_SRC_KMAP_ATOMIC_ARGS |
110 | ZFS_AC_KERNEL_SRC_FOLLOW_DOWN_ONE | |
111 | ZFS_AC_KERNEL_SRC_MAKE_REQUEST_FN | |
112 | ZFS_AC_KERNEL_SRC_GENERIC_IO_ACCT | |
113 | ZFS_AC_KERNEL_SRC_FPU | |
114 | ZFS_AC_KERNEL_SRC_FMODE_T | |
115 | ZFS_AC_KERNEL_SRC_KUIDGID_T | |
116 | ZFS_AC_KERNEL_SRC_KUID_HELPERS | |
117 | ZFS_AC_KERNEL_SRC_MODULE_PARAM_CALL_CONST | |
e2a82961 | 118 | ZFS_AC_KERNEL_SRC_RENAME |
608f8749 BB |
119 | ZFS_AC_KERNEL_SRC_CURRENT_TIME |
120 | ZFS_AC_KERNEL_SRC_USERNS_CAPABILITIES | |
121 | ZFS_AC_KERNEL_SRC_IN_COMPAT_SYSCALL | |
ff5587d6 | 122 | ZFS_AC_KERNEL_SRC_KTIME |
608f8749 BB |
123 | ZFS_AC_KERNEL_SRC_TOTALRAM_PAGES_FUNC |
124 | ZFS_AC_KERNEL_SRC_TOTALHIGH_PAGES | |
125 | ZFS_AC_KERNEL_SRC_KSTRTOUL | |
ec1fea45 | 126 | ZFS_AC_KERNEL_SRC_PERCPU |
60a4c7d2 | 127 | ZFS_AC_KERNEL_SRC_CPU_HOTPLUG |
e2a82961 CK |
128 | ZFS_AC_KERNEL_SRC_GENERIC_FILLATTR_USERNS |
129 | ZFS_AC_KERNEL_SRC_MKNOD | |
130 | ZFS_AC_KERNEL_SRC_SYMLINK | |
ffd6978e | 131 | ZFS_AC_KERNEL_SRC_BIO_MAX_SEGS |
414f7249 PD |
132 | ZFS_AC_KERNEL_SRC_SIGNAL_STOP |
133 | ZFS_AC_KERNEL_SRC_SIGINFO | |
134 | ZFS_AC_KERNEL_SRC_SET_SPECIAL_STATE | |
1c24bf96 | 135 | ZFS_AC_KERNEL_SRC_VFS_SET_PAGE_DIRTY_NOBUFFERS |
a3588c68 | 136 | ZFS_AC_KERNEL_SRC_STANDALONE_LINUX_STDARG |
c0fb44c5 | 137 | ZFS_AC_KERNEL_SRC_PAGEMAP_FOLIO_WAIT_BIT |
12fa250d | 138 | ZFS_AC_KERNEL_SRC_ADD_DISK |
a9856574 | 139 | ZFS_AC_KERNEL_SRC_KTHREAD |
608f8749 BB |
140 | |
141 | AC_MSG_CHECKING([for available kernel interfaces]) | |
142 | ZFS_LINUX_TEST_COMPILE_ALL([kabi]) | |
143 | AC_MSG_RESULT([done]) | |
144 | ]) | |
145 | ||
146 | dnl # | |
147 | dnl # Check results of kernel interface tests. | |
148 | dnl # | |
149 | AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [ | |
150 | ZFS_AC_KERNEL_ACCESS_OK_TYPE | |
151 | ZFS_AC_KERNEL_GLOBAL_PAGE_STATE | |
650383f2 | 152 | ZFS_AC_KERNEL_OBJTOOL |
93ce2b4c | 153 | ZFS_AC_KERNEL_PDE_DATA |
93ce2b4c BB |
154 | ZFS_AC_KERNEL_FALLOCATE |
155 | ZFS_AC_KERNEL_2ARGS_ZLIB_DEFLATE_WORKSPACESIZE | |
608f8749 BB |
156 | ZFS_AC_KERNEL_RWSEM |
157 | ZFS_AC_KERNEL_SCHED | |
93ce2b4c | 158 | ZFS_AC_KERNEL_USLEEP_RANGE |
608f8749 | 159 | ZFS_AC_KERNEL_KMEM_CACHE |
66955885 | 160 | ZFS_AC_KERNEL_KVMALLOC |
080102a1 | 161 | ZFS_AC_KERNEL_VMALLOC_PAGE_KERNEL |
608f8749 | 162 | ZFS_AC_KERNEL_WAIT |
6413c95f | 163 | ZFS_AC_KERNEL_INODE_TIMES |
93ce2b4c BB |
164 | ZFS_AC_KERNEL_INODE_LOCK |
165 | ZFS_AC_KERNEL_GROUP_INFO_GID | |
608f8749 | 166 | ZFS_AC_KERNEL_RW |
8b8b44d0 | 167 | ZFS_AC_KERNEL_TIMER_SETUP |
938cfeb0 | 168 | ZFS_AC_KERNEL_SUPER_USER_NS |
0dd73648 | 169 | ZFS_AC_KERNEL_PROC_OPERATIONS |
608f8749 | 170 | ZFS_AC_KERNEL_BLOCK_DEVICE_OPERATIONS |
066e8252 BB |
171 | ZFS_AC_KERNEL_BIO |
172 | ZFS_AC_KERNEL_BLKDEV | |
173 | ZFS_AC_KERNEL_BLK_QUEUE | |
19697e45 | 174 | ZFS_AC_KERNEL_REVALIDATE_DISK |
c9c0d073 | 175 | ZFS_AC_KERNEL_GET_DISK_RO |
a5e046ea | 176 | ZFS_AC_KERNEL_GENERIC_READLINK_GLOBAL |
ee5fd0bb | 177 | ZFS_AC_KERNEL_DISCARD_GRANULARITY |
023699cd | 178 | ZFS_AC_KERNEL_INODE_OWNER_OR_CAPABLE |
608f8749 BB |
179 | ZFS_AC_KERNEL_XATTR |
180 | ZFS_AC_KERNEL_ACL | |
181 | ZFS_AC_KERNEL_INODE_GETATTR | |
a5248129 | 182 | ZFS_AC_KERNEL_INODE_SET_FLAGS |
18f57327 | 183 | ZFS_AC_KERNEL_INODE_SET_IVERSION |
47621f3d | 184 | ZFS_AC_KERNEL_SHOW_OPTIONS |
534759fa | 185 | ZFS_AC_KERNEL_FILE_INODE |
d9c97ec0 | 186 | ZFS_AC_KERNEL_FILE_DENTRY |
adcd70bd | 187 | ZFS_AC_KERNEL_FSYNC |
7ca25051 | 188 | ZFS_AC_KERNEL_AIO_FSYNC |
608f8749 BB |
189 | ZFS_AC_KERNEL_EVICT_INODE |
190 | ZFS_AC_KERNEL_DIRTY_INODE | |
191 | ZFS_AC_KERNEL_SHRINKER | |
e2a82961 | 192 | ZFS_AC_KERNEL_MKDIR |
066e8252 | 193 | ZFS_AC_KERNEL_LOOKUP_FLAGS |
e2a82961 | 194 | ZFS_AC_KERNEL_CREATE |
beeed459 | 195 | ZFS_AC_KERNEL_GET_LINK |
bd29109f | 196 | ZFS_AC_KERNEL_PUT_LINK |
ace1eae8 | 197 | ZFS_AC_KERNEL_TMPFILE |
ebe7e575 | 198 | ZFS_AC_KERNEL_AUTOMOUNT |
756c3e5a | 199 | ZFS_AC_KERNEL_ENCODE_FH_WITH_INODE |
393b44c7 | 200 | ZFS_AC_KERNEL_COMMIT_METADATA |
739a1a82 | 201 | ZFS_AC_KERNEL_CLEAR_INODE |
3b0ba3ba | 202 | ZFS_AC_KERNEL_SETATTR_PREPARE |
bdf4328b | 203 | ZFS_AC_KERNEL_INSERT_INODE_LOCKED |
608f8749 | 204 | ZFS_AC_KERNEL_DENTRY |
b3129792 | 205 | ZFS_AC_KERNEL_TRUNCATE_SETSIZE |
608f8749 | 206 | ZFS_AC_KERNEL_SECURITY_INODE |
93b43af1 | 207 | ZFS_AC_KERNEL_FST_MOUNT |
7dae2c81 | 208 | ZFS_AC_KERNEL_BDI |
28eb9213 | 209 | ZFS_AC_KERNEL_SET_NLINK |
608f8749 | 210 | ZFS_AC_KERNEL_SGET |
802e7b5f | 211 | ZFS_AC_KERNEL_LSEEK_EXECUTE |
608f8749 BB |
212 | ZFS_AC_KERNEL_VFS_GETATTR |
213 | ZFS_AC_KERNEL_VFS_FSYNC_2ARGS | |
0f37d0c8 | 214 | ZFS_AC_KERNEL_VFS_ITERATE |
a584ef26 | 215 | ZFS_AC_KERNEL_VFS_DIRECT_IO |
608f8749 BB |
216 | ZFS_AC_KERNEL_VFS_RW_ITERATE |
217 | ZFS_AC_KERNEL_VFS_GENERIC_WRITE_CHECKS | |
1c2358c1 | 218 | ZFS_AC_KERNEL_VFS_IOV_ITER |
17888ae3 | 219 | ZFS_AC_KERNEL_KMAP_ATOMIC_ARGS |
278bee93 | 220 | ZFS_AC_KERNEL_FOLLOW_DOWN_ONE |
37f9dac5 | 221 | ZFS_AC_KERNEL_MAKE_REQUEST_FN |
608f8749 | 222 | ZFS_AC_KERNEL_GENERIC_IO_ACCT |
fc0c72b1 | 223 | ZFS_AC_KERNEL_FPU |
608f8749 BB |
224 | ZFS_AC_KERNEL_FMODE_T |
225 | ZFS_AC_KERNEL_KUIDGID_T | |
82a1b2d6 | 226 | ZFS_AC_KERNEL_KUID_HELPERS |
9cc1844a | 227 | ZFS_AC_KERNEL_MODULE_PARAM_CALL_CONST |
e2a82961 | 228 | ZFS_AC_KERNEL_RENAME |
2946a1a1 | 229 | ZFS_AC_KERNEL_CURRENT_TIME |
0e85048f | 230 | ZFS_AC_KERNEL_USERNS_CAPABILITIES |
e897a23e | 231 | ZFS_AC_KERNEL_IN_COMPAT_SYSCALL |
ff5587d6 | 232 | ZFS_AC_KERNEL_KTIME |
031cea17 | 233 | ZFS_AC_KERNEL_TOTALRAM_PAGES_FUNC |
de3e0b91 | 234 | ZFS_AC_KERNEL_TOTALHIGH_PAGES |
8708fd88 | 235 | ZFS_AC_KERNEL_KSTRTOUL |
ec1fea45 | 236 | ZFS_AC_KERNEL_PERCPU |
60a4c7d2 | 237 | ZFS_AC_KERNEL_CPU_HOTPLUG |
e2a82961 CK |
238 | ZFS_AC_KERNEL_GENERIC_FILLATTR_USERNS |
239 | ZFS_AC_KERNEL_MKNOD | |
240 | ZFS_AC_KERNEL_SYMLINK | |
ffd6978e | 241 | ZFS_AC_KERNEL_BIO_MAX_SEGS |
414f7249 PD |
242 | ZFS_AC_KERNEL_SIGNAL_STOP |
243 | ZFS_AC_KERNEL_SIGINFO | |
244 | ZFS_AC_KERNEL_SET_SPECIAL_STATE | |
1c24bf96 | 245 | ZFS_AC_KERNEL_VFS_SET_PAGE_DIRTY_NOBUFFERS |
a3588c68 | 246 | ZFS_AC_KERNEL_STANDALONE_LINUX_STDARG |
c0fb44c5 | 247 | ZFS_AC_KERNEL_PAGEMAP_FOLIO_WAIT_BIT |
12fa250d | 248 | ZFS_AC_KERNEL_ADD_DISK |
a9856574 | 249 | ZFS_AC_KERNEL_KTHREAD |
c9c0d073 BB |
250 | ]) |
251 | ||
252 | dnl # | |
253 | dnl # Detect name used for Module.symvers file in kernel | |
254 | dnl # | |
255 | AC_DEFUN([ZFS_AC_MODULE_SYMVERS], [ | |
256 | modpost=$LINUX/scripts/Makefile.modpost | |
257 | AC_MSG_CHECKING([kernel file name for module symbols]) | |
319a99a3 | 258 | AS_IF([test "x$enable_linux_builtin" != xyes -a -f "$modpost"], [ |
8366cd6a | 259 | AS_IF([grep -q Modules.symvers $modpost], [ |
c9c0d073 | 260 | LINUX_SYMBOLS=Modules.symvers |
8366cd6a | 261 | ], [ |
c9c0d073 | 262 | LINUX_SYMBOLS=Module.symvers |
8366cd6a | 263 | ]) |
a60b1c0a | 264 | |
8366cd6a | 265 | AS_IF([test ! -f "$LINUX_OBJ/$LINUX_SYMBOLS"], [ |
a60b1c0a BB |
266 | AC_MSG_ERROR([ |
267 | *** Please make sure the kernel devel package for your distribution | |
608f8749 BB |
268 | *** is installed. If you are building with a custom kernel, make sure |
269 | *** the kernel is configured, built, and the '--with-linux=PATH' | |
270 | *** configure option refers to the location of the kernel source. | |
271 | ]) | |
8366cd6a PS |
272 | ]) |
273 | ], [ | |
c9c0d073 | 274 | LINUX_SYMBOLS=NONE |
8366cd6a | 275 | ]) |
c9c0d073 BB |
276 | AC_MSG_RESULT($LINUX_SYMBOLS) |
277 | AC_SUBST(LINUX_SYMBOLS) | |
278 | ]) | |
279 | ||
280 | dnl # | |
281 | dnl # Detect the kernel to be built against | |
282 | dnl # | |
283 | AC_DEFUN([ZFS_AC_KERNEL], [ | |
284 | AC_ARG_WITH([linux], | |
285 | AS_HELP_STRING([--with-linux=PATH], | |
286 | [Path to kernel source]), | |
287 | [kernelsrc="$withval"]) | |
288 | ||
289 | AC_ARG_WITH(linux-obj, | |
290 | AS_HELP_STRING([--with-linux-obj=PATH], | |
291 | [Path to kernel build objects]), | |
292 | [kernelbuild="$withval"]) | |
293 | ||
294 | AC_MSG_CHECKING([kernel source directory]) | |
8366cd6a PS |
295 | AS_IF([test -z "$kernelsrc"], [ |
296 | AS_IF([test -e "/lib/modules/$(uname -r)/source"], [ | |
1b94c25c BB |
297 | headersdir="/lib/modules/$(uname -r)/source" |
298 | sourcelink=$(readlink -f "$headersdir") | |
8366cd6a | 299 | ], [test -e "/lib/modules/$(uname -r)/build"], [ |
1b94c25c | 300 | headersdir="/lib/modules/$(uname -r)/build" |
c9c0d073 | 301 | sourcelink=$(readlink -f "$headersdir") |
8366cd6a | 302 | ], [ |
c9c0d073 | 303 | sourcelink=$(ls -1d /usr/src/kernels/* \ |
8366cd6a | 304 | /usr/src/linux-* \ |
c9c0d073 | 305 | 2>/dev/null | grep -v obj | tail -1) |
8366cd6a | 306 | ]) |
c9c0d073 | 307 | |
8366cd6a | 308 | AS_IF([test -n "$sourcelink" && test -e ${sourcelink}], [ |
c9c0d073 | 309 | kernelsrc=`readlink -f ${sourcelink}` |
8366cd6a | 310 | ], [ |
56a517ae | 311 | kernelsrc="[Not found]" |
8366cd6a PS |
312 | ]) |
313 | ], [ | |
314 | AS_IF([test "$kernelsrc" = "NONE"], [ | |
c9c0d073 | 315 | kernsrcver=NONE |
8366cd6a | 316 | ]) |
1d8da991 | 317 | withlinux=yes |
8366cd6a | 318 | ]) |
c9c0d073 BB |
319 | |
320 | AC_MSG_RESULT([$kernelsrc]) | |
56a517ae BB |
321 | AS_IF([test ! -d "$kernelsrc"], [ |
322 | AC_MSG_ERROR([ | |
323 | *** Please make sure the kernel devel package for your distribution | |
4e95cc99 | 324 | *** is installed and then try again. If that fails, you can specify the |
56a517ae BB |
325 | *** location of the kernel source with the '--with-linux=PATH' option.]) |
326 | ]) | |
327 | ||
c9c0d073 | 328 | AC_MSG_CHECKING([kernel build directory]) |
8366cd6a | 329 | AS_IF([test -z "$kernelbuild"], [ |
1d8da991 | 330 | AS_IF([test x$withlinux != xyes -a -e "/lib/modules/$(uname -r)/build"], [ |
1b94c25c | 331 | kernelbuild=`readlink -f /lib/modules/$(uname -r)/build` |
8366cd6a | 332 | ], [test -d ${kernelsrc}-obj/${target_cpu}/${target_cpu}], [ |
c9c0d073 | 333 | kernelbuild=${kernelsrc}-obj/${target_cpu}/${target_cpu} |
8366cd6a | 334 | ], [test -d ${kernelsrc}-obj/${target_cpu}/default], [ |
70574182 | 335 | kernelbuild=${kernelsrc}-obj/${target_cpu}/default |
8366cd6a | 336 | ], [test -d `dirname ${kernelsrc}`/build-${target_cpu}], [ |
c9c0d073 | 337 | kernelbuild=`dirname ${kernelsrc}`/build-${target_cpu} |
8366cd6a | 338 | ], [ |
c9c0d073 | 339 | kernelbuild=${kernelsrc} |
8366cd6a PS |
340 | ]) |
341 | ]) | |
c9c0d073 BB |
342 | AC_MSG_RESULT([$kernelbuild]) |
343 | ||
344 | AC_MSG_CHECKING([kernel source version]) | |
345 | utsrelease1=$kernelbuild/include/linux/version.h | |
346 | utsrelease2=$kernelbuild/include/linux/utsrelease.h | |
347 | utsrelease3=$kernelbuild/include/generated/utsrelease.h | |
8366cd6a | 348 | AS_IF([test -r $utsrelease1 && fgrep -q UTS_RELEASE $utsrelease1], [ |
06346cc5 | 349 | utsrelease=$utsrelease1 |
8366cd6a | 350 | ], [test -r $utsrelease2 && fgrep -q UTS_RELEASE $utsrelease2], [ |
06346cc5 | 351 | utsrelease=$utsrelease2 |
8366cd6a | 352 | ], [test -r $utsrelease3 && fgrep -q UTS_RELEASE $utsrelease3], [ |
06346cc5 | 353 | utsrelease=$utsrelease3 |
8366cd6a | 354 | ]) |
c9c0d073 | 355 | |
06346cc5 BB |
356 | AS_IF([test -n "$utsrelease"], [ |
357 | kernsrcver=$($AWK '/UTS_RELEASE/ { gsub(/"/, "", $[3]); print $[3] }' $utsrelease) | |
8366cd6a | 358 | AS_IF([test -z "$kernsrcver"], [ |
c9c0d073 | 359 | AC_MSG_RESULT([Not found]) |
608f8749 BB |
360 | AC_MSG_ERROR([ |
361 | *** Cannot determine kernel version. | |
362 | ]) | |
8366cd6a PS |
363 | ]) |
364 | ], [ | |
c9c0d073 | 365 | AC_MSG_RESULT([Not found]) |
319a99a3 | 366 | if test "x$enable_linux_builtin" != xyes; then |
608f8749 BB |
367 | AC_MSG_ERROR([ |
368 | *** Cannot find UTS_RELEASE definition. | |
369 | ]) | |
319a99a3 ED |
370 | else |
371 | AC_MSG_ERROR([ | |
372 | *** Cannot find UTS_RELEASE definition. | |
373 | *** Please run 'make prepare' inside the kernel source tree.]) | |
374 | fi | |
8366cd6a | 375 | ]) |
c9c0d073 BB |
376 | |
377 | AC_MSG_RESULT([$kernsrcver]) | |
378 | ||
066e8252 BB |
379 | AS_VERSION_COMPARE([$kernsrcver], [$ZFS_META_KVER_MIN], [ |
380 | AC_MSG_ERROR([ | |
381 | *** Cannot build against kernel version $kernsrcver. | |
382 | *** The minimum supported kernel version is $ZFS_META_KVER_MIN. | |
383 | ]) | |
384 | ]) | |
385 | ||
c9c0d073 BB |
386 | LINUX=${kernelsrc} |
387 | LINUX_OBJ=${kernelbuild} | |
388 | LINUX_VERSION=${kernsrcver} | |
389 | ||
390 | AC_SUBST(LINUX) | |
391 | AC_SUBST(LINUX_OBJ) | |
392 | AC_SUBST(LINUX_VERSION) | |
393 | ||
394 | ZFS_AC_MODULE_SYMVERS | |
395 | ]) | |
396 | ||
6a9d6359 | 397 | dnl # |
608f8749 BB |
398 | dnl # Detect the QAT module to be built against, QAT provides hardware |
399 | dnl # acceleration for data compression: | |
400 | dnl # | |
401 | dnl # https://01.org/intel-quickassist-technology | |
402 | dnl # | |
403 | dnl # 1) Download and install QAT driver from the above link | |
404 | dnl # 2) Start QAT driver in your system: | |
405 | dnl # service qat_service start | |
406 | dnl # 3) Enable QAT in ZFS, e.g.: | |
407 | dnl # ./configure --with-qat=<qat-driver-path>/QAT1.6 | |
408 | dnl # make | |
409 | dnl # 4) Set GZIP compression in ZFS dataset: | |
410 | dnl # zfs set compression = gzip <dataset> | |
411 | dnl # | |
412 | dnl # Then the data written to this ZFS pool is compressed by QAT accelerator | |
413 | dnl # automatically, and de-compressed by QAT when read from the pool. | |
414 | dnl # | |
415 | dnl # 1) Get QAT hardware statistics with: | |
416 | dnl # cat /proc/icp_dh895xcc_dev/qat | |
417 | dnl # 2) To disable QAT: | |
418 | dnl # insmod zfs.ko zfs_qat_disable=1 | |
6a9d6359 | 419 | dnl # |
420 | AC_DEFUN([ZFS_AC_QAT], [ | |
421 | AC_ARG_WITH([qat], | |
422 | AS_HELP_STRING([--with-qat=PATH], | |
423 | [Path to qat source]), | |
424 | AS_IF([test "$withval" = "yes"], | |
425 | AC_MSG_ERROR([--with-qat=PATH requires a PATH]), | |
426 | [qatsrc="$withval"])) | |
427 | ||
428 | AC_ARG_WITH([qat-obj], | |
429 | AS_HELP_STRING([--with-qat-obj=PATH], | |
430 | [Path to qat build objects]), | |
431 | [qatbuild="$withval"]) | |
432 | ||
433 | AS_IF([test ! -z "${qatsrc}"], [ | |
434 | AC_MSG_CHECKING([qat source directory]) | |
435 | AC_MSG_RESULT([$qatsrc]) | |
436 | QAT_SRC="${qatsrc}/quickassist" | |
437 | AS_IF([ test ! -e "$QAT_SRC/include/cpa.h"], [ | |
438 | AC_MSG_ERROR([ | |
608f8749 BB |
439 | *** Please make sure the qat driver package is installed |
440 | *** and specify the location of the qat source with the | |
441 | *** '--with-qat=PATH' option then try again. Failed to | |
442 | *** find cpa.h in: | |
443 | ${QAT_SRC}/include]) | |
6a9d6359 | 444 | ]) |
445 | ]) | |
446 | ||
447 | AS_IF([test ! -z "${qatsrc}"], [ | |
448 | AC_MSG_CHECKING([qat build directory]) | |
449 | AS_IF([test -z "$qatbuild"], [ | |
450 | qatbuild="${qatsrc}/build" | |
451 | ]) | |
452 | ||
453 | AC_MSG_RESULT([$qatbuild]) | |
454 | QAT_OBJ=${qatbuild} | |
1cfdb0e6 | 455 | AS_IF([ ! test -e "$QAT_OBJ/icp_qa_al.ko" && ! test -e "$QAT_OBJ/qat_api.ko"], [ |
6a9d6359 | 456 | AC_MSG_ERROR([ |
608f8749 BB |
457 | *** Please make sure the qat driver is installed then try again. |
458 | *** Failed to find icp_qa_al.ko or qat_api.ko in: | |
459 | $QAT_OBJ]) | |
6a9d6359 | 460 | ]) |
461 | ||
462 | AC_SUBST(QAT_SRC) | |
463 | AC_SUBST(QAT_OBJ) | |
464 | ||
465 | AC_DEFINE(HAVE_QAT, 1, | |
466 | [qat is enabled and existed]) | |
467 | ]) | |
468 | ||
469 | dnl # | |
470 | dnl # Detect the name used for the QAT Module.symvers file. | |
471 | dnl # | |
472 | AS_IF([test ! -z "${qatsrc}"], [ | |
473 | AC_MSG_CHECKING([qat file for module symbols]) | |
474 | QAT_SYMBOLS=$QAT_SRC/lookaside/access_layer/src/Module.symvers | |
475 | ||
476 | AS_IF([test -r $QAT_SYMBOLS], [ | |
477 | AC_MSG_RESULT([$QAT_SYMBOLS]) | |
478 | AC_SUBST(QAT_SYMBOLS) | |
479 | ],[ | |
608f8749 BB |
480 | AC_MSG_ERROR([ |
481 | *** Please make sure the qat driver is installed then try again. | |
482 | *** Failed to find Module.symvers in: | |
483 | $QAT_SYMBOLS | |
6a9d6359 | 484 | ]) |
485 | ]) | |
486 | ]) | |
487 | ]) | |
488 | ||
319a99a3 ED |
489 | dnl # |
490 | dnl # Basic toolchain sanity check. | |
491 | dnl # | |
608f8749 | 492 | AC_DEFUN([ZFS_AC_KERNEL_TEST_MODULE], [ |
e33045ee | 493 | AC_MSG_CHECKING([whether modules can be built]) |
608f8749 | 494 | ZFS_LINUX_TRY_COMPILE([], [], [ |
319a99a3 ED |
495 | AC_MSG_RESULT([yes]) |
496 | ],[ | |
497 | AC_MSG_RESULT([no]) | |
498 | if test "x$enable_linux_builtin" != xyes; then | |
608f8749 BB |
499 | AC_MSG_ERROR([ |
500 | *** Unable to build an empty module. | |
501 | ]) | |
319a99a3 ED |
502 | else |
503 | AC_MSG_ERROR([ | |
504 | *** Unable to build an empty module. | |
505 | *** Please run 'make scripts' inside the kernel source tree.]) | |
506 | fi | |
507 | ]) | |
508 | ]) | |
509 | ||
15805c77 | 510 | dnl # |
608f8749 | 511 | dnl # ZFS_LINUX_CONFTEST_H |
15805c77 | 512 | dnl # |
608f8749 BB |
513 | AC_DEFUN([ZFS_LINUX_CONFTEST_H], [ |
514 | test -d build/$2 || mkdir -p build/$2 | |
515 | cat - <<_ACEOF >build/$2/$2.h | |
516 | $1 | |
517 | _ACEOF | |
518 | ]) | |
e5b85622 | 519 | |
608f8749 BB |
520 | dnl # |
521 | dnl # ZFS_LINUX_CONFTEST_C | |
522 | dnl # | |
523 | AC_DEFUN([ZFS_LINUX_CONFTEST_C], [ | |
524 | test -d build/$2 || mkdir -p build/$2 | |
525 | cat confdefs.h - <<_ACEOF >build/$2/$2.c | |
526 | $1 | |
527 | _ACEOF | |
e5b85622 BB |
528 | ]) |
529 | ||
b58986ee | 530 | dnl # |
608f8749 | 531 | dnl # ZFS_LINUX_CONFTEST_MAKEFILE |
b58986ee | 532 | dnl # |
608f8749 BB |
533 | dnl # $1 - test case name |
534 | dnl # $2 - add to top-level Makefile | |
535 | dnl # $3 - additional build flags | |
b58986ee | 536 | dnl # |
608f8749 BB |
537 | AC_DEFUN([ZFS_LINUX_CONFTEST_MAKEFILE], [ |
538 | test -d build || mkdir -p build | |
539 | test -d build/$1 || mkdir -p build/$1 | |
540 | ||
541 | file=build/$1/Makefile | |
542 | ||
543 | dnl # Example command line to manually build source. | |
544 | cat - <<_ACEOF >$file | |
545 | # Example command line to manually build source | |
546 | # make modules -C $LINUX_OBJ $ARCH_UM M=$PWD/build/$1 | |
547 | ||
548 | ccflags-y := -Werror $FRAME_LARGER_THAN | |
549 | _ACEOF | |
550 | ||
551 | dnl # Additional custom CFLAGS as requested. | |
552 | m4_ifval($3, [echo "ccflags-y += $3" >>$file], []) | |
553 | ||
554 | dnl # Test case source | |
555 | echo "obj-m := $1.o" >>$file | |
556 | ||
557 | AS_IF([test "x$2" = "xyes"], [echo "obj-m += $1/" >>build/Makefile], []) | |
b58986ee BB |
558 | ]) |
559 | ||
e5b85622 | 560 | dnl # |
608f8749 | 561 | dnl # ZFS_LINUX_TEST_PROGRAM(C)([PROLOGUE], [BODY]) |
e5b85622 | 562 | dnl # |
608f8749 | 563 | m4_define([ZFS_LINUX_TEST_PROGRAM], [ |
c347fac5 | 564 | #include <linux/module.h> |
608f8749 | 565 | $1 |
c347fac5 | 566 | |
608f8749 BB |
567 | int |
568 | main (void) | |
569 | { | |
570 | $2 | |
571 | ; | |
572 | return 0; | |
573 | } | |
c347fac5 BB |
574 | |
575 | MODULE_DESCRIPTION("conftest"); | |
576 | MODULE_AUTHOR(ZFS_META_AUTHOR); | |
577 | MODULE_VERSION(ZFS_META_VERSION "-" ZFS_META_RELEASE); | |
578 | MODULE_LICENSE($3); | |
608f8749 BB |
579 | ]) |
580 | ||
e5b85622 | 581 | dnl # |
608f8749 | 582 | dnl # ZFS_LINUX_TEST_REMOVE |
e5b85622 | 583 | dnl # |
608f8749 BB |
584 | dnl # Removes the specified test source and results. |
585 | dnl # | |
586 | AC_DEFUN([ZFS_LINUX_TEST_REMOVE], [ | |
587 | test -d build/$1 && rm -Rf build/$1 | |
588 | test -f build/Makefile && sed '/$1/d' build/Makefile | |
589 | ]) | |
e5b85622 | 590 | |
608f8749 BB |
591 | dnl # |
592 | dnl # ZFS_LINUX_COMPILE | |
593 | dnl # | |
594 | dnl # $1 - build dir | |
595 | dnl # $2 - test command | |
596 | dnl # $3 - pass command | |
597 | dnl # $4 - fail command | |
598 | dnl # $5 - set KBUILD_MODPOST_NOFINAL='yes' | |
599 | dnl # $6 - set KBUILD_MODPOST_WARN='yes' | |
600 | dnl # | |
601 | dnl # Used internally by ZFS_LINUX_TEST_{COMPILE,MODPOST} | |
602 | dnl # | |
603 | AC_DEFUN([ZFS_LINUX_COMPILE], [ | |
b66140c6 PL |
604 | AC_ARG_VAR([KERNEL_CC], [C compiler for |
605 | building kernel modules]) | |
606 | AC_ARG_VAR([KERNEL_LD], [Linker for | |
607 | building kernel modules]) | |
608 | AC_ARG_VAR([KERNEL_LLVM], [Binary option to | |
609 | build kernel modules with LLVM/CLANG toolchain]) | |
608f8749 BB |
610 | AC_TRY_COMMAND([ |
611 | KBUILD_MODPOST_NOFINAL="$5" KBUILD_MODPOST_WARN="$6" | |
b66140c6 | 612 | make modules -k -j$TEST_JOBS ${KERNEL_CC:+CC=$KERNEL_CC} ${KERNEL_LD:+LD=$KERNEL_LD} ${KERNEL_LLVM:+LLVM=$KERNEL_LLVM} -C $LINUX_OBJ $ARCH_UM |
db0ad393 | 613 | M=$PWD/$1 >$1/build.log 2>&1]) |
608f8749 | 614 | AS_IF([AC_TRY_COMMAND([$2])], [$3], [$4]) |
c9c0d073 BB |
615 | ]) |
616 | ||
617 | dnl # | |
608f8749 | 618 | dnl # ZFS_LINUX_TEST_COMPILE |
93ce2b4c | 619 | dnl # |
608f8749 | 620 | dnl # Perform a full compile excluding the final modpost phase. |
93ce2b4c | 621 | dnl # |
608f8749 BB |
622 | AC_DEFUN([ZFS_LINUX_TEST_COMPILE], [ |
623 | ZFS_LINUX_COMPILE([$2], [test -f $2/build.log], [ | |
624 | mv $2/Makefile $2/Makefile.compile.$1 | |
625 | mv $2/build.log $2/build.log.$1 | |
93ce2b4c | 626 | ],[ |
608f8749 BB |
627 | AC_MSG_ERROR([ |
628 | *** Unable to compile test source to determine kernel interfaces.]) | |
629 | ], [yes], []) | |
93ce2b4c BB |
630 | ]) |
631 | ||
632 | dnl # | |
608f8749 | 633 | dnl # ZFS_LINUX_TEST_MODPOST |
c9c0d073 | 634 | dnl # |
608f8749 BB |
635 | dnl # Perform a full compile including the modpost phase. This may |
636 | dnl # be an incremental build if the objects have already been built. | |
637 | dnl # | |
638 | AC_DEFUN([ZFS_LINUX_TEST_MODPOST], [ | |
639 | ZFS_LINUX_COMPILE([$2], [test -f $2/build.log], [ | |
640 | mv $2/Makefile $2/Makefile.modpost.$1 | |
641 | cat $2/build.log >>build/build.log.$1 | |
642 | ],[ | |
643 | AC_MSG_ERROR([ | |
644 | *** Unable to modpost test source to determine kernel interfaces.]) | |
645 | ], [], [yes]) | |
0b39b9f9 PS |
646 | ]) |
647 | ||
648 | dnl # | |
608f8749 | 649 | dnl # Perform the compilation of the test cases in two phases. |
0b39b9f9 | 650 | dnl # |
608f8749 BB |
651 | dnl # Phase 1) attempt to build the object files for all of the tests |
652 | dnl # defined by the ZFS_LINUX_TEST_SRC macro. But do not | |
653 | dnl # perform the final modpost stage. | |
654 | dnl # | |
655 | dnl # Phase 2) disable all tests which failed the initial compilation, | |
656 | dnl # then invoke the final modpost step for the remaining tests. | |
657 | dnl # | |
658 | dnl # This allows us efficiently build the test cases in parallel while | |
659 | dnl # remaining resilient to build failures which are expected when | |
660 | dnl # detecting the available kernel interfaces. | |
661 | dnl # | |
662 | dnl # The maximum allowed parallelism can be controlled by setting the | |
663 | dnl # TEST_JOBS environment variable. Otherwise, it default to $(nproc). | |
664 | dnl # | |
665 | AC_DEFUN([ZFS_LINUX_TEST_COMPILE_ALL], [ | |
666 | dnl # Phase 1 - Compilation only, final linking is skipped. | |
667 | ZFS_LINUX_TEST_COMPILE([$1], [build]) | |
668 | ||
669 | dnl # | |
670 | dnl # Phase 2 - When building external modules disable test cases | |
671 | dnl # which failed to compile and invoke modpost to verify the | |
672 | dnl # final linking. | |
673 | dnl # | |
674 | dnl # Test names suffixed with '_license' call modpost independently | |
675 | dnl # to ensure that a single incompatibility does not result in the | |
676 | dnl # modpost phase exiting early. This check is not performed on | |
677 | dnl # every symbol since the majority are compatible and doing so | |
678 | dnl # would significantly slow down this phase. | |
679 | dnl # | |
680 | dnl # When configuring for builtin (--enable-linux-builtin) | |
681 | dnl # fake the linking step artificially create the expected .ko | |
682 | dnl # files for tests which did compile. This is required for | |
683 | dnl # kernels which do not have loadable module support or have | |
684 | dnl # not yet been built. | |
685 | dnl # | |
686 | AS_IF([test "x$enable_linux_builtin" = "xno"], [ | |
687 | for dir in $(awk '/^obj-m/ { print [$]3 }' \ | |
688 | build/Makefile.compile.$1); do | |
689 | name=${dir%/} | |
690 | AS_IF([test -f build/$name/$name.o], [ | |
691 | AS_IF([test "${name##*_}" = "license"], [ | |
692 | ZFS_LINUX_TEST_MODPOST([$1], | |
693 | [build/$name]) | |
694 | echo "obj-n += $dir" >>build/Makefile | |
695 | ], [ | |
696 | echo "obj-m += $dir" >>build/Makefile | |
697 | ]) | |
698 | ], [ | |
699 | echo "obj-n += $dir" >>build/Makefile | |
700 | ]) | |
701 | done | |
702 | ||
703 | ZFS_LINUX_TEST_MODPOST([$1], [build]) | |
704 | ], [ | |
705 | for dir in $(awk '/^obj-m/ { print [$]3 }' \ | |
706 | build/Makefile.compile.$1); do | |
707 | name=${dir%/} | |
708 | AS_IF([test -f build/$name/$name.o], [ | |
709 | touch build/$name/$name.ko | |
710 | ]) | |
711 | done | |
712 | ]) | |
c9c0d073 BB |
713 | ]) |
714 | ||
715 | dnl # | |
608f8749 | 716 | dnl # ZFS_LINUX_TEST_SRC |
c9c0d073 | 717 | dnl # |
608f8749 BB |
718 | dnl # $1 - name |
719 | dnl # $2 - global | |
720 | dnl # $3 - source | |
721 | dnl # $4 - extra cflags | |
722 | dnl # $5 - check license-compatibility | |
723 | dnl # | |
c347fac5 BB |
724 | dnl # Check if the test source is buildable at all and then if it is |
725 | dnl # license compatible. | |
726 | dnl # | |
608f8749 BB |
727 | dnl # N.B because all of the test cases are compiled in parallel they |
728 | dnl # must never depend on the results of previous tests. Each test | |
729 | dnl # needs to be entirely independent. | |
730 | dnl # | |
731 | AC_DEFUN([ZFS_LINUX_TEST_SRC], [ | |
c347fac5 BB |
732 | ZFS_LINUX_CONFTEST_C([ZFS_LINUX_TEST_PROGRAM([[$2]], [[$3]], |
733 | [["Dual BSD/GPL"]])], [$1]) | |
608f8749 BB |
734 | ZFS_LINUX_CONFTEST_MAKEFILE([$1], [yes], [$4]) |
735 | ||
736 | AS_IF([ test -n "$5" ], [ | |
c347fac5 BB |
737 | ZFS_LINUX_CONFTEST_C([ZFS_LINUX_TEST_PROGRAM( |
738 | [[$2]], [[$3]], [[$5]])], [$1_license]) | |
608f8749 BB |
739 | ZFS_LINUX_CONFTEST_MAKEFILE([$1_license], [yes], [$4]) |
740 | ]) | |
c9c0d073 BB |
741 | ]) |
742 | ||
743 | dnl # | |
608f8749 | 744 | dnl # ZFS_LINUX_TEST_RESULT |
c9c0d073 | 745 | dnl # |
608f8749 BB |
746 | dnl # $1 - name of a test source (ZFS_LINUX_TEST_SRC) |
747 | dnl # $2 - run on success (valid .ko generated) | |
748 | dnl # $3 - run on failure (unable to compile) | |
749 | dnl # | |
750 | AC_DEFUN([ZFS_LINUX_TEST_RESULT], [ | |
751 | AS_IF([test -d build/$1], [ | |
752 | AS_IF([test -f build/$1/$1.ko], [$2], [$3]) | |
753 | ], [ | |
754 | AC_MSG_ERROR([ | |
755 | *** No matching source for the "$1" test, check that | |
756 | *** both the test source and result macros refer to the same name. | |
757 | ]) | |
758 | ]) | |
c9c0d073 BB |
759 | ]) |
760 | ||
761 | dnl # | |
608f8749 | 762 | dnl # ZFS_LINUX_TEST_ERROR |
c9c0d073 | 763 | dnl # |
608f8749 BB |
764 | dnl # Generic error message which can be used when none of the expected |
765 | dnl # kernel interfaces were detected. | |
766 | dnl # | |
767 | AC_DEFUN([ZFS_LINUX_TEST_ERROR], [ | |
768 | AC_MSG_ERROR([ | |
769 | *** None of the expected "$1" interfaces were detected. | |
770 | *** This may be because your kernel version is newer than what is | |
771 | *** supported, or you are using a patched custom kernel with | |
772 | *** incompatible modifications. | |
773 | *** | |
774 | *** ZFS Version: $ZFS_META_ALIAS | |
775 | *** Compatible Kernels: $ZFS_META_KVER_MIN - $ZFS_META_KVER_MAX | |
776 | ]) | |
c9c0d073 BB |
777 | ]) |
778 | ||
779 | dnl # | |
608f8749 | 780 | dnl # ZFS_LINUX_TEST_RESULT_SYMBOL |
c9c0d073 | 781 | dnl # |
608f8749 BB |
782 | dnl # Like ZFS_LINUX_TEST_RESULT except ZFS_CHECK_SYMBOL_EXPORT is called to |
783 | dnl # verify symbol exports, unless --enable-linux-builtin was provided to | |
784 | dnl # configure. | |
785 | dnl # | |
786 | AC_DEFUN([ZFS_LINUX_TEST_RESULT_SYMBOL], [ | |
787 | AS_IF([ ! test -f build/$1/$1.ko], [ | |
788 | $5 | |
789 | ], [ | |
790 | AS_IF([test "x$enable_linux_builtin" != "xyes"], [ | |
791 | ZFS_CHECK_SYMBOL_EXPORT([$2], [$3], [$4], [$5]) | |
792 | ], [ | |
793 | $4 | |
794 | ]) | |
c9c0d073 BB |
795 | ]) |
796 | ]) | |
797 | ||
608f8749 BB |
798 | dnl # |
799 | dnl # ZFS_LINUX_COMPILE_IFELSE | |
800 | dnl # | |
801 | AC_DEFUN([ZFS_LINUX_COMPILE_IFELSE], [ | |
802 | ZFS_LINUX_TEST_REMOVE([conftest]) | |
803 | ||
804 | m4_ifvaln([$1], [ZFS_LINUX_CONFTEST_C([$1], [conftest])]) | |
805 | m4_ifvaln([$5], [ZFS_LINUX_CONFTEST_H([$5], [conftest])], | |
806 | [ZFS_LINUX_CONFTEST_H([], [conftest])]) | |
807 | ||
808 | ZFS_LINUX_CONFTEST_MAKEFILE([conftest], [no], | |
809 | [m4_ifvaln([$5], [-I$PWD/build/conftest], [])]) | |
810 | ZFS_LINUX_COMPILE([build/conftest], [$2], [$3], [$4], [], []) | |
811 | ]) | |
812 | ||
813 | dnl # | |
814 | dnl # ZFS_LINUX_TRY_COMPILE | |
815 | dnl # | |
816 | dnl # $1 - global | |
817 | dnl # $2 - source | |
818 | dnl # $3 - run on success (valid .ko generated) | |
819 | dnl # $4 - run on failure (unable to compile) | |
820 | dnl # | |
3f99a3ab BB |
821 | dnl # When configuring as builtin (--enable-linux-builtin) for kernels |
822 | dnl # without loadable module support (CONFIG_MODULES=n) only the object | |
823 | dnl # file is created. See ZFS_LINUX_TEST_COMPILE_ALL for details. | |
824 | dnl # | |
608f8749 | 825 | AC_DEFUN([ZFS_LINUX_TRY_COMPILE], [ |
3f99a3ab BB |
826 | AS_IF([test "x$enable_linux_builtin" = "xyes"], [ |
827 | ZFS_LINUX_COMPILE_IFELSE( | |
c347fac5 BB |
828 | [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]], |
829 | [[ZFS_META_LICENSE]])], | |
3f99a3ab BB |
830 | [test -f build/conftest/conftest.o], [$3], [$4]) |
831 | ], [ | |
832 | ZFS_LINUX_COMPILE_IFELSE( | |
c347fac5 BB |
833 | [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]], |
834 | [[ZFS_META_LICENSE]])], | |
3f99a3ab BB |
835 | [test -f build/conftest/conftest.ko], [$3], [$4]) |
836 | ]) | |
608f8749 BB |
837 | ]) |
838 | ||
c9c0d073 BB |
839 | dnl # |
840 | dnl # ZFS_CHECK_SYMBOL_EXPORT | |
608f8749 BB |
841 | dnl # |
842 | dnl # Check if a symbol is exported on not by consulting the symbols | |
843 | dnl # file, or optionally the source code. | |
c9c0d073 | 844 | dnl # |
70574182 | 845 | AC_DEFUN([ZFS_CHECK_SYMBOL_EXPORT], [ |
c9c0d073 BB |
846 | grep -q -E '[[[:space:]]]$1[[[:space:]]]' \ |
847 | $LINUX_OBJ/$LINUX_SYMBOLS 2>/dev/null | |
848 | rc=$? | |
70574182 | 849 | if test $rc -ne 0; then |
c9c0d073 BB |
850 | export=0 |
851 | for file in $2; do | |
70574182 ED |
852 | grep -q -E "EXPORT_SYMBOL.*($1)" \ |
853 | "$LINUX/$file" 2>/dev/null | |
c9c0d073 | 854 | rc=$? |
70574182 | 855 | if test $rc -eq 0; then |
8366cd6a PS |
856 | export=1 |
857 | break; | |
70574182 | 858 | fi |
c9c0d073 | 859 | done |
70574182 | 860 | if test $export -eq 0; then : |
c9c0d073 | 861 | $4 |
70574182 | 862 | else : |
c9c0d073 | 863 | $3 |
70574182 ED |
864 | fi |
865 | else : | |
c9c0d073 | 866 | $3 |
70574182 ED |
867 | fi |
868 | ]) | |
869 | ||
870 | dnl # | |
871 | dnl # ZFS_LINUX_TRY_COMPILE_SYMBOL | |
608f8749 BB |
872 | dnl # |
873 | dnl # Like ZFS_LINUX_TRY_COMPILER except ZFS_CHECK_SYMBOL_EXPORT is called | |
874 | dnl # to verify symbol exports, unless --enable-linux-builtin was provided | |
875 | dnl # to configure. | |
70574182 ED |
876 | dnl # |
877 | AC_DEFUN([ZFS_LINUX_TRY_COMPILE_SYMBOL], [ | |
878 | ZFS_LINUX_TRY_COMPILE([$1], [$2], [rc=0], [rc=1]) | |
879 | if test $rc -ne 0; then : | |
880 | $6 | |
881 | else | |
882 | if test "x$enable_linux_builtin" != xyes; then | |
883 | ZFS_CHECK_SYMBOL_EXPORT([$3], [$4], [rc=0], [rc=1]) | |
884 | fi | |
885 | if test $rc -ne 0; then : | |
886 | $6 | |
887 | else : | |
888 | $5 | |
889 | fi | |
890 | fi | |
c9c0d073 | 891 | ]) |
0b39b9f9 PS |
892 | |
893 | dnl # | |
894 | dnl # ZFS_LINUX_TRY_COMPILE_HEADER | |
895 | dnl # like ZFS_LINUX_TRY_COMPILE, except the contents conftest.h are | |
896 | dnl # provided via the fifth parameter | |
897 | dnl # | |
608f8749 BB |
898 | AC_DEFUN([ZFS_LINUX_TRY_COMPILE_HEADER], [ |
899 | ZFS_LINUX_COMPILE_IFELSE( | |
c347fac5 | 900 | [ZFS_LINUX_TEST_PROGRAM([[$1]], [[$2]], [[ZFS_META_LICENSE]])], |
608f8749 BB |
901 | [test -f build/conftest/conftest.ko], |
902 | [$3], [$4], [$5]) | |
0b39b9f9 | 903 | ]) |