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