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