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=path - Enable zfs support and use the zfs headers in the
22 dnl # provided path. No autodetection is performed and
23 dnl # if no headers are found this is a fatal error.
25 dnl # --with-zfs-obj - When zfs support is enabled the object directory
26 dnl # will be based on the --with-zfs directory. If this
27 dnl # is detected incorrectly it can be explicitly
28 dnl # specified using this option.
30 dnl # --without-spl - Disable spl support.
33 dnl # --with-spl - Enable spl support and attempt to autodetect the spl
34 dnl # --with-spl=yes headers in one of the following places in this order:
35 dnl # * /var/lib/dkms/spl/${VERSION}/build
36 dnl # * /usr/src/spl-${VERSION}/${LINUXRELEASE}
37 dnl # * /usr/src/spl-${VERSION}
41 dnl # --with-spl=path - Enable spl support and use the spl headers in the
42 dnl # provided path. No autodetection is performed.
44 dnl # --with-spl-obj - When spl support is enabled the object directory
45 dnl # will be based on the --with-spl directory. If this
46 dnl # is detected incorrectly it can be explicitly
47 dnl # specified using this option.
51 AS_HELP_STRING([--with-spl=PATH],
52 [Path to spl source]),
55 AC_ARG_WITH([spl-obj],
56 AS_HELP_STRING([--with-spl-obj=PATH],
57 [Path to spl build objects]),
61 dnl # The existence of spl.release[.in] is used to identify a valid
62 dnl # source directory. In order of preference:
64 splver=$(ls -1 /usr/src/ | grep -m1 spl | cut -f2 -d'-')
65 splsrc0="/var/lib/dkms/spl/${splver}/build"
66 splsrc1="/usr/src/spl-${splver}/${LINUXRELEASE}"
67 splsrc2="/usr/src/spl-${splver}"
71 AC_MSG_CHECKING([spl source directory])
72 AS_IF([test -z "${splsrc}"], [
73 AS_IF([test -e "${splsrc0}/spl.release.in"], [
75 ], [test -e "${splsrc1}/spl.release.in"], [
77 ], [test -e "${splsrc2}/spl.release.in"], [
79 ], [test -e "${splsrc3}/spl.release.in"], [
80 splsrc=$(readlink -f "${splsrc3}")
81 ], [test -e "${splsrc4}/spl.release.in"], [
87 AC_MSG_RESULT([$splsrc])
89 AS_IF([test ! -e "$splsrc/spl.release" &&
90 test ! -e "$splsrc/spl.release.in"], [
95 dnl # The existence of the spl_config.h is used to identify a valid
96 dnl # spl object directory. In many cases the object and source
97 dnl # directory are the same, however the objects may also reside
98 dnl # is a subdirectory named after the kernel version.
100 AC_MSG_CHECKING([spl build directory])
101 AS_IF([test -z "$splobj"], [
102 AS_IF([test -e "${splsrc}/${LINUXRELEASE}/spl_config.h"], [
103 splobj="${splsrc}/${LINUXRELEASE}"
104 ], [test -e "${splsrc}/spl_config.h"], [
110 AC_MSG_RESULT([$splobj])
112 AS_IF([test ! -e "$splobj/spl_config.h"], [
117 dnl # Verify the source version using SPL_META_VERSION in spl_config.h
119 AS_IF([test x$enable_zfs = xyes], [
120 AC_MSG_CHECKING([spl source version])
121 AS_IF([fgrep -q SPL_META_VERSION $splobj/spl_config.h], [
122 splver=$((echo "#include <spl_config.h>";
123 echo "splver=SPL_META_VERSION-SPL_META_RELEASE") |
125 grep "^splver=" | tr -d \" | cut -d= -f2)
130 AC_MSG_RESULT([$splver])
134 dnl # Verify the modules systems exist by the expect name.
136 AS_IF([test x$enable_zfs = xyes], [
137 AC_MSG_CHECKING([spl file name for module symbols])
138 AS_IF([test -r $splobj/$SYMVERFILE], [
140 ], [test -r $splobj/module/$SYMVERFILE], [
146 AC_MSG_RESULT([$splsym])
151 SPL_VERSION=${splver}
152 SPL_SYMBOLS=${splsym}
156 AC_SUBST(SPL_VERSION)
157 AC_SUBST(SPL_SYMBOLS)
161 AC_ARG_WITH([zfs-obj],
162 AS_HELP_STRING([--with-zfs-obj=PATH],
163 [Path to zfs build objects]),
167 dnl # The existence of zfs.release[.in] is used to identify a valid
168 dnl # source directory. In order of preference:
170 zfsver=$(ls -1 /usr/src/ | grep -m1 zfs | cut -f2 -d'-')
171 zfssrc0="/var/lib/dkms/zfs/${zfsver}/build"
172 zfssrc1="/usr/src/zfs-${zfsver}/${LINUXRELEASE}"
173 zfssrc2="/usr/src/zfs-${zfsver}"
177 AC_MSG_CHECKING([zfs source directory])
178 AS_IF([test -z "${zfssrc}"], [
179 AS_IF([test -e "${zfssrc0}/zfs.release.in"], [
181 ], [test -e "${zfssrc1}/zfs.release.in"], [
183 ], [test -e "${zfssrc2}/zfs.release.in"], [
185 ], [test -e "${zfssrc3}/zfs.release.in"], [
186 zfssrc=$(readlink -f "${zfssrc3}")
187 ], [test -e "${zfssrc4}/zfs.release.in"], [
193 AC_MSG_RESULT([$zfssrc])
195 AS_IF([test ! -e "$zfssrc/zfs.release.in" &&
196 test ! -e "$zfssrc/zfs.release"], [
201 dnl # The existence of the zfs_config.h is used to identify a valid
202 dnl # zfs object directory. In many cases the object and source
203 dnl # directory are the same, however the objects may also reside
204 dnl # is a subdirectory named after the kernel version.
206 AC_MSG_CHECKING([zfs build directory])
207 AS_IF([test -z "$zfsobj"], [
208 AS_IF([test -e "${zfssrc}/${LINUXRELEASE}/zfs_config.h"], [
209 zfsobj="${zfssrc}/${LINUXRELEASE}"
210 ], [test -e "${zfssrc}/zfs_config.h"], [
217 AC_MSG_RESULT([$zfsobj])
218 AS_IF([test ! -e "$zfsobj/zfs_config.h"], [
223 dnl # Verify the source version using SPL_META_VERSION in spl_config.h
225 AS_IF([test x$enable_zfs = xyes], [
226 AC_MSG_CHECKING([zfs source version])
227 AS_IF([fgrep -q ZFS_META_VERSION $zfsobj/zfs_config.h], [
228 zfsver=$((echo "#include <zfs_config.h>";
229 echo "zfsver=ZFS_META_VERSION-ZFS_META_RELEASE") |
231 grep "^zfsver=" | tr -d \" | cut -d= -f2)
236 AC_MSG_RESULT([$zfsver])
240 dnl # Verify the modules systems exist by the expect name.
242 AS_IF([test x$enable_zfs = xyes], [
243 AC_MSG_CHECKING([zfs file name for module symbols])
244 AS_IF([test -r $zfsobj/$SYMVERFILE], [
246 ], [test -r $zfsobj/module/$SYMVERFILE], [
252 AC_MSG_RESULT([$zfssym])
257 ZFS_VERSION=${zfsver}
258 ZFS_SYMBOLS=${zfssym}
262 AC_SUBST(ZFS_VERSION)
263 AC_SUBST(ZFS_SYMBOLS)
266 AC_DEFUN([LB_ZFS_USER], [
268 dnl # Detect user space zfs development headers.
270 AC_MSG_CHECKING([zfs devel headers])
271 AS_IF([test -d /usr/include/libzfs && test -d /usr/include/libspl], [
272 zfslib="-I /usr/include/libspl -I /usr/include/libzfs"
277 AC_MSG_RESULT([$zfslib])
279 ZFS_LIBZFS_INCLUDE=${zfslib}
280 AC_SUBST(ZFS_LIBZFS_INCLUDE)
283 AC_DEFUN([LB_PATH_ZFS], [
285 [AS_HELP_STRING([--with-zfs=PATH], [Path to zfs source])],
287 AS_IF([test x$withval = xno], [
290 ], [test x$withval = xyes], [
299 AS_IF([test x$enable_server = xyes &&
300 test x$enable_dist = xno], [
309 AC_MSG_CHECKING([whether to enable zfs])
310 AC_MSG_RESULT([$enable_zfs])
312 AS_IF([test x$enable_zfs = xyes], [
313 AS_IF([test x$enable_modules = xyes], [
321 dnl # enable_zfs will be set to no in LB_SPL or LB_ZFS if
322 dnl # one of more of the build requirements is not met.
324 AS_IF([test x$enable_zfs = xyes], [
325 AC_DEFINE(HAVE_ZFS_OSD, 1, Enable zfs osd)
327 AS_IF([test x$require_zfs = xyes], [
330 Required zfs osd cannot be built due to missing zfs development headers.
332 Support for zfs can be enabled by downloading the required packages for your
333 distribution. See http://zfsonlinux.org/ to determine is zfs is supported by
339 Disabling optional zfs osd due to missing development headers.
341 Support for zfs can be enabled by downloading the required packages for your
342 distribution. See http://zfsonlinux.org/ to determine is zfs is supported by
349 AM_CONDITIONAL(ZFS_ENABLED, test x$enable_zfs = xyes)