]>
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 | ||
6f174823 | 9 | AC_DEFUN([ZFS_AC_DEBUG_ENABLE], [ |
fed90353 BB |
10 | DEBUG_CFLAGS="-Werror" |
11 | DEBUG_CPPFLAGS="-DDEBUG -UNDEBUG" | |
12 | DEBUG_LDFLAGS="" | |
6f174823 | 13 | DEBUG_ZFS="_with_debug" |
ba74de88 | 14 | WITH_DEBUG="true" |
6f174823 | 15 | AC_DEFINE(ZFS_DEBUG, 1, [zfs debugging enabled]) |
fed90353 BB |
16 | |
17 | KERNEL_DEBUG_CFLAGS="-Werror" | |
18 | KERNEL_DEBUG_CPPFLAGS="-DDEBUG -UNDEBUG" | |
6f174823 RY |
19 | ]) |
20 | ||
21 | AC_DEFUN([ZFS_AC_DEBUG_DISABLE], [ | |
fed90353 BB |
22 | DEBUG_CFLAGS="" |
23 | DEBUG_CPPFLAGS="-UDEBUG -DNDEBUG" | |
24 | DEBUG_LDFLAGS="" | |
6f174823 | 25 | DEBUG_ZFS="_without_debug" |
ba74de88 | 26 | WITH_DEBUG="" |
fed90353 BB |
27 | |
28 | KERNEL_DEBUG_CFLAGS="" | |
29 | KERNEL_DEBUG_CPPFLAGS="-UDEBUG -DNDEBUG" | |
6f174823 RY |
30 | ]) |
31 | ||
fed90353 BB |
32 | dnl # |
33 | dnl # When debugging is enabled: | |
34 | dnl # - Enable all ASSERTs (-DDEBUG) | |
35 | dnl # - Promote all compiler warnings to errors (-Werror) | |
36 | dnl # | |
c9c0d073 | 37 | AC_DEFUN([ZFS_AC_DEBUG], [ |
6f174823 | 38 | AC_MSG_CHECKING([whether assertion support will be enabled]) |
c9c0d073 BB |
39 | AC_ARG_ENABLE([debug], |
40 | [AS_HELP_STRING([--enable-debug], | |
fed90353 | 41 | [Enable compiler and code assertions @<:@default=no@:>@])], |
c9c0d073 BB |
42 | [], |
43 | [enable_debug=no]) | |
44 | ||
6f174823 RY |
45 | AS_CASE(["x$enable_debug"], |
46 | ["xyes"], | |
47 | [ZFS_AC_DEBUG_ENABLE], | |
48 | ["xno"], | |
49 | [ZFS_AC_DEBUG_DISABLE], | |
50 | [AC_MSG_ERROR([Unknown option $enable_debug])]) | |
c9c0d073 | 51 | |
fed90353 BB |
52 | AC_SUBST(DEBUG_CFLAGS) |
53 | AC_SUBST(DEBUG_CPPFLAGS) | |
54 | AC_SUBST(DEBUG_LDFLAGS) | |
4b787d75 | 55 | AC_SUBST(DEBUG_ZFS) |
ba74de88 | 56 | AC_SUBST(WITH_DEBUG) |
fed90353 BB |
57 | |
58 | AC_SUBST(KERNEL_DEBUG_CFLAGS) | |
59 | AC_SUBST(KERNEL_DEBUG_CPPFLAGS) | |
60 | ||
c9c0d073 BB |
61 | AC_MSG_RESULT([$enable_debug]) |
62 | ]) | |
63 | ||
fed90353 | 64 | AC_DEFUN([ZFS_AC_DEBUGINFO_ENABLE], [ |
5b7e6a36 | 65 | DEBUG_CFLAGS="$DEBUG_CFLAGS -g -fno-inline $NO_IPA_SRA" |
fed90353 | 66 | |
5b7e6a36 | 67 | KERNEL_DEBUG_CFLAGS="$KERNEL_DEBUG_CFLAGS -fno-inline $NO_IPA_SRA" |
fed90353 BB |
68 | KERNEL_MAKE="$KERNEL_MAKE CONFIG_DEBUG_INFO=y" |
69 | ||
70 | DEBUGINFO_ZFS="_with_debuginfo" | |
0d3980ac RY |
71 | ]) |
72 | ||
fed90353 BB |
73 | AC_DEFUN([ZFS_AC_DEBUGINFO_DISABLE], [ |
74 | DEBUGINFO_ZFS="_without_debuginfo" | |
0d3980ac RY |
75 | ]) |
76 | ||
77 | AC_DEFUN([ZFS_AC_DEBUGINFO], [ | |
78 | AC_MSG_CHECKING([whether debuginfo support will be forced]) | |
79 | AC_ARG_ENABLE([debuginfo], | |
80 | [AS_HELP_STRING([--enable-debuginfo], | |
81 | [Force generation of debuginfo @<:@default=no@:>@])], | |
82 | [], | |
83 | [enable_debuginfo=no]) | |
84 | ||
85 | AS_CASE(["x$enable_debuginfo"], | |
86 | ["xyes"], | |
fed90353 | 87 | [ZFS_AC_DEBUGINFO_ENABLE], |
0d3980ac | 88 | ["xno"], |
fed90353 BB |
89 | [ZFS_AC_DEBUGINFO_DISABLE], |
90 | [AC_MSG_ERROR([Unknown option $enable_debuginfo])]) | |
0d3980ac RY |
91 | |
92 | AC_SUBST(DEBUG_CFLAGS) | |
fed90353 BB |
93 | AC_SUBST(DEBUGINFO_ZFS) |
94 | ||
95 | AC_SUBST(KERNEL_DEBUG_CFLAGS) | |
96 | AC_SUBST(KERNEL_MAKE) | |
97 | ||
0d3980ac RY |
98 | AC_MSG_RESULT([$enable_debuginfo]) |
99 | ]) | |
100 | ||
93ce2b4c BB |
101 | dnl # |
102 | dnl # Disabled by default, provides basic memory tracking. Track the total | |
103 | dnl # number of bytes allocated with kmem_alloc() and freed with kmem_free(). | |
104 | dnl # Then at module unload time if any bytes were leaked it will be reported | |
105 | dnl # on the console. | |
106 | dnl # | |
107 | AC_DEFUN([ZFS_AC_DEBUG_KMEM], [ | |
108 | AC_MSG_CHECKING([whether basic kmem accounting is enabled]) | |
109 | AC_ARG_ENABLE([debug-kmem], | |
110 | [AS_HELP_STRING([--enable-debug-kmem], | |
111 | [Enable basic kmem accounting @<:@default=no@:>@])], | |
112 | [], | |
113 | [enable_debug_kmem=no]) | |
114 | ||
115 | AS_IF([test "x$enable_debug_kmem" = xyes], [ | |
22831636 | 116 | KERNEL_DEBUG_CPPFLAGS="${KERNEL_DEBUG_CPPFLAGS} -DDEBUG_KMEM" |
93ce2b4c BB |
117 | DEBUG_KMEM_ZFS="_with_debug_kmem" |
118 | ], [ | |
119 | DEBUG_KMEM_ZFS="_without_debug_kmem" | |
120 | ]) | |
121 | ||
122 | AC_SUBST(KERNEL_DEBUG_CPPFLAGS) | |
123 | AC_SUBST(DEBUG_KMEM_ZFS) | |
124 | ||
125 | AC_MSG_RESULT([$enable_debug_kmem]) | |
126 | ]) | |
127 | ||
128 | dnl # | |
129 | dnl # Disabled by default, provides detailed memory tracking. This feature | |
130 | dnl # also requires --enable-debug-kmem to be set. When enabled not only will | |
131 | dnl # total bytes be tracked but also the location of every kmem_alloc() and | |
132 | dnl # kmem_free(). When the module is unloaded a list of all leaked addresses | |
133 | dnl # and where they were allocated will be dumped to the console. Enabling | |
134 | dnl # this feature has a significant impact on performance but it makes finding | |
135 | dnl # memory leaks straight forward. | |
136 | dnl # | |
137 | AC_DEFUN([ZFS_AC_DEBUG_KMEM_TRACKING], [ | |
138 | AC_MSG_CHECKING([whether detailed kmem tracking is enabled]) | |
139 | AC_ARG_ENABLE([debug-kmem-tracking], | |
140 | [AS_HELP_STRING([--enable-debug-kmem-tracking], | |
141 | [Enable detailed kmem tracking @<:@default=no@:>@])], | |
142 | [], | |
143 | [enable_debug_kmem_tracking=no]) | |
144 | ||
145 | AS_IF([test "x$enable_debug_kmem_tracking" = xyes], [ | |
22831636 | 146 | KERNEL_DEBUG_CPPFLAGS="${KERNEL_DEBUG_CPPFLAGS} -DDEBUG_KMEM_TRACKING" |
93ce2b4c BB |
147 | DEBUG_KMEM_TRACKING_ZFS="_with_debug_kmem_tracking" |
148 | ], [ | |
149 | DEBUG_KMEM_TRACKING_ZFS="_without_debug_kmem_tracking" | |
150 | ]) | |
151 | ||
152 | AC_SUBST(KERNEL_DEBUG_CPPFLAGS) | |
153 | AC_SUBST(DEBUG_KMEM_TRACKING_ZFS) | |
154 | ||
155 | AC_MSG_RESULT([$enable_debug_kmem_tracking]) | |
156 | ]) | |
157 | ||
ba74de88 RM |
158 | AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS_DETECT_FREEBSD], [ |
159 | AS_IF([sysctl -n kern.conftxt | fgrep -qx $'options\tINVARIANTS'], | |
160 | [enable_invariants="yes"], | |
161 | [enable_invariants="no"]) | |
162 | ]) | |
163 | ||
164 | AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS_DETECT], [ | |
165 | AM_COND_IF([BUILD_FREEBSD], | |
166 | [ZFS_AC_DEBUG_INVARIANTS_DETECT_FREEBSD], | |
167 | [enable_invariants="no"]) | |
168 | ]) | |
169 | ||
170 | dnl # | |
171 | dnl # Detected for the running kernel by default, enables INVARIANTS features | |
172 | dnl # in the FreeBSD kernel module. This feature must be used when building | |
173 | dnl # for a FreeBSD kernel with "options INVARIANTS" in the KERNCONF and must | |
174 | dnl # not be used when the INVARIANTS option is absent. | |
175 | dnl # | |
176 | AC_DEFUN([ZFS_AC_DEBUG_INVARIANTS], [ | |
177 | AC_MSG_CHECKING([whether FreeBSD kernel INVARIANTS checks are enabled]) | |
178 | AC_ARG_ENABLE([invariants], | |
179 | [AS_HELP_STRING([--enable-invariants], | |
180 | [Enable FreeBSD kernel INVARIANTS checks [[default: detect]]])], | |
181 | [], [ZFS_AC_DEBUG_INVARIANTS_DETECT]) | |
182 | ||
183 | AS_IF([test "x$enable_invariants" = xyes], | |
184 | [WITH_INVARIANTS="true"], | |
185 | [WITH_INVARIANTS=""]) | |
186 | AC_SUBST(WITH_INVARIANTS) | |
187 | ||
188 | AC_MSG_RESULT([$enable_invariants]) | |
189 | ]) | |
190 | ||
2e08aedb | 191 | AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [ |
0e6c493f BB |
192 | AX_COUNT_CPUS([]) |
193 | AC_SUBST(CPU_COUNT) | |
194 | ||
fed90353 BB |
195 | ZFS_AC_CONFIG_ALWAYS_CC_NO_UNUSED_BUT_SET_VARIABLE |
196 | ZFS_AC_CONFIG_ALWAYS_CC_NO_BOOL_COMPARE | |
197 | ZFS_AC_CONFIG_ALWAYS_CC_FRAME_LARGER_THAN | |
198 | ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_TRUNCATION | |
9f0a21e6 | 199 | ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_ZERO_LENGTH |
d5d2ef2b | 200 | ZFS_AC_CONFIG_ALWAYS_CC_NO_OMIT_FRAME_POINTER |
5b7e6a36 | 201 | ZFS_AC_CONFIG_ALWAYS_CC_NO_IPA_SRA |
fed90353 | 202 | ZFS_AC_CONFIG_ALWAYS_CC_ASAN |
fc0c72b1 | 203 | ZFS_AC_CONFIG_ALWAYS_TOOLCHAIN_SIMD |
006e9a40 | 204 | ZFS_AC_CONFIG_ALWAYS_SYSTEM |
0b04990a | 205 | ZFS_AC_CONFIG_ALWAYS_ARCH |
6e72a5b9 | 206 | ZFS_AC_CONFIG_ALWAYS_PYTHON |
85ce3f4f | 207 | ZFS_AC_CONFIG_ALWAYS_PYZFS |
4313a5b4 | 208 | ZFS_AC_CONFIG_ALWAYS_SED |
0e6c493f | 209 | ZFS_AC_CONFIG_ALWAYS_CPPCHECK |
c3ef9f75 | 210 | ZFS_AC_CONFIG_ALWAYS_SHELLCHECK |
2e08aedb BB |
211 | ]) |
212 | ||
c9c0d073 | 213 | AC_DEFUN([ZFS_AC_CONFIG], [ |
608f8749 BB |
214 | |
215 | dnl # Remove the previous build test directory. | |
216 | rm -Rf build | |
217 | ||
c9c0d073 BB |
218 | ZFS_CONFIG=all |
219 | AC_ARG_WITH([config], | |
220 | AS_HELP_STRING([--with-config=CONFIG], | |
221 | [Config file 'kernel|user|all|srpm']), | |
222 | [ZFS_CONFIG="$withval"]) | |
319a99a3 | 223 | AC_ARG_ENABLE([linux-builtin], |
06346cc5 | 224 | [AS_HELP_STRING([--enable-linux-builtin], |
319a99a3 ED |
225 | [Configure for builtin in-tree kernel modules @<:@default=no@:>@])], |
226 | [], | |
227 | [enable_linux_builtin=no]) | |
c9c0d073 BB |
228 | |
229 | AC_MSG_CHECKING([zfs config]) | |
230 | AC_MSG_RESULT([$ZFS_CONFIG]); | |
231 | AC_SUBST(ZFS_CONFIG) | |
232 | ||
2e08aedb BB |
233 | ZFS_AC_CONFIG_ALWAYS |
234 | ||
9f0a21e6 | 235 | AM_COND_IF([BUILD_LINUX], [ |
0e6c493f | 236 | AC_ARG_VAR([TEST_JOBS], [simultaneous jobs during configure]) |
9f0a21e6 | 237 | if test "x$ac_cv_env_TEST_JOBS_set" != "xset"; then |
0e6c493f | 238 | TEST_JOBS=$CPU_COUNT |
9f0a21e6 MM |
239 | fi |
240 | AC_SUBST(TEST_JOBS) | |
241 | ]) | |
242 | ||
c9c0d073 BB |
243 | case "$ZFS_CONFIG" in |
244 | kernel) ZFS_AC_CONFIG_KERNEL ;; | |
245 | user) ZFS_AC_CONFIG_USER ;; | |
6bb24f4d BB |
246 | all) ZFS_AC_CONFIG_USER |
247 | ZFS_AC_CONFIG_KERNEL ;; | |
c9c0d073 BB |
248 | srpm) ;; |
249 | *) | |
250 | AC_MSG_RESULT([Error!]) | |
251 | AC_MSG_ERROR([Bad value "$ZFS_CONFIG" for --with-config, | |
252 | user kernel|user|all|srpm]) ;; | |
253 | esac | |
254 | ||
255 | AM_CONDITIONAL([CONFIG_USER], | |
63e0828c | 256 | [test "$ZFS_CONFIG" = user -o "$ZFS_CONFIG" = all]) |
c9c0d073 | 257 | AM_CONDITIONAL([CONFIG_KERNEL], |
63e0828c BB |
258 | [test "$ZFS_CONFIG" = kernel -o "$ZFS_CONFIG" = all] && |
259 | [test "x$enable_linux_builtin" != xyes ]) | |
6a9d6359 | 260 | AM_CONDITIONAL([CONFIG_QAT], |
261 | [test "$ZFS_CONFIG" = kernel -o "$ZFS_CONFIG" = all] && | |
262 | [test "x$qatsrc" != x ]) | |
b2ab468d BB |
263 | AM_CONDITIONAL([WANT_DEVNAME2DEVID], [test "x$user_libudev" = xyes ]) |
264 | AM_CONDITIONAL([WANT_MMAP_LIBAIO], [test "x$user_libaio" = xyes ]) | |
221e6704 | 265 | AM_CONDITIONAL([PAM_ZFS_ENABLED], [test "x$enable_pam" = xyes]) |
c9c0d073 BB |
266 | ]) |
267 | ||
268 | dnl # | |
269 | dnl # Check for rpm+rpmbuild to build RPM packages. If these tools | |
270 | dnl # are missing it is non-fatal but you will not be able to build | |
271 | dnl # RPM packages and will be warned if you try too. | |
272 | dnl # | |
f3757573 BB |
273 | dnl # By default the generic spec file will be used because it requires |
274 | dnl # minimal dependencies. Distribution specific spec files can be | |
275 | dnl # placed under the 'rpm/<distribution>' directory and enabled using | |
276 | dnl # the --with-spec=<distribution> configure option. | |
277 | dnl # | |
c9c0d073 BB |
278 | AC_DEFUN([ZFS_AC_RPM], [ |
279 | RPM=rpm | |
280 | RPMBUILD=rpmbuild | |
281 | ||
282 | AC_MSG_CHECKING([whether $RPM is available]) | |
283 | AS_IF([tmp=$($RPM --version 2>/dev/null)], [ | |
284 | RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }') | |
285 | HAVE_RPM=yes | |
286 | AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)]) | |
287 | ],[ | |
288 | HAVE_RPM=no | |
289 | AC_MSG_RESULT([$HAVE_RPM]) | |
290 | ]) | |
291 | ||
292 | AC_MSG_CHECKING([whether $RPMBUILD is available]) | |
293 | AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [ | |
294 | RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }') | |
295 | HAVE_RPMBUILD=yes | |
296 | AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)]) | |
297 | ],[ | |
298 | HAVE_RPMBUILD=no | |
299 | AC_MSG_RESULT([$HAVE_RPMBUILD]) | |
300 | ]) | |
301 | ||
3ec3bc21 | 302 | RPM_DEFINE_COMMON='--define "$(DEBUG_ZFS) 1"' |
bdb518c1 | 303 | RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(DEBUGINFO_ZFS) 1"' |
22831636 HD |
304 | RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(DEBUG_KMEM_ZFS) 1"' |
305 | RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(DEBUG_KMEM_TRACKING_ZFS) 1"' | |
22831636 | 306 | RPM_DEFINE_COMMON=${RPM_DEFINE_COMMON}' --define "$(ASAN_ZFS) 1"' |
fed90353 | 307 | |
38e2e9ce | 308 | RPM_DEFINE_UTIL=' --define "_initconfdir $(initconfdir)"' |
9ea6c3d3 TH |
309 | |
310 | dnl # Make the next three RPM_DEFINE_UTIL additions conditional, since | |
311 | dnl # their values may not be set when running: | |
312 | dnl # | |
313 | dnl # ./configure --with-config=srpm | |
314 | dnl # | |
315 | AS_IF([test -n "$dracutdir" ], [ | |
22831636 | 316 | RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' --define "_dracutdir $(dracutdir)"' |
9ea6c3d3 TH |
317 | ]) |
318 | AS_IF([test -n "$udevdir" ], [ | |
22831636 | 319 | RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' --define "_udevdir $(udevdir)"' |
9ea6c3d3 TH |
320 | ]) |
321 | AS_IF([test -n "$udevruledir" ], [ | |
22831636 | 322 | RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' --define "_udevruledir $(udevruledir)"' |
9ea6c3d3 | 323 | ]) |
22831636 HD |
324 | RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_SYSTEMD)' |
325 | RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_PYZFS)' | |
326 | RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_PAM)' | |
327 | RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_PYTHON_VERSION)' | |
328 | RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' $(DEFINE_PYTHON_PKG_VERSION)' | |
fed90353 | 329 | |
6e72a5b9 BB |
330 | dnl # Override default lib directory on Debian/Ubuntu systems. The |
331 | dnl # provided /usr/lib/rpm/platform/<arch>/macros files do not | |
332 | dnl # specify the correct path for multiarch systems as described | |
333 | dnl # by the packaging guidelines. | |
3d25488a BB |
334 | dnl # |
335 | dnl # https://wiki.ubuntu.com/MultiarchSpec | |
336 | dnl # https://wiki.debian.org/Multiarch/Implementation | |
337 | dnl # | |
338 | AS_IF([test "$DEFAULT_PACKAGE" = "deb"], [ | |
339 | MULTIARCH_LIBDIR="lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)" | |
22831636 | 340 | RPM_DEFINE_UTIL=${RPM_DEFINE_UTIL}' --define "_lib $(MULTIARCH_LIBDIR)"' |
3d25488a BB |
341 | AC_SUBST(MULTIARCH_LIBDIR) |
342 | ]) | |
343 | ||
bdb518c1 AS |
344 | dnl # Make RPM_DEFINE_KMOD additions conditional on CONFIG_KERNEL, |
345 | dnl # since the values will not be set otherwise. The spec files | |
346 | dnl # provide defaults for them. | |
347 | dnl # | |
348 | RPM_DEFINE_KMOD='--define "_wrong_version_format_terminate_build 0"' | |
349 | AM_COND_IF([CONFIG_KERNEL], [ | |
350 | RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "kernels $(LINUX_VERSION)"' | |
351 | RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "ksrc $(LINUX)"' | |
352 | RPM_DEFINE_KMOD=${RPM_DEFINE_KMOD}' --define "kobj $(LINUX_OBJ)"' | |
353 | ]) | |
fed90353 BB |
354 | |
355 | RPM_DEFINE_DKMS='' | |
f3757573 BB |
356 | |
357 | SRPM_DEFINE_COMMON='--define "build_src_rpm 1"' | |
358 | SRPM_DEFINE_UTIL= | |
359 | SRPM_DEFINE_KMOD= | |
360 | SRPM_DEFINE_DKMS= | |
361 | ||
362 | RPM_SPEC_DIR="rpm/generic" | |
363 | AC_ARG_WITH([spec], | |
364 | AS_HELP_STRING([--with-spec=SPEC], | |
ee2ca1db | 365 | [Spec files 'generic|redhat']), |
f3757573 BB |
366 | [RPM_SPEC_DIR="rpm/$withval"]) |
367 | ||
368 | AC_MSG_CHECKING([whether spec files are available]) | |
369 | AC_MSG_RESULT([yes ($RPM_SPEC_DIR/*.spec.in)]) | |
370 | ||
c9c0d073 BB |
371 | AC_SUBST(HAVE_RPM) |
372 | AC_SUBST(RPM) | |
373 | AC_SUBST(RPM_VERSION) | |
374 | ||
375 | AC_SUBST(HAVE_RPMBUILD) | |
376 | AC_SUBST(RPMBUILD) | |
377 | AC_SUBST(RPMBUILD_VERSION) | |
f3757573 BB |
378 | |
379 | AC_SUBST(RPM_SPEC_DIR) | |
380 | AC_SUBST(RPM_DEFINE_UTIL) | |
381 | AC_SUBST(RPM_DEFINE_KMOD) | |
382 | AC_SUBST(RPM_DEFINE_DKMS) | |
383 | AC_SUBST(RPM_DEFINE_COMMON) | |
384 | AC_SUBST(SRPM_DEFINE_UTIL) | |
385 | AC_SUBST(SRPM_DEFINE_KMOD) | |
386 | AC_SUBST(SRPM_DEFINE_DKMS) | |
387 | AC_SUBST(SRPM_DEFINE_COMMON) | |
c9c0d073 BB |
388 | ]) |
389 | ||
390 | dnl # | |
391 | dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these | |
392 | dnl # tools are missing it is non-fatal but you will not be able to build | |
393 | dnl # DEB packages and will be warned if you try too. | |
394 | dnl # | |
395 | AC_DEFUN([ZFS_AC_DPKG], [ | |
396 | DPKG=dpkg | |
397 | DPKGBUILD=dpkg-buildpackage | |
398 | ||
399 | AC_MSG_CHECKING([whether $DPKG is available]) | |
400 | AS_IF([tmp=$($DPKG --version 2>/dev/null)], [ | |
401 | DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }') | |
402 | HAVE_DPKG=yes | |
403 | AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)]) | |
404 | ],[ | |
405 | HAVE_DPKG=no | |
406 | AC_MSG_RESULT([$HAVE_DPKG]) | |
407 | ]) | |
408 | ||
409 | AC_MSG_CHECKING([whether $DPKGBUILD is available]) | |
410 | AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [ | |
411 | DPKGBUILD_VERSION=$(echo $tmp | \ | |
412 | $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.') | |
413 | HAVE_DPKGBUILD=yes | |
414 | AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)]) | |
415 | ],[ | |
416 | HAVE_DPKGBUILD=no | |
417 | AC_MSG_RESULT([$HAVE_DPKGBUILD]) | |
418 | ]) | |
419 | ||
420 | AC_SUBST(HAVE_DPKG) | |
421 | AC_SUBST(DPKG) | |
422 | AC_SUBST(DPKG_VERSION) | |
423 | ||
424 | AC_SUBST(HAVE_DPKGBUILD) | |
425 | AC_SUBST(DPKGBUILD) | |
426 | AC_SUBST(DPKGBUILD_VERSION) | |
427 | ]) | |
428 | ||
429 | dnl # | |
430 | dnl # Until native packaging for various different packing systems | |
431 | dnl # can be added the least we can do is attempt to use alien to | |
432 | dnl # convert the RPM packages to the needed package type. This is | |
433 | dnl # a hack but so far it has worked reasonable well. | |
434 | dnl # | |
435 | AC_DEFUN([ZFS_AC_ALIEN], [ | |
436 | ALIEN=alien | |
437 | ||
438 | AC_MSG_CHECKING([whether $ALIEN is available]) | |
439 | AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [ | |
440 | ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }') | |
46fb4783 RE |
441 | ALIEN_MAJOR=$(echo ${ALIEN_VERSION} | $AWK -F'.' '{ print $[1] }') |
442 | ALIEN_MINOR=$(echo ${ALIEN_VERSION} | $AWK -F'.' '{ print $[2] }') | |
443 | ALIEN_POINT=$(echo ${ALIEN_VERSION} | $AWK -F'.' '{ print $[3] }') | |
c9c0d073 BB |
444 | HAVE_ALIEN=yes |
445 | AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)]) | |
446 | ],[ | |
447 | HAVE_ALIEN=no | |
448 | AC_MSG_RESULT([$HAVE_ALIEN]) | |
449 | ]) | |
450 | ||
451 | AC_SUBST(HAVE_ALIEN) | |
452 | AC_SUBST(ALIEN) | |
453 | AC_SUBST(ALIEN_VERSION) | |
46fb4783 RE |
454 | AC_SUBST(ALIEN_MAJOR) |
455 | AC_SUBST(ALIEN_MINOR) | |
456 | AC_SUBST(ALIEN_POINT) | |
c9c0d073 BB |
457 | ]) |
458 | ||
459 | dnl # | |
460 | dnl # Using the VENDOR tag from config.guess set the default | |
461 | dnl # package type for 'make pkg': (rpm | deb | tgz) | |
462 | dnl # | |
463 | AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ | |
9f0a21e6 | 464 | AC_MSG_CHECKING([os distribution]) |
7ddcfe7c GY |
465 | AC_ARG_WITH([vendor], |
466 | [AS_HELP_STRING([--with-vendor], | |
467 | [Distribution vendor @<:@default=check@:>@])], | |
468 | [with_vendor=$withval], | |
469 | [with_vendor=check]) | |
470 | AS_IF([test "x$with_vendor" = "xcheck"],[ | |
471 | if test -f /etc/toss-release ; then | |
472 | VENDOR=toss ; | |
473 | elif test -f /etc/fedora-release ; then | |
474 | VENDOR=fedora ; | |
475 | elif test -f /etc/redhat-release ; then | |
476 | VENDOR=redhat ; | |
477 | elif test -f /etc/gentoo-release ; then | |
478 | VENDOR=gentoo ; | |
479 | elif test -f /etc/arch-release ; then | |
480 | VENDOR=arch ; | |
481 | elif test -f /etc/SuSE-release ; then | |
482 | VENDOR=sles ; | |
483 | elif test -f /etc/slackware-version ; then | |
484 | VENDOR=slackware ; | |
485 | elif test -f /etc/lunar.release ; then | |
486 | VENDOR=lunar ; | |
487 | elif test -f /etc/lsb-release ; then | |
488 | VENDOR=ubuntu ; | |
489 | elif test -f /etc/debian_version ; then | |
490 | VENDOR=debian ; | |
491 | elif test -f /etc/alpine-release ; then | |
492 | VENDOR=alpine ; | |
493 | elif test -f /bin/freebsd-version ; then | |
494 | VENDOR=freebsd ; | |
495 | else | |
496 | VENDOR= ; | |
497 | fi], | |
498 | [ test "x${with_vendor}" != x],[ | |
499 | VENDOR="$with_vendor" ], | |
500 | [ VENDOR= ; ] | |
501 | ) | |
c9c0d073 BB |
502 | AC_MSG_RESULT([$VENDOR]) |
503 | AC_SUBST(VENDOR) | |
504 | ||
505 | AC_MSG_CHECKING([default package type]) | |
506 | case "$VENDOR" in | |
76c2b24c RY |
507 | toss) DEFAULT_PACKAGE=rpm ;; |
508 | redhat) DEFAULT_PACKAGE=rpm ;; | |
509 | fedora) DEFAULT_PACKAGE=rpm ;; | |
510 | gentoo) DEFAULT_PACKAGE=tgz ;; | |
c53fb011 | 511 | alpine) DEFAULT_PACKAGE=tgz ;; |
0da31cd6 | 512 | arch) DEFAULT_PACKAGE=tgz ;; |
76c2b24c RY |
513 | sles) DEFAULT_PACKAGE=rpm ;; |
514 | slackware) DEFAULT_PACKAGE=tgz ;; | |
515 | lunar) DEFAULT_PACKAGE=tgz ;; | |
516 | ubuntu) DEFAULT_PACKAGE=deb ;; | |
517 | debian) DEFAULT_PACKAGE=deb ;; | |
9f0a21e6 | 518 | freebsd) DEFAULT_PACKAGE=pkg ;; |
76c2b24c | 519 | *) DEFAULT_PACKAGE=rpm ;; |
c9c0d073 | 520 | esac |
c9c0d073 BB |
521 | AC_MSG_RESULT([$DEFAULT_PACKAGE]) |
522 | AC_SUBST(DEFAULT_PACKAGE) | |
01c0e61d | 523 | |
615ab66d | 524 | AC_MSG_CHECKING([default init directory]) |
9f0a21e6 | 525 | case "$VENDOR" in |
38e2e9ce AS |
526 | freebsd) initdir=$sysconfdir/rc.d ;; |
527 | *) initdir=$sysconfdir/init.d;; | |
9f0a21e6 | 528 | esac |
38e2e9ce AS |
529 | AC_MSG_RESULT([$initdir]) |
530 | AC_SUBST(initdir) | |
615ab66d | 531 | |
38e2e9ce | 532 | AC_MSG_CHECKING([default init script type and shell]) |
01c0e61d | 533 | case "$VENDOR" in |
76c2b24c | 534 | toss) DEFAULT_INIT_SCRIPT=redhat ;; |
712f8bd8 | 535 | redhat) DEFAULT_INIT_SCRIPT=redhat ;; |
01c0e61d | 536 | fedora) DEFAULT_INIT_SCRIPT=fedora ;; |
c53fb011 CL |
537 | gentoo) DEFAULT_INIT_SCRIPT=openrc ;; |
538 | alpine) DEFAULT_INIT_SCRIPT=openrc ;; | |
0da31cd6 | 539 | arch) DEFAULT_INIT_SCRIPT=lsb ;; |
76c2b24c RY |
540 | sles) DEFAULT_INIT_SCRIPT=lsb ;; |
541 | slackware) DEFAULT_INIT_SCRIPT=lsb ;; | |
542 | lunar) DEFAULT_INIT_SCRIPT=lunar ;; | |
543 | ubuntu) DEFAULT_INIT_SCRIPT=lsb ;; | |
544 | debian) DEFAULT_INIT_SCRIPT=lsb ;; | |
9f0a21e6 | 545 | freebsd) DEFAULT_INIT_SCRIPT=freebsd;; |
76c2b24c | 546 | *) DEFAULT_INIT_SCRIPT=lsb ;; |
01c0e61d | 547 | esac |
38e2e9ce AS |
548 | |
549 | # On gentoo, it's possible that OpenRC isn't installed. Check if | |
550 | # /sbin/openrc-run exists, and if not, fall back to generic defaults. | |
551 | ||
552 | DEFAULT_INIT_SHELL="/bin/sh" | |
553 | AS_IF([test "$DEFAULT_INIT_SCRIPT" = "openrc"], [ | |
554 | AS_IF([test -x "/sbin/openrc-run"], | |
555 | [DEFAULT_INIT_SHELL="/sbin/openrc-run"], | |
556 | [DEFAULT_INIT_SCRIPT=lsb]) | |
557 | ]) | |
558 | ||
559 | AC_MSG_RESULT([$DEFAULT_INIT_SCRIPT:$DEFAULT_INIT_SHELL]) | |
01c0e61d | 560 | AC_SUBST(DEFAULT_INIT_SCRIPT) |
38e2e9ce AS |
561 | AC_SUBST(DEFAULT_INIT_SHELL) |
562 | ||
563 | AC_MSG_CHECKING([default nfs server init script]) | |
564 | AS_IF([test "$VENDOR" = "debian"], | |
565 | [DEFAULT_INIT_NFS_SERVER="nfs-kernel-server"], | |
566 | [DEFAULT_INIT_NFS_SERVER="nfs"] | |
567 | ) | |
568 | AC_MSG_RESULT([$DEFAULT_INIT_NFS_SERVER]) | |
569 | AC_SUBST(DEFAULT_INIT_NFS_SERVER) | |
2a34db1b | 570 | |
2b96f774 | 571 | AC_MSG_CHECKING([default init config directory]) |
2a34db1b | 572 | case "$VENDOR" in |
38e2e9ce AS |
573 | alpine) initconfdir=/etc/conf.d ;; |
574 | gentoo) initconfdir=/etc/conf.d ;; | |
575 | toss) initconfdir=/etc/sysconfig ;; | |
576 | redhat) initconfdir=/etc/sysconfig ;; | |
577 | fedora) initconfdir=/etc/sysconfig ;; | |
578 | sles) initconfdir=/etc/sysconfig ;; | |
579 | ubuntu) initconfdir=/etc/default ;; | |
580 | debian) initconfdir=/etc/default ;; | |
581 | freebsd) initconfdir=$sysconfdir/rc.conf.d;; | |
582 | *) initconfdir=/etc/default ;; | |
2a34db1b | 583 | esac |
38e2e9ce AS |
584 | AC_MSG_RESULT([$initconfdir]) |
585 | AC_SUBST(initconfdir) | |
2cac7f5f TF |
586 | |
587 | AC_MSG_CHECKING([whether initramfs-tools is available]) | |
588 | if test -d /usr/share/initramfs-tools ; then | |
d0cea309 | 589 | RPM_DEFINE_INITRAMFS='--define "_initramfs 1"' |
2cac7f5f TF |
590 | AC_MSG_RESULT([yes]) |
591 | else | |
d0cea309 | 592 | RPM_DEFINE_INITRAMFS='' |
2cac7f5f TF |
593 | AC_MSG_RESULT([no]) |
594 | fi | |
d0cea309 | 595 | AC_SUBST(RPM_DEFINE_INITRAMFS) |
c9c0d073 BB |
596 | ]) |
597 | ||
598 | dnl # | |
599 | dnl # Default ZFS package configuration | |
600 | dnl # | |
601 | AC_DEFUN([ZFS_AC_PACKAGE], [ | |
58d956b0 | 602 | ZFS_AC_DEFAULT_PACKAGE |
9f0a21e6 MM |
603 | AS_IF([test x$VENDOR != xfreebsd], [ |
604 | ZFS_AC_RPM | |
605 | ZFS_AC_DPKG | |
606 | ZFS_AC_ALIEN | |
607 | ]) | |
c9c0d073 | 608 | ]) |