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.1.2])
8 m4_define([LIBARCHIVE_VERSION_N],[3001002])
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())
17 # Now starts the "real" configure script.
20 AC_INIT([libarchive],LIBARCHIVE_VERSION_S(),[libarchive-discuss@googlegroups.com])
21 # Make sure the srcdir contains "libarchive" directory
22 AC_CONFIG_SRCDIR([libarchive])
23 # Use auxiliary subscripts from this subdirectory (cleans up root)
24 AC_CONFIG_AUX_DIR([build/autoconf])
26 AC_CONFIG_MACRO_DIR([build/autoconf])
27 # Must follow AC_CONFIG macros above...
29 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
31 # Libtool's "interface version" can be computed from the libarchive version.
33 # Libtool interface version bumps on any API change, so increments
34 # whenever libarchive minor version does.
35 ARCHIVE_MINOR=$(( (LIBARCHIVE_VERSION_N() / 1000) % 1000 ))
36 # Libarchive 2.7 == libtool interface 9 = 2 + 7
37 # Libarchive 2.8 == libtool interface 10 = 2 + 8
38 # Libarchive 2.9 == libtool interface 11 = 2 + 8
39 # Libarchive 3.0 == libtool interface 12
40 # Libarchive 3.1 == libtool interface 13
41 ARCHIVE_INTERFACE=`echo $((13 + ${ARCHIVE_MINOR}))`
42 # Libarchive revision is bumped on any source change === libtool revision
43 ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 ))
44 # Libarchive minor is bumped on any interface addition === libtool age
45 ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR
47 # Stick the version numbers into config.h
48 AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()",
49 [Version number of libarchive])
50 AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_NUMBER],"LIBARCHIVE_VERSION_N()",
51 [Version number of libarchive as a single integer])
52 AC_DEFINE([BSDCPIO_VERSION_STRING],"BSDCPIO_VERSION_S()",
53 [Version number of bsdcpio])
54 AC_DEFINE([BSDTAR_VERSION_STRING],"BSDTAR_VERSION_S()",
55 [Version number of bsdtar])
57 # The shell variables here must be the same as the AC_SUBST() variables
58 # below, but the shell variable names apparently cannot be the same as
59 # the m4 macro names above. Why? Ask autoconf.
60 BSDCPIO_VERSION_STRING=BSDCPIO_VERSION_S()
61 BSDTAR_VERSION_STRING=BSDTAR_VERSION_S()
62 LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S()
63 LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N()
65 # Substitute the above version numbers into the various files below.
66 # Yes, I believe this is the fourth time we define what are essentially
67 # the same symbols. Why? Ask autoconf.
68 AC_SUBST(ARCHIVE_LIBTOOL_VERSION)
69 AC_SUBST(BSDCPIO_VERSION_STRING)
70 AC_SUBST(BSDTAR_VERSION_STRING)
71 AC_SUBST(LIBARCHIVE_VERSION_STRING)
72 AC_SUBST(LIBARCHIVE_VERSION_NUMBER)
74 AC_CONFIG_HEADERS([config.h])
75 AC_CONFIG_FILES([Makefile])
76 AC_CONFIG_FILES([build/pkgconfig/libarchive.pc])
81 dnl Compilation on mingw and Cygwin needs special Makefile rules
85 *mingw* ) inc_windows_files=yes ;;
86 *cygwin*) inc_cygwin_files=yes ;;
88 AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes])
89 AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes])
91 dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc)
94 *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO ;;
96 AC_SUBST(PLATFORMCPPFLAGS)
98 # Checks for programs.
101 AC_USE_SYSTEM_EXTENSIONS
104 AC_CHECK_TOOL([STRIP],[strip])
107 # Options for building bsdtar.
109 # Default is to build bsdtar, but allow people to override that.
111 AC_ARG_ENABLE([bsdtar],
112 [AS_HELP_STRING([--enable-bsdtar], [enable build of bsdtar (default)])
113 AS_HELP_STRING([--enable-bsdtar=static], [force static build of bsdtar])
114 AS_HELP_STRING([--enable-bsdtar=shared], [force dynamic build of bsdtar])
115 AS_HELP_STRING([--disable-bsdtar], [disable build of bsdtar])],
116 [], [enable_bsdtar=yes])
118 case "$enable_bsdtar" in
120 if test "$enable_static" = "no"; then
128 if test "$enable_shared" = "no"; then
129 AC_MSG_FAILURE([Shared linking of bsdtar requires shared libarchive])
143 AC_MSG_FAILURE([Unsupported value for --enable-bsdtar])
147 AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ])
148 AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ])
151 # Options for building bsdcpio.
153 # Default is not to build bsdcpio, but that can be overridden.
155 AC_ARG_ENABLE([bsdcpio],
156 [AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio (default)])
157 AS_HELP_STRING([--enable-bsdcpio=static], [static build of bsdcpio])
158 AS_HELP_STRING([--enable-bsdcpio=shared], [dynamic build of bsdcpio])
159 AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio])],
160 [], [enable_bsdcpio=yes])
162 case "$enable_bsdcpio" in
164 if test "$enable_static" = "no"; then
172 if test "$enabled_shared" = "no"; then
173 AC_MSG_FAILURE([Shared linking of bsdcpio requires shared libarchive])
186 AC_MSG_FAILURE([Unsupported value for --enable-bsdcpio])
190 AM_CONDITIONAL([BUILD_BSDCPIO], [ test "$build_bsdcpio" = yes ])
191 AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ])
193 # Set up defines needed before including any headers
196 AC_DEFINE([_WIN32_WINNT], 0x0500, [Define to '0x0500' for Windows 2000 APIs.])
197 AC_DEFINE([WINVER], 0x0500, [Define to '0x0500' for Windows 2000 APIs.])
201 # Checks for header files.
204 AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h copyfile.h ctype.h])
205 AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h grp.h])
207 AC_CACHE_CHECK([whether EXT2_IOC_GETFLAGS is usable],
208 [ac_cv_have_decl_EXT2_IOC_GETFLAGS],
209 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <sys/ioctl.h>
210 @%:@include <ext2fs/ext2_fs.h>],
211 [int x = EXT2_IOC_GETFLAGS])],
212 [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes])],
213 [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [no])])])
215 AS_VAR_IF([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes],
216 [AC_DEFINE_UNQUOTED([HAVE_WORKING_EXT2_IOC_GETFLAGS], [1],
217 [Define to 1 if you have a working EXT2_IOC_GETFLAGS])])
219 AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h])
220 AC_CHECK_HEADERS([linux/fiemap.h linux/fs.h linux/magic.h linux/types.h])
221 AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h signal.h spawn.h])
222 AC_CHECK_HEADERS([stdarg.h stdint.h stdlib.h string.h])
223 AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/extattr.h])
224 AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h])
225 AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/statfs.h sys/statvfs.h])
226 AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h])
227 AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h])
228 AC_CHECK_HEADERS([windows.h])
229 # check windows.h first; the other headers require it.
230 AC_CHECK_HEADERS([wincrypt.h winioctl.h],[],[],
231 [[#ifdef HAVE_WINDOWS_H
232 # include <windows.h>
236 # Checks for libraries.
238 AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib]))
240 if test "x$with_zlib" != "xno"; then
241 AC_CHECK_HEADERS([zlib.h])
242 AC_CHECK_LIB(z,inflate)
245 AC_ARG_WITH([bz2lib],
246 AS_HELP_STRING([--without-bz2lib], [Don't build support for bzip2 through bz2lib]))
248 if test "x$with_bz2lib" != "xno"; then
249 AC_CHECK_HEADERS([bzlib.h])
252 dnl AC_CHECK_LIB cannot be used on the Windows port of libbz2, therefore
253 dnl use AC_LINK_IFELSE.
254 AC_MSG_CHECKING([for BZ2_bzDecompressInit in -lbz2])
258 [AC_LANG_SOURCE(#include <bzlib.h>
259 int main() { return BZ2_bzDecompressInit(NULL, 0, 0); })],
260 [ac_cv_lib_bz2_BZ2_bzDecompressInit=yes],
261 [ac_cv_lib_bz2_BZ2_bzDecompressInit=no])
263 AC_MSG_RESULT($ac_cv_lib_bz2_BZ2_bzDecompressInit)
264 if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then
265 AC_DEFINE([HAVE_LIBBZ2], [1], [Define to 1 if you have the `bz2' library (-lbz2).])
270 AC_CHECK_LIB(bz2,BZ2_bzDecompressInit)
275 AC_ARG_WITH([lzmadec],
276 AS_HELP_STRING([--without-lzmadec], [Don't build support for lzma through lzmadec]))
278 if test "x$with_lzmadec" != "xno"; then
279 AC_CHECK_HEADERS([lzmadec.h])
280 AC_CHECK_LIB(lzmadec,lzmadec_decode)
284 AS_HELP_STRING([--without-iconv], [Don't try to link against iconv]))
286 if test "x$with_iconv" != "xno"; then
288 AC_CHECK_HEADERS([iconv.h],[],[],[#include <stdlib.h>])
289 if test "x$am_cv_func_iconv" = "xyes"; then
290 AC_CHECK_HEADERS([localcharset.h])
292 LIBS="${LIBS} ${LIBICONV}"
293 AC_CHECK_FUNCS([locale_charset])
294 LIBS="${am_save_LIBS}"
295 if test "x$ac_cv_func_locale_charset" != "xyes"; then
296 # If locale_charset() is not in libiconv, we have to find libcharset.
297 AC_CHECK_LIB(charset,locale_charset)
303 AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma]))
305 if test "x$with_lzma" != "xno"; then
306 AC_CHECK_HEADERS([lzma.h])
307 AC_CHECK_LIB(lzma,lzma_stream_decoder)
311 AS_HELP_STRING([--without-lzo2], [Don't build support for lzop through liblzo2]))
313 if test "x$with_lzo2" != "xno"; then
314 AC_CHECK_HEADERS([lzo/lzoconf.h lzo/lzo1x.h])
315 AC_CHECK_LIB(lzo2,lzo1x_decompress_safe)
318 AC_ARG_WITH([nettle],
319 AS_HELP_STRING([--without-nettle], [Don't build with crypto support from Nettle]))
320 AC_ARG_WITH([openssl],
321 AS_HELP_STRING([--without-openssl], [Don't build support for mtree and xar hashes through openssl]))
323 *darwin* ) with_openssl=no ;;
327 AS_HELP_STRING([--without-xml2], [Don't build support for xar through libxml2]))
329 AS_HELP_STRING([--without-expat], [Don't build support for xar through expat]))
331 if test "x$with_xml2" != "xno"; then
332 AC_PATH_PROG([XML2_CONFIG], [xml2-config],, [${PATH}])
333 if test "x$XML2_CONFIG" != "x"; then
334 CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`"
335 LIBS="${LIBS} `${XML2_CONFIG} --libs`"
336 AC_CHECK_LIB(xml2,xmlInitParser,[true],AC_MSG_FAILURE(Missing xml2 library))
338 AC_CHECK_LIB(xml2,xmlInitParser)
340 AC_CHECK_HEADERS([libxml/xmlreader.h libxml/xmlwriter.h])
342 if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then
343 if test "x$with_expat" != "xno"; then
344 AC_CHECK_HEADERS([expat.h])
345 AC_CHECK_LIB(expat,XML_ParserCreate)
349 AC_ARG_ENABLE([posix-regex-lib],
350 [AS_HELP_STRING([--enable-posix-regex-lib],
351 [choose what library to use for POSIX regular expression support (default: auto)])
352 AS_HELP_STRING([--enable-posix-regex-lib=libc], [use libc POSIX regular expression support])
353 AS_HELP_STRING([--enable-posix-regex-lib=libregex], [use libregex POSIX regular expression support])
354 AS_HELP_STRING([--enable-posix-regex-lib=libpcreposix], [use libpcreposix POSIX regular expression support])
355 AS_HELP_STRING([--disable-posix-regex-lib], [don't enable POSIX regular expression support])],
356 [], [enable_posix_regex_lib=auto])
358 posix_regex_lib_found=
359 if test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libc" || test "$enable_posix_regex_lib" = "libregex"; then
360 AC_CHECK_HEADERS([regex.h])
361 if test "x$ac_cv_header_regex_h" != "xno"; then
362 AC_CHECK_FUNC(regcomp)
363 if test "x$ac_cv_func_regcomp" = xyes; then
364 posix_regex_lib_found=1
366 AC_CHECK_LIB(regex,regcomp)
367 if test "x$ac_cv_lib_regex_regcomp" = xyes; then
368 posix_regex_lib_found=1
373 if test -z $posix_regex_lib_found && (test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libpcreposix"); then
374 AC_CHECK_HEADERS([pcreposix.h])
375 AC_CHECK_LIB(pcreposix,regcomp)
376 if test "x$ac_cv_lib_pcreposix_regcomp" != xyes; then
377 AC_MSG_NOTICE(trying libpcreposix check again with libpcre)
378 unset ac_cv_lib_pcreposix_regcomp
379 AC_CHECK_LIB(pcre,pcre_exec)
380 AC_CHECK_LIB(pcreposix,regcomp)
381 if test "x$ac_cv_lib_pcre_pcre_exec" = xyes && test "x$ac_cv_lib_pcreposix_regcomp" = xyes; then
382 AC_MSG_CHECKING(if PCRE_STATIC needs to be defined)
384 [AC_LANG_SOURCE(#include <pcreposix.h>
385 int main() { return regcomp(NULL, NULL, 0); })],
386 [without_pcre_static=yes],
387 [without_pcre_static=no])
389 [AC_LANG_SOURCE(#define PCRE_STATIC
390 #include <pcreposix.h>
391 int main() { return regcomp(NULL, NULL, 0); })],
392 [with_pcre_static=yes],
393 [with_pcre_static=no])
394 if test "x$without_pcre_static" != xyes && test "x$with_pcre_static" = xyes; then
396 AC_DEFINE([PCRE_STATIC], [1], [Define to 1 if PCRE_STATIC needs to be defined.])
397 elif test "x$without_pcre_static" = xyes || test "x$with_pcre_static" = xyes; then
400 posix_regex_lib_found=1
403 posix_regex_lib_found=1
407 # TODO: Give the user the option of using a pre-existing system
408 # libarchive. This will define HAVE_LIBARCHIVE which will cause
409 # bsdtar_platform.h to use #include <...> for the libarchive headers.
410 # Need to include Makefile.am magic to link against system
411 # -larchive in that case.
412 #AC_CHECK_LIB(archive,archive_version)
414 # Checks for typedefs, structures, and compiler characteristics.
416 # AC_TYPE_UID_T defaults to "int", which is incorrect for MinGW
417 # and MSVC. Use a customized version.
420 # AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on
421 # most systems... default to "long long" instead.
422 AC_CHECK_TYPE(off_t, [long long])
424 AC_CHECK_TYPE(id_t, [unsigned long])
425 AC_CHECK_TYPE(uintptr_t, [unsigned int])
427 # Check for tm_gmtoff in struct tm
428 AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,
433 # Check for f_namemax in struct statfs
434 AC_CHECK_MEMBERS([struct statfs.f_namemax],,,
436 #include <sys/param.h>
437 #include <sys/mount.h>
440 # Check for f_iosize in struct statvfs
441 AC_CHECK_MEMBERS([struct statvfs.f_iosize],,,
443 #include <sys/statvfs.h>
446 # Check for birthtime in struct stat
447 AC_CHECK_MEMBERS([struct stat.st_birthtime])
449 # Check for high-resolution timestamps in struct stat
450 AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec])
451 AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec])
452 AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
453 AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX
454 AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64
455 AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd
456 # Check for block size support in struct stat
457 AC_CHECK_MEMBERS([struct stat.st_blksize])
458 # Check for st_flags in struct stat (BSD fflags)
459 AC_CHECK_MEMBERS([struct stat.st_flags])
461 # If you have uintmax_t, we assume printf supports %ju
462 # If you have unsigned long long, we assume printf supports %llu
463 # TODO: Check for %ju and %llu support directly.
464 AC_CHECK_TYPES([uintmax_t, unsigned long long])
466 # We use C99-style integer types
467 # Declare them if the local platform doesn't already do so.
478 AC_CHECK_DECLS([SIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX])
480 AC_CHECK_DECL([SSIZE_MAX],
481 [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.])],
483 [#include <limits.h>])
485 AC_CHECK_DECL([EFTYPE],
486 [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])],
488 [#include <errno.h>])
489 AC_CHECK_DECL([EILSEQ],
490 [AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])],
492 [#include <errno.h>])
493 AC_CHECK_TYPE([wchar_t],
494 [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]wchar_t), 1, [Define to 1 if the system has the type `wchar_t'.])dnl
495 AC_CHECK_SIZEOF([wchar_t])],
500 # Checks for library functions.
501 AC_PROG_GCC_TRADITIONAL
511 # CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES)
512 # To avoid necessity for including windows.h or special forward declaration
513 # workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *'
514 AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *])
515 AC_CHECK_FUNCS([chflags chown chroot ctime_r dirfd])
516 AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fork])
517 AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate])
518 AC_CHECK_FUNCS([futimens futimes futimesat])
519 AC_CHECK_FUNCS([geteuid getpid getgrgid_r getgrnam_r])
520 AC_CHECK_FUNCS([getpwnam_r getpwuid_r getvfsbyname gmtime_r])
521 AC_CHECK_FUNCS([lchflags lchmod lchown link localtime_r lstat lutimes])
522 AC_CHECK_FUNCS([mbrtowc memmove memset])
523 AC_CHECK_FUNCS([mkdir mkfifo mknod mkstemp])
524 AC_CHECK_FUNCS([nl_langinfo openat pipe poll posix_spawnp readlink readlinkat])
525 AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs])
526 AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm])
527 AC_CHECK_FUNCS([tzset unsetenv utime utimensat utimes vfork])
528 AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy])
529 AC_CHECK_FUNCS([_ctime64_s _fseeki64])
530 AC_CHECK_FUNCS([_get_timezone _localtime64_s _mkgmtime64])
531 # detects cygwin-1.7, as opposed to older versions
532 AC_CHECK_FUNCS([cygwin_conv_path])
534 # There are several variants of readdir_r around; we only
535 # accept the POSIX-compliant version.
537 [AC_LANG_PROGRAM([[#include <dirent.h>]],
538 [[DIR *dir; struct dirent e, *r;
539 return(readdir_r(dir, &e, &r));]])],
540 [AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have a POSIX compatible readdir_r])]
543 # FreeBSD's nl_langinfo supports an option to specify whether the
544 # current locale uses month/day or day/month ordering. It makes the
545 # output a little prettier...
546 AC_CHECK_DECL([D_MD_ORDER],
547 [AC_DEFINE(HAVE_D_MD_ORDER, 1, [Define to 1 if nl_langinfo supports D_MD_ORDER])],
550 #include <langinfo.h>
554 # Check for dirent.d_namlen field explicitly
555 # (This is a bit more straightforward than, if not quite as portable as,
556 # the recipe given by the autoconf maintainers.)
557 AC_CHECK_MEMBER(struct dirent.d_namlen,,,
563 # Check for Extended Attributes support
564 AC_ARG_ENABLE([xattr],
565 AS_HELP_STRING([--disable-xattr],
566 [Enable Extended Attributes support (default: check)]))
568 if test "x$enable_xattr" != "xno"; then
569 AC_CHECK_HEADERS([attr/xattr.h])
570 AC_CHECK_HEADERS([sys/xattr.h sys/ea.h])
571 AC_CHECK_LIB(attr,setxattr)
572 AC_CHECK_FUNCS([extattr_get_file extattr_list_file])
573 AC_CHECK_FUNCS([extattr_set_fd extattr_set_file])
574 AC_CHECK_FUNCS([fgetxattr flistxattr fsetxattr getxattr])
575 AC_CHECK_FUNCS([lgetxattr listxattr llistxattr lsetxattr])
576 AC_CHECK_FUNCS([fgetea flistea fsetea getea])
577 AC_CHECK_FUNCS([lgetea listea llistea lsetea])
578 AC_CHECK_DECLS([EXTATTR_NAMESPACE_USER], [], [], [#include <sys/types.h>
579 #include <sys/extattr.h>
583 # Check for ACL support
585 # The ACL support in libarchive is written against the POSIX1e draft,
586 # which was never officially approved and varies quite a bit across
587 # platforms. Worse, some systems have completely non-POSIX acl functions,
588 # which makes the following checks rather more complex than I would like.
591 AS_HELP_STRING([--disable-acl],
592 [Enable ACL support (default: check)]))
594 if test "x$enable_acl" != "xno"; then
595 AC_CHECK_HEADERS([sys/acl.h])
596 AC_CHECK_LIB([acl],[acl_get_file])
597 AC_CHECK_FUNCS([acl_create_entry acl_init acl_set_fd acl_set_fd_np acl_set_file])
599 AC_CHECK_TYPES(acl_permset_t,,,
600 [#if HAVE_SYS_TYPES_H
601 #include <sys/types.h>
608 # The "acl_get_perm()" function was omitted from the POSIX draft.
609 # (It's a pretty obvious oversight; otherwise, there's no way to
610 # test for specific permissions in a permset.) Linux uses the obvious
611 # name, FreeBSD adds _np to mark it as "non-Posix extension."
612 # Test for both as a double-check that we really have POSIX-style ACL support.
613 AC_CHECK_FUNCS(acl_get_perm_np acl_get_perm acl_get_link acl_get_link_np,,,
614 [#if HAVE_SYS_TYPES_H
615 #include <sys/types.h>
622 # MacOS has an acl.h that isn't POSIX. It can be detected by
623 # checking for ACL_USER
624 AC_CHECK_DECL([ACL_USER],
625 [AC_DEFINE(HAVE_ACL_USER, 1, [True for systems with POSIX ACL support])],
627 [#include <sys/acl.h>])
630 # Additional requirements
633 dnl NOTE: Crypto checks must run last.
634 AC_DEFUN([CRYPTO_CHECK], [
635 if test "$found_$1" != yes; then
636 saved_CPPFLAGS="$CPPFLAGS"
637 CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive"
638 touch "check_crypto_md.h"
639 AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_$2])
640 AC_LINK_IFELSE([AC_LANG_SOURCE([
641 #define ARCHIVE_$1_COMPILE_TEST
642 #define ARCHIVE_CRYPTO_$1_$2
643 #define PLATFORM_CONFIG_H "check_crypto_md.h"
645 $(cat "$srcdir/libarchive/archive_crypto.c")
648 main(int argc, char **argv)
651 archive_$3_init(&ctx);
652 archive_$3_update(&ctx, *argv, argc);
653 archive_$3_final(&ctx, NULL);
657 [ AC_MSG_RESULT([yes])
660 AC_DEFINE(ARCHIVE_CRYPTO_$1_$2, 1, [ $1 via ARCHIVE_CRYPTO_$1_$2 supported.])
662 [ AC_MSG_RESULT([no])])
663 CPPFLAGS="$saved_CPPFLAGS"
664 rm "check_crypto_md.h"
668 AC_DEFUN([CRYPTO_CHECK_WIN], [
669 if test "$found_$1" != yes; then
670 AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_WIN])
671 AC_LINK_IFELSE([AC_LANG_SOURCE([
672 #define ARCHIVE_$1_COMPILE_TEST
674 #include <wincrypt.h>
677 main(int argc, char **argv)
685 [ AC_MSG_RESULT([yes])
688 AC_DEFINE(ARCHIVE_CRYPTO_$1_WIN, 1, [ $1 via ARCHIVE_CRYPTO_$1_WIN supported.])
690 [ AC_MSG_RESULT([no])])
698 CRYPTO_CHECK(MD5, LIBC, md5)
699 CRYPTO_CHECK(MD5, LIBSYSTEM, md5)
700 CRYPTO_CHECK(RMD160, LIBC, rmd160)
701 CRYPTO_CHECK(SHA1, LIBC, sha1)
702 CRYPTO_CHECK(SHA1, LIBSYSTEM, sha1)
703 CRYPTO_CHECK(SHA256, LIBC, sha256)
704 CRYPTO_CHECK(SHA256, LIBC2, sha256)
705 CRYPTO_CHECK(SHA256, LIBC3, sha256)
706 CRYPTO_CHECK(SHA256, LIBSYSTEM, sha256)
707 CRYPTO_CHECK(SHA384, LIBC, sha384)
708 CRYPTO_CHECK(SHA384, LIBC2, sha384)
709 CRYPTO_CHECK(SHA384, LIBC3, sha384)
710 CRYPTO_CHECK(SHA384, LIBSYSTEM, sha384)
711 CRYPTO_CHECK(SHA512, LIBC, sha512)
712 CRYPTO_CHECK(SHA512, LIBC2, sha512)
713 CRYPTO_CHECK(SHA512, LIBC3, sha512)
714 CRYPTO_CHECK(SHA512, LIBSYSTEM, sha512)
718 if test "x$with_nettle" != "xno"; then
719 AC_CHECK_HEADERS([nettle/md5.h nettle/ripemd160.h nettle/sha.h])
721 AC_CHECK_LIB(nettle,main)
722 CRYPTO_CHECK(MD5, NETTLE, md5)
723 CRYPTO_CHECK(RMD160, NETTLE, rmd160)
724 CRYPTO_CHECK(SHA1, NETTLE, sha1)
725 CRYPTO_CHECK(SHA256, NETTLE, sha256)
726 CRYPTO_CHECK(SHA384, NETTLE, sha384)
727 CRYPTO_CHECK(SHA512, NETTLE, sha512)
728 if test "x$found_NETTLE" != "xyes"; then
732 if test "x$with_openssl" != "xno"; then
733 AC_CHECK_HEADERS([openssl/evp.h])
739 AC_CHECK_LIB(eay64,main)
740 if test "x$ac_cv_lib_eay64_main" != "xyes"; then
741 AC_CHECK_LIB(eay32,main)
745 AC_CHECK_LIB(eay32,main)
750 AC_CHECK_LIB(crypto,main)
753 CRYPTO_CHECK(MD5, OPENSSL, md5)
754 CRYPTO_CHECK(RMD160, OPENSSL, rmd160)
755 CRYPTO_CHECK(SHA1, OPENSSL, sha1)
756 CRYPTO_CHECK(SHA256, OPENSSL, sha256)
757 CRYPTO_CHECK(SHA384, OPENSSL, sha384)
758 CRYPTO_CHECK(SHA512, OPENSSL, sha512)
759 if test "x$found_OPENSSL" != "xyes"; then
764 # Probe libmd AFTER OpenSSL/libcrypto.
765 # The two are incompatible and OpenSSL is more complete.
766 AC_CHECK_HEADERS([md5.h ripemd.h sha.h sha256.h sha512.h])
768 AC_CHECK_LIB(md,main)
769 CRYPTO_CHECK(MD5, LIBMD, md5)
770 CRYPTO_CHECK(RMD160, LIBMD, rmd160)
771 CRYPTO_CHECK(SHA1, LIBMD, sha1)
772 CRYPTO_CHECK(SHA256, LIBMD, sha256)
773 CRYPTO_CHECK(SHA512, LIBMD, sha512)
774 if test "x$found_LIBMD" != "xyes"; then
780 CRYPTO_CHECK_WIN(MD5, CALG_MD5)
781 CRYPTO_CHECK_WIN(SHA1, CALG_SHA1)
782 CRYPTO_CHECK_WIN(SHA256, CALG_SHA_256)
783 CRYPTO_CHECK_WIN(SHA384, CALG_SHA_384)
784 CRYPTO_CHECK_WIN(SHA512, CALG_SHA_512)