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.
26 dnl # --with-zfs=path - Enable zfs support and use the zfs headers in the
27 dnl # provided path. No autodetection is performed and
28 dnl # if no headers are found this is a fatal error.
30 dnl # --with-zfs-obj - When zfs support is enabled the object directory
31 dnl # will be based on the --with-zfs directory. If this
32 dnl # is detected incorrectly it can be explicitly
33 dnl # specified using this option.
35 dnl # --without-spl - Disable spl support.
38 dnl # --with-spl - Enable spl support and attempt to autodetect the spl
39 dnl # --with-spl=yes headers in one of the following places in this order:
40 dnl # * /var/lib/dkms/spl/${VERSION}/build
41 dnl # * /usr/src/spl-${VERSION}/${LINUXRELEASE}
42 dnl # * /usr/src/spl-${VERSION}
46 dnl # --with-spl=path - Enable spl support and use the spl headers in the
47 dnl # provided path. No autodetection is performed.
49 dnl # --with-spl-obj - When spl support is enabled the object directory
50 dnl # will be based on the --with-spl directory. If this
51 dnl # is detected incorrectly it can be explicitly
52 dnl # specified using this option.
56 AS_HELP_STRING([--with-spl=PATH],
57 [Path to spl source]),
60 AC_ARG_WITH([spl-obj],
61 AS_HELP_STRING([--with-spl-obj=PATH],
62 [Path to spl build objects]),
66 dnl # The existence of spl.release[.in] is used to identify a valid
67 dnl # source directory. In order of preference:
69 splver=$(ls -1 /usr/src/ | grep -m1 spl | cut -f2 -d'-')
70 splsrc0="/var/lib/dkms/spl/${splver}/build"
71 splsrc1="/usr/src/spl-${splver}/${LINUXRELEASE}"
72 splsrc2="/usr/src/spl-${splver}"
76 AC_MSG_CHECKING([spl source directory])
77 AS_IF([test -z "${splsrc}"], [
78 AS_IF([test -e "${splsrc0}/spl.release.in"], [
80 ], [test -e "${splsrc1}/spl.release.in"], [
82 ], [test -e "${splsrc2}/spl.release.in"], [
84 ], [test -e "${splsrc3}/spl.release.in"], [
85 splsrc=$(readlink -f "${splsrc3}")
86 ], [test -e "${splsrc4}/spl.release.in"], [
92 AC_MSG_RESULT([$splsrc])
94 AS_IF([test ! -e "$splsrc/spl.release" &&
95 test ! -e "$splsrc/spl.release.in"], [
100 dnl # The existence of the spl_config.h is used to identify a valid
101 dnl # spl object directory. In many cases the object and source
102 dnl # directory are the same, however the objects may also reside
103 dnl # is a subdirectory named after the kernel version.
105 AC_MSG_CHECKING([spl build directory])
106 AS_IF([test -z "$splobj"], [
107 AS_IF([test -e "${splsrc}/${LINUXRELEASE}/spl_config.h"], [
108 splobj="${splsrc}/${LINUXRELEASE}"
109 ], [test -e "${splsrc}/spl_config.h"], [
115 AC_MSG_RESULT([$splobj])
117 AS_IF([test ! -e "$splobj/spl_config.h"], [
122 dnl # Verify the source version using SPL_META_VERSION in spl_config.h
124 AS_IF([test x$enable_zfs = xyes], [
125 AC_MSG_CHECKING([spl source version])
126 AS_IF([fgrep -q SPL_META_VERSION $splobj/spl_config.h], [
127 splver=$((echo "#include <spl_config.h>";
128 echo "splver=SPL_META_VERSION-SPL_META_RELEASE") |
130 grep "^splver=" | tr -d \" | cut -d= -f2)
135 AC_MSG_RESULT([$splver])
139 dnl # Verify the modules systems exist by the expect name.
141 AS_IF([test x$enable_zfs = xyes], [
142 AC_MSG_CHECKING([spl file name for module symbols])
143 AS_IF([test -r $splobj/$SYMVERFILE], [
145 ], [test -r $splobj/module/$SYMVERFILE], [
151 AC_MSG_RESULT([$splsym])
156 SPL_VERSION=${splver}
157 SPL_SYMBOLS=${splsym}
161 AC_SUBST(SPL_VERSION)
162 AC_SUBST(SPL_SYMBOLS)
166 AC_ARG_WITH([zfs-obj],
167 AS_HELP_STRING([--with-zfs-obj=PATH],
168 [Path to zfs build objects]),
172 dnl # The existence of zfs.release[.in] is used to identify a valid
173 dnl # source directory. In order of preference:
175 zfsver=$(ls -1 /usr/src/ | grep -m1 zfs | cut -f2 -d'-')
176 zfssrc0="/var/lib/dkms/zfs/${zfsver}/build"
177 zfssrc1="/usr/src/zfs-${zfsver}/${LINUXRELEASE}"
178 zfssrc2="/usr/src/zfs-${zfsver}"
182 AC_MSG_CHECKING([zfs source directory])
183 AS_IF([test -z "${zfssrc}"], [
184 AS_IF([test -e "${zfssrc0}/zfs.release.in"], [
186 ], [test -e "${zfssrc1}/zfs.release.in"], [
188 ], [test -e "${zfssrc2}/zfs.release.in"], [
190 ], [test -e "${zfssrc3}/zfs.release.in"], [
191 zfssrc=$(readlink -f "${zfssrc3}")
192 ], [test -e "${zfssrc4}/zfs.release.in"], [
198 AC_MSG_RESULT([$zfssrc])
200 AS_IF([test ! -e "$zfssrc/zfs.release.in" &&
201 test ! -e "$zfssrc/zfs.release"], [
206 dnl # The existence of the zfs_config.h is used to identify a valid
207 dnl # zfs object directory. In many cases the object and source
208 dnl # directory are the same, however the objects may also reside
209 dnl # is a subdirectory named after the kernel version.
211 AC_MSG_CHECKING([zfs build directory])
212 AS_IF([test -z "$zfsobj"], [
213 AS_IF([test -e "${zfssrc}/${LINUXRELEASE}/zfs_config.h"], [
214 zfsobj="${zfssrc}/${LINUXRELEASE}"
215 ], [test -e "${zfssrc}/zfs_config.h"], [
222 AC_MSG_RESULT([$zfsobj])
223 AS_IF([test ! -e "$zfsobj/zfs_config.h"], [
228 dnl # Verify the source version using SPL_META_VERSION in spl_config.h
230 AS_IF([test x$enable_zfs = xyes], [
231 AC_MSG_CHECKING([zfs source version])
232 AS_IF([fgrep -q ZFS_META_VERSION $zfsobj/zfs_config.h], [
233 zfsver=$((echo "#include <zfs_config.h>";
234 echo "zfsver=ZFS_META_VERSION-ZFS_META_RELEASE") |
236 grep "^zfsver=" | tr -d \" | cut -d= -f2)
241 AC_MSG_RESULT([$zfsver])
245 dnl # Verify the modules systems exist by the expect name.
247 AS_IF([test x$enable_zfs = xyes], [
248 AC_MSG_CHECKING([zfs file name for module symbols])
249 AS_IF([test -r $zfsobj/$SYMVERFILE], [
251 ], [test -r $zfsobj/module/$SYMVERFILE], [
257 AC_MSG_RESULT([$zfssym])
262 ZFS_VERSION=${zfsver}
263 ZFS_SYMBOLS=${zfssym}
267 AC_SUBST(ZFS_VERSION)
268 AC_SUBST(ZFS_SYMBOLS)
271 AC_DEFUN([LB_ZFS_DEVEL], [
272 AC_ARG_WITH([zfs-devel],
273 [AS_HELP_STRING([--with-zfs-devel=PATH],
274 [Path to zfs development headers])],
275 [zfsdevel="$withval"])
277 AC_MSG_CHECKING([user provided zfs devel headers])
278 AS_IF([test ! -z "${zfsdevel}"], [
279 AS_IF([test -d "${zfsdevel}/usr/include/libspl" && test -d "${zfsdevel}/usr/include/libzfs"], [
280 zfslib="-I $zfsdevel/usr/include/libspl -I $zfsdevel/usr/include/libzfs"
282 AC_MSG_ERROR([Path to development headers directory does not exist])
285 AC_MSG_RESULT([$zfslib])
288 AC_DEFUN([LB_ZFS_USER], [
290 dnl # Detect user space zfs development headers.
292 AC_MSG_CHECKING([zfs devel headers])
293 AS_IF([test -z "${zfslib}"], [
294 AS_IF([test -e "${zfssrc}/include/libzfs.h" && test -e "${zfssrc}/lib/libspl/include"], [
295 zfslib="-I $zfssrc/lib/libspl/include -I $zfssrc/include"
296 ], [test -d /usr/include/libzfs && test -d /usr/include/libspl], [
297 zfslib="-I /usr/include/libspl -I /usr/include/libzfs"
303 AC_MSG_RESULT([$zfslib])
305 ZFS_LIBZFS_INCLUDE=${zfslib}
306 AC_SUBST(ZFS_LIBZFS_INCLUDE)
309 AC_DEFUN([LB_CONFIG_ZFS], [
311 [AS_HELP_STRING([--with-zfs=PATH], [Path to zfs source])],
313 AS_IF([test x$withval = xno], [
316 ], [test x$withval = xyes], [
325 AS_IF([test x$enable_server != xno], [
334 AC_MSG_CHECKING([whether to enable zfs])
335 AC_MSG_RESULT([$enable_zfs])
337 AS_IF([test x$enable_zfs = xyes], [
338 AS_IF([test x$enable_modules = xyes], [
346 dnl # enable_zfs will be set to no in LB_SPL or LB_ZFS if
347 dnl # one of more of the build requirements is not met.
349 AS_IF([test x$enable_zfs = xyes], [
350 AC_DEFINE(HAVE_ZFS_OSD, 1, Enable zfs osd)
352 AS_IF([test x$require_zfs = xyes], [
355 Required zfs osd cannot be built due to missing zfs development headers.
357 Support for zfs can be enabled by downloading the required packages for your
358 distribution. See http://zfsonlinux.org/ to determine is zfs is supported by
364 Disabling optional zfs osd due to missing development headers.
366 Support for zfs can be enabled by downloading the required packages for your
367 distribution. See http://zfsonlinux.org/ to determine is zfs is supported by
374 AS_IF([test "x$enable_zfs" = xyes], [
375 LB_CHECK_COMPILE([if zfs defines dsl_pool_config_enter/exit],
376 dsl_pool_config_enter, [
377 #include <sys/dsl_pool.h>
379 dsl_pool_config_enter(NULL, FTAG);
381 AC_DEFINE(HAVE_DSL_POOL_CONFIG, 1,
382 [Have dsl_pool_config_enter/exit in ZFS])
384 LB_CHECK_COMPILE([if zfs defines dsl_sync_task_do_nowait],
385 dsl_sync_task_do_nowait, [
386 #include <sys/dsl_synctask.h>
388 dsl_sync_task_do_nowait(NULL, NULL, NULL, NULL, NULL, 0, NULL);
390 AC_DEFINE(HAVE_DSL_SYNC_TASK_DO_NOWAIT, 1,
391 [Have dsl_sync_task_do_nowait in ZFS])
395 AM_CONDITIONAL(ZFS_ENABLED, [test "x$enable_zfs" = xyes])