2 dnl # Supported configure options. When no options are specified support
3 dnl # for ZFS OSDs will be autodetected assuming server support is enabled.
4 dnl # If the ZFS OSD cannot be built support for it is disabled and a
5 dnl # warning is issued but the configure process is allowed to continue.
7 dnl # --without-zfs - Disable zfs support.
10 dnl # --with-zfs - Enable zfs support and attempt to autodetect the zfs
11 dnl # --with-zfs=yes headers in one of the following places. Because zfs
12 dnl # support was explicitly required if the headers cannot
13 dnl # be located it is treated as a fatal error.
15 dnl # * /var/lib/dkms/zfs/${VERSION}/source
16 dnl # * /usr/src/zfs-${VERSION}/${LINUXRELEASE}
17 dnl # * /usr/src/zfs-${VERSION}
21 dnl # --with-zfs-devel=path
22 dnl # - User provided directory where zfs development headers
23 dnl # are located. This option is typically used when user
24 dnl # uses rpm2cpio to unpack src rpm.
25 dnl # Assumes layout of:
26 dnl # ${zfs-devel-path}/usr/include/libzfs
27 dnl # ${zfs-devel-path}/usr/include/libspl
28 dnl # ${zfs-devel-path}/lib64/libzfs.so.* or
29 dnl # ${zfs-devel-path}/lib/libzfs.so.*
31 dnl # --with-zfs=path - Enable zfs support and use the zfs headers in the
32 dnl # provided path. No autodetection is performed and
33 dnl # if no headers are found this is a fatal error.
35 dnl # --with-zfs-obj - When zfs support is enabled the object directory
36 dnl # will be based on the --with-zfs directory. If this
37 dnl # is detected incorrectly it can be explicitly
38 dnl # specified using this option.
40 dnl # --without-spl - Disable spl support.
43 dnl # --with-spl - Enable spl support and attempt to autodetect the spl
44 dnl # --with-spl=yes headers in one of the following places in this order:
45 dnl # * /var/lib/dkms/spl/${VERSION}/source
46 dnl # * /usr/src/spl-${VERSION}/${LINUXRELEASE}
47 dnl # * /usr/src/spl-${VERSION}
51 dnl # --with-spl=path - Enable spl support and use the spl headers in the
52 dnl # provided path. No autodetection is performed.
54 dnl # --with-spl-obj - When spl support is enabled the object directory
55 dnl # will be based on the --with-spl directory. If this
56 dnl # is detected incorrectly it can be explicitly
57 dnl # specified using this option.
61 AS_HELP_STRING([--with-spl=PATH],
62 [Path to spl source]),
65 AC_ARG_WITH([spl-obj],
66 AS_HELP_STRING([--with-spl-obj=PATH],
67 [Path to spl build objects]),
71 dnl # The existence of spl.release[.in] is used to identify a valid
72 dnl # source directory. In order of preference:
74 splver=$(ls -1 /usr/src/ | grep ^spl- | cut -f2 -d'-' |
76 spldkms="/var/lib/dkms/spl/${splver}"
77 splsrc1="/usr/src/spl-${splver}/${LINUXRELEASE}"
78 splsrc2="/usr/src/spl-${splver}"
82 AC_MSG_CHECKING([spl source directory])
83 AS_IF([test -z "${splsrc}"], [
84 AS_IF([test -e "${spldkms}/source/spl.release.in"], [
85 splsrc=${spldkms}/source
86 ], [test -e "${splsrc1}/spl.release.in"], [
88 ], [test -e "${splsrc2}/spl.release.in"], [
90 ], [test -e "${splsrc3}/spl.release.in"], [
91 splsrc=$(readlink -f "${splsrc3}")
92 ], [test -e "${splsrc4}/spl.release.in"], [
98 AC_MSG_RESULT([$splsrc])
100 AS_IF([test ! -e "$splsrc/spl.release" &&
101 test ! -e "$splsrc/spl.release.in"], [
106 dnl # The existence of the spl_config.h is used to identify a valid
107 dnl # spl object directory. In many cases the object and source
108 dnl # directory are the same, however the objects may also reside
109 dnl # is a subdirectory named after the kernel version. When
110 dnl # weak modules are used, the kernel version may not be the
111 dnl # same as the LINUXRELEASE against which we are building lustre.
113 AC_MSG_CHECKING([spl build directory])
114 AS_IF([test -z "$splobj"], [
115 last_spl_obj_dir=$(ls -d ${splsrc}/[[0-9]]*/ 2> /dev/null | tail -n 1 | sed 's|/$||')
116 AS_IF([test "${splsrc}" = "${spldkms}/source"], [
117 AS_IF([test -e "${spldkms}/${LINUXRELEASE}/${target_cpu}/spl_config.h"], [
118 splobj=${spldkms}/${LINUXRELEASE}/${target_cpu}
122 ],[test -e "${splsrc}/${LINUXRELEASE}/spl_config.h"], [
123 splobj="${splsrc}/${LINUXRELEASE}"
124 ], [test -e "${splsrc}/spl_config.h"], [
126 ], [test -e "${last_spl_obj_dir}/spl_config.h"], [
127 splobj="${last_spl_obj_dir}"
132 AC_MSG_RESULT([$splobj])
134 AS_IF([test ! -e "$splobj/spl_config.h"], [
139 dnl # Verify the source version using SPL_META_VERSION in spl_config.h
141 AS_IF([test x$enable_zfs = xyes], [
142 AC_MSG_CHECKING([spl source version])
143 AS_IF([fgrep -q SPL_META_VERSION $splobj/spl_config.h], [
144 splver=$((echo "#include <spl_config.h>";
145 echo "splver=SPL_META_VERSION-SPL_META_RELEASE") |
147 grep "^splver=" | tr -d \" | cut -d= -f2)
152 AC_MSG_RESULT([$splver])
156 dnl # Verify the modules systems exist by the expect name.
158 AS_IF([test x$enable_zfs = xyes], [
159 AC_MSG_CHECKING([spl file name for module symbols])
160 AS_IF([test -r $splobj/$SYMVERFILE], [
162 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $splobj/$SYMVERFILE"
163 ], [test -r $splobj/module/$SYMVERFILE], [
165 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $splobj/module/$SYMVERFILE"
170 AC_MSG_RESULT([$splsym])
173 AS_IF([test x$enable_zfs = xyes], [
176 SPL_VERSION=${splver}
180 AC_SUBST(SPL_VERSION)
181 AC_SUBST(EXTRA_SYMBOLS)
187 AC_ARG_WITH([zfs-obj],
188 AS_HELP_STRING([--with-zfs-obj=PATH],
189 [Path to zfs build objects]),
193 dnl # The existence of zfs.release[.in] is used to identify a valid
194 dnl # source directory. In order of preference:
196 zfsver=$(ls -1 /usr/src/ | grep ^zfs- | cut -f2 -d'-' |
198 zfsdkms="/var/lib/dkms/zfs/${zfsver}"
199 zfssrc1="/usr/src/zfs-${zfsver}/${LINUXRELEASE}"
200 zfssrc2="/usr/src/zfs-${zfsver}"
204 AC_MSG_CHECKING([zfs source directory])
205 AS_IF([test -z "${zfssrc}"], [
206 AS_IF([test -e "${zfsdkms}/source/zfs.release.in"], [
207 zfssrc=${zfsdkms}/source
208 ], [test -e "${zfssrc1}/zfs.release.in"], [
210 ], [test -e "${zfssrc2}/zfs.release.in"], [
212 ], [test -e "${zfssrc3}/zfs.release.in"], [
213 zfssrc=$(readlink -f "${zfssrc3}")
214 ], [test -e "${zfssrc4}/zfs.release.in"], [
220 AC_MSG_RESULT([$zfssrc])
222 AS_IF([test ! -e "$zfssrc/zfs.release.in" &&
223 test ! -e "$zfssrc/zfs.release"], [
228 dnl # The existence of the zfs_config.h is used to identify a valid
229 dnl # zfs object directory. In many cases the object and source
230 dnl # directory are the same, however the objects may also reside
231 dnl # is a subdirectory named after the kernel version. When
232 dnl # weak modules are used, the kernel version may not be the
233 dnl # same as the LINUXRELEASE against which we are building lustre.
235 AC_MSG_CHECKING([zfs build directory])
236 AS_IF([test -z "$zfsobj"], [
237 last_zfs_obj_dir=$(ls -d ${zfssrc}/[[0-9]]*/ 2> /dev/null | tail -n 1 | sed 's|/$||')
238 AS_IF([test "${zfssrc}" = "${zfsdkms}/source"], [
239 AS_IF([test -e "${zfsdkms}/${LINUXRELEASE}/${target_cpu}/zfs_config.h"], [
240 zfsobj=${zfsdkms}/${LINUXRELEASE}/${target_cpu}
244 ], [test -e "${zfssrc}/${LINUXRELEASE}/zfs_config.h"], [
245 zfsobj="${zfssrc}/${LINUXRELEASE}"
246 ], [test -e "${zfssrc}/zfs_config.h"], [
248 ], [test -e "${last_zfs_obj_dir}/zfs_config.h"], [
249 zfsobj="${last_zfs_obj_dir}"
255 AC_MSG_RESULT([$zfsobj])
256 AS_IF([test ! -e "$zfsobj/zfs_config.h"], [
261 dnl # Verify the source version using SPL_META_VERSION in spl_config.h
263 AS_IF([test x$enable_zfs = xyes], [
264 AC_MSG_CHECKING([zfs source version])
265 AS_IF([fgrep -q ZFS_META_VERSION $zfsobj/zfs_config.h], [
266 zfsver=$((echo "#include <zfs_config.h>";
267 echo "zfsver=ZFS_META_VERSION-ZFS_META_RELEASE") |
269 grep "^zfsver=" | tr -d \" | cut -d= -f2)
274 AC_MSG_RESULT([$zfsver])
278 dnl # Verify the modules systems exist by the expect name.
280 AS_IF([test x$enable_zfs = xyes], [
281 AC_MSG_CHECKING([zfs file name for module symbols])
282 AS_IF([test -r $zfsobj/$SYMVERFILE], [
284 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $zfsobj/$SYMVERFILE"
285 ], [test -r $zfsobj/module/$SYMVERFILE], [
287 EXTRA_SYMBOLS="$EXTRA_SYMBOLS $zfsobj/module/$SYMVERFILE"
292 AC_MSG_RESULT([$zfssym])
295 AS_IF([test x$enable_zfs = xyes], [
298 ZFS_VERSION=${zfsver}
302 AC_SUBST(ZFS_VERSION)
303 AC_SUBST(EXTRA_SYMBOLS)
308 AC_DEFUN([LB_ZFS_DEVEL], [
309 AC_ARG_WITH([zfs-devel],
310 [AS_HELP_STRING([--with-zfs-devel=PATH],
311 [Path to zfs development headers])],
312 [zfsdevel="$withval"])
314 AC_MSG_CHECKING([user provided zfs devel headers])
315 AS_IF([test ! -z "${zfsdevel}"], [
316 AS_IF([test -d "${zfsdevel}/usr/include/libspl" && test -d "${zfsdevel}/usr/include/libzfs"], [
317 zfsinc="-I $zfsdevel/usr/include/libspl -I $zfsdevel/usr/include/libzfs"
318 zfslib="-L$zfsdevel/usr/lib64 -L$zfsdevel/usr/lib -L$zfsdevel/lib64 -L$zfsdevel/lib"
320 AC_MSG_ERROR([Path to development headers directory does not exist])
323 AC_MSG_RESULT([$zfsinc])
326 AC_DEFUN([LB_ZFS_USER], [
328 dnl # Detect user space zfs development headers.
330 AC_MSG_CHECKING([zfs devel headers])
331 AS_IF([test -z "${zfsinc}"], [
332 AS_IF([test -e "${zfssrc}/include/libzfs.h" && test -e "${zfssrc}/lib/libspl/include"], [
333 zfsinc="-I $zfssrc/lib/libspl/include -I $zfssrc/lib/libspl/include/os/linux -I $zfssrc/include"
334 zfslib="-L$zfssrc/.libs/ -L$zfssrc/lib/libzfs/.libs/ -L$zfssrc/lib/libnvpair/.libs/ -L$zfssrc/lib/libzpool/.libs/"
335 ], [test -d /usr/include/libzfs && test -d /usr/include/libspl], [
336 zfsinc="-I/usr/include/libspl -I /usr/include/libzfs"
344 AC_MSG_RESULT([$zfsinc])
346 ZFS_LIBZFS_INCLUDE=${zfsinc}
347 ZFS_LIBZFS_LDFLAGS=${zfslib}
348 ZFS_LIBZFS_LIBS="-lzfs -lnvpair -lzpool"
349 AC_SUBST(ZFS_LIBZFS_INCLUDE)
350 AC_SUBST(ZFS_LIBZFS_LDFLAGS)
351 AC_SUBST(ZFS_LIBZFS_LIBS)
354 AC_DEFUN([LB_CONFIG_ZFS], [
356 [AS_HELP_STRING([--with-zfs=PATH], [Path to zfs source])],
358 AS_IF([test x$withval = xno], [
362 ], [test x$withval = xyes], [
373 AS_IF([test x$enable_server != xno], [
384 AC_MSG_CHECKING([whether to enable zfs])
385 AC_MSG_RESULT([$enable_zfs])
387 AS_IF([test x$enable_zfs = xyes], [
388 AS_IF([test x$enable_modules = xyes], [
395 dnl # Define zfs source code version
397 ZFS_MAJOR=$(echo $zfsver | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\1/'])
398 ZFS_MINOR=$(echo $zfsver | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\2/'])
399 ZFS_PATCH=$(echo $zfsver | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\3/'])
400 ZFS_FIX=$(echo $zfsver | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\5/'])
401 AS_IF([test -z "$ZFS_FIX"], [ZFS_FIX="0"])
403 AC_DEFINE_UNQUOTED([ZFS_MAJOR], [$ZFS_MAJOR], [zfs major version])
404 AC_DEFINE_UNQUOTED([ZFS_MINOR], [$ZFS_MINOR], [zfs minor version])
405 AC_DEFINE_UNQUOTED([ZFS_PATCH], [$ZFS_PATCH], [zfs patch version])
406 AC_DEFINE_UNQUOTED([ZFS_FIX], [$ZFS_FIX], [zfs fix version])
409 dnl # SPL is only needed if ZFS is prior to 0.8.0
411 AS_IF([test x$enable_modules = xyes && test -n "$ZFS_MAJOR" &&
412 test $ZFS_MAJOR -eq 0 && test $ZFS_MINOR -lt 8], [
419 dnl # enable_zfs will be set to no in LB_SPL or LB_ZFS if
420 dnl # one of more of the build requirements is not met.
422 AS_IF([test x$enable_zfs = xyes], [
423 AC_DEFINE(HAVE_ZFS_OSD, 1, Enable zfs osd)
425 AS_IF([test x$require_zfs = xyes], [
428 Required zfs osd cannot be built due to missing zfs development headers.
430 Support for zfs can be enabled by downloading the required packages for your
431 distribution. See http://zfsonlinux.org/ to determine is zfs is supported by
437 Disabling optional zfs osd due to missing development headers.
439 Support for zfs can be enabled by downloading the required packages for your
440 distribution. See http://zfsonlinux.org/ to determine is zfs is supported by
448 AS_IF([test "x$enable_zfs" = xyes], [
449 LB_CHECK_COMPILE([if zfs defines dsl_pool_config_enter/exit],
450 dsl_pool_config_enter, [
451 #include <sys/dsl_pool.h>
453 dsl_pool_config_enter(NULL, FTAG);
455 AC_DEFINE(HAVE_DSL_POOL_CONFIG, 1,
456 [Have dsl_pool_config_enter/exit in ZFS])
458 AC_MSG_ERROR([dsl_pool_config_enter/exit do not exist])
460 LB_CHECK_COMPILE([if zfs defines zio_buf_alloc/free],
464 void *ptr = zio_buf_alloc(1024);
468 AC_DEFINE(HAVE_ZIO_BUF_ALLOC, 1,
469 [Have zio_buf_alloc/free in ZFS])
471 AC_MSG_ERROR([zio_buf_alloc/free do not exist])
473 LB_CHECK_COMPILE([if zfs defines spa_maxblocksize],
478 int size = spa_maxblocksize(spa);
482 AC_DEFINE(HAVE_SPA_MAXBLOCKSIZE, 1,
483 [Have spa_maxblocksize in ZFS])
485 AC_MSG_ERROR([spa_maxblocksize does not exist])
489 dnl # ZFS 0.7.x adds support for large dnodes. This
490 dnl # allows Lustre to optionally specify the size of a
491 dnl # dnode which ZFS will then use to store metadata such
492 dnl # as xattrs. The default dnode size specified by the
493 dnl # 'dnodesize' dataset property will be used unless a
494 dnl # specific value is provided.
496 LB_CHECK_COMPILE([if zfs defines dmu_object_alloc_dnsize],
497 dmu_object_alloc_dnsize, [
499 #include <sys/dnode.h>
502 dmu_object_type_t objtype = DMU_OT_NONE;
504 dmu_object_type_t bonustype = DMU_OT_SA;
505 int dnodesize = DNODE_MIN_SIZE;
509 id = dmu_object_alloc_dnsize(os, objtype, blocksize,
511 DN_BONUS_SIZE(dnodesize),
514 AC_DEFINE(HAVE_DMU_OBJECT_ALLOC_DNSIZE, 1,
515 [Have dmu_object_alloc_dnsize in ZFS])
517 AC_MSG_ERROR([dmu_object_alloc_dnsize does not exist])
521 dnl # ZFS 0.7.x extended dmu_prefetch() to take an additional
522 dnl # 'level' and 'priority' argument. Use a level of 0 and a
523 dnl # priority of ZIO_PRIORITY_SYNC_READ to replicate the
524 dnl # behavior of the four argument version.
526 LB_CHECK_COMPILE([if ZFS has 'dmu_prefetch' with 6 args],
535 enum zio_priority pri = ZIO_PRIORITY_SYNC_READ;
537 dmu_prefetch(os, object, level, offset, len, pri);
539 AC_DEFINE(HAVE_DMU_PREFETCH_6ARG, 1,
540 [Have 6 argument dmu_pretch in ZFS])
542 AC_MSG_ERROR([6 argument dmu_pretch does not exist])
545 dnl # ZFS 0.7.0 feature: SPA_FEATURE_USEROBJ_ACCOUNTING
547 LB_CHECK_COMPILE([if ZFS has native dnode accounting supported],
548 dmu_objset_userobjused_enabled, [
549 #include <sys/dmu_objset.h>
551 dmu_objset_userobjused_enabled(NULL);
553 AC_DEFINE(HAVE_DMU_USEROBJ_ACCOUNTING, 1,
554 [Have native dnode accounting in ZFS])
556 AC_MSG_ERROR([native dnode accounting does not exist])
559 dnl # ZFS 0.7.0 feature: MULTIHOST
561 LB_CHECK_COMPILE([if ZFS has multihost protection],
563 #include <sys/fs/zfs.h>
565 zpool_prop_t prop = ZPOOL_PROP_MULTIHOST;
569 AC_DEFINE(HAVE_ZFS_MULTIHOST, 1,
570 [Have multihost protection in ZFS])
572 AC_MSG_ERROR([multihost protection does not exist])
575 dnl # ZFS 0.7.x adds new method zap_lookup_by_dnode
577 LB_CHECK_COMPILE([if ZFS has 'zap_lookup_by_dnode'],
578 zap_lookup_by_dnode, [
580 #include <sys/dnode.h>
583 zap_lookup_by_dnode(dn, NULL, 1, 1, NULL);
585 AC_DEFINE(HAVE_ZAP_LOOKUP_BY_DNODE, 1,
586 [Have zap_lookup_by_dnode() in ZFS])
588 AC_MSG_ERROR([zap_lookup_by_dnode does not exist])
591 dnl # ZFS 0.7.x adds new method zap_add_by_dnode
593 LB_CHECK_COMPILE([if ZFS has 'zap_add_by_dnode'],
596 #include <sys/dnode.h>
599 zap_add_by_dnode(dn, NULL, 1, 1, NULL, NULL);
601 AC_DEFINE(HAVE_ZAP_ADD_BY_DNODE, 1,
602 [Have zap_add_by_dnode() in ZFS])
604 AC_MSG_ERROR([zap_add_by_dnode does not exist])
607 dnl # ZFS 0.7.x adds new method zap_remove_by_dnode
609 LB_CHECK_COMPILE([if ZFS has 'zap_remove_by_dnode'],
610 zap_remove_by_dnode, [
612 #include <sys/dnode.h>
615 zap_remove_by_dnode(dn, NULL, NULL);
617 AC_DEFINE(HAVE_ZAP_REMOVE_ADD_BY_DNODE, 1,
618 [Have zap_remove_by_dnode() in ZFS])
620 AC_MSG_ERROR([zap_remove_by_dnode does not exist])
623 dnl # ZFS 0.7.x adds new method dmu_tx_hold_zap_by_dnode
625 LB_CHECK_COMPILE([if ZFS has 'dmu_tx_hold_zap_by_dnode'],
626 dmu_tx_hold_zap_by_dnode, [
628 #include <sys/dnode.h>
631 dmu_tx_hold_zap_by_dnode(NULL, dn, TRUE, NULL);
633 AC_DEFINE(HAVE_DMU_TX_HOLD_ZAP_BY_DNODE, 1,
634 [Have dmu_tx_hold_zap_by_dnode() in ZFS])
636 AC_MSG_ERROR([dmu_tx_hold_zap_by_dnode does not exist])
639 dnl # ZFS 0.7.x adds new method dmu_tx_hold_write_by_dnode
641 LB_CHECK_COMPILE([if ZFS has 'dmu_tx_hold_write_by_dnode'],
642 dmu_tx_hold_write_by_dnode, [
644 #include <sys/dnode.h>
647 dmu_tx_hold_write_by_dnode(NULL, dn, 0, 0);
649 AC_DEFINE(HAVE_DMU_TX_HOLD_WRITE_BY_DNODE, 1,
650 [Have dmu_tx_hold_write_by_dnode() in ZFS])
652 AC_MSG_ERROR([dmu_tx_hold_write_by_dnode does not exist])
655 dnl # ZFS 0.7.x adds new method dmu_write_by_dnode
657 LB_CHECK_COMPILE([if ZFS has 'dmu_write_by_dnode'],
658 dmu_write_by_dnode, [
660 #include <sys/dnode.h>
663 dmu_write_by_dnode(dn, 0, 0, NULL, NULL);
665 AC_DEFINE(HAVE_DMU_WRITE_BY_DNODE, 1,
666 [Have dmu_write_by_dnode() in ZFS])
668 AC_MSG_ERROR([dmu_write_by_dnode does not exist])
671 dnl # ZFS 0.7.x adds new method dmu_read_by_dnode
673 LB_CHECK_COMPILE([if ZFS has 'dmu_read_by_dnode'],
676 #include <sys/dnode.h>
679 dmu_read_by_dnode(dn, 0, 0, NULL, 0);
681 AC_DEFINE(HAVE_DMU_READ_BY_DNODE, 1,
682 [Have dmu_read_by_dnode() in ZFS])
684 AC_MSG_ERROR([dmu_read_by_dnode does not exist])
687 dnl # ZFS 0.7.2 adds new method dmu_tx_mark_netfree
689 LB_CHECK_COMPILE([if ZFS has 'dmu_tx_mark_netfree'],
690 dmu_tx_mark_netfree, [
694 dmu_tx_mark_netfree(tx);
696 AC_DEFINE(HAVE_DMU_TX_MARK_NETFREE, 1,
697 [Have dmu_tx_mark_netfree])
700 dnl # ZFS 0.7.10 changes timestruc_t to inode_timespec_t
702 LB_CHECK_COMPILE([if SPL has 'inode_timespec_t'],
703 zfs_have_inode_timespec, [
704 #include <sys/fs/zfs.h>
706 inode_timespec_t now;
709 AC_DEFINE(HAVE_ZFS_INODE_TIMESPEC, 1,
710 [Have inode_timespec_t])
712 dnl # ZFS 0.7.12/0.8.x uses zfs_refcount_add() instead of
713 dnl # refcount_add(). ZFS 2.0 renamed sys/refcount.h to
714 dnl # sys/zfs_refcount.h, rather the add another check to
715 dnl # determine the correct header name include it
716 dnl # indirectly through sys/dnode.h.
718 LB_CHECK_COMPILE([if ZFS has 'zfs_refcount_add'],
720 #include <sys/dnode.h>
722 zfs_refcount_add((zfs_refcount_t *) NULL, NULL);
724 AC_DEFINE(HAVE_ZFS_REFCOUNT_ADD, 1,
725 [Have zfs_refcount_add])
728 dnl # ZFS 0.8.x changes dmu_objset_own for encryption
730 LB_CHECK_COMPILE([if ZFS has 'dmu_objset_own' with 6 args],
732 #include <sys/dmu_objset.h>
735 dmu_objset_type_t type = DMU_OST_ANY;
736 dmu_objset_own(NULL, type, B_FALSE, B_TRUE, FTAG, &os);
738 AC_DEFINE(HAVE_DMU_OBJSET_OWN_6ARG, 1,
739 [Have dmu_objset_own() with 6 args])
742 dnl # ZFS 0.8.x changes dmu_objset_disown for encryption
744 LB_CHECK_COMPILE([if ZFS has 'dmu_objset_disown' with 3 args],
746 #include <sys/dmu_objset.h>
749 dmu_objset_disown(os, B_TRUE, FTAG);
751 AC_DEFINE(HAVE_DMU_OBJSET_DISOWN_3ARG, 1,
752 [Have dmu_objset_disown() with 3 args])
755 dnl # ZFS exports dmu_offet_next
757 AC_CACHE_CHECK([if ZFS exports 'dmu_offset_next'],
758 [lb_cv_dmu_offset_next], [
759 lb_cv_dmu_offset_next="no"
760 AS_IF([grep -q -E "EXPORT_SYMBOL.*\(dmu_offset_next\)" "$zfssrc/module/zfs/dmu.c" 2>/dev/null],
761 [lb_cv_dmu_offset_next="yes"])
763 AS_IF([test "x$lb_cv_dmu_offset_next" = "xyes"], [
764 AC_DEFINE(HAVE_DMU_OFFSET_NEXT, 1,
765 [Have dmu_offset_next() exported])
768 dnl # ZFS 2.0 replaced .db_last_dirty / .dr_next with a list_t
769 dnl # and list_node_t named .db_dirty_records / .dr_dbuf_node.
771 LB_CHECK_COMPILE([if ZFS has 'db_dirty_records' list_t],
773 #include <sys/dbuf.h>
776 dbuf_dirty_record_t *dr;
777 dr = list_head(&db.db_dirty_records);
779 AC_DEFINE(HAVE_DB_DIRTY_RECORDS_LIST, 1,
780 [Have db_dirty_records list_t])
783 dnl # ZFS 2.0 renamed sys/refcount.h to zfs_refcount.h
784 dnl # This build issue shows up with ZFS 2.0.7 and Lustre 2.12 LTS
786 LB_CHECK_COMPILE([if ZFS renamed sys/refcount to zfs_refcount.h],
788 #include <sys/zfs_refcount.h>
790 zfs_refcount_add((zfs_refcount_t *) NULL, NULL);
792 AC_DEFINE(HAVE_ZFS_REFCOUNT_HEADER, 1,
793 [Have zfs_refcount.h])
797 AS_IF([test "x$enable_zfs" = xyes], [
798 AC_SUBST(ENABLE_ZFS, yes)
800 AC_SUBST(ENABLE_ZFS, no)
802 AM_CONDITIONAL(ZFS_ENABLED, [test "x$enable_zfs" = xyes])
803 AM_CONDITIONAL(SPL_ENABLED, [test "x$enable_spl" = xyes])