]>
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 ]) | |
6a9d6359 | 84 | AM_CONDITIONAL([CONFIG_QAT], |
85 | [test "$ZFS_CONFIG" = kernel -o "$ZFS_CONFIG" = all] && | |
86 | [test "x$qatsrc" != x ]) | |
c9c0d073 BB |
87 | ]) |
88 | ||
89 | dnl # | |
90 | dnl # Check for rpm+rpmbuild to build RPM packages. If these tools | |
91 | dnl # are missing it is non-fatal but you will not be able to build | |
92 | dnl # RPM packages and will be warned if you try too. | |
93 | dnl # | |
f3757573 BB |
94 | dnl # By default the generic spec file will be used because it requires |
95 | dnl # minimal dependencies. Distribution specific spec files can be | |
96 | dnl # placed under the 'rpm/<distribution>' directory and enabled using | |
97 | dnl # the --with-spec=<distribution> configure option. | |
98 | dnl # | |
c9c0d073 BB |
99 | AC_DEFUN([ZFS_AC_RPM], [ |
100 | RPM=rpm | |
101 | RPMBUILD=rpmbuild | |
102 | ||
103 | AC_MSG_CHECKING([whether $RPM is available]) | |
104 | AS_IF([tmp=$($RPM --version 2>/dev/null)], [ | |
105 | RPM_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }') | |
106 | HAVE_RPM=yes | |
107 | AC_MSG_RESULT([$HAVE_RPM ($RPM_VERSION)]) | |
108 | ],[ | |
109 | HAVE_RPM=no | |
110 | AC_MSG_RESULT([$HAVE_RPM]) | |
111 | ]) | |
112 | ||
113 | AC_MSG_CHECKING([whether $RPMBUILD is available]) | |
114 | AS_IF([tmp=$($RPMBUILD --version 2>/dev/null)], [ | |
115 | RPMBUILD_VERSION=$(echo $tmp | $AWK '/RPM/ { print $[3] }') | |
116 | HAVE_RPMBUILD=yes | |
117 | AC_MSG_RESULT([$HAVE_RPMBUILD ($RPMBUILD_VERSION)]) | |
118 | ],[ | |
119 | HAVE_RPMBUILD=no | |
120 | AC_MSG_RESULT([$HAVE_RPMBUILD]) | |
121 | ]) | |
122 | ||
3ec3bc21 | 123 | RPM_DEFINE_COMMON='--define "$(DEBUG_ZFS) 1"' |
2cac7f5f | 124 | RPM_DEFINE_UTIL='--define "_dracutdir $(dracutdir)" --define "_udevdir $(udevdir)" --define "_udevruledir $(udevruledir)" --define "_initconfdir $(DEFAULT_INITCONF_DIR)" $(DEFINE_INITRAMFS)' |
69c7bdb6 | 125 | 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 |
126 | RPM_DEFINE_DKMS= |
127 | ||
128 | SRPM_DEFINE_COMMON='--define "build_src_rpm 1"' | |
129 | SRPM_DEFINE_UTIL= | |
130 | SRPM_DEFINE_KMOD= | |
131 | SRPM_DEFINE_DKMS= | |
132 | ||
133 | RPM_SPEC_DIR="rpm/generic" | |
134 | AC_ARG_WITH([spec], | |
135 | AS_HELP_STRING([--with-spec=SPEC], | |
ee2ca1db | 136 | [Spec files 'generic|redhat']), |
f3757573 BB |
137 | [RPM_SPEC_DIR="rpm/$withval"]) |
138 | ||
139 | AC_MSG_CHECKING([whether spec files are available]) | |
140 | AC_MSG_RESULT([yes ($RPM_SPEC_DIR/*.spec.in)]) | |
141 | ||
c9c0d073 BB |
142 | AC_SUBST(HAVE_RPM) |
143 | AC_SUBST(RPM) | |
144 | AC_SUBST(RPM_VERSION) | |
145 | ||
146 | AC_SUBST(HAVE_RPMBUILD) | |
147 | AC_SUBST(RPMBUILD) | |
148 | AC_SUBST(RPMBUILD_VERSION) | |
f3757573 BB |
149 | |
150 | AC_SUBST(RPM_SPEC_DIR) | |
151 | AC_SUBST(RPM_DEFINE_UTIL) | |
152 | AC_SUBST(RPM_DEFINE_KMOD) | |
153 | AC_SUBST(RPM_DEFINE_DKMS) | |
154 | AC_SUBST(RPM_DEFINE_COMMON) | |
155 | AC_SUBST(SRPM_DEFINE_UTIL) | |
156 | AC_SUBST(SRPM_DEFINE_KMOD) | |
157 | AC_SUBST(SRPM_DEFINE_DKMS) | |
158 | AC_SUBST(SRPM_DEFINE_COMMON) | |
c9c0d073 BB |
159 | ]) |
160 | ||
161 | dnl # | |
162 | dnl # Check for dpkg+dpkg-buildpackage to build DEB packages. If these | |
163 | dnl # tools are missing it is non-fatal but you will not be able to build | |
164 | dnl # DEB packages and will be warned if you try too. | |
165 | dnl # | |
166 | AC_DEFUN([ZFS_AC_DPKG], [ | |
167 | DPKG=dpkg | |
168 | DPKGBUILD=dpkg-buildpackage | |
169 | ||
170 | AC_MSG_CHECKING([whether $DPKG is available]) | |
171 | AS_IF([tmp=$($DPKG --version 2>/dev/null)], [ | |
172 | DPKG_VERSION=$(echo $tmp | $AWK '/Debian/ { print $[7] }') | |
173 | HAVE_DPKG=yes | |
174 | AC_MSG_RESULT([$HAVE_DPKG ($DPKG_VERSION)]) | |
175 | ],[ | |
176 | HAVE_DPKG=no | |
177 | AC_MSG_RESULT([$HAVE_DPKG]) | |
178 | ]) | |
179 | ||
180 | AC_MSG_CHECKING([whether $DPKGBUILD is available]) | |
181 | AS_IF([tmp=$($DPKGBUILD --version 2>/dev/null)], [ | |
182 | DPKGBUILD_VERSION=$(echo $tmp | \ | |
183 | $AWK '/Debian/ { print $[4] }' | cut -f-4 -d'.') | |
184 | HAVE_DPKGBUILD=yes | |
185 | AC_MSG_RESULT([$HAVE_DPKGBUILD ($DPKGBUILD_VERSION)]) | |
186 | ],[ | |
187 | HAVE_DPKGBUILD=no | |
188 | AC_MSG_RESULT([$HAVE_DPKGBUILD]) | |
189 | ]) | |
190 | ||
191 | AC_SUBST(HAVE_DPKG) | |
192 | AC_SUBST(DPKG) | |
193 | AC_SUBST(DPKG_VERSION) | |
194 | ||
195 | AC_SUBST(HAVE_DPKGBUILD) | |
196 | AC_SUBST(DPKGBUILD) | |
197 | AC_SUBST(DPKGBUILD_VERSION) | |
198 | ]) | |
199 | ||
200 | dnl # | |
201 | dnl # Until native packaging for various different packing systems | |
202 | dnl # can be added the least we can do is attempt to use alien to | |
203 | dnl # convert the RPM packages to the needed package type. This is | |
204 | dnl # a hack but so far it has worked reasonable well. | |
205 | dnl # | |
206 | AC_DEFUN([ZFS_AC_ALIEN], [ | |
207 | ALIEN=alien | |
208 | ||
209 | AC_MSG_CHECKING([whether $ALIEN is available]) | |
210 | AS_IF([tmp=$($ALIEN --version 2>/dev/null)], [ | |
211 | ALIEN_VERSION=$(echo $tmp | $AWK '{ print $[3] }') | |
212 | HAVE_ALIEN=yes | |
213 | AC_MSG_RESULT([$HAVE_ALIEN ($ALIEN_VERSION)]) | |
214 | ],[ | |
215 | HAVE_ALIEN=no | |
216 | AC_MSG_RESULT([$HAVE_ALIEN]) | |
217 | ]) | |
218 | ||
219 | AC_SUBST(HAVE_ALIEN) | |
220 | AC_SUBST(ALIEN) | |
221 | AC_SUBST(ALIEN_VERSION) | |
222 | ]) | |
223 | ||
224 | dnl # | |
225 | dnl # Using the VENDOR tag from config.guess set the default | |
226 | dnl # package type for 'make pkg': (rpm | deb | tgz) | |
227 | dnl # | |
228 | AC_DEFUN([ZFS_AC_DEFAULT_PACKAGE], [ | |
229 | AC_MSG_CHECKING([linux distribution]) | |
76c2b24c RY |
230 | if test -f /etc/toss-release ; then |
231 | VENDOR=toss ; | |
c9c0d073 BB |
232 | elif test -f /etc/fedora-release ; then |
233 | VENDOR=fedora ; | |
76c2b24c RY |
234 | elif test -f /etc/redhat-release ; then |
235 | VENDOR=redhat ; | |
d9bfe0f5 AS |
236 | elif test -f /etc/gentoo-release ; then |
237 | VENDOR=gentoo ; | |
76c2b24c RY |
238 | elif test -f /etc/arch-release ; then |
239 | VENDOR=arch ; | |
c9c0d073 BB |
240 | elif test -f /etc/SuSE-release ; then |
241 | VENDOR=sles ; | |
242 | elif test -f /etc/slackware-version ; then | |
243 | VENDOR=slackware ; | |
712f8bd8 BB |
244 | elif test -f /etc/lunar.release ; then |
245 | VENDOR=lunar ; | |
76c2b24c RY |
246 | elif test -f /etc/lsb-release ; then |
247 | VENDOR=ubuntu ; | |
248 | elif test -f /etc/debian_version ; then | |
249 | VENDOR=debian ; | |
c53fb011 CL |
250 | elif test -f /etc/alpine-release ; then |
251 | VENDOR=alpine ; | |
c9c0d073 BB |
252 | else |
253 | VENDOR= ; | |
254 | fi | |
255 | AC_MSG_RESULT([$VENDOR]) | |
256 | AC_SUBST(VENDOR) | |
257 | ||
258 | AC_MSG_CHECKING([default package type]) | |
259 | case "$VENDOR" in | |
76c2b24c RY |
260 | toss) DEFAULT_PACKAGE=rpm ;; |
261 | redhat) DEFAULT_PACKAGE=rpm ;; | |
262 | fedora) DEFAULT_PACKAGE=rpm ;; | |
263 | gentoo) DEFAULT_PACKAGE=tgz ;; | |
c53fb011 | 264 | alpine) DEFAULT_PACKAGE=tgz ;; |
0da31cd6 | 265 | arch) DEFAULT_PACKAGE=tgz ;; |
76c2b24c RY |
266 | sles) DEFAULT_PACKAGE=rpm ;; |
267 | slackware) DEFAULT_PACKAGE=tgz ;; | |
268 | lunar) DEFAULT_PACKAGE=tgz ;; | |
269 | ubuntu) DEFAULT_PACKAGE=deb ;; | |
270 | debian) DEFAULT_PACKAGE=deb ;; | |
271 | *) DEFAULT_PACKAGE=rpm ;; | |
c9c0d073 | 272 | esac |
c9c0d073 BB |
273 | AC_MSG_RESULT([$DEFAULT_PACKAGE]) |
274 | AC_SUBST(DEFAULT_PACKAGE) | |
01c0e61d | 275 | |
0da31cd6 | 276 | DEFAULT_INIT_DIR=$sysconfdir/init.d |
615ab66d | 277 | AC_MSG_CHECKING([default init directory]) |
615ab66d KF |
278 | AC_MSG_RESULT([$DEFAULT_INIT_DIR]) |
279 | AC_SUBST(DEFAULT_INIT_DIR) | |
280 | ||
01c0e61d BB |
281 | AC_MSG_CHECKING([default init script type]) |
282 | case "$VENDOR" in | |
76c2b24c | 283 | toss) DEFAULT_INIT_SCRIPT=redhat ;; |
712f8bd8 | 284 | redhat) DEFAULT_INIT_SCRIPT=redhat ;; |
01c0e61d | 285 | fedora) DEFAULT_INIT_SCRIPT=fedora ;; |
c53fb011 CL |
286 | gentoo) DEFAULT_INIT_SCRIPT=openrc ;; |
287 | alpine) DEFAULT_INIT_SCRIPT=openrc ;; | |
0da31cd6 | 288 | arch) DEFAULT_INIT_SCRIPT=lsb ;; |
76c2b24c RY |
289 | sles) DEFAULT_INIT_SCRIPT=lsb ;; |
290 | slackware) DEFAULT_INIT_SCRIPT=lsb ;; | |
291 | lunar) DEFAULT_INIT_SCRIPT=lunar ;; | |
292 | ubuntu) DEFAULT_INIT_SCRIPT=lsb ;; | |
293 | debian) DEFAULT_INIT_SCRIPT=lsb ;; | |
294 | *) DEFAULT_INIT_SCRIPT=lsb ;; | |
01c0e61d | 295 | esac |
01c0e61d BB |
296 | AC_MSG_RESULT([$DEFAULT_INIT_SCRIPT]) |
297 | AC_SUBST(DEFAULT_INIT_SCRIPT) | |
2a34db1b TF |
298 | |
299 | AC_MSG_CHECKING([default init config direectory]) | |
300 | case "$VENDOR" in | |
c53fb011 | 301 | alpine) DEFAULT_INITCONF_DIR=/etc/conf.d ;; |
2a34db1b TF |
302 | gentoo) DEFAULT_INITCONF_DIR=/etc/conf.d ;; |
303 | toss) DEFAULT_INITCONF_DIR=/etc/sysconfig ;; | |
304 | redhat) DEFAULT_INITCONF_DIR=/etc/sysconfig ;; | |
305 | fedora) DEFAULT_INITCONF_DIR=/etc/sysconfig ;; | |
306 | sles) DEFAULT_INITCONF_DIR=/etc/sysconfig ;; | |
307 | ubuntu) DEFAULT_INITCONF_DIR=/etc/default ;; | |
308 | debian) DEFAULT_INITCONF_DIR=/etc/default ;; | |
309 | *) DEFAULT_INITCONF_DIR=/etc/default ;; | |
310 | esac | |
2a34db1b TF |
311 | AC_MSG_RESULT([$DEFAULT_INITCONF_DIR]) |
312 | AC_SUBST(DEFAULT_INITCONF_DIR) | |
2cac7f5f TF |
313 | |
314 | AC_MSG_CHECKING([whether initramfs-tools is available]) | |
315 | if test -d /usr/share/initramfs-tools ; then | |
316 | DEFINE_INITRAMFS='--define "_initramfs 1"' | |
317 | AC_MSG_RESULT([yes]) | |
318 | else | |
319 | DEFINE_INITRAMFS='' | |
320 | AC_MSG_RESULT([no]) | |
321 | fi | |
322 | AC_SUBST(DEFINE_INITRAMFS) | |
c9c0d073 BB |
323 | ]) |
324 | ||
325 | dnl # | |
326 | dnl # Default ZFS package configuration | |
327 | dnl # | |
328 | AC_DEFUN([ZFS_AC_PACKAGE], [ | |
58d956b0 | 329 | ZFS_AC_DEFAULT_PACKAGE |
c9c0d073 BB |
330 | ZFS_AC_RPM |
331 | ZFS_AC_DPKG | |
332 | ZFS_AC_ALIEN | |
c9c0d073 | 333 | ]) |