]>
Commit | Line | Data |
---|---|---|
c9c0d073 BB |
1 | AC_DEFUN([ZFS_AC_LICENSE], [ |
2 | AC_MSG_CHECKING([zfs author]) | |
3 | AC_MSG_RESULT([$ZFS_META_AUTHOR]) | |
4 | ||
5 | AC_MSG_CHECKING([zfs license]) | |
6 | AC_MSG_RESULT([$ZFS_META_LICENSE]) | |
7 | ]) | |
8 | ||
9 | AC_DEFUN([ZFS_AC_DEBUG], [ | |
10 | AC_MSG_CHECKING([whether debugging is enabled]) | |
11 | AC_ARG_ENABLE([debug], | |
12 | [AS_HELP_STRING([--enable-debug], | |
13 | [Enable generic debug support @<:@default=no@:>@])], | |
14 | [], | |
15 | [enable_debug=no]) | |
16 | ||
17 | AS_IF([test "x$enable_debug" = xyes], | |
18 | [ | |
19 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DDEBUG -Werror" | |
20 | HOSTCFLAGS="${HOSTCFLAGS} -DDEBUG -Werror" | |
21 | DEBUG_CFLAGS="-DDEBUG -Werror" | |
22 | DEBUG_STACKFLAGS="-fstack-check" | |
4b787d75 BB |
23 | DEBUG_ZFS="_with_debug" |
24 | AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled]) | |
c9c0d073 BB |
25 | ], |
26 | [ | |
27 | KERNELCPPFLAGS="${KERNELCPPFLAGS} -DNDEBUG " | |
28 | HOSTCFLAGS="${HOSTCFLAGS} -DNDEBUG " | |
29 | DEBUG_CFLAGS="-DNDEBUG" | |
30 | DEBUG_STACKFLAGS="" | |
4b787d75 | 31 | DEBUG_ZFS="_without_debug" |
c9c0d073 BB |
32 | ]) |
33 | ||
34 | AC_SUBST(DEBUG_CFLAGS) | |
35 | AC_SUBST(DEBUG_STACKFLAGS) | |
4b787d75 | 36 | AC_SUBST(DEBUG_ZFS) |
c9c0d073 BB |
37 | AC_MSG_RESULT([$enable_debug]) |
38 | ]) | |
39 | ||
2e08aedb BB |
40 | AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [ |
41 | ZFS_AC_CONFIG_ALWAYS_NO_UNUSED_BUT_SET_VARIABLE | |
c2d17fd8 | 42 | ZFS_AC_CONFIG_ALWAYS_NO_BOOL_COMPARE |
fc0c72b1 | 43 | ZFS_AC_CONFIG_ALWAYS_TOOLCHAIN_SIMD |
0b04990a | 44 | ZFS_AC_CONFIG_ALWAYS_ARCH |
2e08aedb BB |
45 | ]) |
46 | ||
c9c0d073 | 47 | AC_DEFUN([ZFS_AC_CONFIG], [ |
c9c0d073 BB |
48 | ZFS_CONFIG=all |
49 | AC_ARG_WITH([config], | |
50 | AS_HELP_STRING([--with-config=CONFIG], | |
51 | [Config file 'kernel|user|all|srpm']), | |
52 | [ZFS_CONFIG="$withval"]) | |
319a99a3 ED |
53 | AC_ARG_ENABLE([linux-builtin], |
54 | [AC_HELP_STRING([--enable-linux-builtin], | |
55 | [Configure for builtin in-tree kernel modules @<:@default=no@:>@])], | |
56 | [], | |
57 | [enable_linux_builtin=no]) | |
c9c0d073 BB |
58 | |
59 | AC_MSG_CHECKING([zfs config]) | |
60 | AC_MSG_RESULT([$ZFS_CONFIG]); | |
61 | AC_SUBST(ZFS_CONFIG) | |
62 | ||
2e08aedb BB |
63 | ZFS_AC_CONFIG_ALWAYS |
64 | ||
c9c0d073 BB |
65 | case "$ZFS_CONFIG" in |
66 | kernel) ZFS_AC_CONFIG_KERNEL ;; | |
67 | user) ZFS_AC_CONFIG_USER ;; | |
6bb24f4d BB |
68 | all) ZFS_AC_CONFIG_USER |
69 | ZFS_AC_CONFIG_KERNEL ;; | |
c9c0d073 BB |
70 | srpm) ;; |
71 | *) | |
72 | AC_MSG_RESULT([Error!]) | |
73 | AC_MSG_ERROR([Bad value "$ZFS_CONFIG" for --with-config, | |
74 | user kernel|user|all|srpm]) ;; | |
75 | esac | |
76 | ||
77 | AM_CONDITIONAL([CONFIG_USER], | |
63e0828c | 78 | [test "$ZFS_CONFIG" = user -o "$ZFS_CONFIG" = all]) |
c9c0d073 | 79 | AM_CONDITIONAL([CONFIG_KERNEL], |
63e0828c BB |
80 | [test "$ZFS_CONFIG" = kernel -o "$ZFS_CONFIG" = all] && |
81 | [test "x$enable_linux_builtin" != xyes ]) | |
82 | AM_CONDITIONAL([WANT_DEVNAME2DEVID], | |
83 | [test "x$user_libudev" = xyes ]) | |
c9c0d073 BB |
84 | ]) |
85 | ||
86 | dnl # | |
87 | dnl # Check for rpm+rpmbuild to build RPM packages. If these tools | |
88 | dnl # are missing it is non-fatal but you will not be able to build | |
89 | dnl # RPM packages and will be warned if you try too. | |
90 | dnl # | |
f3757573 BB |
91 | dnl # By default the generic spec file will be used because it requires |
92 | dnl # minimal dependencies. Distribution specific spec files can be | |
93 | dnl # placed under the 'rpm/<distribution>' directory and enabled using | |
94 | dnl # the --with-spec=<distribution> configure option. | |
95 | dnl # | |
c9c0d073 BB |
96 | AC_DEFUN([ZFS_AC_RPM], [ |
97 | RPM=rpm | |
98 | RPMBUILD=rpmbuild | |
99 | ||
100 | AC_MSG_CHECKING([whether $RPM is available]) | |
101 | AS_IF([tmp=$($RPM --version 2>/dev/null)], [ | |
102 | RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }') | |
103 | HAVE_RPM=yes | |
104 | AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)]) | |
105 | ],[ | |
106 | HAVE_RPM=no | |
107 | AC_MSG_RESULT([$HAVE_RPM]) | |
108 | ]) | |
109 | ||
110 | AC_MSG_CHECKING([whether $RPMBUILD is available]) | |
111 | AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [ | |
112 | RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }') | |
113 | HAVE_RPMBUILD=yes | |
114 | AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)]) | |
115 | ],[ | |
116 | HAVE_RPMBUILD=no | |
117 | AC_MSG_RESULT([$HAVE_RPMBUILD]) | |
118 | ]) | |
119 | ||
3ec3bc21 | 120 | RPM_DEFINE_COMMON='--define "$(DEBUG_ZFS) 1"' |
2cac7f5f | 121 | RPM_DEFINE_UTIL='--define "_dracutdir $(dracutdir)" --define "_udevdir $(udevdir)" --define "_udevruledir $(udevruledir)" --define "_initconfdir $(DEFAULT_INITCONF_DIR)" $(DEFINE_INITRAMFS)' |
69c7bdb6 | 122 | RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)" --define "require_spldir $(SPL)" --define "require_splobj $(SPL_OBJ)" --define "ksrc $(LINUX)" --define "kobj $(LINUX_OBJ)"' |
f3757573 BB |
123 | RPM_DEFINE_DKMS= |
124 | ||
125 | SRPM_DEFINE_COMMON='--define "build_src_rpm 1"' | |
126 | SRPM_DEFINE_UTIL= | |
127 | SRPM_DEFINE_KMOD= | |
128 | SRPM_DEFINE_DKMS= | |
129 | ||
130 | RPM_SPEC_DIR="rpm/generic" | |
131 | AC_ARG_WITH([spec], | |
132 | AS_HELP_STRING([--with-spec=SPEC], | |
ee2ca1db | 133 | [Spec files 'generic|redhat']), |
f3757573 BB |
134 | [RPM_SPEC_DIR="rpm/$withval"]) |
135 | ||
136 | AC_MSG_CHECKING([whether spec files are available]) | |
137 | AC_MSG_RESULT([yes ($RPM_SPEC_DIR/*.spec.in)]) | |
138 | ||
c9c0d073 BB |
139 | AC_SUBST(HAVE_RPM) |
140 | AC_SUBST(RPM) | |
141 | AC_SUBST(RPM_VERSION) | |
142 | ||
143 | AC_SUBST(HAVE_RPMBUILD) | |
144 | AC_SUBST(RPMBUILD) | |
145 | AC_SUBST(RPMBUILD_VERSION) | |
f3757573 BB |
146 | |
147 | AC_SUBST(RPM_SPEC_DIR) | |
148 | AC_SUBST(RPM_DEFINE_UTIL) | |
149 | AC_SUBST(RPM_DEFINE_KMOD) | |
150 | AC_SUBST(RPM_DEFINE_DKMS) | |
151 | AC_SUBST(RPM_DEFINE_COMMON) | |
152 | AC_SUBST(SRPM_DEFINE_UTIL) | |
153 | AC_SUBST(SRPM_DEFINE_KMOD) | |
154 | AC_SUBST(SRPM_DEFINE_DKMS) | |
155 | AC_SUBST(SRPM_DEFINE_COMMON) | |
c9c0d073 BB |
156 | ]) |
157 | ||
158 | dnl # | |
159 | dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these | |
160 | dnl # tools are missing it is non-fatal but you will not be able to build | |
161 | dnl # DEB packages and will be warned if you try too. | |
162 | dnl # | |
163 | AC_DEFUN([ZFS_AC_DPKG], [ | |
164 | DPKG=dpkg | |
165 | DPKGBUILD=dpkg-buildpackage | |
166 | ||
167 | AC_MSG_CHECKING([whether $DPKG is available]) | |
168 | AS_IF([tmp=$($DPKG --version 2>/dev/null)], [ | |
169 | DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }') | |
170 | HAVE_DPKG=yes | |
171 | AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)]) | |
172 | ],[ | |
173 | HAVE_DPKG=no | |
174 | AC_MSG_RESULT([$HAVE_DPKG]) | |
175 | ]) | |
176 | ||
177 | AC_MSG_CHECKING([whether $DPKGBUILD is available]) | |
178 | AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [ | |
179 | DPKGBUILD_VERSION=$(echo $tmp | \ | |
180 | $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.') | |
181 | HAVE_DPKGBUILD=yes | |
182 | AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)]) | |
183 | ],[ | |
184 | HAVE_DPKGBUILD=no | |
185 | AC_MSG_RESULT([$HAVE_DPKGBUILD]) | |
186 | ]) | |
187 | ||
188 | AC_SUBST(HAVE_DPKG) | |
189 | AC_SUBST(DPKG) | |
190 | AC_SUBST(DPKG_VERSION) | |
191 | ||
192 | AC_SUBST(HAVE_DPKGBUILD) | |
193 | AC_SUBST(DPKGBUILD) | |
194 | AC_SUBST(DPKGBUILD_VERSION) | |
195 | ]) | |
196 | ||
197 | dnl # | |
198 | dnl # Until native packaging for various different packing systems | |
199 | dnl # can be added the least we can do is attempt to use alien to | |
200 | dnl # convert the RPM packages to the needed package type. This is | |
201 | dnl # a hack but so far it has worked reasonable well. | |
202 | dnl # | |
203 | AC_DEFUN([ZFS_AC_ALIEN], [ | |
204 | ALIEN=alien | |
205 | ||
206 | AC_MSG_CHECKING([whether $ALIEN is available]) | |
207 | AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [ | |
208 | ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }') | |
209 | HAVE_ALIEN=yes | |
210 | AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)]) | |
211 | ],[ | |
212 | HAVE_ALIEN=no | |
213 | AC_MSG_RESULT([$HAVE_ALIEN]) | |
214 | ]) | |
215 | ||
216 | AC_SUBST(HAVE_ALIEN) | |
217 | AC_SUBST(ALIEN) | |
218 | AC_SUBST(ALIEN_VERSION) | |
219 | ]) | |
220 | ||
221 | dnl # | |
222 | dnl # Using the VENDOR tag from config.guess set the default | |
223 | dnl # package type for 'make pkg': (rpm | deb | tgz) | |
224 | dnl # | |
225 | AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ | |
226 | AC_MSG_CHECKING([linux distribution]) | |
76c2b24c RY |
227 | if test -f /etc/toss-release ; then |
228 | VENDOR=toss ; | |
c9c0d073 BB |
229 | elif test -f /etc/fedora-release ; then |
230 | VENDOR=fedora ; | |
76c2b24c RY |
231 | elif test -f /etc/redhat-release ; then |
232 | VENDOR=redhat ; | |
d9bfe0f5 AS |
233 | elif test -f /etc/gentoo-release ; then |
234 | VENDOR=gentoo ; | |
76c2b24c RY |
235 | elif test -f /etc/arch-release ; then |
236 | VENDOR=arch ; | |
c9c0d073 BB |
237 | elif test -f /etc/SuSE-release ; then |
238 | VENDOR=sles ; | |
239 | elif test -f /etc/slackware-version ; then | |
240 | VENDOR=slackware ; | |
712f8bd8 BB |
241 | elif test -f /etc/lunar.release ; then |
242 | VENDOR=lunar ; | |
76c2b24c RY |
243 | elif test -f /etc/lsb-release ; then |
244 | VENDOR=ubuntu ; | |
245 | elif test -f /etc/debian_version ; then | |
246 | VENDOR=debian ; | |
c53fb011 CL |
247 | elif test -f /etc/alpine-release ; then |
248 | VENDOR=alpine ; | |
c9c0d073 BB |
249 | else |
250 | VENDOR= ; | |
251 | fi | |
252 | AC_MSG_RESULT([$VENDOR]) | |
253 | AC_SUBST(VENDOR) | |
254 | ||
255 | AC_MSG_CHECKING([default package type]) | |
256 | case "$VENDOR" in | |
76c2b24c RY |
257 | toss) DEFAULT_PACKAGE=rpm ;; |
258 | redhat) DEFAULT_PACKAGE=rpm ;; | |
259 | fedora) DEFAULT_PACKAGE=rpm ;; | |
260 | gentoo) DEFAULT_PACKAGE=tgz ;; | |
c53fb011 | 261 | alpine) DEFAULT_PACKAGE=tgz ;; |
0da31cd6 | 262 | arch) DEFAULT_PACKAGE=tgz ;; |
76c2b24c RY |
263 | sles) DEFAULT_PACKAGE=rpm ;; |
264 | slackware) DEFAULT_PACKAGE=tgz ;; | |
265 | lunar) DEFAULT_PACKAGE=tgz ;; | |
266 | ubuntu) DEFAULT_PACKAGE=deb ;; | |
267 | debian) DEFAULT_PACKAGE=deb ;; | |
268 | *) DEFAULT_PACKAGE=rpm ;; | |
c9c0d073 | 269 | esac |
c9c0d073 BB |
270 | AC_MSG_RESULT([$DEFAULT_PACKAGE]) |
271 | AC_SUBST(DEFAULT_PACKAGE) | |
01c0e61d | 272 | |
0da31cd6 | 273 | DEFAULT_INIT_DIR=$sysconfdir/init.d |
615ab66d | 274 | AC_MSG_CHECKING([default init directory]) |
615ab66d KF |
275 | AC_MSG_RESULT([$DEFAULT_INIT_DIR]) |
276 | AC_SUBST(DEFAULT_INIT_DIR) | |
277 | ||
01c0e61d BB |
278 | AC_MSG_CHECKING([default init script type]) |
279 | case "$VENDOR" in | |
76c2b24c | 280 | toss) DEFAULT_INIT_SCRIPT=redhat ;; |
712f8bd8 | 281 | redhat) DEFAULT_INIT_SCRIPT=redhat ;; |
01c0e61d | 282 | fedora) DEFAULT_INIT_SCRIPT=fedora ;; |
c53fb011 CL |
283 | gentoo) DEFAULT_INIT_SCRIPT=openrc ;; |
284 | alpine) DEFAULT_INIT_SCRIPT=openrc ;; | |
0da31cd6 | 285 | arch) DEFAULT_INIT_SCRIPT=lsb ;; |
76c2b24c RY |
286 | sles) DEFAULT_INIT_SCRIPT=lsb ;; |
287 | slackware) DEFAULT_INIT_SCRIPT=lsb ;; | |
288 | lunar) DEFAULT_INIT_SCRIPT=lunar ;; | |
289 | ubuntu) DEFAULT_INIT_SCRIPT=lsb ;; | |
290 | debian) DEFAULT_INIT_SCRIPT=lsb ;; | |
291 | *) DEFAULT_INIT_SCRIPT=lsb ;; | |
01c0e61d | 292 | esac |
01c0e61d BB |
293 | AC_MSG_RESULT([$DEFAULT_INIT_SCRIPT]) |
294 | AC_SUBST(DEFAULT_INIT_SCRIPT) | |
2a34db1b TF |
295 | |
296 | AC_MSG_CHECKING([default init config direectory]) | |
297 | case "$VENDOR" in | |
c53fb011 | 298 | alpine) DEFAULT_INITCONF_DIR=/etc/conf.d ;; |
2a34db1b TF |
299 | gentoo) DEFAULT_INITCONF_DIR=/etc/conf.d ;; |
300 | toss) DEFAULT_INITCONF_DIR=/etc/sysconfig ;; | |
301 | redhat) DEFAULT_INITCONF_DIR=/etc/sysconfig ;; | |
302 | fedora) DEFAULT_INITCONF_DIR=/etc/sysconfig ;; | |
303 | sles) DEFAULT_INITCONF_DIR=/etc/sysconfig ;; | |
304 | ubuntu) DEFAULT_INITCONF_DIR=/etc/default ;; | |
305 | debian) DEFAULT_INITCONF_DIR=/etc/default ;; | |
306 | *) DEFAULT_INITCONF_DIR=/etc/default ;; | |
307 | esac | |
2a34db1b TF |
308 | AC_MSG_RESULT([$DEFAULT_INITCONF_DIR]) |
309 | AC_SUBST(DEFAULT_INITCONF_DIR) | |
2cac7f5f TF |
310 | |
311 | AC_MSG_CHECKING([whether initramfs-tools is available]) | |
312 | if test -d /usr/share/initramfs-tools ; then | |
313 | DEFINE_INITRAMFS='--define "_initramfs 1"' | |
314 | AC_MSG_RESULT([yes]) | |
315 | else | |
316 | DEFINE_INITRAMFS='' | |
317 | AC_MSG_RESULT([no]) | |
318 | fi | |
319 | AC_SUBST(DEFINE_INITRAMFS) | |
c9c0d073 BB |
320 | ]) |
321 | ||
322 | dnl # | |
323 | dnl # Default ZFS package configuration | |
324 | dnl # | |
325 | AC_DEFUN([ZFS_AC_PACKAGE], [ | |
58d956b0 | 326 | ZFS_AC_DEFAULT_PACKAGE |
c9c0d073 BB |
327 | ZFS_AC_RPM |
328 | ZFS_AC_DPKG | |
329 | ZFS_AC_ALIEN | |
c9c0d073 | 330 | ]) |