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