diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 322 |
1 files changed, 223 insertions, 99 deletions
diff --git a/configure.ac b/configure.ac index 5a93cd6..75c2ca3 100644 --- a/configure.ac +++ b/configure.ac @@ -4,18 +4,20 @@ dnl First, define all of the version numbers up front. dnl In particular, this allows the version macro to be used in AC_INIT dnl These first two version numbers are updated automatically on each release. -m4_define([LIBARCHIVE_VERSION_S],[2.8.5]) -m4_define([LIBARCHIVE_VERSION_N],[2008005]) +m4_define([LIBARCHIVE_VERSION_S],[3.0.3]) +m4_define([LIBARCHIVE_VERSION_N],[3000003]) dnl bsdtar and bsdcpio versioning tracks libarchive m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) m4_define([BSDCPIO_VERSION_S],LIBARCHIVE_VERSION_S()) +AC_PREREQ(2.65) + # # Now starts the "real" configure script. # -AC_INIT([libarchive],LIBARCHIVE_VERSION_S(),[kientzle@freebsd.org]) +AC_INIT([libarchive],LIBARCHIVE_VERSION_S(),[kientzle@FreeBSD.org]) # Make sure the srcdir contains "libarchive" directory AC_CONFIG_SRCDIR([libarchive]) # Use auxiliary subscripts from this subdirectory (cleans up root) @@ -25,15 +27,21 @@ AC_CONFIG_MACRO_DIR([build/autoconf]) # Must follow AC_CONFIG macros above... AM_INIT_AUTOMAKE() -# Libtool versioning uses different conventions on different -# platforms. At least on FreeBSD, libtool uses an overly complex -# convention that attempts to solve problems that most people just -# don't have and which just causes confusion for most end users. -ARCHIVE_MAJOR=$(( LIBARCHIVE_VERSION_N() / 1000000 )) +# Libtool's "interface version" can be computed from the libarchive version. + +# Libtool interface version bumps on any API change, so increments +# whenever libarchive minor version does. ARCHIVE_MINOR=$(( (LIBARCHIVE_VERSION_N() / 1000) % 1000 )) +# Libarchive 2.7 == libtool interface 9 = 2 + 7 +# Libarchive 2.8 == libtool interface 10 = 2 + 8 +# Libarchive 2.9 == libtool interface 11 = 2 + 8 +# Libarchive 3.0 == libtool interface 12 +# Libarchive 3.x == libtool interface 12 + x +ARCHIVE_INTERFACE=`echo $((12 + ${ARCHIVE_MINOR}))` +# Libarchive revision is bumped on any source change === libtool revision ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 )) -ARCHIVE_LIBTOOL_MAJOR=`echo $((${ARCHIVE_MAJOR} + ${ARCHIVE_MINOR}))` -ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_LIBTOOL_MAJOR:$ARCHIVE_REVISION:$ARCHIVE_MINOR +# Libarchive minor is bumped on any interface addition === libtool age +ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR # Stick the version numbers into config.h AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()", @@ -189,17 +197,47 @@ case $host in ;; esac +# We need CoreServices on Mac OS. +case $host in + *darwin* ) + LIBS="${LIBS} -framework CoreServices" + ;; +esac + # Checks for header files. AC_HEADER_DIRENT AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h ctype.h errno.h]) -AC_CHECK_HEADERS([ext2fs/ext2_fs.h fcntl.h grp.h]) -AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h linux/fs.h]) +AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h copyfile.h ctype.h]) +AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h grp.h]) + +AC_CACHE_CHECK([whether EXT2_IOC_GETFLAGS is usable], + [ac_cv_have_decl_EXT2_IOC_GETFLAGS], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include <sys/ioctl.h> +@%:@include <ext2fs/ext2_fs.h>], + [int x = EXT2_IOC_GETFLAGS])], + [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes])], + [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [no])])]) + +AS_VAR_IF([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes], + [AC_DEFINE_UNQUOTED([HAVE_WORKING_EXT2_IOC_GETFLAGS], [1], + [Define to 1 if you have a working EXT2_IOC_GETFLAGS])]) + +AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h]) +AC_CHECK_HEADERS([linux/fiemap.h linux/fs.h linux/magic.h]) AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h regex.h signal.h stdarg.h]) AC_CHECK_HEADERS([stdint.h stdlib.h string.h]) -AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/extattr.h sys/ioctl.h sys/mkdev.h]) -AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/time.h sys/utime.h]) -AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h windows.h]) +AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/extattr.h sys/ioctl.h]) +AC_CHECK_HEADERS([sys/mkdev.h sys/mount.h]) +AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/statfs.h sys/statvfs.h]) +AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h]) +AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h]) +AC_CHECK_HEADERS([windows.h]) +# check windows.h first; the other headers require it. +AC_CHECK_HEADERS([wincrypt.h winioctl.h],[],[], +[[#ifdef HAVE_WINDOWS_H +# include <windows.h> +#endif +]]) # Checks for libraries. AC_ARG_WITH([zlib], @@ -226,6 +264,25 @@ if test "x$with_lzmadec" != "xno"; then AC_CHECK_LIB(lzmadec,lzmadec_decode) fi +AC_ARG_WITH([iconv], + AS_HELP_STRING([--without-iconv], [Don't try to link against iconv])) + +if test "x$with_iconv" != "xno"; then + AC_CHECK_HEADERS([iconv.h],[],[],[#include <stdlib.h>]) + AM_ICONV + if test "x$am_cv_func_iconv" = "xyes"; then + AC_CHECK_HEADERS([localcharset.h]) + am_save_LIBS="$LIBS" + LIBS="${LIBS} ${LIBICONV}" + AC_CHECK_FUNCS([locale_charset]) + LIBS="${am_save_LIBS}" + if test "x$ac_cv_func_locale_charset" != "xyes"; then + # If locale_charset() is not in libiconv, we have to find libcharset. + AC_CHECK_LIB(charset,locale_charset) + fi + fi +fi + AC_ARG_WITH([lzma], AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma])) @@ -234,8 +291,13 @@ if test "x$with_lzma" != "xno"; then AC_CHECK_LIB(lzma,lzma_stream_decoder) fi +AC_ARG_WITH([nettle], + AS_HELP_STRING([--without-nettle], [Don't build with crypto support from Nettle])) AC_ARG_WITH([openssl], AS_HELP_STRING([--without-openssl], [Don't build support for mtree and xar hashes through openssl])) +case "$host_os" in + *darwin* ) with_openssl=no ;; +esac AC_ARG_WITH([xml2], AS_HELP_STRING([--without-xml2], [Don't build support for xar through libxml2])) @@ -247,9 +309,11 @@ if test "x$with_xml2" != "xno"; then if test "x$XML2_CONFIG" != "x"; then CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`" LIBS="${LIBS} `${XML2_CONFIG} --libs`" + AC_CHECK_LIB(xml2,xmlInitParser,[true],AC_MSG_FAILURE(Missing xml2 library)) + else + AC_CHECK_LIB(xml2,xmlInitParser) fi - AC_CHECK_HEADERS([libxml/xmlreader.h]) - AC_CHECK_LIB(xml2,xmlInitParser) + AC_CHECK_HEADERS([libxml/xmlreader.h libxml/xmlwriter.h]) fi if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then if test "x$with_expat" != "xno"; then @@ -258,72 +322,6 @@ if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then fi fi -AC_DEFUN([MD_CHECK], [ - if test "$found_$1" != yes; then - saved_LIBS="$LIBS" - saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I$srcdir/libarchive" - if test $ac_cv_header_sys_types_h = yes; then - CPPFLAGS="$CPPFLAGS -DHAVE_SYS_TYPES_H=1" - fi - LIBS="$LIBS $4" - AC_MSG_CHECKING([support for ARCHIVE_HASH_$1_$2]) - AC_LINK_IFELSE([ -#define $1_COMPILE_TEST -#define ARCHIVE_HASH_$1_$2 -#define __LIBARCHIVE_BUILD -#include "archive_hash.h" - -int -main(int argc, char **argv) -{ - archive_$3_ctx ctx; - - archive_$3_init(&ctx); - archive_$3_update(&ctx, *argv, argc); - archive_$3_final(&ctx, *argv); - return 0; -} -], - [ AC_MSG_RESULT([yes]) - found_$1=yes - mdLIBS="$mdLIBS $4" - AC_DEFINE(ARCHIVE_HASH_$1_$2, 1, [ $1 via ARCHIVE_HASH_$1_$2 supported.]) - ], - [ AC_MSG_RESULT([no])]) - LIBS="$saved_LIBS" - CPPFLAGS="$saved_CPPFLAGS" - fi -]) - -MD_CHECK(MD5, LIBC, md5) -MD_CHECK(MD5, LIBSYSTEM, md5) -MD_CHECK(RMD160, LIBC, rmd160) -MD_CHECK(SHA1, LIBC, sha1) -MD_CHECK(SHA1, LIBSYSTEM, sha1) -MD_CHECK(SHA256, LIBC, sha256) -MD_CHECK(SHA256, LIBC2, sha256) -MD_CHECK(SHA256, LIBC3, sha256) -MD_CHECK(SHA256, LIBSYSTEM, sha256) -MD_CHECK(SHA384, LIBC, sha384) -MD_CHECK(SHA384, LIBC2, sha384) -MD_CHECK(SHA384, LIBC3, sha384) -MD_CHECK(SHA384, LIBSYSTEM, sha384) -MD_CHECK(SHA512, LIBC, sha512) -MD_CHECK(SHA512, LIBC2, sha512) -MD_CHECK(SHA512, LIBC3, sha512) -MD_CHECK(SHA512, LIBSYSTEM, sha512) - -if test "x$with_openssl" != "xno"; then - MD_CHECK(MD5, OPENSSL, md5, -lcrypto) - MD_CHECK(RMD160, OPENSSL, rmd160, -lcrypto) - MD_CHECK(SHA1, OPENSSL, sha1, -lcrypto) - MD_CHECK(SHA256, OPENSSL, sha256, -lcrypto) - MD_CHECK(SHA384, OPENSSL, sha384, -lcrypto) - MD_CHECK(SHA512, OPENSSL, sha512, -lcrypto) -fi -LIBS="$LIBS $mdLIBS" - # TODO: Give the user the option of using a pre-existing system # libarchive. This will define HAVE_LIBARCHIVE which will cause # bsdtar_platform.h to use #include <...> for the libarchive headers. @@ -344,6 +342,19 @@ AC_TYPE_SIZE_T AC_CHECK_TYPE(id_t, [unsigned long]) AC_CHECK_TYPE(uintptr_t, [unsigned int]) +# Check for tm_gmtoff in struct tm +AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,, +[ +#include <time.h> +]) + +# Check for f_namemax in struct statfs +AC_CHECK_MEMBERS([struct statfs.f_namemax],,, +[ +#include <sys/param.h> +#include <sys/mount.h> +]) + # Check for birthtime in struct stat AC_CHECK_MEMBERS([struct stat.st_birthtime]) @@ -364,14 +375,24 @@ AC_CHECK_MEMBERS([struct stat.st_flags]) # TODO: Check for %ju and %llu support directly. AC_CHECK_TYPES([uintmax_t, unsigned long long]) -# We need int64_t, uint64_t, intmax_t, and uintmax_t +# We use C99-style integer types +# Declare them if the local platform doesn't already do so. AC_TYPE_INTMAX_T -AC_TYPE_INT64_T AC_TYPE_UINTMAX_T +AC_TYPE_INT64_T AC_TYPE_UINT64_T +AC_TYPE_INT32_T +AC_TYPE_UINT32_T +AC_TYPE_INT16_T +AC_TYPE_UINT16_T +AC_TYPE_UINT8_T -# TODO: If any of these are missing, define them right here. -AC_CHECK_DECLS([SIZE_MAX, SSIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX]) +AC_CHECK_DECLS([SIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX]) + +AC_CHECK_DECL([SSIZE_MAX], + [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.])], + [], + [#include <limits.h>]) AC_CHECK_DECL([EFTYPE], [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])], @@ -403,20 +424,34 @@ AC_FUNC_VPRINTF # To avoid necessity for including windows.h or special forward declaration # workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *' AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *]) -AC_CHECK_FUNCS([chflags chown chroot]) -AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fork]) -AC_CHECK_FUNCS([fstat ftruncate futimens futimes geteuid getpid]) -AC_CHECK_FUNCS([getgrgid_r getgrnam_r getpwnam_r getpwuid_r ]) -AC_CHECK_FUNCS([lchflags lchmod lchown link lstat]) -AC_CHECK_FUNCS([lutimes memmove memset mkdir mkfifo mknod]) -AC_CHECK_FUNCS([nl_langinfo pipe poll readlink]) -AC_CHECK_FUNCS([select setenv setlocale sigaction]) +AC_CHECK_FUNCS([chflags chown chroot ctime_r]) +AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fork]) +AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate]) +AC_CHECK_FUNCS([futimens futimes futimesat]) +AC_CHECK_FUNCS([geteuid getpid getgrgid_r getgrnam_r]) +AC_CHECK_FUNCS([getpwnam_r getpwuid_r getvfsbyname gmtime_r]) +AC_CHECK_FUNCS([lchflags lchmod lchown link localtime_r lstat lutimes]) +AC_CHECK_FUNCS([mbrtowc mbsnrtowcs memmove memset]) +AC_CHECK_FUNCS([mkdir mkfifo mknod mkstemp]) +AC_CHECK_FUNCS([nl_langinfo openat pipe poll readlink readlinkat]) +AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs]) AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm]) AC_CHECK_FUNCS([tzset unsetenv utime utimensat utimes vfork]) -AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy]) +AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wcsnrtombs wctomb wmemcmp wmemcpy]) +AC_CHECK_FUNCS([_ctime64_s _fseeki64]) +AC_CHECK_FUNCS([_get_timezone _localtime64_s _mkgmtime64]) # detects cygwin-1.7, as opposed to older versions AC_CHECK_FUNCS([cygwin_conv_path]) +# There are several variants of readdir_r around; we only +# accept the POSIX-compliant version. +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include <dirent.h>]], + [[DIR *dir; struct dirent e, *r; + return(readdir_r(dir, &e, &r));]])], + [AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have a POSIX compatible readdir_r])] +) + # FreeBSD's nl_langinfo supports an option to specify whether the # current locale uses month/day or day/month ordering. It makes the # output a little prettier... @@ -444,12 +479,14 @@ AC_ARG_ENABLE([xattr], if test "x$enable_xattr" != "xno"; then AC_CHECK_HEADERS([attr/xattr.h]) - AC_CHECK_HEADERS([sys/xattr.h]) + AC_CHECK_HEADERS([sys/xattr.h sys/ea.h]) AC_CHECK_LIB(attr,setxattr) AC_CHECK_FUNCS([extattr_get_file extattr_list_file]) AC_CHECK_FUNCS([extattr_set_fd extattr_set_file]) - AC_CHECK_FUNCS([fsetxattr getxattr]) + AC_CHECK_FUNCS([fgetxattr flistxattr fsetxattr getxattr]) AC_CHECK_FUNCS([lgetxattr listxattr llistxattr lsetxattr]) + AC_CHECK_FUNCS([fgetea flistea fsetea getea]) + AC_CHECK_FUNCS([lgetea listea llistea lsetea]) AC_CHECK_DECLS([EXTATTR_NAMESPACE_USER], [], [], [#include <sys/types.h> #include <sys/extattr.h> ]) @@ -505,4 +542,91 @@ fi # Additional requirements AC_SYS_LARGEFILE +dnl NOTE: Crypto checks must run last. +AC_DEFUN([CRYPTO_CHECK], [ + if test "$found_$1" != yes; then + saved_LIBS="$LIBS" + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" + LIBS="$LIBS $mdLIBS $4" + touch "check_crypto_md.h" + AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_$2]) + AC_LINK_IFELSE([AC_LANG_SOURCE([ +#define ARCHIVE_$1_COMPILE_TEST +#define ARCHIVE_CRYPTO_$1_$2 +#define PLATFORM_CONFIG_H "check_crypto_md.h" + +$(cat "$srcdir/libarchive/archive_crypto.c") + +int +main(int argc, char **argv) +{ + archive_$3_ctx ctx; + archive_$3_init(&ctx); + archive_$3_update(&ctx, *argv, argc); + archive_$3_final(&ctx, NULL); + return 0; +} +])], + [ AC_MSG_RESULT([yes]) + found_$1=yes + if [[ -n "$4" ]]; then + # The .$4 avoids -e, which doesn't work on Solaris 10 + # The _$mdLIBS allows .$4 to match at beginning of string <sigh> + test -n "$(echo _$mdLIBS | $GREP .$4)" || mdLIBS="$mdLIBS $4" + fi + AC_DEFINE(ARCHIVE_CRYPTO_$1_$2, 1, [ $1 via ARCHIVE_CRYPTO_$1_$2 supported.]) + ], + [ AC_MSG_RESULT([no])]) + LIBS="$saved_LIBS" + CPPFLAGS="$saved_CPPFLAGS" + rm "check_crypto_md.h" + fi +]) + +CRYPTO_CHECK(MD5, LIBC, md5) +CRYPTO_CHECK(MD5, LIBSYSTEM, md5) +CRYPTO_CHECK(RMD160, LIBC, rmd160) +CRYPTO_CHECK(SHA1, LIBC, sha1) +CRYPTO_CHECK(SHA1, LIBSYSTEM, sha1) +CRYPTO_CHECK(SHA256, LIBC, sha256) +CRYPTO_CHECK(SHA256, LIBC2, sha256) +CRYPTO_CHECK(SHA256, LIBC3, sha256) +CRYPTO_CHECK(SHA256, LIBSYSTEM, sha256) +CRYPTO_CHECK(SHA384, LIBC, sha384) +CRYPTO_CHECK(SHA384, LIBC2, sha384) +CRYPTO_CHECK(SHA384, LIBC3, sha384) +CRYPTO_CHECK(SHA384, LIBSYSTEM, sha384) +CRYPTO_CHECK(SHA512, LIBC, sha512) +CRYPTO_CHECK(SHA512, LIBC2, sha512) +CRYPTO_CHECK(SHA512, LIBC3, sha512) +CRYPTO_CHECK(SHA512, LIBSYSTEM, sha512) + +if test "x$with_nettle" != "xno"; then + CRYPTO_CHECK(MD5, NETTLE, md5, -lnettle) + CRYPTO_CHECK(RMD160, NETTLE, rmd160, -lnettle) + CRYPTO_CHECK(SHA1, NETTLE, sha1, -lnettle) + CRYPTO_CHECK(SHA256, NETTLE, sha256, -lnettle) + CRYPTO_CHECK(SHA384, NETTLE, sha384, -lnettle) + CRYPTO_CHECK(SHA512, NETTLE, sha512, -lnettle) +fi +if test "x$with_openssl" != "xno"; then + CRYPTO_CHECK(MD5, OPENSSL, md5, -lcrypto) + CRYPTO_CHECK(RMD160, OPENSSL, rmd160, -lcrypto) + CRYPTO_CHECK(SHA1, OPENSSL, sha1, -lcrypto) + CRYPTO_CHECK(SHA256, OPENSSL, sha256, -lcrypto) + CRYPTO_CHECK(SHA384, OPENSSL, sha384, -lcrypto) + CRYPTO_CHECK(SHA512, OPENSSL, sha512, -lcrypto) +fi + +# Probe libmd AFTER OpenSSL/libcrypto. +# The two are incompatible and OpenSSL is more complete. +CRYPTO_CHECK(MD5, LIBMD, md5, -lmd) +CRYPTO_CHECK(RMD160, LIBMD, rmd160, -lmd) +CRYPTO_CHECK(SHA1, LIBMD, sha1, -lmd) +CRYPTO_CHECK(SHA256, LIBMD, sha256, -lmd) +CRYPTO_CHECK(SHA512, LIBMD, sha512, -lmd) + +LIBS="$LIBS $mdLIBS" + AC_OUTPUT |