1 # SPDX-License-Identifier: NOASSERTION
4 # This file is part of Lustre, http://www.lustre.org/
6 # config/lustre-build-zfs.m4
8 # openZFS OSD related configuration
12 # Supported configure options. When no options are specified support
13 # for ZFS OSDs will be autodetected assuming server support is enabled.
14 # If the ZFS OSD cannot be built support for it is disabled and a
15 # warning is issued but the configure process is allowed to continue.
17 # --without-zfs - Disable zfs support.
20 # --with-zfs - Enable zfs support and attempt to autodetect the zfs
21 # --with-zfs=yes headers in one of the following places. Because zfs
22 # support was explicitly required if the headers cannot
23 # be located it is treated as a fatal error.
25 # * /var/lib/dkms/zfs/${VERSION}/source
26 # * /usr/src/zfs-${VERSION}/${LINUXRELEASE}
27 # * /usr/src/zfs-${VERSION}
31 # --with-zfs-devel=path
32 # - User provided directory where zfs development headers
33 # are located. This option is typically used when user
34 # uses rpm2cpio to unpack src rpm.
36 # ${zfs-devel-path}/usr/include/libzfs
37 # ${zfs-devel-path}/usr/include/libspl
38 # ${zfs-devel-path}/lib64/libzfs.so.* or
39 # ${zfs-devel-path}/lib/libzfs.so.*
41 # --with-zfs=path - Enable zfs support and use the zfs headers in the
42 # provided path. No autodetection is performed and
43 # if no headers are found this is a fatal error.
45 # --with-zfs-obj - When zfs support is enabled the object directory
46 # will be based on the --with-zfs directory. If this
47 # is detected incorrectly it can be explicitly
48 # specified using this option.
50 # --without-spl - Disable spl support.
53 # --with-spl - Enable spl support and attempt to autodetect the spl
54 # --with-spl=yes headers in one of the following places in this order:
55 # * /var/lib/dkms/spl/${VERSION}/source
56 # * /usr/src/spl-${VERSION}/${LINUXRELEASE}
57 # * /usr/src/spl-${VERSION}
61 # --with-spl=path - Enable spl support and use the spl headers in the
62 # provided path. No autodetection is performed.
64 # --with-spl-obj - When spl support is enabled the object directory
65 # will be based on the --with-spl directory. If this
66 # is detected incorrectly it can be explicitly
67 # specified using this option.
75 AS_HELP_STRING([--with-spl=PATH],
76 [Path to spl source]),
79 AC_ARG_WITH([spl-obj],
80 AS_HELP_STRING([--with-spl-obj=PATH],
81 [Path to spl build objects]),
85 # The existence of spl.release[.in] is used to identify a valid
86 # source directory. In order of preference:
88 splver=$(ls -1 /usr/src/ | grep ^spl- | cut -f2 -d'-' |
90 spldkms="/var/lib/dkms/spl/${splver}"
91 splsrc1="/usr/src/spl-${splver}/${LINUXRELEASE}"
92 splsrc2="/usr/src/spl-${splver}"
96 AC_MSG_CHECKING([spl source directory])
97 AS_IF([test -z "${splsrc}"], [
98 AS_IF([test -e "${spldkms}/source/spl.release.in"], [
99 splsrc=${spldkms}/source
100 ], [test -e "${splsrc1}/spl.release.in"], [
102 ], [test -e "${splsrc2}/spl.release.in"], [
104 ], [test -e "${splsrc3}/spl.release.in"], [
105 splsrc=$(readlink -f "${splsrc3}")
106 ], [test -e "${splsrc4}/spl.release.in"], [
112 AC_MSG_RESULT([$splsrc])
114 AS_IF([test ! -e "$splsrc/spl.release" &&
115 test ! -e "$splsrc/spl.release.in"], [
120 # The existence of the spl_config.h is used to identify a valid
121 # spl object directory. In many cases the object and source
122 # directory are the same, however the objects may also reside
123 # is a subdirectory named after the kernel version. When
124 # weak modules are used, the kernel version may not be the
125 # same as the LINUXRELEASE against which we are building lustre.
127 AC_MSG_CHECKING([spl build directory])
128 AS_IF([test -z "$splobj"], [
129 last_spl_obj_dir=$(ls -d ${splsrc}/[[0-9]]*/ 2> /dev/null | tail -n 1 | sed 's|/$||')
130 AS_IF([test "${splsrc}" = "${spldkms}/source"], [
131 AS_IF([test -e "${spldkms}/${LINUXRELEASE}/${target_cpu}/spl_config.h"], [
132 splobj=${spldkms}/${LINUXRELEASE}/${target_cpu}
136 ],[test -e "${splsrc}/${LINUXRELEASE}/spl_config.h"], [
137 splobj="${splsrc}/${LINUXRELEASE}"
138 ], [test -e "${splsrc}/spl_config.h"], [
140 ], [test -e "${last_spl_obj_dir}/spl_config.h"], [
141 splobj="${last_spl_obj_dir}"
146 AC_MSG_RESULT([$splobj])
148 AS_IF([test ! -e "$splobj/spl_config.h"], [
153 # Verify the source version using SPL_META_VERSION in spl_config.h
155 AS_IF([test x$enable_zfs = xyes], [
156 AC_MSG_CHECKING([spl source version])
157 AS_IF([fgrep -q SPL_META_VERSION $splobj/spl_config.h], [
158 splver=$((echo "#include <spl_config.h>";
159 echo "splver=SPL_META_VERSION-SPL_META_RELEASE") |
161 grep "^splver=" | tr -d \" | cut -d= -f2)
166 AC_MSG_RESULT([$splver])
170 # Verify the modules systems exist by the expect name.
172 AS_IF([test x$enable_zfs = xyes], [
173 AC_MSG_CHECKING([spl file name for module symbols])
174 AS_IF([test -r $splobj/$SYMVERFILE], [
176 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $splobj/$SYMVERFILE"
177 ], [test -r $splobj/module/$SYMVERFILE], [
179 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $splobj/module/$SYMVERFILE"
184 AC_MSG_RESULT([$splsym])
187 AS_IF([test x$enable_zfs = xyes], [
190 SPL_VERSION=${splver}
194 AC_SUBST(SPL_VERSION)
195 AC_SUBST(EXTRA_SYMBOLS)
204 AC_ARG_WITH([zfs-obj],
205 AS_HELP_STRING([--with-zfs-obj=PATH],
206 [Path to zfs build objects]),
210 # The existence of zfs.release[.in] is used to identify a valid
211 # source directory. In order of preference:
213 zfsver=$(ls -1 /usr/src/ | grep ^zfs- | cut -f2 -d'-' |
215 zfsdkms="/var/lib/dkms/zfs/${zfsver}"
216 zfssrc1="/usr/src/zfs-${zfsver}/${LINUXRELEASE}"
217 zfssrc2="/usr/src/zfs-${zfsver}"
221 AC_MSG_CHECKING([zfs source directory])
222 AS_IF([test -z "${zfssrc}"], [
223 AS_IF([test -e "${zfsdkms}/source/zfs.release.in"], [
224 zfssrc=${zfsdkms}/source
225 ], [test -e "${zfssrc1}/zfs.release.in"], [
227 ], [test -e "${zfssrc2}/zfs.release.in"], [
229 ], [test -e "${zfssrc3}/zfs.release.in"], [
230 zfssrc=$(readlink -f "${zfssrc3}")
231 ], [test -e "${zfssrc4}/zfs.release.in"], [
237 AC_MSG_RESULT([$zfssrc])
239 AS_IF([test ! -e "$zfssrc/zfs.release.in" &&
240 test ! -e "$zfssrc/zfs.release"], [
245 # The existence of the zfs_config.h is used to identify a valid
246 # zfs object directory. In many cases the object and source
247 # directory are the same, however the objects may also reside
248 # is a subdirectory named after the kernel version. When
249 # weak modules are used, the kernel version may not be the
250 # same as the LINUXRELEASE against which we are building lustre.
252 AC_MSG_CHECKING([zfs build directory])
253 AS_IF([test -z "$zfsobj"], [
254 last_zfs_obj_dir=$(ls -d ${zfssrc}/[[0-9]]*/ 2> /dev/null | tail -n 1 | sed 's|/$||')
255 AS_IF([test "${zfssrc}" = "${zfsdkms}/source"], [
256 AS_IF([test -e "${zfsdkms}/${LINUXRELEASE}/${target_cpu}/zfs_config.h"], [
257 zfsobj=${zfsdkms}/${LINUXRELEASE}/${target_cpu}
261 ], [test -e "${zfssrc}/${LINUXRELEASE}/zfs_config.h"], [
262 zfsobj="${zfssrc}/${LINUXRELEASE}"
263 ], [test -e "${zfssrc}/zfs_config.h"], [
265 ], [test -e "${last_zfs_obj_dir}/zfs_config.h"], [
266 zfsobj="${last_zfs_obj_dir}"
272 AC_MSG_RESULT([$zfsobj])
273 AS_IF([test ! -e "$zfsobj/zfs_config.h"], [
278 # Verify the source version using SPL_META_VERSION in spl_config.h
280 AS_IF([test x$enable_zfs = xyes], [
281 AC_MSG_CHECKING([zfs source version])
282 AS_IF([fgrep -q ZFS_META_VERSION $zfsobj/zfs_config.h], [
283 zfsver=$((echo "#include <zfs_config.h>";
284 echo "zfsver=ZFS_META_VERSION-ZFS_META_RELEASE") |
286 grep "^zfsver=" | tr -d \" | cut -d= -f2)
291 AC_MSG_RESULT([$zfsver])
295 # Verify the modules systems exist by the expect name.
297 AS_IF([test x$enable_zfs = xyes], [
298 AC_MSG_CHECKING([zfs file name for module symbols])
299 AS_IF([test -r $zfsobj/$SYMVERFILE], [
301 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $zfsobj/$SYMVERFILE"
302 ], [test -r $zfsobj/module/$SYMVERFILE], [
304 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $zfsobj/module/$SYMVERFILE"
309 AC_MSG_RESULT([$zfssym])
312 AS_IF([test x$enable_zfs = xyes], [
315 ZFS_VERSION=${zfsver}
319 AC_SUBST(ZFS_VERSION)
320 AC_SUBST(EXTRA_SYMBOLS)
328 AC_DEFUN([LB_ZFS_DEVEL], [
329 AC_ARG_WITH([zfs-devel],
330 [AS_HELP_STRING([--with-zfs-devel=PATH],
331 [Path to zfs development headers])],
332 [zfsdevel="$withval"])
334 AC_MSG_CHECKING([user provided zfs devel headers])
335 AS_IF([test ! -z "${zfsdevel}"], [
336 AS_IF([test -d "${zfsdevel}/usr/include/libspl" && test -d "${zfsdevel}/usr/include/libzfs"], [
337 zfsinc="-I $zfsdevel/usr/include/libspl -I $zfsdevel/usr/include/libzfs"
338 zfslib="-L$zfsdevel/usr/lib64 -L$zfsdevel/usr/lib -L$zfsdevel/lib64 -L$zfsdevel/lib"
340 AC_MSG_ERROR([Path to development headers directory does not exist])
343 AC_MSG_RESULT([$zfsinc])
349 AC_DEFUN([LB_ZFS_USER], [
351 # Detect user space zfs development headers.
353 AC_MSG_CHECKING([zfs devel headers])
354 AS_IF([test -z "${zfsinc}"], [
355 AS_IF([test -e "${zfssrc}/include/libzfs.h" && test -e "${zfssrc}/lib/libspl/include"], [
356 zfsinc="-I $zfssrc/lib/libspl/include -I $zfssrc/lib/libspl/include/os/linux -I $zfssrc/include"
357 zfslib="-L$zfssrc/.libs/ -L$zfssrc/lib/libzfs/.libs/ -L$zfssrc/lib/libnvpair/.libs/ -L$zfssrc/lib/libzpool/.libs/"
358 ], [test -d /usr/include/libzfs && test -d /usr/include/libspl], [
359 zfsinc="-I/usr/include/libspl -I /usr/include/libzfs"
367 AC_MSG_RESULT([$zfsinc])
369 ZFS_LIBZFS_INCLUDE=${zfsinc}
370 ZFS_LIBZFS_LDFLAGS=${zfslib}
371 ZFS_LIBZFS_LIBS="-lzfs -lnvpair -lzpool"
372 AC_SUBST(ZFS_LIBZFS_INCLUDE)
373 AC_SUBST(ZFS_LIBZFS_LDFLAGS)
374 AC_SUBST(ZFS_LIBZFS_LIBS)
380 AC_DEFUN([LB_CONFIG_ZFS], [
382 [AS_HELP_STRING([--with-zfs=PATH], [Path to zfs source])],
384 AS_IF([test x$withval = xno], [
388 ], [test x$withval = xyes], [
399 AS_IF([test x$enable_server != xno], [
410 AC_MSG_CHECKING([whether to enable zfs])
411 AC_MSG_RESULT([$enable_zfs])
413 AS_IF([test x$enable_zfs = xyes], [
414 AS_IF([test x$enable_modules = xyes], [
421 # Define zfs source code version
423 ZFS_MAJOR=$(echo $zfsver | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\1/'])
424 ZFS_MINOR=$(echo $zfsver | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\2/'])
425 ZFS_PATCH=$(echo $zfsver | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\3/'])
426 ZFS_FIX=$(echo $zfsver | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\5/'])
427 AS_IF([test -z "$ZFS_FIX"], [ZFS_FIX="0"])
429 AC_DEFINE_UNQUOTED([ZFS_MAJOR], [$ZFS_MAJOR], [zfs major version])
430 AC_DEFINE_UNQUOTED([ZFS_MINOR], [$ZFS_MINOR], [zfs minor version])
431 AC_DEFINE_UNQUOTED([ZFS_PATCH], [$ZFS_PATCH], [zfs patch version])
432 AC_DEFINE_UNQUOTED([ZFS_FIX], [$ZFS_FIX], [zfs fix version])
435 # SPL is only needed if ZFS is prior to 0.8.0
437 AS_IF([test x$enable_modules = xyes && test -n "$ZFS_MAJOR" &&
438 test $ZFS_MAJOR -eq 0 && test $ZFS_MINOR -lt 8], [
445 # enable_zfs will be set to no in LB_SPL or LB_ZFS if
446 # one of more of the build requirements is not met.
448 AS_IF([test x$enable_zfs = xyes], [
449 AC_DEFINE(HAVE_ZFS_OSD, 1, Enable zfs osd)
451 AS_IF([test x$require_zfs = xyes], [
454 Required zfs osd cannot be built due to missing zfs development headers.
456 Support for zfs can be enabled by downloading the required packages for your
457 distribution. See http://zfsonlinux.org/ to determine is zfs is supported by
463 Disabling optional zfs osd due to missing development headers.
465 Support for zfs can be enabled by downloading the required packages for your
466 distribution. See http://zfsonlinux.org/ to determine is zfs is supported by
474 AS_IF([test "x$enable_zfs" = xyes], [
475 LB_CHECK_COMPILE([if zfs defines dsl_pool_config_enter/exit],
476 dsl_pool_config_enter, [
477 #include <sys/dsl_pool.h>
479 dsl_pool_config_enter(NULL, FTAG);
481 AC_DEFINE(HAVE_DSL_POOL_CONFIG, 1,
482 [Have dsl_pool_config_enter/exit in ZFS])
484 AC_MSG_ERROR([dsl_pool_config_enter/exit do not exist])
486 LB_CHECK_COMPILE([if zfs defines zio_buf_alloc/free],
490 void *ptr = zio_buf_alloc(1024);
494 AC_DEFINE(HAVE_ZIO_BUF_ALLOC, 1,
495 [Have zio_buf_alloc/free in ZFS])
497 AC_MSG_ERROR([zio_buf_alloc/free do not exist])
499 LB_CHECK_COMPILE([if zfs defines spa_maxblocksize],
504 int size = spa_maxblocksize(spa);
508 AC_DEFINE(HAVE_SPA_MAXBLOCKSIZE, 1,
509 [Have spa_maxblocksize in ZFS])
511 AC_MSG_ERROR([spa_maxblocksize does not exist])
515 # ZFS 0.7.x adds support for large dnodes. This
516 # allows Lustre to optionally specify the size of a
517 # dnode which ZFS will then use to store metadata such
518 # as xattrs. The default dnode size specified by the
519 # 'dnodesize' dataset property will be used unless a
520 # specific value is provided.
522 LB_CHECK_COMPILE([if zfs defines dmu_object_alloc_dnsize],
523 dmu_object_alloc_dnsize, [
525 #include <sys/dnode.h>
528 dmu_object_type_t objtype = DMU_OT_NONE;
530 dmu_object_type_t bonustype = DMU_OT_SA;
531 int dnodesize = DNODE_MIN_SIZE;
535 id = dmu_object_alloc_dnsize(os, objtype, blocksize,
537 DN_BONUS_SIZE(dnodesize),
540 AC_DEFINE(HAVE_DMU_OBJECT_ALLOC_DNSIZE, 1,
541 [Have dmu_object_alloc_dnsize in ZFS])
543 AC_MSG_ERROR([dmu_object_alloc_dnsize does not exist])
547 # ZFS 0.7.x extended dmu_prefetch() to take an additional
548 # 'level' and 'priority' argument. Use a level of 0 and a
549 # priority of ZIO_PRIORITY_SYNC_READ to replicate the
550 # behavior of the four argument version.
552 LB_CHECK_COMPILE([if ZFS has 'dmu_prefetch' with 6 args],
561 enum zio_priority pri = ZIO_PRIORITY_SYNC_READ;
563 dmu_prefetch(os, object, level, offset, len, pri);
565 AC_DEFINE(HAVE_DMU_PREFETCH_6ARG, 1,
566 [Have 6 argument dmu_pretch in ZFS])
568 AC_MSG_ERROR([6 argument dmu_pretch does not exist])
571 # ZFS 0.7.0 feature: SPA_FEATURE_USEROBJ_ACCOUNTING
573 LB_CHECK_COMPILE([if ZFS has native dnode accounting supported],
574 dmu_objset_userobjused_enabled, [
575 #include <sys/dmu_objset.h>
577 dmu_objset_userobjused_enabled(NULL);
579 AC_DEFINE(HAVE_DMU_USEROBJ_ACCOUNTING, 1,
580 [Have native dnode accounting in ZFS])
582 AC_MSG_ERROR([native dnode accounting does not exist])
585 # ZFS 0.7.0 feature: MULTIHOST
587 LB_CHECK_COMPILE([if ZFS has multihost protection],
589 #include <sys/fs/zfs.h>
591 zpool_prop_t prop = ZPOOL_PROP_MULTIHOST;
595 AC_DEFINE(HAVE_ZFS_MULTIHOST, 1,
596 [Have multihost protection in ZFS])
598 AC_MSG_ERROR([multihost protection does not exist])
601 # ZFS 0.7.x adds new method zap_lookup_by_dnode
603 LB_CHECK_COMPILE([if ZFS has 'zap_lookup_by_dnode'],
604 zap_lookup_by_dnode, [
606 #include <sys/dnode.h>
609 zap_lookup_by_dnode(dn, NULL, 1, 1, NULL);
611 AC_DEFINE(HAVE_ZAP_LOOKUP_BY_DNODE, 1,
612 [Have zap_lookup_by_dnode() in ZFS])
614 AC_MSG_ERROR([zap_lookup_by_dnode does not exist])
617 # ZFS 0.7.x adds new method zap_add_by_dnode
619 LB_CHECK_COMPILE([if ZFS has 'zap_add_by_dnode'],
622 #include <sys/dnode.h>
625 zap_add_by_dnode(dn, NULL, 1, 1, NULL, NULL);
627 AC_DEFINE(HAVE_ZAP_ADD_BY_DNODE, 1,
628 [Have zap_add_by_dnode() in ZFS])
630 AC_MSG_ERROR([zap_add_by_dnode does not exist])
633 # ZFS 0.7.x adds new method zap_remove_by_dnode
635 LB_CHECK_COMPILE([if ZFS has 'zap_remove_by_dnode'],
636 zap_remove_by_dnode, [
638 #include <sys/dnode.h>
641 zap_remove_by_dnode(dn, NULL, NULL);
643 AC_DEFINE(HAVE_ZAP_REMOVE_ADD_BY_DNODE, 1,
644 [Have zap_remove_by_dnode() in ZFS])
646 AC_MSG_ERROR([zap_remove_by_dnode does not exist])
649 # ZFS 0.7.x adds new method dmu_tx_hold_zap_by_dnode
651 LB_CHECK_COMPILE([if ZFS has 'dmu_tx_hold_zap_by_dnode'],
652 dmu_tx_hold_zap_by_dnode, [
654 #include <sys/dnode.h>
657 dmu_tx_hold_zap_by_dnode(NULL, dn, TRUE, NULL);
659 AC_DEFINE(HAVE_DMU_TX_HOLD_ZAP_BY_DNODE, 1,
660 [Have dmu_tx_hold_zap_by_dnode() in ZFS])
662 AC_MSG_ERROR([dmu_tx_hold_zap_by_dnode does not exist])
665 # ZFS 0.7.x adds new method dmu_tx_hold_write_by_dnode
667 LB_CHECK_COMPILE([if ZFS has 'dmu_tx_hold_write_by_dnode'],
668 dmu_tx_hold_write_by_dnode, [
670 #include <sys/dnode.h>
673 dmu_tx_hold_write_by_dnode(NULL, dn, 0, 0);
675 AC_DEFINE(HAVE_DMU_TX_HOLD_WRITE_BY_DNODE, 1,
676 [Have dmu_tx_hold_write_by_dnode() in ZFS])
678 AC_MSG_ERROR([dmu_tx_hold_write_by_dnode does not exist])
681 # ZFS 0.7.x adds new method dmu_write_by_dnode
683 LB_CHECK_COMPILE([if ZFS has 'dmu_write_by_dnode'],
684 dmu_write_by_dnode, [
686 #include <sys/dnode.h>
689 dmu_write_by_dnode(dn, 0, 0, NULL, NULL);
691 AC_DEFINE(HAVE_DMU_WRITE_BY_DNODE, 1,
692 [Have dmu_write_by_dnode() in ZFS])
694 AC_MSG_ERROR([dmu_write_by_dnode does not exist])
697 # ZFS 0.7.x adds new method dmu_read_by_dnode
699 LB_CHECK_COMPILE([if ZFS has 'dmu_read_by_dnode'],
702 #include <sys/dnode.h>
705 dmu_read_by_dnode(dn, 0, 0, NULL, 0);
707 AC_DEFINE(HAVE_DMU_READ_BY_DNODE, 1,
708 [Have dmu_read_by_dnode() in ZFS])
710 AC_MSG_ERROR([dmu_read_by_dnode does not exist])
713 # ZFS 0.7.2 adds new method dmu_tx_mark_netfree
715 LB_CHECK_COMPILE([if ZFS has 'dmu_tx_mark_netfree'],
716 dmu_tx_mark_netfree, [
720 dmu_tx_mark_netfree(tx);
722 AC_DEFINE(HAVE_DMU_TX_MARK_NETFREE, 1,
723 [Have dmu_tx_mark_netfree])
726 # ZFS 0.7.10 changes timestruc_t to inode_timespec_t
728 LB_CHECK_COMPILE([if SPL has 'inode_timespec_t'],
729 zfs_have_inode_timespec, [
730 #include <sys/fs/zfs.h>
732 inode_timespec_t now;
735 AC_DEFINE(HAVE_ZFS_INODE_TIMESPEC, 1,
736 [Have inode_timespec_t])
738 # ZFS 0.7.12/0.8.x uses zfs_refcount_add() instead of
739 # refcount_add(). ZFS 2.0 renamed sys/refcount.h to
740 # sys/zfs_refcount.h, rather the add another check to
741 # determine the correct header name include it
742 # indirectly through sys/dnode.h.
744 LB_CHECK_COMPILE([if ZFS has 'zfs_refcount_add'],
746 #include <sys/dnode.h>
748 zfs_refcount_add((zfs_refcount_t *) NULL, NULL);
750 AC_DEFINE(HAVE_ZFS_REFCOUNT_ADD, 1,
751 [Have zfs_refcount_add])
754 # ZFS 0.8.x changes dmu_objset_own for encryption
756 LB_CHECK_COMPILE([if ZFS has 'dmu_objset_own' with 6 args],
758 #include <sys/dmu_objset.h>
761 dmu_objset_type_t type = DMU_OST_ANY;
762 dmu_objset_own(NULL, type, B_FALSE, B_TRUE, FTAG, &os);
764 AC_DEFINE(HAVE_DMU_OBJSET_OWN_6ARG, 1,
765 [Have dmu_objset_own() with 6 args])
768 # ZFS 0.8.x changes dmu_objset_disown for encryption
770 LB_CHECK_COMPILE([if ZFS has 'dmu_objset_disown' with 3 args],
772 #include <sys/dmu_objset.h>
775 dmu_objset_disown(os, B_TRUE, FTAG);
777 AC_DEFINE(HAVE_DMU_OBJSET_DISOWN_3ARG, 1,
778 [Have dmu_objset_disown() with 3 args])
781 # ZFS exports dmu_offet_next
783 AC_CACHE_CHECK([if ZFS exports 'dmu_offset_next'],
784 [lb_cv_dmu_offset_next], [
785 lb_cv_dmu_offset_next="no"
786 AS_IF([grep -q -E "EXPORT_SYMBOL.*\(dmu_offset_next\)" "$zfssrc/module/zfs/dmu.c" 2>/dev/null],
787 [lb_cv_dmu_offset_next="yes"])
789 AS_IF([test "x$lb_cv_dmu_offset_next" = "xyes"], [
790 AC_DEFINE(HAVE_DMU_OFFSET_NEXT, 1,
791 [Have dmu_offset_next() exported])
794 # ZFS 2.0 replaced .db_last_dirty / .dr_next with a list_t
795 # and list_node_t named .db_dirty_records / .dr_dbuf_node.
797 LB_CHECK_COMPILE([if ZFS has 'db_dirty_records' list_t],
799 #include <sys/dbuf.h>
802 dbuf_dirty_record_t *dr;
803 dr = list_head(&db.db_dirty_records);
805 AC_DEFINE(HAVE_DB_DIRTY_RECORDS_LIST, 1,
806 [Have db_dirty_records list_t])
809 # ZFS 2.0 renamed sys/refcount.h to zfs_refcount.h
810 # This build issue shows up with ZFS 2.0.7 and Lustre 2.12 LTS
812 LB_CHECK_COMPILE([if ZFS renamed sys/refcount to zfs_refcount.h],
814 #include <sys/zfs_refcount.h>
816 zfs_refcount_add((zfs_refcount_t *) NULL, NULL);
818 AC_DEFINE(HAVE_ZFS_REFCOUNT_HEADER, 1,
819 [Have zfs_refcount.h])
821 old_EXTRA_KCFLAGS=$EXTRA_KCFLAGS
822 EXTRA_KCFLAGS+=" -Werror"
824 dnl # ZFS 2.2.0 nvpair now returns and expects constant args
826 LB_CHECK_COMPILE([if ZFS nvlist interfaces require const],
828 #include <sys/nvpair.h>
830 nvpair_t *nvp = NULL;
831 nvlist_t *nvl = NULL;
832 const char *name = nvpair_name(nvp);
833 nvlist_lookup_string(nvl, name, &name);
834 nvlist_lookup_nvlist(nvl, name, &nvl);
836 AC_DEFINE(HAVE_ZFS_NVLIST_CONST_INTERFACES, 1,
837 [ZFS nvlist interfaces require const])
840 dnl # ZFS 2.2.1 arc_prune_func_t now uses uint64_t for the
841 dnl # first parameter
843 LB_CHECK_COMPILE([if ZFS arc_prune_func_t uses uint64_t],
844 zfs_arc_prune_func_uint64, [
847 void arc_prune_func(uint64_t bytes, void *priv) {}
848 arc_prune_t *arc_p __attribute__ ((unused)) =
849 arc_add_prune_callback(arc_prune_func, NULL);
851 AC_DEFINE(HAVE_ZFS_ARC_PRUNE_FUNC_UINT64, 1,
852 [ZFS arc_prune_func_t uses uint64_t])
854 EXTRA_KCFLAGS=$old_EXTRA_KCFLAGS
857 AS_IF([test "x$enable_zfs" = xyes], [
858 AC_SUBST(ENABLE_ZFS, yes)
860 AC_SUBST(ENABLE_ZFS, no)
862 AM_CONDITIONAL(ZFS_ENABLED, [test "x$enable_zfs" = xyes])
863 AM_CONDITIONAL(SPL_ENABLED, [test "x$enable_spl" = xyes])