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