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}/build
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}/build
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 -m1 spl | cut -f2 -d'-')
75 splsrc0="/var/lib/dkms/spl/${splver}/build"
76 splsrc1="/usr/src/spl-${splver}/${LINUXRELEASE}"
77 splsrc2="/usr/src/spl-${splver}"
81 AC_MSG_CHECKING([spl source directory])
82 AS_IF([test -z "${splsrc}"], [
83 AS_IF([test -e "${splsrc0}/spl.release.in"], [
85 ], [test -e "${splsrc1}/spl.release.in"], [
87 ], [test -e "${splsrc2}/spl.release.in"], [
89 ], [test -e "${splsrc3}/spl.release.in"], [
90 splsrc=$(readlink -f "${splsrc3}")
91 ], [test -e "${splsrc4}/spl.release.in"], [
97 AC_MSG_RESULT([$splsrc])
99 AS_IF([test ! -e "$splsrc/spl.release" &&
100 test ! -e "$splsrc/spl.release.in"], [
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.
110 AC_MSG_CHECKING([spl build directory])
111 AS_IF([test -z "$splobj"], [
112 AS_IF([test -e "${splsrc}/${LINUXRELEASE}/spl_config.h"], [
113 splobj="${splsrc}/${LINUXRELEASE}"
114 ], [test -e "${splsrc}/spl_config.h"], [
120 AC_MSG_RESULT([$splobj])
122 AS_IF([test ! -e "$splobj/spl_config.h"], [
127 dnl # Verify the source version using SPL_META_VERSION in spl_config.h
129 AS_IF([test x$enable_zfs = xyes], [
130 AC_MSG_CHECKING([spl source version])
131 AS_IF([fgrep -q SPL_META_VERSION $splobj/spl_config.h], [
132 splver=$((echo "#include <spl_config.h>";
133 echo "splver=SPL_META_VERSION-SPL_META_RELEASE") |
135 grep "^splver=" | tr -d \" | cut -d= -f2)
140 AC_MSG_RESULT([$splver])
144 dnl # Verify the modules systems exist by the expect name.
146 AS_IF([test x$enable_zfs = xyes], [
147 AC_MSG_CHECKING([spl file name for module symbols])
148 AS_IF([test -r $splobj/$SYMVERFILE], [
150 ], [test -r $splobj/module/$SYMVERFILE], [
156 AC_MSG_RESULT([$splsym])
161 SPL_VERSION=${splver}
162 SPL_SYMBOLS=${splsym}
166 AC_SUBST(SPL_VERSION)
167 AC_SUBST(SPL_SYMBOLS)
171 AC_ARG_WITH([zfs-obj],
172 AS_HELP_STRING([--with-zfs-obj=PATH],
173 [Path to zfs build objects]),
177 dnl # The existence of zfs.release[.in] is used to identify a valid
178 dnl # source directory. In order of preference:
180 zfsver=$(ls -1 /usr/src/ | grep -m1 zfs | cut -f2 -d'-')
181 zfssrc0="/var/lib/dkms/zfs/${zfsver}/build"
182 zfssrc1="/usr/src/zfs-${zfsver}/${LINUXRELEASE}"
183 zfssrc2="/usr/src/zfs-${zfsver}"
187 AC_MSG_CHECKING([zfs source directory])
188 AS_IF([test -z "${zfssrc}"], [
189 AS_IF([test -e "${zfssrc0}/zfs.release.in"], [
191 ], [test -e "${zfssrc1}/zfs.release.in"], [
193 ], [test -e "${zfssrc2}/zfs.release.in"], [
195 ], [test -e "${zfssrc3}/zfs.release.in"], [
196 zfssrc=$(readlink -f "${zfssrc3}")
197 ], [test -e "${zfssrc4}/zfs.release.in"], [
203 AC_MSG_RESULT([$zfssrc])
205 AS_IF([test ! -e "$zfssrc/zfs.release.in" &&
206 test ! -e "$zfssrc/zfs.release"], [
211 dnl # The existence of the zfs_config.h is used to identify a valid
212 dnl # zfs object directory. In many cases the object and source
213 dnl # directory are the same, however the objects may also reside
214 dnl # is a subdirectory named after the kernel version.
216 AC_MSG_CHECKING([zfs build directory])
217 AS_IF([test -z "$zfsobj"], [
218 AS_IF([test -e "${zfssrc}/${LINUXRELEASE}/zfs_config.h"], [
219 zfsobj="${zfssrc}/${LINUXRELEASE}"
220 ], [test -e "${zfssrc}/zfs_config.h"], [
227 AC_MSG_RESULT([$zfsobj])
228 AS_IF([test ! -e "$zfsobj/zfs_config.h"], [
233 dnl # Verify the source version using SPL_META_VERSION in spl_config.h
235 AS_IF([test x$enable_zfs = xyes], [
236 AC_MSG_CHECKING([zfs source version])
237 AS_IF([fgrep -q ZFS_META_VERSION $zfsobj/zfs_config.h], [
238 zfsver=$((echo "#include <zfs_config.h>";
239 echo "zfsver=ZFS_META_VERSION-ZFS_META_RELEASE") |
241 grep "^zfsver=" | tr -d \" | cut -d= -f2)
246 AC_MSG_RESULT([$zfsver])
250 dnl # Verify the modules systems exist by the expect name.
252 AS_IF([test x$enable_zfs = xyes], [
253 AC_MSG_CHECKING([zfs file name for module symbols])
254 AS_IF([test -r $zfsobj/$SYMVERFILE], [
256 ], [test -r $zfsobj/module/$SYMVERFILE], [
262 AC_MSG_RESULT([$zfssym])
267 ZFS_VERSION=${zfsver}
268 ZFS_SYMBOLS=${zfssym}
272 AC_SUBST(ZFS_VERSION)
273 AC_SUBST(ZFS_SYMBOLS)
276 AC_DEFUN([LB_ZFS_DEVEL], [
277 AC_ARG_WITH([zfs-devel],
278 [AS_HELP_STRING([--with-zfs-devel=PATH],
279 [Path to zfs development headers])],
280 [zfsdevel="$withval"])
282 AC_MSG_CHECKING([user provided zfs devel headers])
283 AS_IF([test ! -z "${zfsdevel}"], [
284 AS_IF([test -d "${zfsdevel}/usr/include/libspl" && test -d "${zfsdevel}/usr/include/libzfs"], [
285 zfsinc="-I $zfsdevel/usr/include/libspl -I $zfsdevel/usr/include/libzfs"
286 zfslib="-L$zfsdevel/usr/lib64 -L$zfsdevel/usr/lib -L$zfsdevel/lib64 -L$zfsdevel/lib"
288 AC_MSG_ERROR([Path to development headers directory does not exist])
291 AC_MSG_RESULT([$zfsinc])
294 AC_DEFUN([LB_ZFS_USER], [
296 dnl # Detect user space zfs development headers.
298 AC_MSG_CHECKING([zfs devel headers])
299 AS_IF([test -z "${zfsinc}"], [
300 AS_IF([test -e "${zfssrc}/include/libzfs.h" && test -e "${zfssrc}/lib/libspl/include"], [
301 zfsinc="-I $zfssrc/lib/libspl/include -I $zfssrc/include"
302 zfslib="-L$zfssrc/lib/libzfs/.libs/"
303 ], [test -d /usr/include/libzfs && test -d /usr/include/libspl], [
304 zfsinc="-I/usr/include/libspl -I /usr/include/libzfs"
312 AC_MSG_RESULT([$zfsinc])
314 ZFS_LIBZFS_INCLUDE=${zfsinc}
315 ZFS_LIBZFS_LDFLAGS="-lzfs ${zfslib}"
316 AC_SUBST(ZFS_LIBZFS_INCLUDE)
317 AC_SUBST(ZFS_LIBZFS_LDFLAGS)
320 AC_DEFUN([LB_CONFIG_ZFS], [
322 [AS_HELP_STRING([--with-zfs=PATH], [Path to zfs source])],
324 AS_IF([test x$withval = xno], [
327 ], [test x$withval = xyes], [
336 AS_IF([test x$enable_server != xno], [
345 AC_MSG_CHECKING([whether to enable zfs])
346 AC_MSG_RESULT([$enable_zfs])
348 AS_IF([test x$enable_zfs = xyes], [
349 AS_IF([test x$enable_modules = xyes], [
357 dnl # enable_zfs will be set to no in LB_SPL or LB_ZFS if
358 dnl # one of more of the build requirements is not met.
360 AS_IF([test x$enable_zfs = xyes], [
361 AC_DEFINE(HAVE_ZFS_OSD, 1, Enable zfs osd)
363 AS_IF([test x$require_zfs = xyes], [
366 Required zfs osd cannot be built due to missing zfs development headers.
368 Support for zfs can be enabled by downloading the required packages for your
369 distribution. See http://zfsonlinux.org/ to determine is zfs is supported by
375 Disabling optional zfs osd due to missing development headers.
377 Support for zfs can be enabled by downloading the required packages for your
378 distribution. See http://zfsonlinux.org/ to determine is zfs is supported by
385 AS_IF([test "x$enable_zfs" = xyes], [
386 LB_CHECK_COMPILE([if zfs defines dsl_pool_config_enter/exit],
387 dsl_pool_config_enter, [
388 #include <sys/dsl_pool.h>
390 dsl_pool_config_enter(NULL, FTAG);
392 AC_DEFINE(HAVE_DSL_POOL_CONFIG, 1,
393 [Have dsl_pool_config_enter/exit in ZFS])
395 LB_CHECK_COMPILE([if zfs defines dsl_sync_task_do_nowait],
396 dsl_sync_task_do_nowait, [
397 #include <sys/dsl_synctask.h>
399 dsl_sync_task_do_nowait(NULL, NULL, NULL, NULL, NULL, 0, NULL);
401 AC_DEFINE(HAVE_DSL_SYNC_TASK_DO_NOWAIT, 1,
402 [Have dsl_sync_task_do_nowait in ZFS])
406 AM_CONDITIONAL(ZFS_ENABLED, [test "x$enable_zfs" = xyes])