Whamcloud - gitweb
LU-9564 build: Add server-build for Ubuntu with Kernel 4.4.0
[fs/lustre-release.git] / config / lustre-build-zfs.m4
1 dnl #
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.
6 dnl #
7 dnl # --without-zfs   - Disable zfs support.
8 dnl # --with-zfs=no
9 dnl #
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.
14 dnl #
15 dnl #                       * /var/lib/dkms/zfs/${VERSION}/source
16 dnl #                       * /usr/src/zfs-${VERSION}/${LINUXRELEASE}
17 dnl #                       * /usr/src/zfs-${VERSION}
18 dnl #                       * ../spl/
19 dnl #                       * $LINUX
20 dnl #
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.*
30 dnl #
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.
34 dnl #
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.
39 dnl #
40 dnl # --without-spl   - Disable spl support.
41 dnl # --with-spl=no
42 dnl #
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}
48 dnl #                   * ../spl/
49 dnl #                   * $LINUX
50 dnl #
51 dnl # --with-spl=path - Enable spl support and use the spl headers in the
52 dnl #                   provided path.  No autodetection is performed.
53 dnl #
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.
58 dnl #
59 AC_DEFUN([LB_SPL], [
60         AC_ARG_WITH([spl],
61                 AS_HELP_STRING([--with-spl=PATH],
62                 [Path to spl source]),
63                 [splsrc="$withval"])
64
65         AC_ARG_WITH([spl-obj],
66                 AS_HELP_STRING([--with-spl-obj=PATH],
67                 [Path to spl build objects]),
68                 [splobj="$withval"])
69
70         dnl #
71         dnl # The existence of spl.release[.in] is used to identify a valid
72         dnl # source directory.  In order of preference:
73         dnl #
74         splver=$(ls -1 /usr/src/ | grep -m1 spl | cut -f2 -d'-')
75         spldkms="/var/lib/dkms/spl/${splver}"
76         splsrc1="/usr/src/spl-${splver}/${LINUXRELEASE}"
77         splsrc2="/usr/src/spl-${splver}"
78         splsrc3="../spl/"
79         splsrc4="$LINUX"
80
81         AC_MSG_CHECKING([spl source directory])
82         AS_IF([test -z "${splsrc}"], [
83                 AS_IF([test -e "${spldkms}/source/spl.release.in"], [
84                         splsrc=${spldkms}/source
85                 ], [test -e "${splsrc1}/spl.release.in"], [
86                         splsrc=${splsrc1}
87                 ], [test -e "${splsrc2}/spl.release.in"], [
88                         splsrc=${splsrc2}
89                 ], [test -e "${splsrc3}/spl.release.in"], [
90                         splsrc=$(readlink -f "${splsrc3}")
91                 ], [test -e "${splsrc4}/spl.release.in"], [
92                         splsrc=${splsrc4}
93                 ], [
94                         splsrc="[Not found]"
95                 ])
96         ])
97         AC_MSG_RESULT([$splsrc])
98
99         AS_IF([test ! -e "$splsrc/spl.release" &&
100             test ! -e "$splsrc/spl.release.in"], [
101                 enable_zfs=no
102         ])
103
104         dnl #
105         dnl # The existence of the spl_config.h is used to identify a valid
106         dnl # spl object directory.  In many cases the object and source
107         dnl # directory are the same, however the objects may also reside
108         dnl # is a subdirectory named after the kernel version.  When
109         dnl # weak modules are used, the kernel version may not be the
110         dnl # same as the LINUXRELEASE against which we are building lustre.
111         dnl #
112         AC_MSG_CHECKING([spl build directory])
113         AS_IF([test -z "$splobj"], [
114                 last_spl_obj_dir=$(ls -d ${splsrc}/[[0-9]]*/ | tail -n 1 | sed 's|/$||')
115                 AS_IF([test "${splsrc}" = "${spldkms}/source"], [
116                         AS_IF([test -e "${spldkms}/${LINUXRELEASE}/${target_cpu}/spl_config.h"], [
117                                 splobj=${spldkms}/${LINUXRELEASE}/${target_cpu}
118                         ], [
119                                 splobj="[Not found]"
120                         ])
121                 ],[test -e "${splsrc}/${LINUXRELEASE}/spl_config.h"], [
122                         splobj="${splsrc}/${LINUXRELEASE}"
123                 ], [test -e "${splsrc}/spl_config.h"], [
124                         splobj="${splsrc}"
125                 ], [test -e "${last_spl_obj_dir}/spl_config.h"], [
126                         splobj="${last_spl_obj_dir}"
127                 ], [
128                         splobj="[Not found]"
129                 ])
130         ])
131         AC_MSG_RESULT([$splobj])
132
133         AS_IF([test ! -e "$splobj/spl_config.h"], [
134                 enable_zfs=no
135         ])
136
137         dnl #
138         dnl # Verify the source version using SPL_META_VERSION in spl_config.h
139         dnl #
140         AS_IF([test x$enable_zfs = xyes], [
141                 AC_MSG_CHECKING([spl source version])
142                 AS_IF([fgrep -q SPL_META_VERSION $splobj/spl_config.h], [
143                         splver=$((echo "#include <spl_config.h>";
144                             echo "splver=SPL_META_VERSION-SPL_META_RELEASE") |
145                             cpp -I $splobj |
146                             grep "^splver=" | tr -d \" | cut -d= -f2)
147                 ], [
148                         splver="[Not found]"
149                         enable_zfs=no
150                 ])
151                 AC_MSG_RESULT([$splver])
152         ])
153
154         dnl #
155         dnl # Verify the modules systems exist by the expect name.
156         dnl #
157         AS_IF([test x$enable_zfs = xyes], [
158                 AC_MSG_CHECKING([spl file name for module symbols])
159                 AS_IF([test -r $splobj/$SYMVERFILE], [
160                         splsym=$SYMVERFILE
161                         EXTRA_SYMBOLS="$EXTRA_SYMBOLS $splobj/$SYMVERFILE"
162                 ], [test -r $splobj/module/$SYMVERFILE], [
163                         splsym=$SYMVERFILE
164                         EXTRA_SYMBOLS="$EXTRA_SYMBOLS $splobj/module/$SYMVERFILE"
165                 ], [
166                         splsym="[Not found]"
167                         enable_zfs=no
168                 ])
169                 AC_MSG_RESULT([$splsym])
170         ])
171
172         SPL=${splsrc}
173         SPL_OBJ=${splobj}
174         SPL_VERSION=${splver}
175
176         AC_SUBST(SPL)
177         AC_SUBST(SPL_OBJ)
178         AC_SUBST(SPL_VERSION)
179         AC_SUBST(EXTRA_SYMBOLS)
180 ])
181
182 AC_DEFUN([LB_ZFS], [
183         AC_ARG_WITH([zfs-obj],
184                 AS_HELP_STRING([--with-zfs-obj=PATH],
185                 [Path to zfs build objects]),
186                 [zfsobj="$withval"])
187
188         dnl #
189         dnl # The existence of zfs.release[.in] is used to identify a valid
190         dnl # source directory.  In order of preference:
191         dnl #
192         zfsver=$(ls -1 /usr/src/ | grep -m1 zfs | cut -f2 -d'-')
193         zfsdkms="/var/lib/dkms/zfs/${zfsver}"
194         zfssrc1="/usr/src/zfs-${zfsver}/${LINUXRELEASE}"
195         zfssrc2="/usr/src/zfs-${zfsver}"
196         zfssrc3="../zfs/"
197         zfssrc4="$LINUX"
198
199         AC_MSG_CHECKING([zfs source directory])
200         AS_IF([test -z "${zfssrc}"], [
201                 AS_IF([test -e "${zfsdkms}/source/zfs.release.in"], [
202                         zfssrc=${zfsdkms}/source
203                 ], [test -e "${zfssrc1}/zfs.release.in"], [
204                         zfssrc=${zfssrc1}
205                 ], [test -e "${zfssrc2}/zfs.release.in"], [
206                         zfssrc=${zfssrc2}
207                 ], [test -e "${zfssrc3}/zfs.release.in"], [
208                         zfssrc=$(readlink -f "${zfssrc3}")
209                 ], [test -e "${zfssrc4}/zfs.release.in"], [
210                         zfssrc=${zfssrc4}
211                 ], [
212                         zfssrc="[Not found]"
213                 ])
214         ])
215         AC_MSG_RESULT([$zfssrc])
216
217         AS_IF([test ! -e "$zfssrc/zfs.release.in" &&
218             test ! -e "$zfssrc/zfs.release"], [
219                 enable_zfs=no
220         ])
221
222         dnl #
223         dnl # The existence of the zfs_config.h is used to identify a valid
224         dnl # zfs object directory.  In many cases the object and source
225         dnl # directory are the same, however the objects may also reside
226         dnl # is a subdirectory named after the kernel version.  When
227         dnl # weak modules are used, the kernel version may not be the
228         dnl # same as the LINUXRELEASE against which we are building lustre.
229         dnl #
230         AC_MSG_CHECKING([zfs build directory])
231         AS_IF([test -z "$zfsobj"], [
232                 last_zfs_obj_dir=$(ls -d ${zfssrc}/[[0-9]]*/ | tail -n 1 | sed 's|/$||')
233                 AS_IF([test "${zfssrc}" = "${zfsdkms}/source"], [
234                         AS_IF([test -e "${zfsdkms}/${LINUXRELEASE}/${target_cpu}/zfs_config.h"], [
235                                 zfsobj=${zfsdkms}/${LINUXRELEASE}/${target_cpu}
236                         ], [
237                                 zfsobj="[Not found]"
238                         ])
239                 ], [test -e "${zfssrc}/${LINUXRELEASE}/zfs_config.h"], [
240                         zfsobj="${zfssrc}/${LINUXRELEASE}"
241                 ], [test -e "${zfssrc}/zfs_config.h"], [
242                         zfsobj="${zfssrc}"
243                 ], [test -e "${last_zfs_obj_dir}/zfs_config.h"], [
244                         zfsobj="${last_zfs_obj_dir}"
245                 ], [
246                         zfsobj="[Not found]"
247                 ])
248         ])
249
250         AC_MSG_RESULT([$zfsobj])
251         AS_IF([test ! -e "$zfsobj/zfs_config.h"], [
252                 enable_zfs=no
253         ])
254
255         dnl #
256         dnl # Verify the source version using SPL_META_VERSION in spl_config.h
257         dnl #
258         AS_IF([test x$enable_zfs = xyes], [
259                 AC_MSG_CHECKING([zfs source version])
260                 AS_IF([fgrep -q ZFS_META_VERSION $zfsobj/zfs_config.h], [
261                         zfsver=$((echo "#include <zfs_config.h>";
262                             echo "zfsver=ZFS_META_VERSION-ZFS_META_RELEASE") |
263                             cpp -I $zfsobj |
264                             grep "^zfsver=" | tr -d \" | cut -d= -f2)
265                 ],[
266                         zfsver="[Not found]"
267                         enable_zfs=no
268                 ])
269                 AC_MSG_RESULT([$zfsver])
270         ])
271
272         dnl #
273         dnl # Verify the modules systems exist by the expect name.
274         dnl #
275         AS_IF([test x$enable_zfs = xyes], [
276                 AC_MSG_CHECKING([zfs file name for module symbols])
277                 AS_IF([test -r $zfsobj/$SYMVERFILE], [
278                         zfssym=$SYMVERFILE
279                         EXTRA_SYMBOLS="$EXTRA_SYMBOLS $zfsobj/$SYMVERFILE"
280                 ], [test -r $zfsobj/module/$SYMVERFILE], [
281                         zfssym=$SYMVERFILE
282                         EXTRA_SYMBOLS="$EXTRA_SYMBOLS $zfsobj/module/$SYMVERFILE"
283                 ], [
284                         zfssym="[Not found]"
285                         enable_zfs=no
286                 ])
287                 AC_MSG_RESULT([$zfssym])
288         ])
289
290         ZFS=${zfssrc}
291         ZFS_OBJ=${zfsobj}
292         ZFS_VERSION=${zfsver}
293
294         AC_SUBST(ZFS)
295         AC_SUBST(ZFS_OBJ)
296         AC_SUBST(ZFS_VERSION)
297         AC_SUBST(EXTRA_SYMBOLS)
298 ])
299
300 AC_DEFUN([LB_ZFS_DEVEL], [
301         AC_ARG_WITH([zfs-devel],
302                 [AS_HELP_STRING([--with-zfs-devel=PATH],
303                 [Path to zfs development headers])],
304                 [zfsdevel="$withval"])
305
306         AC_MSG_CHECKING([user provided zfs devel headers])
307         AS_IF([test ! -z "${zfsdevel}"], [
308                 AS_IF([test -d "${zfsdevel}/usr/include/libspl" && test -d "${zfsdevel}/usr/include/libzfs"], [
309                         zfsinc="-I $zfsdevel/usr/include/libspl -I $zfsdevel/usr/include/libzfs"
310                         zfslib="-L$zfsdevel/usr/lib64 -L$zfsdevel/usr/lib -L$zfsdevel/lib64 -L$zfsdevel/lib"
311                 ], [
312                         AC_MSG_ERROR([Path to development headers directory does not exist])
313                 ])
314         ])
315         AC_MSG_RESULT([$zfsinc])
316 ])
317
318 AC_DEFUN([LB_ZFS_USER], [
319         dnl #
320         dnl # Detect user space zfs development headers.
321         dnl #
322         AC_MSG_CHECKING([zfs devel headers])
323         AS_IF([test -z "${zfsinc}"], [
324                 AS_IF([test -e "${zfssrc}/include/libzfs.h" && test -e "${zfssrc}/lib/libspl/include"], [
325                         zfsinc="-I $zfssrc/lib/libspl/include -I $zfssrc/include"
326                         zfslib="-L$zfssrc/lib/libzfs/.libs/"
327                 ], [test -d /usr/include/libzfs && test -d /usr/include/libspl], [
328                         zfsinc="-I/usr/include/libspl -I /usr/include/libzfs"
329                         zfslib=""
330                 ], [
331                         zfsinc="[Not Found]"
332                         zfslib=""
333                         enable_zfs=no
334                 ])
335         ])
336         AC_MSG_RESULT([$zfsinc])
337
338         ZFS_LIBZFS_INCLUDE=${zfsinc}
339         ZFS_LIBZFS_LDFLAGS="-lzfs ${zfslib}"
340         AC_SUBST(ZFS_LIBZFS_INCLUDE)
341         AC_SUBST(ZFS_LIBZFS_LDFLAGS)
342 ])
343
344 AC_DEFUN([LB_CONFIG_ZFS], [
345         AC_ARG_WITH([zfs],
346                 [AS_HELP_STRING([--with-zfs=PATH], [Path to zfs source])],
347                 [
348                         AS_IF([test x$withval = xno], [
349                                 enable_zfs=no
350                                 require_zfs=no
351                         ], [test x$withval = xyes], [
352                                 enable_zfs=yes
353                                 require_zfs=yes
354                         ], [
355                                 enable_zfs=yes
356                                 require_zfs=yes
357                                 zfssrc="$withval"
358                         ])
359                 ], [
360                         AS_IF([test x$enable_server != xno], [
361                                 require_zfs=no
362                                 enable_zfs=yes
363                         ], [
364                                 require_zfs=no
365                                 enable_zfs=no
366                         ])
367                 ])
368
369         AC_MSG_CHECKING([whether to enable zfs])
370         AC_MSG_RESULT([$enable_zfs])
371
372         AS_IF([test x$enable_zfs = xyes], [
373                 AS_IF([test x$enable_modules = xyes], [
374                         LB_SPL
375                         LB_ZFS
376                 ])
377                 LB_ZFS_DEVEL
378                 LB_ZFS_USER
379
380                 dnl #
381                 dnl # enable_zfs will be set to no in LB_SPL or LB_ZFS if
382                 dnl # one of more of the build requirements is not met.
383                 dnl #
384                 AS_IF([test x$enable_zfs = xyes], [
385                         AC_DEFINE(HAVE_ZFS_OSD, 1, Enable zfs osd)
386                 ],[
387                         AS_IF([test x$require_zfs = xyes], [
388                                 AC_MSG_ERROR([
389
390 Required zfs osd cannot be built due to missing zfs development headers.
391
392 Support for zfs can be enabled by downloading the required packages for your
393 distribution.  See http://zfsonlinux.org/ to determine is zfs is supported by
394 your distribution.
395                                 ])
396                         ], [
397                                 AC_MSG_WARN([
398
399 Disabling optional zfs osd due to missing development headers.
400
401 Support for zfs can be enabled by downloading the required packages for your
402 distribution.  See http://zfsonlinux.org/ to determine is zfs is supported by
403 your distribution.
404                                 ])
405                         ])
406                 ])
407         ])
408
409         dnl #
410         dnl # Define zfs source code version
411         dnl #
412         AS_IF([test x$enable_zfs = xyes], [
413                 ZFS_MAJOR=$(echo $zfsver | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\1/'])
414                 ZFS_MINOR=$(echo $zfsver | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\2/'])
415                 ZFS_PATCH=$(echo $zfsver | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\3/'])
416                 ZFS_FIX=$(echo $zfsver   | sed -re ['s/([0-9]+)\.([0-9]+)\.([0-9]+)(\.([0-9]+))?.*/\5/'])
417                 AS_IF([test -z "$ZFS_FIX"], [ZFS_FIX="0"])
418
419                 AC_DEFINE_UNQUOTED([ZFS_MAJOR], [$ZFS_MAJOR], [zfs major version])
420                 AC_DEFINE_UNQUOTED([ZFS_MINOR], [$ZFS_MINOR], [zfs minor version])
421                 AC_DEFINE_UNQUOTED([ZFS_PATCH], [$ZFS_PATCH], [zfs patch version])
422                 AC_DEFINE_UNQUOTED([ZFS_FIX],   [$ZFS_FIX],   [zfs fix version])
423         ])
424
425         AS_IF([test "x$enable_zfs" = xyes], [
426                 LB_CHECK_COMPILE([if zfs defines dsl_pool_config_enter/exit],
427                 dsl_pool_config_enter, [
428                         #include <sys/dsl_pool.h>
429                 ],[
430                         dsl_pool_config_enter(NULL, FTAG);
431                 ],[
432                         AC_DEFINE(HAVE_DSL_POOL_CONFIG, 1,
433                                 [Have dsl_pool_config_enter/exit in ZFS])
434                 ])
435                 LB_CHECK_COMPILE([if zfs defines dsl_sync_task_do_nowait],
436                 dsl_sync_task_do_nowait, [
437                         #include <sys/dsl_synctask.h>
438                 ],[
439                         dsl_sync_task_do_nowait(NULL, NULL, NULL, NULL, NULL, 0, NULL);
440                 ],[
441                         AC_DEFINE(HAVE_DSL_SYNC_TASK_DO_NOWAIT, 1,
442                                 [Have dsl_sync_task_do_nowait in ZFS])
443                 ])
444                 LB_CHECK_COMPILE([if zfs defines sa_spill_alloc],
445                 sa_spill_alloc, [
446                         #include <sys/kmem.h>
447                         #include <sys/sa.h>
448                 ],[
449                         void *ptr;
450
451                         ptr = sa_spill_alloc(KM_SLEEP);
452                         sa_spill_free(ptr);
453                 ],[
454                         AC_DEFINE(HAVE_SA_SPILL_ALLOC, 1,
455                                 [Have sa_spill_alloc in ZFS])
456                 ])
457                 LB_CHECK_COMPILE([if zfs defines spa_maxblocksize],
458                 spa_maxblocksize, [
459                         #include <sys/spa.h>
460                 ],[
461                         spa_t *spa = NULL;
462                         int size;
463
464                         size = spa_maxblocksize(spa);
465                 ],[
466                         AC_DEFINE(HAVE_SPA_MAXBLOCKSIZE, 1,
467                                 [Have spa_maxblocksize in ZFS])
468                 ])
469
470                 dnl #
471                 dnl # ZFS 0.7.x adds support for large dnodes.  This
472                 dnl # allows Lustre to optionally specify the size of a
473                 dnl # dnode which ZFS will then use to store metadata such
474                 dnl # as xattrs. The default dnode size specified by the
475                 dnl # 'dnodesize' dataset property will be used unless a
476                 dnl # specific value is provided.
477                 dnl #
478                 LB_CHECK_COMPILE([if zfs defines dmu_object_alloc_dnsize],
479                 dmu_object_alloc_dnsize, [
480                         #include <sys/dmu.h>
481                         #include <sys/dnode.h>
482                 ],[
483                         objset_t *os = NULL;
484                         dmu_object_type_t objtype = DMU_OT_NONE;
485                         int blocksize = 0;
486                         dmu_object_type_t bonustype = DMU_OT_SA;
487                         int dnodesize = DNODE_MIN_SIZE;
488                         dmu_tx_t *tx = NULL;
489                         uint64_t id;
490
491                         id = dmu_object_alloc_dnsize(os, objtype, blocksize,
492                                                      bonustype,
493                                                      DN_BONUS_SIZE(dnodesize),
494                                                      dnodesize, tx);
495                 ],[
496                         AC_DEFINE(HAVE_DMU_OBJECT_ALLOC_DNSIZE, 1,
497                                 [Have dmu_object_alloc_dnsize in ZFS])
498                 ])
499
500                 dnl #
501                 dnl # ZFS 0.7.x extended dmu_prefetch() to take an additional
502                 dnl # 'level' and 'priority' argument.  Use a level of 0 and a
503                 dnl # priority of ZIO_PRIORITY_SYNC_READ to replicate the
504                 dnl # behavior of the four argument version.
505                 dnl #
506                 LB_CHECK_COMPILE([if ZFS has 'dmu_prefetch' with 6 args],
507                 dmu_prefetch, [
508                         #include <sys/dmu.h>
509                 ],[
510                         objset_t *os = NULL;
511                         uint64_t object = 0;
512                         int64_t level = 0;
513                         uint64_t offset = 0;
514                         uint64_t len = 0;
515                         enum zio_priority pri = ZIO_PRIORITY_SYNC_READ;
516
517                         dmu_prefetch(os, object, level, offset, len, pri);
518                 ],[
519                         AC_DEFINE(HAVE_DMU_PREFETCH_6ARG, 1,
520                                 [Have 6 argument dmu_pretch in ZFS])
521                 ])
522                 dnl #
523                 dnl # ZFS 0.7.0 feature: SPA_FEATURE_USEROBJ_ACCOUNTING
524                 dnl #
525                 LB_CHECK_COMPILE([if zfs has native dnode accounting supported],
526                 dmu_objset_userobjspace_upgrade, [
527                         #include <sys/dmu_objset.h>
528                 ],[
529                         dmu_objset_userobjspace_upgrade(NULL);
530                 ],[
531                         AC_DEFINE(HAVE_DMU_USEROBJ_ACCOUNTING, 1,
532                                 [Have native dnode accounting in ZFS])
533                 ])
534                 dnl # ZFS 0.7.x adds new method zap_lookup_by_dnode
535                 dnl #
536                 LB_CHECK_COMPILE([if ZFS has 'zap_lookup_by_dnode'],
537                 zap_lookup_by_dnode, [
538                         #include <sys/zap.h>
539                         #include <sys/dnode.h>
540                 ],[
541                         dnode_t *dn = NULL;
542                         zap_lookup_by_dnode(dn, NULL, 1, 1, NULL);
543                 ],[
544                         AC_DEFINE(HAVE_ZAP_LOOKUP_BY_DNODE, 1,
545                                 [Have zap_lookup_by_dnode() in ZFS])
546                 ])
547                 dnl #
548                 dnl # ZFS 0.7.x adds new method zap_add_by_dnode
549                 dnl #
550                 LB_CHECK_COMPILE([if ZFS has 'zap_add_by_dnode'],
551                 zap_add_by_dnode, [
552                         #include <sys/zap.h>
553                         #include <sys/dnode.h>
554                 ],[
555                         dnode_t *dn = NULL;
556                         zap_add_by_dnode(dn, NULL, 1, 1, NULL, NULL);
557                 ],[
558                         AC_DEFINE(HAVE_ZAP_ADD_BY_DNODE, 1,
559                                 [Have zap_add_by_dnode() in ZFS])
560                 ])
561                 dnl #
562                 dnl # ZFS 0.7.x adds new method zap_remove_by_dnode
563                 dnl #
564                 LB_CHECK_COMPILE([if ZFS has 'zap_remove_by_dnode'],
565                 zap_remove_by_dnode, [
566                         #include <sys/zap.h>
567                         #include <sys/dnode.h>
568                 ],[
569                         dnode_t *dn = NULL;
570                         zap_remove_by_dnode(dn, NULL, NULL);
571                 ],[
572                         AC_DEFINE(HAVE_ZAP_REMOVE_ADD_BY_DNODE, 1,
573                                 [Have zap_remove_by_dnode() in ZFS])
574                 ])
575                 dnl #
576                 dnl # ZFS 0.7.x adds new method dmu_tx_hold_zap_by_dnode
577                 dnl #
578                 LB_CHECK_COMPILE([if ZFS has 'dmu_tx_hold_zap_by_dnode'],
579                 dmu_tx_hold_zap_by_dnode, [
580                         #include <sys/zap.h>
581                         #include <sys/dnode.h>
582                 ],[
583                         dnode_t *dn = NULL;
584                         dmu_tx_hold_zap_by_dnode(NULL, dn, TRUE, NULL);
585                 ],[
586                         AC_DEFINE(HAVE_DMU_TX_HOLD_ZAP_BY_DNODE, 1,
587                                 [Have dmu_tx_hold_zap_by_dnode() in ZFS])
588                 ])
589                 dnl #
590                 dnl # ZFS 0.7.x adds new method dmu_tx_hold_write_by_dnode
591                 dnl #
592                 LB_CHECK_COMPILE([if ZFS has 'dmu_tx_hold_write_by_dnode'],
593                 dmu_tx_hold_write_by_dnode, [
594                         #include <sys/zap.h>
595                         #include <sys/dnode.h>
596                 ],[
597                         dnode_t *dn = NULL;
598                         dmu_tx_hold_write_by_dnode(NULL, dn, 0, 0);
599                 ],[
600                         AC_DEFINE(HAVE_DMU_TX_HOLD_WRITE_BY_DNODE, 1,
601                                 [Have dmu_tx_hold_write_by_dnode() in ZFS])
602                 ])
603                 dnl #
604                 dnl # ZFS 0.7.x adds new method dmu_write_by_dnode
605                 dnl #
606                 LB_CHECK_COMPILE([if ZFS has 'dmu_write_by_dnode'],
607                 dmu_write_by_dnode, [
608                         #include <sys/zap.h>
609                         #include <sys/dnode.h>
610                 ],[
611                         dnode_t *dn = NULL;
612                         dmu_write_by_dnode(dn, 0, 0, NULL, NULL);
613                 ],[
614                         AC_DEFINE(HAVE_DMU_WRITE_BY_DNODE, 1,
615                                 [Have dmu_write_by_dnode() in ZFS])
616                 ])
617                 dnl #
618                 dnl # ZFS 0.7.x adds new method dmu_read_by_dnode
619                 dnl #
620                 LB_CHECK_COMPILE([if ZFS has 'dmu_read_by_dnode'],
621                 dmu_read_by_dnode, [
622                         #include <sys/zap.h>
623                         #include <sys/dnode.h>
624                 ],[
625                         dnode_t *dn = NULL;
626                         dmu_read_by_dnode(dn, 0, 0, NULL, 0);
627                 ],[
628                         AC_DEFINE(HAVE_DMU_READ_BY_DNODE, 1,
629                                 [Have dmu_read_by_dnode() in ZFS])
630                 ])
631         ])
632
633         AS_IF([test "x$enable_zfs" = xyes], [
634                 AC_SUBST(ENABLE_ZFS, yes)
635         ], [
636                 AC_SUBST(ENABLE_ZFS, no)
637         ])
638         AM_CONDITIONAL(ZFS_ENABLED, [test "x$enable_zfs" = xyes])
639 ])