1 dnl Process this file with autoconf to produce a configure script.
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
6 dnl These first two version numbers are updated automatically on each release.
7 m4_define([LIBARCHIVE_VERSION_S],[3.6.3dev])
8 m4_define([LIBARCHIVE_VERSION_N],[3006003])
10 dnl bsdtar and bsdcpio versioning tracks libarchive
11 m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S())
12 m4_define([BSDCPIO_VERSION_S],LIBARCHIVE_VERSION_S())
13 m4_define([BSDCAT_VERSION_S],LIBARCHIVE_VERSION_S())
18 # Now starts the "real" configure script.
21 AC_INIT([libarchive],[LIBARCHIVE_VERSION_S()],[libarchive-discuss@googlegroups.com])
22 # Make sure the srcdir contains "libarchive" directory
23 AC_CONFIG_SRCDIR([libarchive])
24 # Use auxiliary subscripts from this subdirectory (cleans up root)
25 AC_CONFIG_AUX_DIR([build/autoconf])
27 AC_CONFIG_MACRO_DIR([build/autoconf])
28 # Must follow AC_CONFIG macros above...
29 AM_INIT_AUTOMAKE([1.11 dist-xz dist-zip])
30 AM_MAINTAINER_MODE([enable])
31 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
33 # Libtool's "interface version" can be computed from the libarchive version.
35 # Libtool interface version bumps on any API change, so increments
36 # whenever libarchive minor version does.
37 ARCHIVE_MINOR=$(( (LIBARCHIVE_VERSION_N() / 1000) % 1000 ))
38 # Libarchive 2.7 == libtool interface 9 = 2 + 7
39 # Libarchive 2.8 == libtool interface 10 = 2 + 8
40 # Libarchive 2.9 == libtool interface 11 = 2 + 8
41 # Libarchive 3.0 == libtool interface 12
42 # Libarchive 3.1 == libtool interface 13
43 ARCHIVE_INTERFACE=`echo $((13 + ${ARCHIVE_MINOR}))`
44 # Libarchive revision is bumped on any source change === libtool revision
45 ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 ))
46 # Libarchive minor is bumped on any interface addition === libtool age
47 ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR
49 # Stick the version numbers into config.h
50 AC_DEFINE([__LIBARCHIVE_CONFIG_H_INCLUDED], [1],
51 [Internal macro for sanity checks])
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])
60 AC_DEFINE([BSDCAT_VERSION_STRING],"BSDTAR_VERSION_S()",
61 [Version number of bsdcat])
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()
68 BSDCAT_VERSION_STRING=BSDCAT_VERSION_S()
69 LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S()
70 LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N()
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)
78 AC_SUBST(BSDCAT_VERSION_STRING)
79 AC_SUBST(LIBARCHIVE_VERSION_STRING)
80 AC_SUBST(LIBARCHIVE_VERSION_NUMBER)
82 AC_CONFIG_HEADERS([config.h])
83 AC_CONFIG_FILES([Makefile])
84 AC_CONFIG_FILES([build/pkgconfig/libarchive.pc])
89 dnl Compilation on mingw and Cygwin needs special Makefile rules
93 *mingw* ) inc_windows_files=yes ;;
94 *cygwin* | *msys*) inc_cygwin_files=yes ;;
96 AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes])
97 AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes])
99 dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc)
102 *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO -D__MINGW_USE_VC2005_COMPAT ;;
104 AC_SUBST(PLATFORMCPPFLAGS)
106 # Checks for programs.
110 AC_USE_SYSTEM_EXTENSIONS
113 AC_CHECK_TOOL([STRIP],[strip])
117 # Options for building bsdtar.
119 # Default is to build bsdtar, but allow people to override that.
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])
128 case "$enable_bsdtar" in
130 if test "$enable_static" = "no"; then
138 if test "$enable_shared" = "no"; then
139 AC_MSG_FAILURE([Shared linking of bsdtar requires shared libarchive])
153 AC_MSG_FAILURE([Unsupported value for --enable-bsdtar])
157 AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ])
158 AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ])
161 # Options for building bsdcat.
163 # Default is to build bsdcat, but allow people to override that.
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])
172 case "$enable_bsdcat" in
174 if test "$enable_static" = "no"; then
182 if test "$enable_shared" = "no"; then
183 AC_MSG_FAILURE([Shared linking of bsdcat requires shared libarchive])
197 AC_MSG_FAILURE([Unsupported value for --enable-bsdcat])
201 AM_CONDITIONAL([BUILD_BSDCAT], [ test "$build_bsdcat" = yes ])
202 AM_CONDITIONAL([STATIC_BSDCAT], [ test "$static_bsdcat" = yes ])
205 # Options for building bsdcpio.
207 # Default is not to build bsdcpio, but that can be overridden.
209 AC_ARG_ENABLE([bsdcpio],
210 [AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio (default)])
211 AS_HELP_STRING([--enable-bsdcpio=static], [static build of bsdcpio])
212 AS_HELP_STRING([--enable-bsdcpio=shared], [dynamic build of bsdcpio])
213 AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio])],
214 [], [enable_bsdcpio=yes])
216 case "$enable_bsdcpio" in
218 if test "$enable_static" = "no"; then
226 if test "$enabled_shared" = "no"; then
227 AC_MSG_FAILURE([Shared linking of bsdcpio requires shared libarchive])
240 AC_MSG_FAILURE([Unsupported value for --enable-bsdcpio])
244 AM_CONDITIONAL([BUILD_BSDCPIO], [ test "$build_bsdcpio" = yes ])
245 AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ])
247 # Set up defines needed before including any headers
249 *mingw* | *cygwin* | *msys* )
250 AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
251 [[#ifdef _WIN32_WINNT
252 # error _WIN32_WINNT already defined
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.])
259 AC_PREPROC_IFELSE([AC_LANG_PROGRAM(
261 # error WINVER already defined
265 AC_DEFINE([WINVER], 0x0502, [Define to '0x0502' for Windows Server 2003 APIs.])
270 # Checks for header files.
273 AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h])
274 AC_CHECK_HEADERS([copyfile.h ctype.h])
275 AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h grp.h])
277 AC_CACHE_CHECK([whether EXT2_IOC_GETFLAGS is usable],
278 [ac_cv_have_decl_EXT2_IOC_GETFLAGS],
279 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <sys/ioctl.h>
280 @%:@include <ext2fs/ext2_fs.h>],
281 [int x = EXT2_IOC_GETFLAGS])],
282 [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes])],
283 [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [no])])])
285 AS_VAR_IF([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes],
286 [AC_DEFINE_UNQUOTED([HAVE_WORKING_EXT2_IOC_GETFLAGS], [1],
287 [Define to 1 if you have a working EXT2_IOC_GETFLAGS])])
289 AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h])
290 AC_CHECK_HEADERS([linux/fiemap.h linux/fs.h linux/magic.h linux/types.h])
292 AC_CACHE_CHECK([whether FS_IOC_GETFLAGS is usable],
293 [ac_cv_have_decl_FS_IOC_GETFLAGS],
294 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <sys/ioctl.h>
295 @%:@include <linux/fs.h>],
296 [int x = FS_IOC_GETFLAGS])],
297 [AS_VAR_SET([ac_cv_have_decl_FS_IOC_GETFLAGS], [yes])],
298 [AS_VAR_SET([ac_cv_have_decl_FS_IOC_GETFLAGS], [no])])])
300 AS_VAR_IF([ac_cv_have_decl_FS_IOC_GETFLAGS], [yes],
301 [AC_DEFINE_UNQUOTED([HAVE_WORKING_FS_IOC_GETFLAGS], [1],
302 [Define to 1 if you have a working FS_IOC_GETFLAGS])])
304 AC_CHECK_HEADERS([locale.h membership.h paths.h poll.h pthread.h pwd.h])
305 AC_CHECK_HEADERS([readpassphrase.h signal.h spawn.h])
306 AC_CHECK_HEADERS([stdarg.h stdint.h stdlib.h string.h])
307 AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/ea.h sys/extattr.h])
308 AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h])
309 AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/richacl.h])
310 AC_CHECK_HEADERS([sys/select.h sys/statfs.h sys/statvfs.h sys/sysmacros.h])
311 AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h sys/xattr.h])
312 AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h])
313 AC_CHECK_HEADERS([windows.h])
314 # check windows.h first; the other headers require it.
315 AC_CHECK_HEADERS([wincrypt.h winioctl.h],[],[],
316 [[#ifdef HAVE_WINDOWS_H
317 # include <windows.h>
321 # Checks for libraries.
323 AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib]))
325 if test "x$with_zlib" != "xno"; then
326 AC_CHECK_HEADERS([zlib.h])
327 AC_CHECK_LIB(z,inflate)
330 AC_ARG_WITH([bz2lib],
331 AS_HELP_STRING([--without-bz2lib], [Don't build support for bzip2 through bz2lib]))
333 if test "x$with_bz2lib" != "xno"; then
334 AC_CHECK_HEADERS([bzlib.h])
336 *mingw* | *cygwin* | *msys*)
337 dnl AC_CHECK_LIB cannot be used on the Windows port of libbz2, therefore
338 dnl use AC_LINK_IFELSE.
339 AC_MSG_CHECKING([for BZ2_bzDecompressInit in -lbz2])
343 [AC_LANG_SOURCE(#include <bzlib.h>
344 int main() { return BZ2_bzDecompressInit(NULL, 0, 0); })],
345 [ac_cv_lib_bz2_BZ2_bzDecompressInit=yes],
346 [ac_cv_lib_bz2_BZ2_bzDecompressInit=no])
348 AC_MSG_RESULT($ac_cv_lib_bz2_BZ2_bzDecompressInit)
349 if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then
350 AC_DEFINE([HAVE_LIBBZ2], [1], [Define to 1 if you have the `bz2' library (-lbz2).])
355 AC_CHECK_LIB(bz2,BZ2_bzDecompressInit)
361 AS_HELP_STRING([--without-libb2], [Don't build support for BLAKE2 through libb2]))
363 if test "x$with_libb2" != "xno"; then
364 AC_CHECK_HEADERS([blake2.h])
365 AC_CHECK_LIB(b2,blake2sp_init)
368 AM_CONDITIONAL([INC_BLAKE2], [test "x$ac_cv_lib_b2_blake2sp_init" != "xyes"])
371 AS_HELP_STRING([--without-iconv], [Don't try to link against iconv]))
373 if test "x$with_iconv" != "xno"; then
375 AC_CHECK_HEADERS([iconv.h],[],[],[#include <stdlib.h>])
376 if test "x$am_cv_func_iconv" = "xyes"; then
377 AC_CHECK_HEADERS([localcharset.h])
379 LIBS="${LIBS} ${LIBICONV}"
380 if test -n "$LIBICONV"; then
381 LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }iconv"
383 AC_CHECK_FUNCS([locale_charset])
384 LIBS="${am_save_LIBS}"
385 if test "x$ac_cv_func_locale_charset" != "xyes"; then
386 # If locale_charset() is not in libiconv, we have to find libcharset.
387 AC_CHECK_LIB(charset,locale_charset)
393 AS_HELP_STRING([--without-lz4], [Don't build support for lz4 through liblz4]))
395 if test "x$with_lz4" != "xno"; then
396 AC_CHECK_HEADERS([lz4.h lz4hc.h])
397 AC_CHECK_LIB(lz4,LZ4_decompress_safe)
401 AS_HELP_STRING([--without-zstd], [Don't build support for zstd through libzstd]))
403 if test "x$with_zstd" != "xno"; then
404 AC_CHECK_HEADERS([zstd.h])
405 AC_CHECK_LIB(zstd,ZSTD_decompressStream)
406 AC_CHECK_LIB(zstd,ZSTD_compressStream,
407 AC_DEFINE([HAVE_LIBZSTD_COMPRESSOR], [1], [Define to 1 if you have the `zstd' library (-lzstd) with compression support.]))
411 AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma]))
413 if test "x$with_lzma" != "xno"; then
414 AC_CHECK_HEADERS([lzma.h])
415 AC_CHECK_LIB(lzma,lzma_stream_decoder)
416 # Some pre-release (but widely distributed) versions of liblzma
417 # included a disabled version of lzma_stream_encoder_mt that
418 # fools a naive AC_CHECK_LIB or AC_CHECK_FUNC, so we need
419 # to do something more complex here:
421 [whether we have multithread support in lzma],
424 AC_LANG_PROGRAM([[#include <lzma.h>]
425 [#if LZMA_VERSION < 50020000]
428 [[lzma_stream_encoder_mt(0, 0);]])],
429 [ac_cv_lzma_has_mt=yes], [ac_cv_lzma_has_mt=no])])
430 if test "x$ac_cv_lzma_has_mt" != xno; then
431 AC_DEFINE([HAVE_LZMA_STREAM_ENCODER_MT], [1], [Define to 1 if you have the `lzma_stream_encoder_mt' function.])
436 AS_HELP_STRING([--with-lzo2], [Build with LZO support from liblzo2]))
438 if test "x$with_lzo2" = "xyes"; then
439 AC_CHECK_HEADERS([lzo/lzoconf.h lzo/lzo1x.h])
440 AC_CHECK_LIB(lzo2,lzo1x_decompress_safe)
444 AS_HELP_STRING([--without-cng], [Don't build support of CNG(Crypto Next Generation)]))
446 AC_ARG_WITH([mbedtls],
447 AS_HELP_STRING([--with-mbedtls], [Build with crypto support from mbed TLS]))
448 AC_ARG_WITH([nettle],
449 AS_HELP_STRING([--with-nettle], [Build with crypto support from Nettle]))
450 AC_ARG_WITH([openssl],
451 AS_HELP_STRING([--without-openssl], [Don't build support for mtree and xar hashes through openssl]))
453 *darwin* ) with_openssl=no ;;
457 AS_HELP_STRING([--without-xml2], [Don't build support for xar through libxml2]))
459 AS_HELP_STRING([--without-expat], [Don't build support for xar through expat]))
461 if test "x$with_xml2" != "xno"; then
463 PKG_CHECK_MODULES(LIBXML2_PC, [libxml-2.0], [
464 CPPFLAGS="${CPPFLAGS} ${LIBXML2_PC_CFLAGS}"
465 LIBS="${LIBS} ${LIBXML2_PC_LIBS}"
466 AC_CHECK_LIB(xml2,xmlInitParser,[true],AC_MSG_FAILURE(Missing xml2 library))
468 AC_CHECK_LIB(xml2,xmlInitParser)
470 AC_CHECK_HEADERS([libxml/xmlreader.h libxml/xmlwriter.h])
472 if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then
473 if test "x$with_expat" != "xno"; then
474 AC_CHECK_HEADERS([expat.h])
475 AC_CHECK_LIB(expat,XML_ParserCreate)
479 AC_ARG_ENABLE([posix-regex-lib],
480 [AS_HELP_STRING([--enable-posix-regex-lib],
481 [choose what library to use for POSIX regular expression support (default: auto)])
482 AS_HELP_STRING([--enable-posix-regex-lib=libc], [use libc POSIX regular expression support])
483 AS_HELP_STRING([--enable-posix-regex-lib=libregex], [use libregex POSIX regular expression support])
484 AS_HELP_STRING([--enable-posix-regex-lib=libpcreposix], [use libpcreposix POSIX regular expression support])
485 AS_HELP_STRING([--disable-posix-regex-lib], [don't enable POSIX regular expression support])],
486 [], [enable_posix_regex_lib=auto])
488 posix_regex_lib_found=
489 if test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libc" || test "$enable_posix_regex_lib" = "libregex"; then
490 AC_CHECK_HEADERS([regex.h])
491 if test "x$ac_cv_header_regex_h" != "xno"; then
492 AC_CHECK_FUNC(regcomp)
493 if test "x$ac_cv_func_regcomp" = xyes; then
494 posix_regex_lib_found=1
496 AC_CHECK_LIB(regex,regcomp)
497 if test "x$ac_cv_lib_regex_regcomp" = xyes; then
498 posix_regex_lib_found=1
503 if test -z $posix_regex_lib_found && (test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libpcreposix"); then
504 AC_CHECK_HEADERS([pcreposix.h])
505 AC_CHECK_LIB(pcreposix,regcomp)
506 if test "x$ac_cv_lib_pcreposix_regcomp" != xyes; then
507 AC_MSG_NOTICE(trying libpcreposix check again with libpcre)
508 unset ac_cv_lib_pcreposix_regcomp
509 AC_CHECK_LIB(pcre,pcre_exec)
510 AC_CHECK_LIB(pcreposix,regcomp)
511 if test "x$ac_cv_lib_pcre_pcre_exec" = xyes && test "x$ac_cv_lib_pcreposix_regcomp" = xyes; then
512 AC_MSG_CHECKING(if PCRE_STATIC needs to be defined)
514 [AC_LANG_SOURCE(#include <pcreposix.h>
515 int main() { return regcomp(NULL, NULL, 0); })],
516 [without_pcre_static=yes],
517 [without_pcre_static=no])
519 [AC_LANG_SOURCE(#define PCRE_STATIC
520 #include <pcreposix.h>
521 int main() { return regcomp(NULL, NULL, 0); })],
522 [with_pcre_static=yes],
523 [with_pcre_static=no])
524 if test "x$without_pcre_static" != xyes && test "x$with_pcre_static" = xyes; then
526 AC_DEFINE([PCRE_STATIC], [1], [Define to 1 if PCRE_STATIC needs to be defined.])
527 elif test "x$without_pcre_static" = xyes || test "x$with_pcre_static" = xyes; then
530 posix_regex_lib_found=1
533 posix_regex_lib_found=1
537 # TODO: Give the user the option of using a pre-existing system
538 # libarchive. This will define HAVE_LIBARCHIVE which will cause
539 # bsdtar_platform.h to use #include <...> for the libarchive headers.
540 # Need to include Makefile.am magic to link against system
541 # -larchive in that case.
542 #AC_CHECK_LIB(archive,archive_version)
544 # Checks for supported compiler flags
545 AX_APPEND_COMPILE_FLAGS([-Wall -Wformat -Wformat-security])
547 # Place the functions and data into separate sections, allowing the linker
548 # to garbage collect the unused ones.
549 save_LDFLAGS=$LDFLAGS
550 LDFLAGS="$LDFLAGS -Wl,--gc-sections"
551 AC_MSG_CHECKING([whether ld supports --gc-sections])
553 [AC_LANG_SOURCE([static char UnusedFunc() { return 5; } int main() { return 0;}])],
554 [AC_MSG_RESULT([yes])
555 GC_SECTIONS="-Wl,--gc-sections";
556 AX_APPEND_COMPILE_FLAGS([-ffunction-sections -fdata-sections])],
559 LDFLAGS=$save_LDFLAGS
561 AC_SUBST(GC_SECTIONS)
563 # Checks for typedefs, structures, and compiler characteristics.
565 # la_TYPE_UID_T defaults to "int", which is incorrect for MinGW
566 # and MSVC. Use a customized version.
569 # AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on
570 # most systems... default to "long long" instead.
571 AC_CHECK_TYPE(off_t, [long long])
573 AC_CHECK_TYPE(id_t, [unsigned long])
574 AC_CHECK_TYPE(uintptr_t, [unsigned int])
576 # Check for tm_gmtoff in struct tm
577 AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,
582 # Check for f_namemax in struct statfs
583 AC_CHECK_MEMBERS([struct statfs.f_namemax],,,
585 #include <sys/param.h>
586 #include <sys/mount.h>
589 # Check for f_iosize in struct statfs
590 AC_CHECK_MEMBERS([struct statfs.f_iosize],,,
592 #include <sys/param.h>
593 #include <sys/mount.h>
596 # Check for f_iosize in struct statvfs
597 AC_CHECK_MEMBERS([struct statvfs.f_iosize],,,
599 #include <sys/statvfs.h>
602 # Check for birthtime in struct stat
603 AC_CHECK_MEMBERS([struct stat.st_birthtime])
605 # Check for high-resolution timestamps in struct stat
606 AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec])
607 AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec])
608 AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
609 AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX
610 AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64
611 AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd
612 # Check for block size support in struct stat
613 AC_CHECK_MEMBERS([struct stat.st_blksize])
614 # Check for st_flags in struct stat (BSD fflags)
615 AC_CHECK_MEMBERS([struct stat.st_flags])
617 # If you have uintmax_t, we assume printf supports %ju
618 # If you have unsigned long long, we assume printf supports %llu
619 # TODO: Check for %ju and %llu support directly.
620 AC_CHECK_TYPES([uintmax_t, unsigned long long])
622 # We use C99-style integer types
623 # Declare them if the local platform doesn't already do so.
634 AC_CHECK_DECLS([SIZE_MAX, INT32_MAX, INT32_MIN])
635 AC_CHECK_DECLS([INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX])
636 AC_CHECK_DECLS([INTMAX_MAX, INTMAX_MIN, UINTMAX_MAX])
638 AC_CHECK_DECL([SSIZE_MAX],
639 [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.])],
641 [#include <limits.h>])
643 AC_CHECK_DECL([EFTYPE],
644 [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])],
646 [#include <errno.h>])
647 AC_CHECK_DECL([EILSEQ],
648 [AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])],
650 [#include <errno.h>])
651 AC_CHECK_TYPE([wchar_t],
652 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]wchar_t), 1, [Define to 1 if the system has the type `wchar_t'.])dnl
653 AC_CHECK_SIZEOF([wchar_t])],
656 AX_COMPILE_CHECK_SIZEOF(int)
657 AX_COMPILE_CHECK_SIZEOF(long)
659 AC_CHECK_HEADERS_ONCE([sys/time.h])
661 # Checks for library functions.
662 AC_PROG_GCC_TRADITIONAL
672 # CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES)
673 # To avoid necessity for including windows.h or special forward declaration
674 # workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *'
675 AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *])
676 AC_CHECK_FUNCS([arc4random_buf chflags chown chroot ctime_r])
677 AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fork])
678 AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate])
679 AC_CHECK_FUNCS([futimens futimes futimesat])
680 AC_CHECK_FUNCS([geteuid getpid getgrgid_r getgrnam_r])
681 AC_CHECK_FUNCS([getpwnam_r getpwuid_r getvfsbyname gmtime_r])
682 AC_CHECK_FUNCS([lchflags lchmod lchown link linkat localtime_r lstat lutimes])
683 AC_CHECK_FUNCS([mbrtowc memmove memset])
684 AC_CHECK_FUNCS([mkdir mkfifo mknod mkstemp])
685 AC_CHECK_FUNCS([nl_langinfo openat pipe poll posix_spawnp readlink readlinkat])
686 AC_CHECK_FUNCS([readpassphrase])
687 AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs])
688 AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strnlen strrchr symlink])
689 AC_CHECK_FUNCS([timegm tzset unlinkat unsetenv utime utimensat utimes vfork])
690 AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy wmemmove])
691 AC_CHECK_FUNCS([_fseeki64 _get_timezone])
692 AC_CHECK_DECL([cmtime_s],
693 [AC_DEFINE(HAVE_CMTIME_S, 1, [cmtime_s function])],
696 AC_CHECK_DECL([gmtime_s],
697 [AC_DEFINE(HAVE_GMTIME_S, 1, [gmtime_s function])],
700 AC_CHECK_TYPE([localtime_s],
701 [AC_DEFINE(HAVE_LOCALTIME_S, 1, [localtime_s function])],
704 AC_CHECK_DECL([_mkgmtime],
705 [AC_DEFINE(HAVE__MKGMTIME, 1, [_mkgmtime function])],
709 # detects cygwin-1.7, as opposed to older versions
710 AC_CHECK_FUNCS([cygwin_conv_path])
712 # DragonFly uses vfsconf, FreeBSD xvfsconf.
713 AC_CHECK_TYPES(struct vfsconf,,,
714 [#if HAVE_SYS_TYPES_H
715 #include <sys/types.h>
717 #include <sys/mount.h>
720 AC_CHECK_TYPES(struct xvfsconf,,,
721 [#if HAVE_SYS_TYPES_H
722 #include <sys/types.h>
724 #include <sys/mount.h>
727 AC_CHECK_TYPES(struct statfs,,,
728 [#if HAVE_SYS_TYPES_H
729 #include <sys/types.h>
731 #include <sys/mount.h>
734 # There are several variants of readdir_r around; we only
735 # accept the POSIX-compliant version.
737 [AC_LANG_PROGRAM([[#include <dirent.h>]],
738 [[DIR *dir; struct dirent e, *r;
739 return(readdir_r(dir, &e, &r));]])],
740 [AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have a POSIX compatible readdir_r])]
742 # dirfd can be either a function or a macro.
744 [AC_LANG_PROGRAM([[#include <dirent.h>
746 [[return(dirfd(dir));]])],
747 [AC_DEFINE(HAVE_DIRFD,1,[Define to 1 if you have a dirfd function or macro])]
750 # FreeBSD's nl_langinfo supports an option to specify whether the
751 # current locale uses month/day or day/month ordering. It makes the
752 # output a little prettier...
753 AC_CHECK_DECL([D_MD_ORDER],
754 [AC_DEFINE(HAVE_D_MD_ORDER, 1, [Define to 1 if nl_langinfo supports D_MD_ORDER])],
757 #include <langinfo.h>
761 # Check for dirent.d_namlen field explicitly
762 # (This is a bit more straightforward than, if not quite as portable as,
763 # the recipe given by the autoconf maintainers.)
764 AC_CHECK_MEMBER(struct dirent.d_namlen,,,
770 # Check for Extended Attributes support
771 AC_ARG_ENABLE([xattr],
772 AS_HELP_STRING([--disable-xattr],
773 [Disable Extended Attributes support (default: check)]))
775 if test "x$enable_xattr" != "xno"; then
776 AC_SEARCH_LIBS([setxattr], [attr gnu])
777 AC_CHECK_DECLS([EXTATTR_NAMESPACE_USER], [], [], [#include <sys/types.h>
778 #include <sys/extattr.h>
780 AC_CHECK_DECLS([XATTR_NOFOLLOW], [], [], [#include <sys/xattr.h>
782 if test "x$ac_cv_header_sys_xattr_h" = "xyes" \
783 -a "x$ac_cv_have_decl_XATTR_NOFOLLOW" = "xyes"; then
784 # Darwin extended attributes support
785 AC_CACHE_VAL([ac_cv_archive_xattr_darwin],
786 [AC_CHECK_FUNCS(fgetxattr \
792 [ac_cv_archive_xattr_darwin=yes],
793 [ac_cv_archive_xattr_darwin=no],
794 [#include <sys/xattr.h>
798 elif test "x$ac_cv_header_sys_extattr_h" = "xyes" \
799 -a "x$ac_cv_have_decl_EXTATTR_NAMESPACE_USER" = "xyes"; then
800 # FreeBSD extended attributes support
801 AC_CACHE_VAL([ac_cv_archive_xattr_freebsd],
802 [AC_CHECK_FUNCS(extattr_get_fd \
810 [ac_cv_archive_xattr_freebsd=yes],
811 [ac_cv_archive_xattr_freebsd=no],
812 [#include <sys/types.h>
813 #include <sys/extattr.h>
817 elif test "x$ac_cv_header_sys_xattr_h" = "xyes" \
818 -o "x$ac_cv_header_attr_xattr_h" = "xyes"; then
819 # Linux extended attributes support
820 AC_CACHE_VAL([ac_cv_archive_xattr_linux],
821 [AC_CHECK_FUNCS(fgetxattr \
829 [ac_cv_archive_xattr_linux=yes],
830 [ac_cv_archive_xattr_linux=no],
831 [#if HAVE_SYS_TYPES_H
832 #include <sys/types.h>
835 #include <sys/xattr.h>
837 #if HAVE_ATTR_XATTR_H
838 #include <attr/xatr.h>
843 elif test "x$ac_cv_header_sys_ea_h" = "xyes"; then
844 # AIX extended attributes support
845 AC_CACHE_VAL([ac_cv_archive_xattr_aix],
846 [AC_CHECK_FUNCS(fgetea \
854 [ac_cv_archive_xattr_aix=yes],
855 [ac_cv_archive_xattr_aix=no],
862 AC_MSG_CHECKING([for extended attributes support])
863 if test "x$ac_cv_archive_xattr_linux" = "xyes"; then
864 AC_DEFINE([ARCHIVE_XATTR_LINUX], [1], [Linux xattr support])
865 AC_MSG_RESULT([Linux])
866 elif test "x$ac_cv_archive_xattr_darwin" = "xyes"; then
867 AC_DEFINE([ARCHIVE_XATTR_DARWIN], [1], [Darwin xattr support])
868 AC_MSG_RESULT([Darwin])
869 elif test "x$ac_cv_archive_xattr_freebsd" = "xyes"; then
870 AC_DEFINE([ARCHIVE_XATTR_FREEBSD], [1], [FreeBSD xattr support])
871 AC_MSG_RESULT([FreeBSD])
872 elif test "x$ac_cv_archive_xattr_aix" = "xyes"; then
873 AC_DEFINE([ARCHIVE_XATTR_AIX], [1], [AIX xattr support])
876 AC_MSG_RESULT([none])
880 # Check for ACL support
882 # The ACL support in libarchive is written against the POSIX1e draft,
883 # which was never officially approved and varies quite a bit across
884 # platforms. Worse, some systems have completely non-POSIX acl functions,
885 # which makes the following checks rather more complex than I would like.
888 AS_HELP_STRING([--disable-acl],
889 [Disable ACL support (default: check)]))
891 if test "x$enable_acl" != "xno"; then
893 AC_CHECK_LIB([acl], [acl_get_file])
895 AC_CHECK_TYPES([acl_t, acl_entry_t, acl_permset_t, acl_tag_t], [], [], [
897 #include <sys/types.h>
904 AC_CHECK_LIB([richacl], [richacl_get_file])
906 AC_CHECK_TYPES([[struct richace], [struct richacl]], [], [], [
907 #if HAVE_SYS_RICHACL_H
908 #include <sys/richacl.h>
912 # Solaris and derivates ACLs
913 AC_CHECK_FUNCS(acl facl)
915 if test "x$ac_cv_lib_richacl_richacl_get_file" = "xyes" \
916 -a "x$ac_cv_type_struct_richace" = "xyes" \
917 -a "x$ac_cv_type_struct_richacl" = "xyes"; then
918 AC_CACHE_VAL([ac_cv_archive_acl_librichacl],
919 [AC_CHECK_FUNCS(richacl_alloc \
926 [ac_cv_archive_acl_librichacl=yes], [ac_cv_archive_acl_librichacl=no], [#include <sys/richacl.h>])])
929 if test "x$ac_cv_func_acl" = "xyes" \
930 -a "x$ac_cv_func_facl" = "xyes"; then
931 AC_CHECK_TYPES([aclent_t], [], [], [[#include <sys/acl.h>]])
932 if test "x$ac_cv_type_aclent_t" = "xyes"; then
933 AC_CACHE_VAL([ac_cv_archive_acl_sunos],
934 [AC_CHECK_DECLS([GETACL, SETACL, GETACLCNT],
935 [ac_cv_archive_acl_sunos=yes], [ac_cv_archive_acl_sunos=no],
936 [#include <sys/acl.h>])])
937 AC_CHECK_TYPES([ace_t], [], [], [[#include <sys/acl.h>]])
938 if test "x$ac_cv_type_ace_t" = "xyes"; then
939 AC_CACHE_VAL([ac_cv_archive_acl_sunos_nfs4],
940 [AC_CHECK_DECLS([ACE_GETACL, ACE_SETACL, ACE_GETACLCNT],
941 [ac_cv_archive_acl_sunos_nfs4=yes],
942 [ac_cv_archive_acl_sonos_nfs4=no],
943 [#include <sys/acl.h>])])
946 elif test "x$ac_cv_type_acl_t" = "xyes" \
947 -a "x$ac_cv_type_acl_entry_t" = "xyes" \
948 -a "x$ac_cv_type_acl_permset_t" = "xyes" \
949 -a "x$ac_cv_type_acl_tag_t" = "xyes"; then
950 # POSIX.1e ACL functions
951 AC_CACHE_VAL([ac_cv_posix_acl_funcs],
952 [AC_CHECK_FUNCS(acl_add_perm \
955 acl_delete_def_file \
968 [ac_cv_posix_acl_funcs=yes], [ac_cv_posix_acl_funcs=no],
969 [#if HAVE_SYS_TYPES_H
970 #include <sys/types.h>
978 AC_CHECK_FUNCS(acl_get_perm)
980 if test "x$ac_cv_posix_acl_funcs" = "xyes" \
981 -a "x$ac_cv_header_acl_libacl_h" = "xyes" \
982 -a "x$ac_cv_lib_acl_acl_get_file" = "xyes" \
983 -a "x$ac_cv_func_acl_get_perm"; then
984 AC_CACHE_VAL([ac_cv_archive_acl_libacl],
985 [ac_cv_archive_acl_libacl=yes])
986 AC_DEFINE([ARCHIVE_ACL_LIBACL], [1],
987 [POSIX.1e ACL support via libacl])
990 AC_CHECK_FUNCS(acl_add_flag_np \
993 acl_get_entry_type_np \
1000 acl_set_entry_type_np \
1003 [#include <sys/types.h>
1004 #include <sys/acl.h>])
1006 AC_CHECK_FUNCS(mbr_uid_to_uuid \
1009 [#include <membership.h>])
1011 AC_CHECK_DECLS([ACL_TYPE_EXTENDED, ACL_TYPE_NFS4, ACL_USER,
1012 ACL_SYNCHRONIZE], [], [],
1013 [#include <sys/types.h>
1014 #include <sys/acl.h>])
1015 if test "x$ac_cv_posix_acl_funcs" = "xyes" \
1016 -a "x$ac_cv_func_acl_get_fd_np" = "xyes" \
1017 -a "x$ac_cv_func_acl_get_perm" != "xyes" \
1018 -a "x$ac_cv_func_acl_get_perm_np" = "xyes" \
1019 -a "x$ac_cv_func_acl_set_fd_np" = "xyes"; then
1020 if test "x$ac_cv_have_decl_ACL_USER" = "xyes"; then
1021 AC_CACHE_VAL([ac_cv_archive_acl_freebsd],
1022 [ac_cv_archive_acl_freebsd=yes])
1023 if test "x$ac_cv_have_decl_ACL_TYPE_NFS4" = "xyes" \
1024 -a "x$ac_cv_func_acl_add_flag_np" = "xyes" \
1025 -a "x$ac_cv_func_acl_get_brand_np" = "xyes" \
1026 -a "x$ac_cv_func_acl_get_entry_type_np" = "xyes" \
1027 -a "x$ac_cv_func_acl_get_flagset_np" = "xyes" \
1028 -a "x$ac_cv_func_acl_set_entry_type_np" = "xyes"; then
1029 AC_CACHE_VAL([ac_cv_archive_acl_freebsd_nfs4],
1030 [ac_cv_archive_acl_freebsd_nfs4=yes])
1032 elif test "x$ac_cv_have_decl_ACL_TYPE_EXTENDED" = "xyes" \
1033 -a "x$ac_cv_func_acl_add_flag_np" = "xyes" \
1034 -a "x$ac_cv_func_acl_get_flagset_np" = "xyes" \
1035 -a "x$ac_cv_func_acl_get_link_np" = "xyes" \
1036 -a "x$ac_cv_func_acl_set_link_np" = "xyes" \
1037 -a "x$ac_cv_func_mbr_uid_to_uuid" = "xyes" \
1038 -a "x$ac_cv_func_mbr_uuid_to_id" = "xyes" \
1039 -a "x$ac_cv_func_mbr_gid_to_uuid" = "xyes"; then
1040 AC_CACHE_VAL([ac_cv_archive_acl_darwin],
1041 [ac_cv_archive_acl_darwin=yes])
1046 AC_MSG_CHECKING([for ACL support])
1047 if test "x$ac_cv_archive_acl_libacl" = "xyes" \
1048 -a "x$ac_cv_archive_acl_librichacl" = "xyes"; then
1049 AC_MSG_RESULT([libacl (POSIX.1e) + librichacl (NFSv4)])
1050 AC_DEFINE([ARCHIVE_ACL_LIBACL], [1],
1051 [Linux POSIX.1e ACL support via libacl])
1052 AC_DEFINE([ARCHIVE_ACL_LIBRICHACL], [1],
1053 [Linux NFSv4 ACL support via librichacl])
1054 elif test "x$ac_cv_archive_acl_libacl" = "xyes"; then
1055 AC_MSG_RESULT([libacl (POSIX.1e)])
1056 AC_DEFINE([ARCHIVE_ACL_LIBACL], [1],
1057 [Linux POSIX.1e ACL support via libacl])
1058 elif test "x$ac_cv_archive_acl_librichacl" = "xyes"; then
1059 AC_MSG_RESULT([librichacl (NFSv4)])
1060 AC_DEFINE([ARCHIVE_ACL_LIBRICHACL], [1],
1061 [Linux NFSv4 ACL support via librichacl])
1062 elif test "x$ac_cv_archive_acl_darwin" = "xyes"; then
1063 AC_DEFINE([ARCHIVE_ACL_DARWIN], [1], [Darwin ACL support])
1064 AC_MSG_RESULT([Darwin (limited NFSv4)])
1065 elif test "x$ac_cv_archive_acl_sunos" = "xyes"; then
1066 AC_DEFINE([ARCHIVE_ACL_SUNOS], [1], [Solaris ACL support])
1067 if test "x$ac_cv_archive_acl_sunos_nfs4" = "xyes"; then
1068 AC_DEFINE([ARCHIVE_ACL_SUNOS_NFS4], [1],
1069 [Solaris NFSv4 ACL support])
1070 AC_MSG_RESULT([Solaris (POSIX.1e and NFSv4)])
1072 AC_MSG_RESULT([Solaris (POSIX.1e)])
1074 elif test "x$ac_cv_archive_acl_freebsd" = "xyes"; then
1075 AC_DEFINE([ARCHIVE_ACL_FREEBSD], [1], [FreeBSD ACL support])
1076 if test "x$ac_cv_archive_acl_freebsd_nfs4" = "xyes"; then
1077 AC_DEFINE([ARCHIVE_ACL_FREEBSD_NFS4], [1],
1078 [FreeBSD NFSv4 ACL support])
1079 AC_MSG_RESULT([FreeBSD (POSIX.1e and NFSv4)])
1081 AC_MSG_RESULT([FreeBSD (POSIX.1e)])
1084 AC_MSG_RESULT([none])
1089 AM_CONDITIONAL([INC_LINUX_ACL],
1090 [test "x$ac_cv_archive_acl_libacl" = "xyes" \
1091 -o "x$ac_cv_archive_acl_librichacl" = "xyes"])
1092 AM_CONDITIONAL([INC_SUNOS_ACL], [test "x$ac_cv_archive_acl_sunos" = "xyes"])
1093 AM_CONDITIONAL([INC_DARWIN_ACL],
1094 [test "x$ac_cv_archive_acl_darwin" = "xyes"])
1095 AM_CONDITIONAL([INC_FREEBSD_ACL],
1096 [test "x$ac_cv_archive_acl_freebsd" = "xyes"])
1098 # Additional requirements
1101 dnl NOTE: Crypto checks must run last.
1102 AC_DEFUN([CRYPTO_CHECK], [
1103 if test "$found_$1" != yes; then
1104 saved_CPPFLAGS="$CPPFLAGS"
1105 CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive"
1106 touch "check_crypto_md.h"
1107 AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_$2])
1108 AC_LINK_IFELSE([AC_LANG_SOURCE([
1109 #define ARCHIVE_$1_COMPILE_TEST
1110 #define ARCHIVE_CRYPTO_$1_$2
1111 #define PLATFORM_CONFIG_H "check_crypto_md.h"
1113 $(cat "$srcdir/libarchive/archive_digest.c")
1116 main(int argc, char **argv)
1119 archive_$3_init(&ctx);
1120 archive_$3_update(&ctx, *argv, argc);
1121 archive_$3_final(&ctx, NULL);
1125 [ AC_MSG_RESULT([yes])
1128 AC_DEFINE(ARCHIVE_CRYPTO_$1_$2, 1, [ $1 via ARCHIVE_CRYPTO_$1_$2 supported.])
1130 [ AC_MSG_RESULT([no])])
1131 CPPFLAGS="$saved_CPPFLAGS"
1132 rm "check_crypto_md.h"
1136 AC_DEFUN([CRYPTO_CHECK_WIN], [
1137 if test "$found_$1" != yes; then
1138 AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_WIN])
1139 AC_LINK_IFELSE([AC_LANG_SOURCE([
1140 #define ARCHIVE_$1_COMPILE_TEST
1141 #include <windows.h>
1142 #include <wincrypt.h>
1145 main(int argc, char **argv)
1153 [ AC_MSG_RESULT([yes])
1156 AC_DEFINE(ARCHIVE_CRYPTO_$1_WIN, 1, [ $1 via ARCHIVE_CRYPTO_$1_WIN supported.])
1158 [ AC_MSG_RESULT([no])])
1163 *mingw* | *cygwin* | *msys*)
1166 CRYPTO_CHECK(MD5, LIBC, md5)
1167 CRYPTO_CHECK(MD5, LIBSYSTEM, md5)
1168 CRYPTO_CHECK(RMD160, LIBC, rmd160)
1169 CRYPTO_CHECK(SHA1, LIBC, sha1)
1170 CRYPTO_CHECK(SHA1, LIBSYSTEM, sha1)
1171 CRYPTO_CHECK(SHA256, LIBC, sha256)
1172 CRYPTO_CHECK(SHA256, LIBC2, sha256)
1173 CRYPTO_CHECK(SHA256, LIBC3, sha256)
1174 CRYPTO_CHECK(SHA256, LIBSYSTEM, sha256)
1175 CRYPTO_CHECK(SHA384, LIBC, sha384)
1176 CRYPTO_CHECK(SHA384, LIBC2, sha384)
1177 CRYPTO_CHECK(SHA384, LIBC3, sha384)
1178 CRYPTO_CHECK(SHA384, LIBSYSTEM, sha384)
1179 CRYPTO_CHECK(SHA512, LIBC, sha512)
1180 CRYPTO_CHECK(SHA512, LIBC2, sha512)
1181 CRYPTO_CHECK(SHA512, LIBC3, sha512)
1182 CRYPTO_CHECK(SHA512, LIBSYSTEM, sha512)
1186 if test "x$with_cng" != "xno"; then
1187 AC_CHECK_HEADERS([bcrypt.h],[
1188 LIBS="$LIBS -lbcrypt"
1190 [[#ifdef HAVE_WINDOWS_H
1191 # include <windows.h>
1196 if test "x$with_mbedtls" = "xyes"; then
1197 AC_CHECK_HEADERS([mbedtls/aes.h mbedtls/md.h mbedtls/pkcs5.h])
1199 AC_CHECK_LIB(mbedcrypto,mbedtls_sha1_init)
1200 CRYPTO_CHECK(MD5, MBEDTLS, md5)
1201 CRYPTO_CHECK(RMD160, MBEDTLS, rmd160)
1202 CRYPTO_CHECK(SHA1, MBEDTLS, sha1)
1203 CRYPTO_CHECK(SHA256, MBEDTLS, sha256)
1204 CRYPTO_CHECK(SHA384, MBEDTLS, sha384)
1205 CRYPTO_CHECK(SHA512, MBEDTLS, sha512)
1206 if test "x$found_MBEDTLS" != "xyes"; then
1211 if test "x$with_nettle" = "xyes"; then
1212 AC_CHECK_HEADERS([nettle/md5.h nettle/ripemd160.h nettle/sha.h])
1213 AC_CHECK_HEADERS([nettle/pbkdf2.h nettle/aes.h nettle/hmac.h])
1215 AC_CHECK_LIB(nettle,nettle_sha1_init)
1216 CRYPTO_CHECK(MD5, NETTLE, md5)
1217 CRYPTO_CHECK(RMD160, NETTLE, rmd160)
1218 CRYPTO_CHECK(SHA1, NETTLE, sha1)
1219 CRYPTO_CHECK(SHA256, NETTLE, sha256)
1220 CRYPTO_CHECK(SHA384, NETTLE, sha384)
1221 CRYPTO_CHECK(SHA512, NETTLE, sha512)
1222 if test "x$found_NETTLE" != "xyes"; then
1227 if test "x$with_openssl" != "xno"; then
1228 AC_CHECK_HEADERS([openssl/evp.h])
1230 LIBSREQUIRED="$LIBSREQUIRED${LIBSREQUIRED:+ }libssl libcrypto"
1231 AC_CHECK_LIB(crypto,OPENSSL_config)
1232 CRYPTO_CHECK(MD5, OPENSSL, md5)
1233 CRYPTO_CHECK(RMD160, OPENSSL, rmd160)
1234 CRYPTO_CHECK(SHA1, OPENSSL, sha1)
1235 CRYPTO_CHECK(SHA256, OPENSSL, sha256)
1236 CRYPTO_CHECK(SHA384, OPENSSL, sha384)
1237 CRYPTO_CHECK(SHA512, OPENSSL, sha512)
1238 AC_CHECK_FUNCS([PKCS5_PBKDF2_HMAC_SHA1])
1241 AC_SUBST(LIBSREQUIRED)
1243 # Probe libmd AFTER OpenSSL/libcrypto.
1244 # The two are incompatible and OpenSSL is more complete.
1245 AC_CHECK_HEADERS([md5.h ripemd.h sha.h sha256.h sha512.h])
1247 AC_CHECK_LIB(md,MD5Init)
1248 CRYPTO_CHECK(MD5, LIBMD, md5)
1249 CRYPTO_CHECK(RMD160, LIBMD, rmd160)
1250 CRYPTO_CHECK(SHA1, LIBMD, sha1)
1251 CRYPTO_CHECK(SHA256, LIBMD, sha256)
1252 CRYPTO_CHECK(SHA512, LIBMD, sha512)
1253 if test "x$found_LIBMD" != "xyes"; then
1258 *mingw* | *cygwin* | *msys*)
1259 CRYPTO_CHECK_WIN(MD5, CALG_MD5)
1260 CRYPTO_CHECK_WIN(SHA1, CALG_SHA1)
1261 CRYPTO_CHECK_WIN(SHA256, CALG_SHA_256)
1262 CRYPTO_CHECK_WIN(SHA384, CALG_SHA_384)
1263 CRYPTO_CHECK_WIN(SHA512, CALG_SHA_512)
1267 dnl Visibility annotations...
1268 saved_CFLAGS="$CFLAGS"
1269 CFLAGS="$CFLAGS -fvisibility=hidden -Werror"
1270 AC_MSG_CHECKING(whether compiler supports visibility annotations)
1271 AC_LINK_IFELSE([AC_LANG_PROGRAM([
1272 int foo( void ) __attribute__((visibility("default")));
1274 [CFLAGS="$saved_CFLAGS -fvisibility=hidden -D__LIBARCHIVE_ENABLE_VISIBILITY";
1275 AC_MSG_RESULT(yes)],
1276 [CFLAGS="$saved_CFLAGS"
1279 # Ensure test directories are present if building out-of-tree
1280 AC_CONFIG_COMMANDS([mkdirs],
1281 [mkdir -p libarchive/test tar/test cat/test cpio/test])