]>
Commit | Line | Data |
---|---|---|
b3cfa26b TK |
1 | dnl Process this file with autoconf to produce a configure script. |
2 | ||
3 | dnl First, define all of the version numbers up front. | |
4 | dnl In particular, this allows the version macro to be used in AC_INIT | |
5 | ||
6 | dnl These first two version numbers are updated automatically on each release. | |
a122717f MM |
7 | m4_define([LIBARCHIVE_VERSION_S],[3.7.1dev]) |
8 | m4_define([LIBARCHIVE_VERSION_N],[3007001]) | |
b3cfa26b | 9 | |
80bdb4b4 | 10 | dnl bsdtar and bsdcpio versioning tracks libarchive |
b3cfa26b | 11 | m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) |
80bdb4b4 | 12 | m4_define([BSDCPIO_VERSION_S],LIBARCHIVE_VERSION_S()) |
5d3f56d2 | 13 | m4_define([BSDCAT_VERSION_S],LIBARCHIVE_VERSION_S()) |
b3cfa26b | 14 | |
013aef12 | 15 | AC_PREREQ([2.71]) |
77cfbb98 | 16 | |
b3cfa26b TK |
17 | # |
18 | # Now starts the "real" configure script. | |
19 | # | |
20 | ||
a580c98e | 21 | AC_INIT([libarchive],[LIBARCHIVE_VERSION_S()],[libarchive-discuss@googlegroups.com]) |
b3cfa26b TK |
22 | # Make sure the srcdir contains "libarchive" directory |
23 | AC_CONFIG_SRCDIR([libarchive]) | |
24 | # Use auxiliary subscripts from this subdirectory (cleans up root) | |
4c9c2bcd | 25 | AC_CONFIG_AUX_DIR([build/autoconf]) |
79cb8e5b | 26 | # M4 scripts |
80b5f20f | 27 | AC_CONFIG_MACRO_DIR([build/autoconf]) |
b3cfa26b | 28 | # Must follow AC_CONFIG macros above... |
dc064872 | 29 | AM_INIT_AUTOMAKE([1.11 dist-xz dist-zip]) |
3bf4a20e | 30 | AM_MAINTAINER_MODE([enable]) |
fcfe9113 | 31 | m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) |
b3cfa26b | 32 | |
f2488cf6 TK |
33 | # Libtool's "interface version" can be computed from the libarchive version. |
34 | ||
35 | # Libtool interface version bumps on any API change, so increments | |
36 | # whenever libarchive minor version does. | |
b3cfa26b | 37 | ARCHIVE_MINOR=$(( (LIBARCHIVE_VERSION_N() / 1000) % 1000 )) |
f2488cf6 TK |
38 | # Libarchive 2.7 == libtool interface 9 = 2 + 7 |
39 | # Libarchive 2.8 == libtool interface 10 = 2 + 8 | |
7eeddea4 TK |
40 | # Libarchive 2.9 == libtool interface 11 = 2 + 8 |
41 | # Libarchive 3.0 == libtool interface 12 | |
bdf2c171 AM |
42 | # Libarchive 3.1 == libtool interface 13 |
43 | ARCHIVE_INTERFACE=`echo $((13 + ${ARCHIVE_MINOR}))` | |
f2488cf6 | 44 | # Libarchive revision is bumped on any source change === libtool revision |
b3cfa26b | 45 | ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 )) |
f2488cf6 | 46 | # Libarchive minor is bumped on any interface addition === libtool age |
7f6d230a | 47 | ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR |
b3cfa26b TK |
48 | |
49 | # Stick the version numbers into config.h | |
0d8b61ea AR |
50 | AC_DEFINE([__LIBARCHIVE_CONFIG_H_INCLUDED], [1], |
51 | [Internal macro for sanity checks]) | |
b3cfa26b TK |
52 | AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()", |
53 | [Version number of libarchive]) | |
54 | AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_NUMBER],"LIBARCHIVE_VERSION_N()", | |
55 | [Version number of libarchive as a single integer]) | |
56 | AC_DEFINE([BSDCPIO_VERSION_STRING],"BSDCPIO_VERSION_S()", | |
57 | [Version number of bsdcpio]) | |
58 | AC_DEFINE([BSDTAR_VERSION_STRING],"BSDTAR_VERSION_S()", | |
59 | [Version number of bsdtar]) | |
5d3f56d2 MK |
60 | AC_DEFINE([BSDCAT_VERSION_STRING],"BSDTAR_VERSION_S()", |
61 | [Version number of bsdcat]) | |
b3cfa26b TK |
62 | |
63 | # The shell variables here must be the same as the AC_SUBST() variables | |
64 | # below, but the shell variable names apparently cannot be the same as | |
65 | # the m4 macro names above. Why? Ask autoconf. | |
66 | BSDCPIO_VERSION_STRING=BSDCPIO_VERSION_S() | |
67 | BSDTAR_VERSION_STRING=BSDTAR_VERSION_S() | |
5d3f56d2 | 68 | BSDCAT_VERSION_STRING=BSDCAT_VERSION_S() |
b3cfa26b TK |
69 | LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S() |
70 | LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N() | |
71 | ||
72 | # Substitute the above version numbers into the various files below. | |
73 | # Yes, I believe this is the fourth time we define what are essentially | |
74 | # the same symbols. Why? Ask autoconf. | |
75 | AC_SUBST(ARCHIVE_LIBTOOL_VERSION) | |
76 | AC_SUBST(BSDCPIO_VERSION_STRING) | |
77 | AC_SUBST(BSDTAR_VERSION_STRING) | |
5d3f56d2 | 78 | AC_SUBST(BSDCAT_VERSION_STRING) |
b3cfa26b TK |
79 | AC_SUBST(LIBARCHIVE_VERSION_STRING) |
80 | AC_SUBST(LIBARCHIVE_VERSION_NUMBER) | |
81 | ||
82 | AC_CONFIG_HEADERS([config.h]) | |
83 | AC_CONFIG_FILES([Makefile]) | |
bafc3c6b | 84 | AC_CONFIG_FILES([build/pkgconfig/libarchive.pc]) |
b3cfa26b | 85 | |
79cb8e5b CW |
86 | # Check for host type |
87 | AC_CANONICAL_HOST | |
88 | ||
89 | dnl Compilation on mingw and Cygwin needs special Makefile rules | |
90 | inc_windows_files=no | |
91 | inc_cygwin_files=no | |
92 | case "$host_os" in | |
93 | *mingw* ) inc_windows_files=yes ;; | |
1e2b6c98 | 94 | *cygwin* | *msys*) inc_cygwin_files=yes ;; |
79cb8e5b CW |
95 | esac |
96 | AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes]) | |
97 | AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes]) | |
98 | ||
c31d1bc4 CW |
99 | dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc) |
100 | PLATFORMCPPFLAGS= | |
101 | case "$host_os" in | |
0348e24b | 102 | *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO -D__MINGW_USE_VC2005_COMPAT ;; |
c31d1bc4 CW |
103 | esac |
104 | AC_SUBST(PLATFORMCPPFLAGS) | |
105 | ||
b3cfa26b TK |
106 | # Checks for programs. |
107 | AC_PROG_CC | |
108 | AM_PROG_CC_C_O | |
b4c5bf51 | 109 | AC_PROG_CPP |
6ca9835b | 110 | AC_USE_SYSTEM_EXTENSIONS |
01a4df54 | 111 | AC_LIBTOOL_WIN32_DLL |
b3cfa26b TK |
112 | AC_PROG_LIBTOOL |
113 | AC_CHECK_TOOL([STRIP],[strip]) | |
1c6adda3 | 114 | AC_PROG_MKDIR_P |
b3cfa26b TK |
115 | |
116 | # | |
117 | # Options for building bsdtar. | |
118 | # | |
119 | # Default is to build bsdtar, but allow people to override that. | |
120 | # | |
121 | AC_ARG_ENABLE([bsdtar], | |
122 | [AS_HELP_STRING([--enable-bsdtar], [enable build of bsdtar (default)]) | |
123 | AS_HELP_STRING([--enable-bsdtar=static], [force static build of bsdtar]) | |
124 | AS_HELP_STRING([--enable-bsdtar=shared], [force dynamic build of bsdtar]) | |
125 | AS_HELP_STRING([--disable-bsdtar], [disable build of bsdtar])], | |
126 | [], [enable_bsdtar=yes]) | |
127 | ||
128 | case "$enable_bsdtar" in | |
129 | yes) | |
130 | if test "$enable_static" = "no"; then | |
131 | static_bsdtar=no | |
132 | else | |
133 | static_bsdtar=yes | |
134 | fi | |
135 | build_bsdtar=yes | |
136 | ;; | |
137 | dynamic|shared) | |
138 | if test "$enable_shared" = "no"; then | |
139 | AC_MSG_FAILURE([Shared linking of bsdtar requires shared libarchive]) | |
140 | fi | |
141 | build_bsdtar=yes | |
142 | static_bsdtar=no | |
143 | ;; | |
144 | static) | |
145 | build_bsdtar=yes | |
146 | static_bsdtar=yes | |
147 | ;; | |
148 | no) | |
149 | build_bsdtar=no | |
150 | static_bsdtar=no | |
151 | ;; | |
152 | *) | |
153 | AC_MSG_FAILURE([Unsupported value for --enable-bsdtar]) | |
154 | ;; | |
155 | esac | |
156 | ||
157 | AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ]) | |
158 | AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ]) | |
159 | ||
5d3f56d2 MK |
160 | # |
161 | # Options for building bsdcat. | |
162 | # | |
163 | # Default is to build bsdcat, but allow people to override that. | |
164 | # | |
165 | AC_ARG_ENABLE([bsdcat], | |
166 | [AS_HELP_STRING([--enable-bsdcat], [enable build of bsdcat (default)]) | |
167 | AS_HELP_STRING([--enable-bsdcat=static], [force static build of bsdcat]) | |
168 | AS_HELP_STRING([--enable-bsdcat=shared], [force dynamic build of bsdcat]) | |
169 | AS_HELP_STRING([--disable-bsdcat], [disable build of bsdcat])], | |
170 | [], [enable_bsdcat=yes]) | |
171 | ||
172 | case "$enable_bsdcat" in | |
173 | yes) | |
174 | if test "$enable_static" = "no"; then | |
175 | static_bsdcat=no | |
176 | else | |
177 | static_bsdcat=yes | |
178 | fi | |
179 | build_bsdcat=yes | |
180 | ;; | |
181 | dynamic|shared) | |
182 | if test "$enable_shared" = "no"; then | |
183 | AC_MSG_FAILURE([Shared linking of bsdcat requires shared libarchive]) | |
184 | fi | |
185 | build_bsdcat=yes | |
186 | static_bsdcat=no | |
187 | ;; | |
188 | static) | |
189 | build_bsdcat=yes | |
190 | static_bsdcat=yes | |
191 | ;; | |
192 | no) | |
193 | build_bsdcat=no | |
194 | static_bsdcat=no | |
195 | ;; | |
196 | *) | |
197 | AC_MSG_FAILURE([Unsupported value for --enable-bsdcat]) | |
198 | ;; | |
199 | esac | |
200 | ||
201 | AM_CONDITIONAL([BUILD_BSDCAT], [ test "$build_bsdcat" = yes ]) | |
202 | AM_CONDITIONAL([STATIC_BSDCAT], [ test "$static_bsdcat" = yes ]) | |
203 | ||
b3cfa26b TK |
204 | # |
205 | # Options for building bsdcpio. | |
206 | # | |
207 | # Default is not to build bsdcpio, but that can be overridden. | |
208 | # | |
209 | AC_ARG_ENABLE([bsdcpio], | |
f9a97a03 | 210 | [AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio (default)]) |
b3cfa26b TK |
211 | AS_HELP_STRING([--enable-bsdcpio=static], [static build of bsdcpio]) |
212 | AS_HELP_STRING([--enable-bsdcpio=shared], [dynamic build of bsdcpio]) | |
f9a97a03 TK |
213 | AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio])], |
214 | [], [enable_bsdcpio=yes]) | |
b3cfa26b TK |
215 | |
216 | case "$enable_bsdcpio" in | |
217 | yes) | |
218 | if test "$enable_static" = "no"; then | |
219 | static_bsdcpio=no | |
220 | else | |
221 | static_bsdcpio=yes | |
222 | fi | |
223 | build_bsdcpio=yes | |
224 | ;; | |
225 | dynamic|shared) | |
226 | if test "$enabled_shared" = "no"; then | |
227 | AC_MSG_FAILURE([Shared linking of bsdcpio requires shared libarchive]) | |
228 | fi | |
229 | build_bsdcpio=yes | |
230 | ;; | |
231 | static) | |
232 | build_bsdcpio=yes | |
233 | static_bsdcpio=yes | |
234 | ;; | |
235 | no) | |
236 | build_bsdcpio=no | |
237 | static_bsdcpio=no | |
238 | ;; | |
239 | *) | |
240 | AC_MSG_FAILURE([Unsupported value for --enable-bsdcpio]) | |
241 | ;; | |
242 | esac | |
243 | ||
244 | AM_CONDITIONAL([BUILD_BSDCPIO], [ test "$build_bsdcpio" = yes ]) | |
245 | AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ]) | |
246 | ||
197cc2d1 CW |
247 | # Set up defines needed before including any headers |
248 | case $host in | |
1e2b6c98 | 249 | *mingw* | *cygwin* | *msys* ) |
1fd0c015 SL |
250 | AC_PREPROC_IFELSE([AC_LANG_PROGRAM( |
251 | [[#ifdef _WIN32_WINNT | |
252 | # error _WIN32_WINNT already defined | |
253 | #endif | |
254 | ]],[[;]]) | |
255 | ],[ | |
256 | AC_DEFINE([_WIN32_WINNT], 0x0502, [Define to '0x0502' for Windows Server 2003 APIs.]) | |
257 | AC_DEFINE([NTDDI_VERSION], 0x05020000, [Define to '0x05020000' for Windows Server 2003 APIs.]) | |
258 | ]) | |
259 | AC_PREPROC_IFELSE([AC_LANG_PROGRAM( | |
260 | [[#ifdef WINVER | |
261 | # error WINVER already defined | |
262 | #endif | |
263 | ]],[[;]]) | |
264 | ],[ | |
265 | AC_DEFINE([WINVER], 0x0502, [Define to '0x0502' for Windows Server 2003 APIs.]) | |
266 | ]) | |
197cc2d1 CW |
267 | ;; |
268 | esac | |
269 | ||
c157e4ce AV |
270 | # |
271 | # Options for building bsdunzip. | |
272 | # | |
273 | # Default is to build bsdunzip, but allow people to override that. | |
386412e2 | 274 | # Bsdunzip has not yet been ported for Windows |
c157e4ce | 275 | # |
386412e2 MM |
276 | case "$host_os" in |
277 | *mingw* | *msys*) | |
278 | enable_bsdunzip=no | |
279 | ;; | |
280 | *) | |
281 | AC_ARG_ENABLE([bsdunzip], | |
282 | [AS_HELP_STRING([--enable-bsdunzip], [enable build of bsdunzip (default)]) | |
283 | AS_HELP_STRING([--enable-bsdunzip=static], [force static build of bsdunzip]) | |
284 | AS_HELP_STRING([--enable-bsdunzip=shared], [force dynamic build of bsdunzip]) | |
285 | AS_HELP_STRING([--disable-bsdunzip], [disable build of bsdunzip])], | |
286 | [], [enable_bsdunzip=yes]) | |
287 | ;; | |
288 | esac | |
c157e4ce AV |
289 | |
290 | case "$enable_bsdunzip" in | |
291 | yes) | |
292 | if test "$enable_static" = "no"; then | |
293 | static_bsdunzip=no | |
294 | else | |
295 | static_bsdunzip=yes | |
296 | fi | |
297 | build_bsdunzip=yes | |
298 | ;; | |
299 | dynamic|shared) | |
300 | if test "$enable_shared" = "no"; then | |
301 | AC_MSG_FAILURE([Shared linking of bsdunzip requires shared libarchive]) | |
302 | fi | |
303 | build_bsdunzip=yes | |
304 | static_bsdunzip=no | |
305 | ;; | |
306 | static) | |
307 | build_bsdunzip=yes | |
308 | static_bsdunzip=yes | |
309 | ;; | |
310 | no) | |
311 | build_bsdunzip=no | |
312 | static_bsdunzip=no | |
313 | ;; | |
314 | *) | |
315 | AC_MSG_FAILURE([Unsupported value for --enable-bsdunzip]) | |
316 | ;; | |
317 | esac | |
318 | ||
319 | AM_CONDITIONAL([BUILD_BSDUNZIP], [ test "$build_bsdunzip" = yes ]) | |
320 | AM_CONDITIONAL([STATIC_BSDUNZIP], [ test "$static_bsdunzip" = yes ]) | |
321 | ||
b3cfa26b | 322 | # Checks for header files. |
b3cfa26b TK |
323 | AC_HEADER_DIRENT |
324 | AC_HEADER_SYS_WAIT | |
365a91de | 325 | AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h]) |
b30c530a | 326 | AC_CHECK_HEADERS([copyfile.h ctype.h]) |
386412e2 | 327 | AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h fnmatch.h grp.h]) |
95c74682 JS |
328 | |
329 | AC_CACHE_CHECK([whether EXT2_IOC_GETFLAGS is usable], | |
330 | [ac_cv_have_decl_EXT2_IOC_GETFLAGS], | |
331 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <sys/ioctl.h> | |
332 | @%:@include <ext2fs/ext2_fs.h>], | |
333 | [int x = EXT2_IOC_GETFLAGS])], | |
334 | [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes])], | |
335 | [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [no])])]) | |
336 | ||
337 | AS_VAR_IF([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes], | |
338 | [AC_DEFINE_UNQUOTED([HAVE_WORKING_EXT2_IOC_GETFLAGS], [1], | |
339 | [Define to 1 if you have a working EXT2_IOC_GETFLAGS])]) | |
340 | ||
d216d028 | 341 | AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h]) |
407f6e94 | 342 | AC_CHECK_HEADERS([linux/fiemap.h linux/fs.h linux/magic.h linux/types.h]) |
a9c5818b MM |
343 | |
344 | AC_CACHE_CHECK([whether FS_IOC_GETFLAGS is usable], | |
345 | [ac_cv_have_decl_FS_IOC_GETFLAGS], | |
346 | [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <sys/ioctl.h> | |
347 | @%:@include <linux/fs.h>], | |
348 | [int x = FS_IOC_GETFLAGS])], | |
349 | [AS_VAR_SET([ac_cv_have_decl_FS_IOC_GETFLAGS], [yes])], | |
350 | [AS_VAR_SET([ac_cv_have_decl_FS_IOC_GETFLAGS], [no])])]) | |
351 | ||
352 | AS_VAR_IF([ac_cv_have_decl_FS_IOC_GETFLAGS], [yes], | |
353 | [AC_DEFINE_UNQUOTED([HAVE_WORKING_FS_IOC_GETFLAGS], [1], | |
354 | [Define to 1 if you have a working FS_IOC_GETFLAGS])]) | |
355 | ||
f57d129d | 356 | AC_CHECK_HEADERS([locale.h membership.h paths.h poll.h pthread.h pwd.h]) |
9769e6f7 | 357 | AC_CHECK_HEADERS([readpassphrase.h signal.h spawn.h]) |
8c1c0a7a | 358 | AC_CHECK_HEADERS([stdarg.h stdint.h stdlib.h string.h]) |
365a91de | 359 | AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/ea.h sys/extattr.h]) |
386412e2 | 360 | AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h sys/queue.h]) |
bea9f9cf | 361 | AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/richacl.h]) |
4925fd0b | 362 | AC_CHECK_HEADERS([sys/select.h sys/statfs.h sys/statvfs.h sys/sysmacros.h]) |
365a91de | 363 | AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h sys/xattr.h]) |
996334f3 | 364 | AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h]) |
d7ae3cca TK |
365 | AC_CHECK_HEADERS([windows.h]) |
366 | # check windows.h first; the other headers require it. | |
367 | AC_CHECK_HEADERS([wincrypt.h winioctl.h],[],[], | |
368 | [[#ifdef HAVE_WINDOWS_H | |
369 | # include <windows.h> | |
370 | #endif | |
371 | ]]) | |
b3cfa26b TK |
372 | |
373 | # Checks for libraries. | |
2186dc24 TK |
374 | AC_ARG_WITH([zlib], |
375 | AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib])) | |
376 | ||
377 | if test "x$with_zlib" != "xno"; then | |
378 | AC_CHECK_HEADERS([zlib.h]) | |
379 | AC_CHECK_LIB(z,inflate) | |
380 | fi | |
381 | ||
382 | AC_ARG_WITH([bz2lib], | |
383 | AS_HELP_STRING([--without-bz2lib], [Don't build support for bzip2 through bz2lib])) | |
384 | ||
385 | if test "x$with_bz2lib" != "xno"; then | |
386 | AC_CHECK_HEADERS([bzlib.h]) | |
1a0f8974 | 387 | case "$host_os" in |
1e2b6c98 | 388 | *mingw* | *cygwin* | *msys*) |
1a0f8974 AM |
389 | dnl AC_CHECK_LIB cannot be used on the Windows port of libbz2, therefore |
390 | dnl use AC_LINK_IFELSE. | |
391 | AC_MSG_CHECKING([for BZ2_bzDecompressInit in -lbz2]) | |
392 | old_LIBS="$LIBS" | |
393 | LIBS="-lbz2 $LIBS" | |
394 | AC_LINK_IFELSE( | |
395 | [AC_LANG_SOURCE(#include <bzlib.h> | |
396 | int main() { return BZ2_bzDecompressInit(NULL, 0, 0); })], | |
397 | [ac_cv_lib_bz2_BZ2_bzDecompressInit=yes], | |
398 | [ac_cv_lib_bz2_BZ2_bzDecompressInit=no]) | |
399 | LIBS="$old_LIBS" | |
400 | AC_MSG_RESULT($ac_cv_lib_bz2_BZ2_bzDecompressInit) | |
401 | if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then | |
402 | AC_DEFINE([HAVE_LIBBZ2], [1], [Define to 1 if you have the `bz2' library (-lbz2).]) | |
403 | LIBS="-lbz2 $LIBS" | |
404 | fi | |
405 | ;; | |
406 | *) | |
407 | AC_CHECK_LIB(bz2,BZ2_bzDecompressInit) | |
408 | ;; | |
409 | esac | |
2186dc24 TK |
410 | fi |
411 | ||
c5013112 MM |
412 | AC_ARG_WITH([libb2], |
413 | AS_HELP_STRING([--without-libb2], [Don't build support for BLAKE2 through libb2])) | |
414 | ||
415 | if test "x$with_libb2" != "xno"; then | |
416 | AC_CHECK_HEADERS([blake2.h]) | |
417 | AC_CHECK_LIB(b2,blake2sp_init) | |
418 | fi | |
419 | ||
420 | AM_CONDITIONAL([INC_BLAKE2], [test "x$ac_cv_lib_b2_blake2sp_init" != "xyes"]) | |
421 | ||
c91b3538 TK |
422 | AC_ARG_WITH([iconv], |
423 | AS_HELP_STRING([--without-iconv], [Don't try to link against iconv])) | |
424 | ||
425 | if test "x$with_iconv" != "xno"; then | |
d975ebec | 426 | AM_ICONV |
1354b7df | 427 | AC_CHECK_HEADERS([iconv.h],[],[],[#include <stdlib.h>]) |
17fd872a | 428 | if test "x$am_cv_func_iconv" = "xyes"; then |
89032bfd MN |
429 | AC_CHECK_HEADERS([localcharset.h]) |
430 | am_save_LIBS="$LIBS" | |
431 | LIBS="${LIBS} ${LIBICONV}" | |
1f35c466 PP |
432 | if test -n "$LIBICONV"; then |
433 | LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }iconv" | |
434 | fi | |
89032bfd MN |
435 | AC_CHECK_FUNCS([locale_charset]) |
436 | LIBS="${am_save_LIBS}" | |
437 | if test "x$ac_cv_func_locale_charset" != "xyes"; then | |
057c8b91 | 438 | # If locale_charset() is not in libiconv, we have to find libcharset. |
89032bfd MN |
439 | AC_CHECK_LIB(charset,locale_charset) |
440 | fi | |
441 | fi | |
c91b3538 TK |
442 | fi |
443 | ||
724f3f91 MN |
444 | AC_ARG_WITH([lz4], |
445 | AS_HELP_STRING([--without-lz4], [Don't build support for lz4 through liblz4])) | |
446 | ||
447 | if test "x$with_lz4" != "xno"; then | |
448 | AC_CHECK_HEADERS([lz4.h lz4hc.h]) | |
449 | AC_CHECK_LIB(lz4,LZ4_decompress_safe) | |
450 | fi | |
451 | ||
26838cf5 SP |
452 | AC_ARG_WITH([zstd], |
453 | AS_HELP_STRING([--without-zstd], [Don't build support for zstd through libzstd])) | |
454 | ||
455 | if test "x$with_zstd" != "xno"; then | |
456 | AC_CHECK_HEADERS([zstd.h]) | |
406165fc PM |
457 | AC_CHECK_LIB(zstd,ZSTD_decompressStream) |
458 | AC_CHECK_LIB(zstd,ZSTD_compressStream, | |
459 | AC_DEFINE([HAVE_LIBZSTD_COMPRESSOR], [1], [Define to 1 if you have the `zstd' library (-lzstd) with compression support.])) | |
26838cf5 SP |
460 | fi |
461 | ||
c25e0da2 MN |
462 | AC_ARG_WITH([lzma], |
463 | AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma])) | |
464 | ||
465 | if test "x$with_lzma" != "xno"; then | |
466 | AC_CHECK_HEADERS([lzma.h]) | |
467 | AC_CHECK_LIB(lzma,lzma_stream_decoder) | |
b05a2733 TK |
468 | # Some pre-release (but widely distributed) versions of liblzma |
469 | # included a disabled version of lzma_stream_encoder_mt that | |
470 | # fools a naive AC_CHECK_LIB or AC_CHECK_FUNC, so we need | |
471 | # to do something more complex here: | |
472 | AC_CACHE_CHECK( | |
473 | [whether we have multithread support in lzma], | |
474 | ac_cv_lzma_has_mt, | |
7c3148ec JS |
475 | [AC_LINK_IFELSE([ |
476 | AC_LANG_PROGRAM([[#include <lzma.h>] | |
477 | [#if LZMA_VERSION < 50020000] | |
478 | [#error unsupported] | |
479 | [#endif]], | |
b05a2733 TK |
480 | [[lzma_stream_encoder_mt(0, 0);]])], |
481 | [ac_cv_lzma_has_mt=yes], [ac_cv_lzma_has_mt=no])]) | |
9690ea4f JR |
482 | if test "x$ac_cv_lzma_has_mt" != xno; then |
483 | AC_DEFINE([HAVE_LZMA_STREAM_ENCODER_MT], [1], [Define to 1 if you have the `lzma_stream_encoder_mt' function.]) | |
484 | fi | |
eb2b5ad6 MBM |
485 | |
486 | AC_CACHE_CHECK( | |
487 | [whether we have ARM64 filter support in lzma], | |
488 | ac_cv_lzma_has_arm64, | |
489 | [AC_LINK_IFELSE([ | |
490 | AC_LANG_PROGRAM([[#include <lzma.h>] | |
491 | [#ifndef LZMA_FILTER_ARM64] | |
492 | [#error unsupported] | |
493 | [#endif]])], | |
494 | [ac_cv_lzma_has_arm64=yes], [ac_cv_lzma_has_arm64=no])]) | |
495 | if test "x$ac_cv_lzma_has_arm64" != xno; then | |
496 | AC_DEFINE([HAVE_LZMA_FILTER_ARM64], [1], [Define to 1 if you have the `LZMA_FILTER_ARM64' macro.]) | |
497 | fi | |
c25e0da2 MN |
498 | fi |
499 | ||
6b29a1cc | 500 | AC_ARG_WITH([lzo2], |
6a509898 | 501 | AS_HELP_STRING([--with-lzo2], [Build with LZO support from liblzo2])) |
6b29a1cc | 502 | |
525f55c9 | 503 | if test "x$with_lzo2" = "xyes"; then |
6b29a1cc MN |
504 | AC_CHECK_HEADERS([lzo/lzoconf.h lzo/lzo1x.h]) |
505 | AC_CHECK_LIB(lzo2,lzo1x_decompress_safe) | |
506 | fi | |
507 | ||
0869c13c PM |
508 | AC_ARG_WITH([cng], |
509 | AS_HELP_STRING([--without-cng], [Don't build support of CNG(Crypto Next Generation)])) | |
510 | ||
f96a7114 MM |
511 | AC_ARG_WITH([mbedtls], |
512 | AS_HELP_STRING([--with-mbedtls], [Build with crypto support from mbed TLS])) | |
00ac9023 | 513 | AC_ARG_WITH([nettle], |
f96a7114 | 514 | AS_HELP_STRING([--with-nettle], [Build with crypto support from Nettle])) |
eace4421 | 515 | AC_ARG_WITH([openssl], |
d2c0930d | 516 | AS_HELP_STRING([--without-openssl], [Don't build support for mtree and xar hashes through openssl])) |
b0f3a5e1 TK |
517 | case "$host_os" in |
518 | *darwin* ) with_openssl=no ;; | |
519 | esac | |
d2c0930d MN |
520 | |
521 | AC_ARG_WITH([xml2], | |
522 | AS_HELP_STRING([--without-xml2], [Don't build support for xar through libxml2])) | |
523 | AC_ARG_WITH([expat], | |
524 | AS_HELP_STRING([--without-expat], [Don't build support for xar through expat])) | |
525 | ||
526 | if test "x$with_xml2" != "xno"; then | |
f7b0a9f3 KM |
527 | PKG_PROG_PKG_CONFIG |
528 | PKG_CHECK_MODULES(LIBXML2_PC, [libxml-2.0], [ | |
529 | CPPFLAGS="${CPPFLAGS} ${LIBXML2_PC_CFLAGS}" | |
530 | LIBS="${LIBS} ${LIBXML2_PC_LIBS}" | |
5256aa1a | 531 | AC_CHECK_LIB(xml2,xmlInitParser,[true],AC_MSG_FAILURE(Missing xml2 library)) |
f7b0a9f3 | 532 | ], [ |
5256aa1a | 533 | AC_CHECK_LIB(xml2,xmlInitParser) |
f7b0a9f3 | 534 | ]) |
b7115a7d | 535 | AC_CHECK_HEADERS([libxml/xmlreader.h libxml/xmlwriter.h]) |
d2c0930d MN |
536 | fi |
537 | if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then | |
538 | if test "x$with_expat" != "xno"; then | |
aa5b327f MN |
539 | AC_CHECK_HEADERS([expat.h]) |
540 | AC_CHECK_LIB(expat,XML_ParserCreate) | |
d2c0930d MN |
541 | fi |
542 | fi | |
eace4421 | 543 | |
9fe06744 AM |
544 | AC_ARG_ENABLE([posix-regex-lib], |
545 | [AS_HELP_STRING([--enable-posix-regex-lib], | |
546 | [choose what library to use for POSIX regular expression support (default: auto)]) | |
547 | AS_HELP_STRING([--enable-posix-regex-lib=libc], [use libc POSIX regular expression support]) | |
548 | AS_HELP_STRING([--enable-posix-regex-lib=libregex], [use libregex POSIX regular expression support]) | |
549 | AS_HELP_STRING([--enable-posix-regex-lib=libpcreposix], [use libpcreposix POSIX regular expression support]) | |
550 | AS_HELP_STRING([--disable-posix-regex-lib], [don't enable POSIX regular expression support])], | |
551 | [], [enable_posix_regex_lib=auto]) | |
552 | ||
553 | posix_regex_lib_found= | |
554 | if test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libc" || test "$enable_posix_regex_lib" = "libregex"; then | |
555 | AC_CHECK_HEADERS([regex.h]) | |
c9b68f41 | 556 | if test "x$ac_cv_header_regex_h" != "xno"; then |
9797fb4e AM |
557 | AC_CHECK_FUNC(regcomp) |
558 | if test "x$ac_cv_func_regcomp" = xyes; then | |
559 | posix_regex_lib_found=1 | |
560 | else | |
561 | AC_CHECK_LIB(regex,regcomp) | |
562 | if test "x$ac_cv_lib_regex_regcomp" = xyes; then | |
563 | posix_regex_lib_found=1 | |
564 | fi | |
565 | fi | |
c9b68f41 MN |
566 | fi |
567 | fi | |
9fe06744 AM |
568 | if test -z $posix_regex_lib_found && (test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libpcreposix"); then |
569 | AC_CHECK_HEADERS([pcreposix.h]) | |
9797fb4e | 570 | AC_CHECK_LIB(pcreposix,regcomp) |
d16c4871 AM |
571 | if test "x$ac_cv_lib_pcreposix_regcomp" != xyes; then |
572 | AC_MSG_NOTICE(trying libpcreposix check again with libpcre) | |
573 | unset ac_cv_lib_pcreposix_regcomp | |
574 | AC_CHECK_LIB(pcre,pcre_exec) | |
575 | AC_CHECK_LIB(pcreposix,regcomp) | |
576 | if test "x$ac_cv_lib_pcre_pcre_exec" = xyes && test "x$ac_cv_lib_pcreposix_regcomp" = xyes; then | |
577 | AC_MSG_CHECKING(if PCRE_STATIC needs to be defined) | |
578 | AC_LINK_IFELSE( | |
579 | [AC_LANG_SOURCE(#include <pcreposix.h> | |
580 | int main() { return regcomp(NULL, NULL, 0); })], | |
581 | [without_pcre_static=yes], | |
582 | [without_pcre_static=no]) | |
583 | AC_LINK_IFELSE( | |
584 | [AC_LANG_SOURCE(#define PCRE_STATIC | |
585 | #include <pcreposix.h> | |
586 | int main() { return regcomp(NULL, NULL, 0); })], | |
587 | [with_pcre_static=yes], | |
588 | [with_pcre_static=no]) | |
589 | if test "x$without_pcre_static" != xyes && test "x$with_pcre_static" = xyes; then | |
590 | AC_MSG_RESULT(yes) | |
591 | AC_DEFINE([PCRE_STATIC], [1], [Define to 1 if PCRE_STATIC needs to be defined.]) | |
592 | elif test "x$without_pcre_static" = xyes || test "x$with_pcre_static" = xyes; then | |
593 | AC_MSG_RESULT(no) | |
594 | fi | |
595 | posix_regex_lib_found=1 | |
91717f72 | 596 | fi |
d16c4871 AM |
597 | else |
598 | posix_regex_lib_found=1 | |
9797fb4e | 599 | fi |
9fe06744 | 600 | fi |
c9b68f41 | 601 | |
b3cfa26b TK |
602 | # TODO: Give the user the option of using a pre-existing system |
603 | # libarchive. This will define HAVE_LIBARCHIVE which will cause | |
604 | # bsdtar_platform.h to use #include <...> for the libarchive headers. | |
605 | # Need to include Makefile.am magic to link against system | |
606 | # -larchive in that case. | |
607 | #AC_CHECK_LIB(archive,archive_version) | |
608 | ||
9f6c6d5d EVW |
609 | # Checks for supported compiler flags |
610 | AX_APPEND_COMPILE_FLAGS([-Wall -Wformat -Wformat-security]) | |
611 | ||
fc075823 EV |
612 | # Place the functions and data into separate sections, allowing the linker |
613 | # to garbage collect the unused ones. | |
614 | save_LDFLAGS=$LDFLAGS | |
615 | LDFLAGS="$LDFLAGS -Wl,--gc-sections" | |
616 | AC_MSG_CHECKING([whether ld supports --gc-sections]) | |
617 | AC_LINK_IFELSE( | |
618 | [AC_LANG_SOURCE([static char UnusedFunc() { return 5; } int main() { return 0;}])], | |
619 | [AC_MSG_RESULT([yes]) | |
620 | GC_SECTIONS="-Wl,--gc-sections"; | |
621 | AX_APPEND_COMPILE_FLAGS([-ffunction-sections -fdata-sections])], | |
622 | [AC_MSG_RESULT([no]) | |
623 | GC_SECTIONS="";]) | |
624 | LDFLAGS=$save_LDFLAGS | |
625 | ||
626 | AC_SUBST(GC_SECTIONS) | |
627 | ||
b3cfa26b TK |
628 | # Checks for typedefs, structures, and compiler characteristics. |
629 | AC_C_CONST | |
a580c98e | 630 | # la_TYPE_UID_T defaults to "int", which is incorrect for MinGW |
92165c97 CW |
631 | # and MSVC. Use a customized version. |
632 | la_TYPE_UID_T | |
b3cfa26b TK |
633 | AC_TYPE_MODE_T |
634 | # AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on | |
635 | # most systems... default to "long long" instead. | |
636 | AC_CHECK_TYPE(off_t, [long long]) | |
637 | AC_TYPE_SIZE_T | |
638 | AC_CHECK_TYPE(id_t, [unsigned long]) | |
639 | AC_CHECK_TYPE(uintptr_t, [unsigned int]) | |
8ac32d27 | 640 | |
9d72ea76 MN |
641 | # Check for tm_gmtoff in struct tm |
642 | AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,, | |
643 | [ | |
644 | #include <time.h> | |
645 | ]) | |
646 | ||
a3b61f44 MN |
647 | # Check for f_namemax in struct statfs |
648 | AC_CHECK_MEMBERS([struct statfs.f_namemax],,, | |
649 | [ | |
650 | #include <sys/param.h> | |
651 | #include <sys/mount.h> | |
652 | ]) | |
653 | ||
b8e4320b CZ |
654 | # Check for f_iosize in struct statfs |
655 | AC_CHECK_MEMBERS([struct statfs.f_iosize],,, | |
656 | [ | |
657 | #include <sys/param.h> | |
658 | #include <sys/mount.h> | |
659 | ]) | |
660 | ||
19c22e92 BK |
661 | # Check for f_iosize in struct statvfs |
662 | AC_CHECK_MEMBERS([struct statvfs.f_iosize],,, | |
663 | [ | |
664 | #include <sys/statvfs.h> | |
665 | ]) | |
666 | ||
8ac32d27 TK |
667 | # Check for birthtime in struct stat |
668 | AC_CHECK_MEMBERS([struct stat.st_birthtime]) | |
669 | ||
b3cfa26b | 670 | # Check for high-resolution timestamps in struct stat |
8ac32d27 | 671 | AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec]) |
b3cfa26b TK |
672 | AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec]) |
673 | AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec]) | |
d831cc4b BJ |
674 | AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX |
675 | AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64 | |
a0b5f839 | 676 | AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd |
c15d8e24 TK |
677 | # Check for block size support in struct stat |
678 | AC_CHECK_MEMBERS([struct stat.st_blksize]) | |
c5e9786e TK |
679 | # Check for st_flags in struct stat (BSD fflags) |
680 | AC_CHECK_MEMBERS([struct stat.st_flags]) | |
b3cfa26b TK |
681 | |
682 | # If you have uintmax_t, we assume printf supports %ju | |
683 | # If you have unsigned long long, we assume printf supports %llu | |
684 | # TODO: Check for %ju and %llu support directly. | |
685 | AC_CHECK_TYPES([uintmax_t, unsigned long long]) | |
686 | ||
566a6636 TK |
687 | # We use C99-style integer types |
688 | # Declare them if the local platform doesn't already do so. | |
b3cfa26b | 689 | AC_TYPE_INTMAX_T |
b3cfa26b | 690 | AC_TYPE_UINTMAX_T |
566a6636 | 691 | AC_TYPE_INT64_T |
b3cfa26b | 692 | AC_TYPE_UINT64_T |
566a6636 TK |
693 | AC_TYPE_INT32_T |
694 | AC_TYPE_UINT32_T | |
695 | AC_TYPE_INT16_T | |
696 | AC_TYPE_UINT16_T | |
3de335e1 | 697 | AC_TYPE_UINT8_T |
b3cfa26b | 698 | |
2f637b08 TK |
699 | AC_CHECK_DECLS([SIZE_MAX, INT32_MAX, INT32_MIN]) |
700 | AC_CHECK_DECLS([INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX]) | |
b699d5c6 | 701 | AC_CHECK_DECLS([INTMAX_MAX, INTMAX_MIN, UINTMAX_MAX]) |
a1f91bd1 MN |
702 | |
703 | AC_CHECK_DECL([SSIZE_MAX], | |
704 | [AC_DEFINE(HAVE_DECL_SSIZE_MAX, 1, [Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you don't.])], | |
705 | [], | |
706 | [#include <limits.h>]) | |
b3cfa26b TK |
707 | |
708 | AC_CHECK_DECL([EFTYPE], | |
709 | [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])], | |
710 | [], | |
711 | [#include <errno.h>]) | |
712 | AC_CHECK_DECL([EILSEQ], | |
713 | [AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])], | |
714 | [], | |
715 | [#include <errno.h>]) | |
778a496c CW |
716 | AC_CHECK_TYPE([wchar_t], |
717 | [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]wchar_t), 1, [Define to 1 if the system has the type `wchar_t'.])dnl | |
718 | AC_CHECK_SIZEOF([wchar_t])], | |
719 | []) | |
720 | ||
9a6a8e77 | 721 | AX_COMPILE_CHECK_SIZEOF(int) |
722 | AX_COMPILE_CHECK_SIZEOF(long) | |
723 | ||
013aef12 | 724 | AC_CHECK_HEADERS_ONCE([sys/time.h]) |
b3cfa26b TK |
725 | |
726 | # Checks for library functions. | |
727 | AC_PROG_GCC_TRADITIONAL | |
728 | AC_HEADER_MAJOR | |
729 | AC_FUNC_FSEEKO | |
730 | AC_FUNC_MEMCMP | |
731 | AC_FUNC_LSTAT | |
732 | AC_FUNC_STAT | |
733 | AC_FUNC_STRERROR_R | |
734 | AC_FUNC_STRFTIME | |
735 | AC_FUNC_VPRINTF | |
197cc2d1 CW |
736 | # check for: |
737 | # CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES) | |
738 | # To avoid necessity for including windows.h or special forward declaration | |
739 | # workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *' | |
740 | AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *]) | |
d5ed4f85 | 741 | AC_CHECK_FUNCS([arc4random_buf chflags chown chroot ctime_r]) |
386412e2 | 742 | AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fnmatch fork]) |
4f1939c9 MN |
743 | AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate]) |
744 | AC_CHECK_FUNCS([futimens futimes futimesat]) | |
5397c4ed | 745 | AC_CHECK_FUNCS([geteuid getline getpid getgrgid_r getgrnam_r]) |
21467bd9 | 746 | AC_CHECK_FUNCS([getpwnam_r getpwuid_r getvfsbyname gmtime_r]) |
5e646b89 | 747 | AC_CHECK_FUNCS([lchflags lchmod lchown link linkat localtime_r lstat lutimes]) |
47a98250 | 748 | AC_CHECK_FUNCS([mbrtowc memmove memset]) |
496b1876 | 749 | AC_CHECK_FUNCS([mkdir mkfifo mknod mkstemp]) |
8c1c0a7a | 750 | AC_CHECK_FUNCS([nl_langinfo openat pipe poll posix_spawnp readlink readlinkat]) |
9769e6f7 | 751 | AC_CHECK_FUNCS([readpassphrase]) |
4ba1f7d7 | 752 | AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs]) |
c581b317 MM |
753 | AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strnlen strrchr symlink]) |
754 | AC_CHECK_FUNCS([timegm tzset unlinkat unsetenv utime utimensat utimes vfork]) | |
b6ba5603 | 755 | AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy wmemmove]) |
0348e24b RP |
756 | AC_CHECK_FUNCS([_fseeki64 _get_timezone]) |
757 | AC_CHECK_DECL([cmtime_s], | |
758 | [AC_DEFINE(HAVE_CMTIME_S, 1, [cmtime_s function])], | |
759 | [], | |
760 | [#include <time.h>]) | |
761 | AC_CHECK_DECL([gmtime_s], | |
762 | [AC_DEFINE(HAVE_GMTIME_S, 1, [gmtime_s function])], | |
763 | [], | |
764 | [#include <time.h>]) | |
765 | AC_CHECK_TYPE([localtime_s], | |
766 | [AC_DEFINE(HAVE_LOCALTIME_S, 1, [localtime_s function])], | |
767 | [], | |
768 | [#include <time.h>]) | |
769 | AC_CHECK_DECL([_mkgmtime], | |
770 | [AC_DEFINE(HAVE__MKGMTIME, 1, [_mkgmtime function])], | |
771 | [], | |
772 | [#include <time.h>]) | |
773 | ||
ed585028 CW |
774 | # detects cygwin-1.7, as opposed to older versions |
775 | AC_CHECK_FUNCS([cygwin_conv_path]) | |
b3cfa26b | 776 | |
e7642e12 JS |
777 | # DragonFly uses vfsconf, FreeBSD xvfsconf. |
778 | AC_CHECK_TYPES(struct vfsconf,,, | |
779 | [#if HAVE_SYS_TYPES_H | |
780 | #include <sys/types.h> | |
781 | #endif | |
782 | #include <sys/mount.h> | |
783 | ]) | |
784 | ||
a847b455 TK |
785 | AC_CHECK_TYPES(struct xvfsconf,,, |
786 | [#if HAVE_SYS_TYPES_H | |
787 | #include <sys/types.h> | |
788 | #endif | |
789 | #include <sys/mount.h> | |
790 | ]) | |
791 | ||
c4970dcd CZ |
792 | AC_CHECK_TYPES(struct statfs,,, |
793 | [#if HAVE_SYS_TYPES_H | |
794 | #include <sys/types.h> | |
795 | #endif | |
796 | #include <sys/mount.h> | |
797 | ]) | |
798 | ||
09654df8 TK |
799 | # There are several variants of readdir_r around; we only |
800 | # accept the POSIX-compliant version. | |
3f8f054e | 801 | AC_LINK_IFELSE( |
09654df8 TK |
802 | [AC_LANG_PROGRAM([[#include <dirent.h>]], |
803 | [[DIR *dir; struct dirent e, *r; | |
c8f97841 | 804 | return(readdir_r(dir, &e, &r));]])], |
09654df8 TK |
805 | [AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have a POSIX compatible readdir_r])] |
806 | ) | |
d5ed4f85 | 807 | # dirfd can be either a function or a macro. |
3f8f054e | 808 | AC_LINK_IFELSE( |
d5ed4f85 JS |
809 | [AC_LANG_PROGRAM([[#include <dirent.h> |
810 | DIR *dir;]], | |
811 | [[return(dirfd(dir));]])], | |
812 | [AC_DEFINE(HAVE_DIRFD,1,[Define to 1 if you have a dirfd function or macro])] | |
813 | ) | |
09654df8 | 814 | |
b3cfa26b TK |
815 | # FreeBSD's nl_langinfo supports an option to specify whether the |
816 | # current locale uses month/day or day/month ordering. It makes the | |
817 | # output a little prettier... | |
818 | AC_CHECK_DECL([D_MD_ORDER], | |
819 | [AC_DEFINE(HAVE_D_MD_ORDER, 1, [Define to 1 if nl_langinfo supports D_MD_ORDER])], | |
820 | [], | |
821 | [#if HAVE_LANGINFO_H | |
822 | #include <langinfo.h> | |
823 | #endif | |
824 | ]) | |
825 | ||
b3cfa26b TK |
826 | # Check for dirent.d_namlen field explicitly |
827 | # (This is a bit more straightforward than, if not quite as portable as, | |
828 | # the recipe given by the autoconf maintainers.) | |
829 | AC_CHECK_MEMBER(struct dirent.d_namlen,,, | |
830 | [#if HAVE_DIRENT_H | |
831 | #include <dirent.h> | |
832 | #endif | |
833 | ]) | |
834 | ||
c157e4ce AV |
835 | AC_CHECK_DECL([optreset], |
836 | [AC_DEFINE(HAVE_GETOPT_OPTRESET, 1, [Platform uses optreset to reset getopt])], | |
837 | [], | |
838 | [#include <getopt.h>]) | |
839 | ||
b3cfa26b TK |
840 | # Check for Extended Attributes support |
841 | AC_ARG_ENABLE([xattr], | |
842 | AS_HELP_STRING([--disable-xattr], | |
b30c530a | 843 | [Disable Extended Attributes support (default: check)])) |
b3cfa26b TK |
844 | |
845 | if test "x$enable_xattr" != "xno"; then | |
37740e26 | 846 | AC_SEARCH_LIBS([setxattr], [attr gnu]) |
365a91de | 847 | AC_CHECK_DECLS([EXTATTR_NAMESPACE_USER], [], [], [#include <sys/types.h> |
6d23f1c5 JS |
848 | #include <sys/extattr.h> |
849 | ]) | |
365a91de MM |
850 | AC_CHECK_DECLS([XATTR_NOFOLLOW], [], [], [#include <sys/xattr.h> |
851 | ]) | |
852 | if test "x$ac_cv_header_sys_xattr_h" = "xyes" \ | |
853 | -a "x$ac_cv_have_decl_XATTR_NOFOLLOW" = "xyes"; then | |
854 | # Darwin extended attributes support | |
855 | AC_CACHE_VAL([ac_cv_archive_xattr_darwin], | |
856 | [AC_CHECK_FUNCS(fgetxattr \ | |
857 | flistxattr \ | |
858 | fsetxattr \ | |
859 | getxattr \ | |
860 | listxattr \ | |
861 | setxattr, | |
862 | [ac_cv_archive_xattr_darwin=yes], | |
863 | [ac_cv_archive_xattr_darwin=no], | |
864 | [#include <sys/xattr.h> | |
865 | ]) | |
866 | ] | |
867 | ) | |
868 | elif test "x$ac_cv_header_sys_extattr_h" = "xyes" \ | |
869 | -a "x$ac_cv_have_decl_EXTATTR_NAMESPACE_USER" = "xyes"; then | |
870 | # FreeBSD extended attributes support | |
871 | AC_CACHE_VAL([ac_cv_archive_xattr_freebsd], | |
872 | [AC_CHECK_FUNCS(extattr_get_fd \ | |
873 | extattr_get_file \ | |
874 | extattr_get_link \ | |
875 | extattr_list_fd \ | |
876 | extattr_list_file \ | |
877 | extattr_list_link \ | |
878 | extattr_set_fd \ | |
879 | extattr_set_link, | |
880 | [ac_cv_archive_xattr_freebsd=yes], | |
881 | [ac_cv_archive_xattr_freebsd=no], | |
882 | [#include <sys/types.h> | |
883 | #include <sys/extattr.h> | |
884 | ]) | |
885 | ] | |
886 | ) | |
887 | elif test "x$ac_cv_header_sys_xattr_h" = "xyes" \ | |
888 | -o "x$ac_cv_header_attr_xattr_h" = "xyes"; then | |
889 | # Linux extended attributes support | |
890 | AC_CACHE_VAL([ac_cv_archive_xattr_linux], | |
891 | [AC_CHECK_FUNCS(fgetxattr \ | |
892 | flistxattr \ | |
893 | fsetxattr \ | |
894 | getxattr \ | |
895 | lgetxattr \ | |
896 | listxattr \ | |
897 | llistxattr \ | |
898 | lsetxattr, | |
899 | [ac_cv_archive_xattr_linux=yes], | |
900 | [ac_cv_archive_xattr_linux=no], | |
901 | [#if HAVE_SYS_TYPES_H | |
902 | #include <sys/types.h> | |
903 | #endif | |
904 | #if HAVE_SYS_XATTR_H | |
905 | #include <sys/xattr.h> | |
906 | #endif | |
907 | #if HAVE_ATTR_XATTR_H | |
908 | #include <attr/xatr.h> | |
909 | #endif | |
910 | ]) | |
911 | ] | |
912 | ) | |
913 | elif test "x$ac_cv_header_sys_ea_h" = "xyes"; then | |
914 | # AIX extended attributes support | |
915 | AC_CACHE_VAL([ac_cv_archive_xattr_aix], | |
916 | [AC_CHECK_FUNCS(fgetea \ | |
917 | flistea \ | |
918 | fsetea \ | |
919 | getea \ | |
920 | lgetea \ | |
921 | listea \ | |
922 | llistea \ | |
923 | lsetea, | |
924 | [ac_cv_archive_xattr_aix=yes], | |
925 | [ac_cv_archive_xattr_aix=no], | |
926 | [#include <sys/ea.h> | |
927 | ]) | |
928 | ] | |
929 | ) | |
930 | fi | |
931 | ||
932 | AC_MSG_CHECKING([for extended attributes support]) | |
933 | if test "x$ac_cv_archive_xattr_linux" = "xyes"; then | |
934 | AC_DEFINE([ARCHIVE_XATTR_LINUX], [1], [Linux xattr support]) | |
935 | AC_MSG_RESULT([Linux]) | |
936 | elif test "x$ac_cv_archive_xattr_darwin" = "xyes"; then | |
937 | AC_DEFINE([ARCHIVE_XATTR_DARWIN], [1], [Darwin xattr support]) | |
938 | AC_MSG_RESULT([Darwin]) | |
939 | elif test "x$ac_cv_archive_xattr_freebsd" = "xyes"; then | |
940 | AC_DEFINE([ARCHIVE_XATTR_FREEBSD], [1], [FreeBSD xattr support]) | |
941 | AC_MSG_RESULT([FreeBSD]) | |
942 | elif test "x$ac_cv_archive_xattr_aix" = "xyes"; then | |
943 | AC_DEFINE([ARCHIVE_XATTR_AIX], [1], [AIX xattr support]) | |
944 | AC_MSG_RESULT([AIX]) | |
945 | else | |
946 | AC_MSG_RESULT([none]) | |
947 | fi | |
b3cfa26b TK |
948 | fi |
949 | ||
950 | # Check for ACL support | |
951 | # | |
952 | # The ACL support in libarchive is written against the POSIX1e draft, | |
953 | # which was never officially approved and varies quite a bit across | |
954 | # platforms. Worse, some systems have completely non-POSIX acl functions, | |
955 | # which makes the following checks rather more complex than I would like. | |
956 | # | |
957 | AC_ARG_ENABLE([acl], | |
958 | AS_HELP_STRING([--disable-acl], | |
b30c530a | 959 | [Disable ACL support (default: check)])) |
b3cfa26b TK |
960 | |
961 | if test "x$enable_acl" != "xno"; then | |
f57d129d MM |
962 | # Libacl |
963 | AC_CHECK_LIB([acl], [acl_get_file]) | |
964 | ||
965 | AC_CHECK_TYPES([acl_t, acl_entry_t, acl_permset_t, acl_tag_t], [], [], [ | |
966 | #if HAVE_SYS_TYPES_H | |
967 | #include <sys/types.h> | |
968 | #endif | |
969 | #if HAVE_SYS_ACL_H | |
970 | #include <sys/acl.h> | |
971 | #endif | |
972 | ]) | |
b3cfa26b | 973 | |
bea9f9cf MM |
974 | AC_CHECK_LIB([richacl], [richacl_get_file]) |
975 | ||
976 | AC_CHECK_TYPES([[struct richace], [struct richacl]], [], [], [ | |
977 | #if HAVE_SYS_RICHACL_H | |
978 | #include <sys/richacl.h> | |
979 | #endif | |
980 | ]) | |
981 | ||
f57d129d MM |
982 | # Solaris and derivates ACLs |
983 | AC_CHECK_FUNCS(acl facl) | |
b3cfa26b | 984 | |
bea9f9cf MM |
985 | if test "x$ac_cv_lib_richacl_richacl_get_file" = "xyes" \ |
986 | -a "x$ac_cv_type_struct_richace" = "xyes" \ | |
987 | -a "x$ac_cv_type_struct_richacl" = "xyes"; then | |
988 | AC_CACHE_VAL([ac_cv_archive_acl_librichacl], | |
989 | [AC_CHECK_FUNCS(richacl_alloc \ | |
990 | richacl_equiv_mode \ | |
991 | richacl_free \ | |
992 | richacl_get_fd \ | |
993 | richacl_get_file \ | |
994 | richacl_set_fd \ | |
995 | richacl_set_file, | |
996 | [ac_cv_archive_acl_librichacl=yes], [ac_cv_archive_acl_librichacl=no], [#include <sys/richacl.h>])]) | |
997 | fi | |
998 | ||
f57d129d MM |
999 | if test "x$ac_cv_func_acl" = "xyes" \ |
1000 | -a "x$ac_cv_func_facl" = "xyes"; then | |
1001 | AC_CHECK_TYPES([aclent_t], [], [], [[#include <sys/acl.h>]]) | |
1002 | if test "x$ac_cv_type_aclent_t" = "xyes"; then | |
1003 | AC_CACHE_VAL([ac_cv_archive_acl_sunos], | |
1004 | [AC_CHECK_DECLS([GETACL, SETACL, GETACLCNT], | |
1005 | [ac_cv_archive_acl_sunos=yes], [ac_cv_archive_acl_sunos=no], | |
1006 | [#include <sys/acl.h>])]) | |
1007 | AC_CHECK_TYPES([ace_t], [], [], [[#include <sys/acl.h>]]) | |
1008 | if test "x$ac_cv_type_ace_t" = "xyes"; then | |
1009 | AC_CACHE_VAL([ac_cv_archive_acl_sunos_nfs4], | |
1010 | [AC_CHECK_DECLS([ACE_GETACL, ACE_SETACL, ACE_GETACLCNT], | |
1011 | [ac_cv_archive_acl_sunos_nfs4=yes], | |
1012 | [ac_cv_archive_acl_sonos_nfs4=no], | |
1013 | [#include <sys/acl.h>])]) | |
1014 | fi | |
1015 | fi | |
1016 | elif test "x$ac_cv_type_acl_t" = "xyes" \ | |
1017 | -a "x$ac_cv_type_acl_entry_t" = "xyes" \ | |
1018 | -a "x$ac_cv_type_acl_permset_t" = "xyes" \ | |
1019 | -a "x$ac_cv_type_acl_tag_t" = "xyes"; then | |
1020 | # POSIX.1e ACL functions | |
1021 | AC_CACHE_VAL([ac_cv_posix_acl_funcs], | |
1022 | [AC_CHECK_FUNCS(acl_add_perm \ | |
1023 | acl_clear_perms \ | |
1024 | acl_create_entry \ | |
1025 | acl_delete_def_file \ | |
1026 | acl_free \ | |
1027 | acl_get_entry \ | |
1028 | acl_get_fd \ | |
1029 | acl_get_file \ | |
1030 | acl_get_permset \ | |
1031 | acl_get_qualifier \ | |
1032 | acl_get_tag_type \ | |
1033 | acl_init \ | |
1034 | acl_set_fd \ | |
1035 | acl_set_file \ | |
1036 | acl_set_qualifier \ | |
1037 | acl_set_tag_type, | |
1038 | [ac_cv_posix_acl_funcs=yes], [ac_cv_posix_acl_funcs=no], | |
1039 | [#if HAVE_SYS_TYPES_H | |
1040 | #include <sys/types.h> | |
1041 | #endif | |
1042 | #if HAVE_SYS_ACL_H | |
1043 | #include <sys/acl.h> | |
1044 | #endif | |
1045 | ]) | |
992652f4 MM |
1046 | ]) |
1047 | ||
f57d129d | 1048 | AC_CHECK_FUNCS(acl_get_perm) |
9f43a7d6 | 1049 | |
f57d129d MM |
1050 | if test "x$ac_cv_posix_acl_funcs" = "xyes" \ |
1051 | -a "x$ac_cv_header_acl_libacl_h" = "xyes" \ | |
1052 | -a "x$ac_cv_lib_acl_acl_get_file" = "xyes" \ | |
1053 | -a "x$ac_cv_func_acl_get_perm"; then | |
1054 | AC_CACHE_VAL([ac_cv_archive_acl_libacl], | |
1055 | [ac_cv_archive_acl_libacl=yes]) | |
1056 | AC_DEFINE([ARCHIVE_ACL_LIBACL], [1], | |
1057 | [POSIX.1e ACL support via libacl]) | |
1058 | else | |
1059 | # FreeBSD/Darwin | |
1060 | AC_CHECK_FUNCS(acl_add_flag_np \ | |
1061 | acl_clear_flags_np \ | |
1062 | acl_get_brand_np \ | |
1063 | acl_get_entry_type_np \ | |
1064 | acl_get_flag_np \ | |
1065 | acl_get_flagset_np \ | |
1066 | acl_get_fd_np \ | |
1067 | acl_get_link_np \ | |
1068 | acl_get_perm_np \ | |
1069 | acl_is_trivial_np \ | |
1070 | acl_set_entry_type_np \ | |
1071 | acl_set_fd_np \ | |
1072 | acl_set_link_np,,, | |
1073 | [#include <sys/types.h> | |
1074 | #include <sys/acl.h>]) | |
1075 | ||
1076 | AC_CHECK_FUNCS(mbr_uid_to_uuid \ | |
1077 | mbr_uuid_to_id \ | |
1078 | mbr_gid_to_uuid,,, | |
1079 | [#include <membership.h>]) | |
1080 | ||
1081 | AC_CHECK_DECLS([ACL_TYPE_EXTENDED, ACL_TYPE_NFS4, ACL_USER, | |
1082 | ACL_SYNCHRONIZE], [], [], | |
1083 | [#include <sys/types.h> | |
1084 | #include <sys/acl.h>]) | |
1085 | if test "x$ac_cv_posix_acl_funcs" = "xyes" \ | |
1086 | -a "x$ac_cv_func_acl_get_fd_np" = "xyes" \ | |
1087 | -a "x$ac_cv_func_acl_get_perm" != "xyes" \ | |
1088 | -a "x$ac_cv_func_acl_get_perm_np" = "xyes" \ | |
1089 | -a "x$ac_cv_func_acl_set_fd_np" = "xyes"; then | |
1090 | if test "x$ac_cv_have_decl_ACL_USER" = "xyes"; then | |
1091 | AC_CACHE_VAL([ac_cv_archive_acl_freebsd], | |
1092 | [ac_cv_archive_acl_freebsd=yes]) | |
1093 | if test "x$ac_cv_have_decl_ACL_TYPE_NFS4" = "xyes" \ | |
1094 | -a "x$ac_cv_func_acl_add_flag_np" = "xyes" \ | |
1095 | -a "x$ac_cv_func_acl_get_brand_np" = "xyes" \ | |
1096 | -a "x$ac_cv_func_acl_get_entry_type_np" = "xyes" \ | |
1097 | -a "x$ac_cv_func_acl_get_flagset_np" = "xyes" \ | |
1098 | -a "x$ac_cv_func_acl_set_entry_type_np" = "xyes"; then | |
1099 | AC_CACHE_VAL([ac_cv_archive_acl_freebsd_nfs4], | |
1100 | [ac_cv_archive_acl_freebsd_nfs4=yes]) | |
1101 | fi | |
1102 | elif test "x$ac_cv_have_decl_ACL_TYPE_EXTENDED" = "xyes" \ | |
1103 | -a "x$ac_cv_func_acl_add_flag_np" = "xyes" \ | |
1104 | -a "x$ac_cv_func_acl_get_flagset_np" = "xyes" \ | |
1105 | -a "x$ac_cv_func_acl_get_link_np" = "xyes" \ | |
1106 | -a "x$ac_cv_func_acl_set_link_np" = "xyes" \ | |
1107 | -a "x$ac_cv_func_mbr_uid_to_uuid" = "xyes" \ | |
1108 | -a "x$ac_cv_func_mbr_uuid_to_id" = "xyes" \ | |
1109 | -a "x$ac_cv_func_mbr_gid_to_uuid" = "xyes"; then | |
1110 | AC_CACHE_VAL([ac_cv_archive_acl_darwin], | |
1111 | [ac_cv_archive_acl_darwin=yes]) | |
1112 | fi | |
1113 | fi | |
1114 | fi | |
1115 | fi | |
1116 | AC_MSG_CHECKING([for ACL support]) | |
bea9f9cf MM |
1117 | if test "x$ac_cv_archive_acl_libacl" = "xyes" \ |
1118 | -a "x$ac_cv_archive_acl_librichacl" = "xyes"; then | |
1119 | AC_MSG_RESULT([libacl (POSIX.1e) + librichacl (NFSv4)]) | |
1120 | AC_DEFINE([ARCHIVE_ACL_LIBACL], [1], | |
1121 | [Linux POSIX.1e ACL support via libacl]) | |
1122 | AC_DEFINE([ARCHIVE_ACL_LIBRICHACL], [1], | |
1123 | [Linux NFSv4 ACL support via librichacl]) | |
1124 | elif test "x$ac_cv_archive_acl_libacl" = "xyes"; then | |
f57d129d | 1125 | AC_MSG_RESULT([libacl (POSIX.1e)]) |
bea9f9cf MM |
1126 | AC_DEFINE([ARCHIVE_ACL_LIBACL], [1], |
1127 | [Linux POSIX.1e ACL support via libacl]) | |
1128 | elif test "x$ac_cv_archive_acl_librichacl" = "xyes"; then | |
1129 | AC_MSG_RESULT([librichacl (NFSv4)]) | |
1130 | AC_DEFINE([ARCHIVE_ACL_LIBRICHACL], [1], | |
1131 | [Linux NFSv4 ACL support via librichacl]) | |
f57d129d MM |
1132 | elif test "x$ac_cv_archive_acl_darwin" = "xyes"; then |
1133 | AC_DEFINE([ARCHIVE_ACL_DARWIN], [1], [Darwin ACL support]) | |
1134 | AC_MSG_RESULT([Darwin (limited NFSv4)]) | |
1135 | elif test "x$ac_cv_archive_acl_sunos" = "xyes"; then | |
1136 | AC_DEFINE([ARCHIVE_ACL_SUNOS], [1], [Solaris ACL support]) | |
1137 | if test "x$ac_cv_archive_acl_sunos_nfs4" = "xyes"; then | |
1138 | AC_DEFINE([ARCHIVE_ACL_SUNOS_NFS4], [1], | |
1139 | [Solaris NFSv4 ACL support]) | |
1140 | AC_MSG_RESULT([Solaris (POSIX.1e and NFSv4)]) | |
1141 | else | |
1142 | AC_MSG_RESULT([Solaris (POSIX.1e)]) | |
1143 | fi | |
1144 | elif test "x$ac_cv_archive_acl_freebsd" = "xyes"; then | |
1145 | AC_DEFINE([ARCHIVE_ACL_FREEBSD], [1], [FreeBSD ACL support]) | |
1146 | if test "x$ac_cv_archive_acl_freebsd_nfs4" = "xyes"; then | |
1147 | AC_DEFINE([ARCHIVE_ACL_FREEBSD_NFS4], [1], | |
1148 | [FreeBSD NFSv4 ACL support]) | |
1149 | AC_MSG_RESULT([FreeBSD (POSIX.1e and NFSv4)]) | |
1150 | else | |
1151 | AC_MSG_RESULT([FreeBSD (POSIX.1e)]) | |
1152 | fi | |
1153 | else | |
1154 | AC_MSG_RESULT([none]) | |
1155 | fi | |
b3cfa26b TK |
1156 | fi |
1157 | ||
f57d129d | 1158 | |
bea9f9cf MM |
1159 | AM_CONDITIONAL([INC_LINUX_ACL], |
1160 | [test "x$ac_cv_archive_acl_libacl" = "xyes" \ | |
1161 | -o "x$ac_cv_archive_acl_librichacl" = "xyes"]) | |
f57d129d MM |
1162 | AM_CONDITIONAL([INC_SUNOS_ACL], [test "x$ac_cv_archive_acl_sunos" = "xyes"]) |
1163 | AM_CONDITIONAL([INC_DARWIN_ACL], | |
1164 | [test "x$ac_cv_archive_acl_darwin" = "xyes"]) | |
1165 | AM_CONDITIONAL([INC_FREEBSD_ACL], | |
1166 | [test "x$ac_cv_archive_acl_freebsd" = "xyes"]) | |
1167 | ||
b3cfa26b TK |
1168 | # Additional requirements |
1169 | AC_SYS_LARGEFILE | |
1170 | ||
2d53ab9e AM |
1171 | dnl NOTE: Crypto checks must run last. |
1172 | AC_DEFUN([CRYPTO_CHECK], [ | |
1173 | if test "$found_$1" != yes; then | |
2d53ab9e | 1174 | saved_CPPFLAGS="$CPPFLAGS" |
38644a9a | 1175 | CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" |
2d53ab9e AM |
1176 | touch "check_crypto_md.h" |
1177 | AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_$2]) | |
1178 | AC_LINK_IFELSE([AC_LANG_SOURCE([ | |
1179 | #define ARCHIVE_$1_COMPILE_TEST | |
1180 | #define ARCHIVE_CRYPTO_$1_$2 | |
1181 | #define PLATFORM_CONFIG_H "check_crypto_md.h" | |
1182 | ||
c4c6533b | 1183 | $(cat "$srcdir/libarchive/archive_digest.c") |
2d53ab9e AM |
1184 | |
1185 | int | |
1186 | main(int argc, char **argv) | |
1187 | { | |
1188 | archive_$3_ctx ctx; | |
1189 | archive_$3_init(&ctx); | |
1190 | archive_$3_update(&ctx, *argv, argc); | |
1191 | archive_$3_final(&ctx, NULL); | |
1192 | return 0; | |
1193 | } | |
1194 | ])], | |
1195 | [ AC_MSG_RESULT([yes]) | |
1196 | found_$1=yes | |
177cf35b | 1197 | found_$2=yes |
2d53ab9e AM |
1198 | AC_DEFINE(ARCHIVE_CRYPTO_$1_$2, 1, [ $1 via ARCHIVE_CRYPTO_$1_$2 supported.]) |
1199 | ], | |
1200 | [ AC_MSG_RESULT([no])]) | |
2d53ab9e AM |
1201 | CPPFLAGS="$saved_CPPFLAGS" |
1202 | rm "check_crypto_md.h" | |
1203 | fi | |
1204 | ]) | |
1205 | ||
275000df MN |
1206 | AC_DEFUN([CRYPTO_CHECK_WIN], [ |
1207 | if test "$found_$1" != yes; then | |
1208 | AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_WIN]) | |
1209 | AC_LINK_IFELSE([AC_LANG_SOURCE([ | |
275000df MN |
1210 | #define ARCHIVE_$1_COMPILE_TEST |
1211 | #include <windows.h> | |
1212 | #include <wincrypt.h> | |
1213 | ||
1214 | int | |
1215 | main(int argc, char **argv) | |
1216 | { | |
1217 | (void)argc; | |
1218 | (void)argv; | |
1219 | ||
1220 | return ($2); | |
1221 | } | |
1222 | ])], | |
1223 | [ AC_MSG_RESULT([yes]) | |
1224 | found_$1=yes | |
177cf35b | 1225 | found_WIN=yes |
275000df MN |
1226 | AC_DEFINE(ARCHIVE_CRYPTO_$1_WIN, 1, [ $1 via ARCHIVE_CRYPTO_$1_WIN supported.]) |
1227 | ], | |
1228 | [ AC_MSG_RESULT([no])]) | |
1229 | fi | |
1230 | ]) | |
1231 | ||
1232 | case "$host_os" in | |
1e2b6c98 | 1233 | *mingw* | *cygwin* | *msys*) |
275000df MN |
1234 | ;; |
1235 | *) | |
1236 | CRYPTO_CHECK(MD5, LIBC, md5) | |
1237 | CRYPTO_CHECK(MD5, LIBSYSTEM, md5) | |
1238 | CRYPTO_CHECK(RMD160, LIBC, rmd160) | |
1239 | CRYPTO_CHECK(SHA1, LIBC, sha1) | |
1240 | CRYPTO_CHECK(SHA1, LIBSYSTEM, sha1) | |
1241 | CRYPTO_CHECK(SHA256, LIBC, sha256) | |
1242 | CRYPTO_CHECK(SHA256, LIBC2, sha256) | |
1243 | CRYPTO_CHECK(SHA256, LIBC3, sha256) | |
1244 | CRYPTO_CHECK(SHA256, LIBSYSTEM, sha256) | |
1245 | CRYPTO_CHECK(SHA384, LIBC, sha384) | |
1246 | CRYPTO_CHECK(SHA384, LIBC2, sha384) | |
1247 | CRYPTO_CHECK(SHA384, LIBC3, sha384) | |
1248 | CRYPTO_CHECK(SHA384, LIBSYSTEM, sha384) | |
1249 | CRYPTO_CHECK(SHA512, LIBC, sha512) | |
1250 | CRYPTO_CHECK(SHA512, LIBC2, sha512) | |
1251 | CRYPTO_CHECK(SHA512, LIBC3, sha512) | |
1252 | CRYPTO_CHECK(SHA512, LIBSYSTEM, sha512) | |
1253 | ;; | |
1254 | esac | |
2d53ab9e | 1255 | |
0869c13c PM |
1256 | if test "x$with_cng" != "xno"; then |
1257 | AC_CHECK_HEADERS([bcrypt.h],[ | |
1258 | LIBS="$LIBS -lbcrypt" | |
1259 | ],[], | |
1260 | [[#ifdef HAVE_WINDOWS_H | |
1261 | # include <windows.h> | |
1262 | #endif | |
1263 | ]]) | |
1264 | fi | |
1265 | ||
f96a7114 MM |
1266 | if test "x$with_mbedtls" = "xyes"; then |
1267 | AC_CHECK_HEADERS([mbedtls/aes.h mbedtls/md.h mbedtls/pkcs5.h]) | |
1268 | saved_LIBS=$LIBS | |
1269 | AC_CHECK_LIB(mbedcrypto,mbedtls_sha1_init) | |
1270 | CRYPTO_CHECK(MD5, MBEDTLS, md5) | |
1271 | CRYPTO_CHECK(RMD160, MBEDTLS, rmd160) | |
1272 | CRYPTO_CHECK(SHA1, MBEDTLS, sha1) | |
1273 | CRYPTO_CHECK(SHA256, MBEDTLS, sha256) | |
1274 | CRYPTO_CHECK(SHA384, MBEDTLS, sha384) | |
1275 | CRYPTO_CHECK(SHA512, MBEDTLS, sha512) | |
1276 | if test "x$found_MBEDTLS" != "xyes"; then | |
1277 | LIBS=$saved_LIBS | |
1278 | fi | |
1279 | fi | |
1280 | ||
1281 | if test "x$with_nettle" = "xyes"; then | |
177cf35b | 1282 | AC_CHECK_HEADERS([nettle/md5.h nettle/ripemd160.h nettle/sha.h]) |
48e40df7 | 1283 | AC_CHECK_HEADERS([nettle/pbkdf2.h nettle/aes.h nettle/hmac.h]) |
177cf35b | 1284 | saved_LIBS=$LIBS |
48e40df7 | 1285 | AC_CHECK_LIB(nettle,nettle_sha1_init) |
177cf35b AM |
1286 | CRYPTO_CHECK(MD5, NETTLE, md5) |
1287 | CRYPTO_CHECK(RMD160, NETTLE, rmd160) | |
1288 | CRYPTO_CHECK(SHA1, NETTLE, sha1) | |
1289 | CRYPTO_CHECK(SHA256, NETTLE, sha256) | |
1290 | CRYPTO_CHECK(SHA384, NETTLE, sha384) | |
1291 | CRYPTO_CHECK(SHA512, NETTLE, sha512) | |
1292 | if test "x$found_NETTLE" != "xyes"; then | |
1293 | LIBS=$saved_LIBS | |
1294 | fi | |
00ac9023 | 1295 | fi |
48e40df7 | 1296 | |
2d53ab9e | 1297 | if test "x$with_openssl" != "xno"; then |
177cf35b AM |
1298 | AC_CHECK_HEADERS([openssl/evp.h]) |
1299 | saved_LIBS=$LIBS | |
1f3c62eb | 1300 | LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }libcrypto" |
9210f025 | 1301 | AC_CHECK_LIB(crypto,OPENSSL_config) |
fdd5acfe AM |
1302 | CRYPTO_CHECK(MD5, OPENSSL, md5) |
1303 | CRYPTO_CHECK(RMD160, OPENSSL, rmd160) | |
1304 | CRYPTO_CHECK(SHA1, OPENSSL, sha1) | |
1305 | CRYPTO_CHECK(SHA256, OPENSSL, sha256) | |
1306 | CRYPTO_CHECK(SHA384, OPENSSL, sha384) | |
1307 | CRYPTO_CHECK(SHA512, OPENSSL, sha512) | |
b2b69d4f | 1308 | AC_CHECK_FUNCS([PKCS5_PBKDF2_HMAC_SHA1]) |
2d53ab9e | 1309 | fi |
f8709112 | 1310 | |
a83f3d32 BN |
1311 | AC_SUBST(LIBSREQUIRED) |
1312 | ||
f8709112 TK |
1313 | # Probe libmd AFTER OpenSSL/libcrypto. |
1314 | # The two are incompatible and OpenSSL is more complete. | |
177cf35b AM |
1315 | AC_CHECK_HEADERS([md5.h ripemd.h sha.h sha256.h sha512.h]) |
1316 | saved_LIBS=$LIBS | |
48e40df7 | 1317 | AC_CHECK_LIB(md,MD5Init) |
fdd5acfe AM |
1318 | CRYPTO_CHECK(MD5, LIBMD, md5) |
1319 | CRYPTO_CHECK(RMD160, LIBMD, rmd160) | |
1320 | CRYPTO_CHECK(SHA1, LIBMD, sha1) | |
1321 | CRYPTO_CHECK(SHA256, LIBMD, sha256) | |
1322 | CRYPTO_CHECK(SHA512, LIBMD, sha512) | |
177cf35b AM |
1323 | if test "x$found_LIBMD" != "xyes"; then |
1324 | LIBS=$saved_LIBS | |
1325 | fi | |
2d53ab9e | 1326 | |
c078ff5d | 1327 | case "$host_os" in |
1e2b6c98 | 1328 | *mingw* | *cygwin* | *msys*) |
c078ff5d AM |
1329 | CRYPTO_CHECK_WIN(MD5, CALG_MD5) |
1330 | CRYPTO_CHECK_WIN(SHA1, CALG_SHA1) | |
1331 | CRYPTO_CHECK_WIN(SHA256, CALG_SHA_256) | |
1332 | CRYPTO_CHECK_WIN(SHA384, CALG_SHA_384) | |
1333 | CRYPTO_CHECK_WIN(SHA512, CALG_SHA_512) | |
1334 | ;; | |
1335 | esac | |
1336 | ||
5235554e YG |
1337 | dnl Visibility annotations... |
1338 | saved_CFLAGS="$CFLAGS" | |
1339 | CFLAGS="$CFLAGS -fvisibility=hidden -Werror" | |
1340 | AC_MSG_CHECKING(whether compiler supports visibility annotations) | |
1341 | AC_LINK_IFELSE([AC_LANG_PROGRAM([ | |
1342 | int foo( void ) __attribute__((visibility("default"))); | |
1343 | ])], | |
1344 | [CFLAGS="$saved_CFLAGS -fvisibility=hidden -D__LIBARCHIVE_ENABLE_VISIBILITY"; | |
1345 | AC_MSG_RESULT(yes)], | |
1346 | [CFLAGS="$saved_CFLAGS" | |
1347 | AC_MSG_RESULT(no)]) | |
1348 | ||
af77429c PB |
1349 | # Ensure test directories are present if building out-of-tree |
1350 | AC_CONFIG_COMMANDS([mkdirs], | |
41a759a7 | 1351 | [mkdir -p libarchive/test tar/test cat/test cpio/test]) |
af77429c | 1352 | |
b3cfa26b | 1353 | AC_OUTPUT |