diff --git a/.cirrus.yml b/.cirrus.yml index 472338e2ac80..e8235e426e62 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,44 +1,44 @@ env: CIRRUS_CLONE_DEPTH: 1 ARCH: amd64 FreeBSD_task: matrix: env: BS: autotools env: BS: cmake matrix: freebsd_instance: - image_family: freebsd-12-1 + image_family: freebsd-12-2 freebsd_instance: image_family: freebsd-11-4 prepare_script: - ./build/ci/cirrus_ci/ci.sh prepare configure_script: - env CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./build/ci/build.sh -a autogen - env CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./build/ci/build.sh -a configure build_script: - ./build/ci/build.sh -a build test_script: - ./build/ci/build.sh -a test - ./build/ci/cirrus_ci/ci.sh test install_script: - ./build/ci/build.sh -a install Windows_Cygwin_task: windows_container: image: cirrusci/windowsservercore:2019 os_version: 2019 env: BE: cygwin-gcc prepare_script: - build\ci\cirrus_ci\ci.cmd prepare configure_script: - build\ci\cirrus_ci\ci.cmd configure build_script: - build\ci\cirrus_ci\ci.cmd build test_script: - build\ci\cirrus_ci\ci.cmd test install_script: - build\ci\cirrus_ci\ci.cmd install diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d8fc3c46dc0..58b4c8d9862a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,2056 +1,2056 @@ # CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR) if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) #3.12.0 `find_package()`` uses ``_ROOT`` variables. endif() # PROJECT(libarchive C) # SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin) endif() # # Set the Build type for make based generators. # You can choose following types: # Debug : Debug build # Release : Release build # RelWithDebInfo : Release build with Debug Info # MinSizeRel : Release Min Size build IF(NOT CMAKE_BUILD_TYPE) - SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Type" FORCE) + SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type" FORCE) ENDIF(NOT CMAKE_BUILD_TYPE) # Set a value type to properly display CMAKE_BUILD_TYPE on GUI if the # value type is "UNINITIALIZED". GET_PROPERTY(cached_type CACHE CMAKE_BUILD_TYPE PROPERTY TYPE) IF("${cached_type}" STREQUAL "UNINITIALIZED") SET(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Build Type" FORCE) ENDIF("${cached_type}" STREQUAL "UNINITIALIZED") # Check the Build Type. IF(NOT "${CMAKE_BUILD_TYPE}" MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)\$") MESSAGE(FATAL_ERROR "Unknown keyword for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}\n" "Acceptable keywords: Debug,Release,RelWithDebInfo,MinSizeRel") ENDIF(NOT "${CMAKE_BUILD_TYPE}" MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)\$") # On MacOS, prefer MacPorts libraries to system libraries. # I haven't come up with a compelling argument for this to be conditional. list(APPEND CMAKE_PREFIX_PATH /opt/local) # Enable @rpath in the install name. # detail in "cmake --help-policy CMP0042" SET(CMAKE_MACOSX_RPATH ON) # # Version - read from 'version' file. # FILE(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/build/version _version) STRING(REGEX REPLACE "^([0-9])[0-9][0-9][0-9][0-9][0-9][0-9][a-z]*$" "\\1" _major ${_version}) STRING(REGEX REPLACE "^[0-9]([0-9][0-9][0-9])[0-9][0-9][0-9][a-z]*$" "\\1" _minor ${_version}) STRING(REGEX REPLACE "^[0-9][0-9][0-9][0-9]([0-9][0-9][0-9])[a-z]*$" "\\1" _revision ${_version}) STRING(REGEX REPLACE "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9]([a-z]*)$" "\\1" _quality ${_version}) SET(_version_number ${_major}${_minor}${_revision}) STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_minor ${_minor}) STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_revision ${_revision}) # SET(VERSION "${_major}.${_trimmed_minor}.${_trimmed_revision}${_quality}") SET(BSDCPIO_VERSION_STRING "${VERSION}") SET(BSDTAR_VERSION_STRING "${VERSION}") SET(BSDCAT_VERSION_STRING "${VERSION}") SET(LIBARCHIVE_VERSION_NUMBER "${_version_number}") SET(LIBARCHIVE_VERSION_STRING "${VERSION}") # INTERFACE_VERSION increments with every release # libarchive 2.7 == interface version 9 = 2 + 7 # libarchive 2.8 == interface version 10 = 2 + 8 # libarchive 2.9 == interface version 11 = 2 + 9 # libarchive 3.0 == interface version 12 # libarchive 3.1 == interface version 13 math(EXPR INTERFACE_VERSION "13 + ${_minor}") # Set SOVERSION == Interface version # ?? Should there be more here ?? SET(SOVERSION "${INTERFACE_VERSION}") # Enalbe CMAKE_PUSH_CHECK_STATE() and CMAKE_POP_CHECK_STATE() macros # saving and restoring the state of the variables. INCLUDE(CMakePushCheckState) # Initialize the state of the variables. This initialization is not # necessary but this shows you what value the variables initially have. SET(CMAKE_REQUIRED_DEFINITIONS) SET(CMAKE_REQUIRED_INCLUDES) SET(CMAKE_REQUIRED_LIBRARIES) SET(CMAKE_REQUIRED_FLAGS) if (CMAKE_BUILD_TYPE STREQUAL "Debug") OPTION(ENABLE_WERROR "Treat warnings as errors - default is ON for Debug, OFF otherwise." ON) else () OPTION(ENABLE_WERROR "Treat warnings as errors - default is ON for Debug, OFF otherwise." OFF) endif () # Especially for early development, we want to be a little # aggressive about diagnosing build problems; this can get # relaxed somewhat in final shipping versions. IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$") SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security") ################################################################# # Set compile flags for all build types. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wformat -Wformat-security") if (ENABLE_WERROR) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") endif () ################################################################# # Set compile flags for debug build. # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wextra") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wunused") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wmissing-prototypes") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wcast-qual") ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$") IF (CMAKE_C_COMPILER_ID MATCHES "^Clang$") SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security") ################################################################# # Set compile flags for all build types. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wformat -Wformat-security") if (ENABLE_WERROR) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror") endif () ################################################################# # Set compile flags for debug build. # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wextra") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wunused") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wmissing-prototypes") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wcast-qual") ENDIF (CMAKE_C_COMPILER_ID MATCHES "^Clang$") IF (CMAKE_C_COMPILER_ID MATCHES "^XL$") SET(CMAKE_C_COMPILER "xlc_r") SET(CMAKE_REQUIRED_FLAGS "-qflag=e:e -qformat=sec") ################################################################# # Set compile flags for all build types. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qflag=e:e -qformat=sec") if (ENABLE_WERROR) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qhalt=w") endif () ################################################################# # Set compile flags for debug build. # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qflag=w:w") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qinfo=pro:use") ENDIF(CMAKE_C_COMPILER_ID MATCHES "^XL$") IF (MSVC) if (ENABLE_WERROR) # /WX option is the same as gcc's -Werror option. SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX") endif () ################################################################# # Set compile flags for debug build. # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" # Enable level 4 C4062: The enumerate has no associated handler in a switch # statement and there is no default that can catch it. SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /w14062") # Enable level 4 C4254: A larger bit field was assigned to a smaller bit # field. SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /w14254") # Enable level 4 C4295: An array was initialized but the last character in # the array is not a null; accessing the array may # produce unexpected results. SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /w14295") # Enable level 4 C4296: An unsigned variable was used in a comparison # operation with zero. SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /w14296") # Enable level 4 C4389: An operation involved signed and unsigned variables. # This could result in a loss of data. SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /w14389") # Enable level 4 C4505: The given function is local and not referenced in # the body of the module; therefore, the function is # dead code. SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /w14505") # Enable level 4 C4514: The optimizer removed an inline function that is not # called. SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /w14514") # Enable level 4 C4702: Unreachable code. SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /w14702") # Enable level 4 C4706: The test value in a conditional expression was the # result of an assignment. SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /w14706") # /Oi option enables built-in functions. SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Oi") ################################################################# # Set compile flags for release build. SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi") ENDIF (MSVC) # Enable CTest/CDash support include(CTest) OPTION(ENABLE_MBEDTLS "Enable use of mbed TLS" OFF) OPTION(ENABLE_NETTLE "Enable use of Nettle" OFF) OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON) OPTION(ENABLE_LIBB2 "Enable the use of the system LIBB2 library if found" ON) OPTION(ENABLE_LZ4 "Enable the use of the system LZ4 library if found" ON) OPTION(ENABLE_LZO "Enable the use of the system LZO library if found" OFF) OPTION(ENABLE_LZMA "Enable the use of the system LZMA library if found" ON) OPTION(ENABLE_ZSTD "Enable the use of the system zstd library if found" ON) OPTION(ENABLE_ZLIB "Enable the use of the system ZLIB library if found" ON) OPTION(ENABLE_BZip2 "Enable the use of the system BZip2 library if found" ON) OPTION(ENABLE_LIBXML2 "Enable the use of the system libxml2 library if found" ON) OPTION(ENABLE_EXPAT "Enable the use of the system EXPAT library if found" ON) OPTION(ENABLE_PCREPOSIX "Enable the use of the system PCREPOSIX library if found" ON) OPTION(ENABLE_LibGCC "Enable the use of the system LibGCC library if found" ON) # CNG is used for encrypt/decrypt Zip archives on Windows. OPTION(ENABLE_CNG "Enable the use of CNG(Crypto Next Generation)" ON) OPTION(ENABLE_TAR "Enable tar building" ON) OPTION(ENABLE_TAR_SHARED "Enable dynamic build of tar" FALSE) OPTION(ENABLE_CPIO "Enable cpio building" ON) OPTION(ENABLE_CPIO_SHARED "Enable dynamic build of cpio" FALSE) OPTION(ENABLE_CAT "Enable cat building" ON) OPTION(ENABLE_CAT_SHARED "Enable dynamic build of cat" FALSE) OPTION(ENABLE_XATTR "Enable extended attribute support" ON) OPTION(ENABLE_ACL "Enable ACL support" ON) OPTION(ENABLE_ICONV "Enable iconv support" ON) OPTION(ENABLE_TEST "Enable unit and regression tests" ON) OPTION(ENABLE_COVERAGE "Enable code coverage (GCC only, automatically sets ENABLE_TEST to ON)" FALSE) OPTION(ENABLE_INSTALL "Enable installing of libraries" ON) SET(POSIX_REGEX_LIB "AUTO" CACHE STRING "Choose what library should provide POSIX regular expression support") SET(ENABLE_SAFESEH "AUTO" CACHE STRING "Enable use of /SAFESEH linker flag (MSVC only)") SET(WINDOWS_VERSION "WIN7" CACHE STRING "Set Windows version to use (Windows only)") IF(ENABLE_COVERAGE) include(LibarchiveCodeCoverage) ENDIF(ENABLE_COVERAGE) IF(ENABLE_TEST) ENABLE_TESTING() ENDIF(ENABLE_TEST) IF(WIN32) IF(WINDOWS_VERSION STREQUAL "WIN8") SET(NTDDI_VERSION 0x06020000) SET(_WIN32_WINNT 0x0602) SET(WINVER 0x0602) ELSEIF(WINDOWS_VERSION STREQUAL "WIN7") SET(NTDDI_VERSION 0x06010000) SET(_WIN32_WINNT 0x0601) SET(WINVER 0x0601) ELSEIF(WINDOWS_VERSION STREQUAL "WS08") SET(NTDDI_VERSION 0x06000100) SET(_WIN32_WINNT 0x0600) SET(WINVER 0x0600) ELSEIF(WINDOWS_VERSION STREQUAL "VISTA") SET(NTDDI_VERSION 0x06000000) SET(_WIN32_WINNT 0x0600) SET(WINVER 0x0600) ELSEIF(WINDOWS_VERSION STREQUAL "WS03") SET(NTDDI_VERSION 0x05020000) SET(_WIN32_WINNT 0x0502) SET(WINVER 0x0502) ELSEIF(WINDOWS_VERSION STREQUAL "WINXP") SET(NTDDI_VERSION 0x05010000) SET(_WIN32_WINNT 0x0501) SET(WINVER 0x0501) ELSE(WINDOWS_VERSION STREQUAL "WIN8") # Default to Windows Server 2003 API if we don't recognize the specifier SET(NTDDI_VERSION 0x05020000) SET(_WIN32_WINNT 0x0502) SET(WINVER 0x0502) ENDIF(WINDOWS_VERSION STREQUAL "WIN8") ENDIF(WIN32) IF(MSVC) IF(ENABLE_SAFESEH STREQUAL "YES") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH") SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH") SET(ENV{LDFLAGS} "$ENV{LDFLAGS} /SAFESEH") ELSEIF(ENABLE_SAFESEH STREQUAL "NO") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO") SET(ENV{LDFLAGS} "$ENV{LDFLAGS} /SAFESEH:NO") ENDIF(ENABLE_SAFESEH STREQUAL "YES") ENDIF(MSVC) IF("${CMAKE_C_PLATFORM_ID}" MATCHES "^(HP-UX)$") ADD_DEFINITIONS(-D_XOPEN_SOURCE=500) # Ask wchar.h for mbstate_t ENDIF() IF(MINGW) ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO) ENDIF() # INCLUDE(CheckCSourceCompiles) INCLUDE(CheckCSourceRuns) INCLUDE(CheckFileOffsetBits) INCLUDE(CheckFuncs) INCLUDE(CheckHeaderDirent) INCLUDE(CheckIncludeFile) INCLUDE(CheckIncludeFiles) INCLUDE(CheckLibraryExists) INCLUDE(CheckStructHasMember) INCLUDE(CheckSymbolExists) INCLUDE(CheckTypeExists) INCLUDE(CheckTypeSize) # # Generate list.h # MACRO (GENERATE_LIST_H _listfile _cmlist __list_sources) SET(_argv ${ARGV}) # Remove _listfile and _cmlist from _argv LIST(REMOVE_AT _argv 0 1) IF (NOT EXISTS "${_listfile}" OR ${_cmlist} IS_NEWER_THAN "${_listfile}") MESSAGE(STATUS "Generating ${_listfile}") FILE(WRITE ${_listfile} "") FOREACH (testfile ${_argv}) IF (testfile MATCHES "^test_[^/]+[.]c$") FILE(STRINGS ${testfile} testvar REGEX "^DEFINE_TEST") FOREACH (deftest ${testvar}) FILE(APPEND ${_listfile} "${deftest}\n") ENDFOREACH (deftest) ENDIF (testfile MATCHES "^test_[^/]+[.]c$") ENDFOREACH (testfile) ENDIF (NOT EXISTS "${_listfile}" OR ${_cmlist} IS_NEWER_THAN "${_listfile}") ENDMACRO (GENERATE_LIST_H) # # Generate installation rules for man pages. # MACRO (INSTALL_MAN __mans) FOREACH (_man ${ARGV}) STRING(REGEX REPLACE "^.+[.]([1-9])" "\\1" _mansect ${_man}) INSTALL(FILES ${_man} DESTINATION "share/man/man${_mansect}") ENDFOREACH (_man) ENDMACRO (INSTALL_MAN __mans) # # Find out what macro is needed to use libraries on Windows. # MACRO (TRY_MACRO_FOR_LIBRARY INCLUDES LIBRARIES TRY_TYPE SAMPLE_SOURCE MACRO_LIST) IF(WIN32 AND NOT CYGWIN) CMAKE_PUSH_CHECK_STATE() # Save the state of the variables SET(CMAKE_REQUIRED_INCLUDES ${INCLUDES}) SET(CMAKE_REQUIRED_LIBRARIES ${LIBRARIES}) FOREACH(VAR ${MACRO_LIST}) # Clear ${VAR} from CACHE If the libraries which ${VAR} was # checked with are changed. SET(VAR_WITH_LIB "${VAR}_WITH_LIB") GET_PROPERTY(PREV_VAR_WITH_LIB VARIABLE PROPERTY ${VAR_WITH_LIB}) IF(NOT "${PREV_VAR_WITH_LIB}" STREQUAL "${LIBRARIES}") UNSET(${VAR} CACHE) ENDIF(NOT "${PREV_VAR_WITH_LIB}" STREQUAL "${LIBRARIES}") # Check if the library can be used with the macro. IF("${TRY_TYPE}" MATCHES "COMPILES") CHECK_C_SOURCE_COMPILES("${SAMPLE_SOURCE}" ${VAR}) ELSEIF("${TRY_TYPE}" MATCHES "RUNS") CHECK_C_SOURCE_RUNS("${SAMPLE_SOURCE}" ${VAR}) ELSE("${TRY_TYPE}" MATCHES "COMPILES") MESSAGE(FATAL_ERROR "UNKNOWN KEYWORD \"${TRY_TYPE}\" FOR TRY_TYPE") ENDIF("${TRY_TYPE}" MATCHES "COMPILES") # Save the libraries which ${VAR} is checked with. SET(${VAR_WITH_LIB} "${LIBRARIES}" CACHE INTERNAL "Macro ${VAR} is checked with") ENDFOREACH(VAR) CMAKE_POP_CHECK_STATE() # Restore the state of the variables ENDIF(WIN32 AND NOT CYGWIN) ENDMACRO (TRY_MACRO_FOR_LIBRARY) # # Check compress/decompress libraries # IF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN) # GnuWin32 is only for Win32, not Win64. SET(__GNUWIN32PATH "C:/Program Files/GnuWin32") ENDIF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN) IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") # You have to add a path availabel DLL file into PATH environment variable. # Maybe DLL path is "C:/Program Files/GnuWin32/bin". # The zlib and the bzip2 Setup program have installed programs and DLLs into # "C:/Program Files/GnuWin32" by default. # This is convenience setting for Windows. SET(CMAKE_PREFIX_PATH ${__GNUWIN32PATH} $(CMAKE_PREFIX_PATH)) # # If you didn't use Setup program or installed into nonstandard path, # cmake cannot find out your zlib or bzip2 libraries and include files, # you should execute cmake with -DCMAKE_PREFIX_PATH option. # e.g. # cmake -DCMAKE_PREFIX_PATH= # # If compiling error occurred in zconf.h, You may need patch to zconf.h. #--- zconf.h.orig 2005-07-21 00:40:26.000000000 #+++ zconf.h 2009-01-19 11:39:10.093750000 #@@ -286,7 +286,7 @@ # # #if 1 /* HAVE_UNISTD_H -- this line is updated by ./configure */ # # include /* for off_t */ #-# include /* for SEEK_* and off_t */ #+# include /* for SEEK_* and off_t */ # # ifdef VMS # # include /* for off_t */ # # endif ENDIF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") SET(ADDITIONAL_LIBS "") # # Find ZLIB # IF(ENABLE_ZLIB) FIND_PACKAGE(ZLIB) ELSE() SET(ZLIB_FOUND FALSE) # Override cached value ENDIF() IF(ZLIB_FOUND) SET(HAVE_LIBZ 1) SET(HAVE_ZLIB_H 1) INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) IF(WIN32 AND NOT CYGWIN) # # Test if ZLIB_WINAPI macro is needed to use. # TRY_MACRO_FOR_LIBRARY( "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" RUNS "#include \nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" ZLIB_WINAPI) IF(ZLIB_WINAPI) ADD_DEFINITIONS(-DZLIB_WINAPI) ELSE(ZLIB_WINAPI) # Test if a macro is needed for the library. TRY_MACRO_FOR_LIBRARY( "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" COMPILES "#include \nint main() {return zlibVersion()?1:0; }" "ZLIB_DLL;WITHOUT_ZLIB_DLL") IF(ZLIB_DLL) ADD_DEFINITIONS(-DZLIB_DLL) ENDIF(ZLIB_DLL) ENDIF(ZLIB_WINAPI) ENDIF(WIN32 AND NOT CYGWIN) ENDIF(ZLIB_FOUND) MARK_AS_ADVANCED(CLEAR ZLIB_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR ZLIB_LIBRARY) # # Find BZip2 # IF(ENABLE_BZip2) FIND_PACKAGE(BZip2) ELSE() SET(BZIP2_FOUND FALSE) # Override cached value ENDIF() IF(BZIP2_FOUND) SET(HAVE_LIBBZ2 1) SET(HAVE_BZLIB_H 1) INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${BZIP2_LIBRARIES}) # Test if a macro is needed for the library. TRY_MACRO_FOR_LIBRARY( "${BZIP2_INCLUDE_DIR}" "${BZIP2_LIBRARIES}" COMPILES "#include \nint main() {return BZ2_bzlibVersion()?1:0; }" "USE_BZIP2_DLL;USE_BZIP2_STATIC") IF(USE_BZIP2_DLL) ADD_DEFINITIONS(-DUSE_BZIP2_DLL) ELSEIF(USE_BZIP2_STATIC) ADD_DEFINITIONS(-DUSE_BZIP2_STATIC) ENDIF(USE_BZIP2_DLL) ENDIF(BZIP2_FOUND) MARK_AS_ADVANCED(CLEAR BZIP2_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR BZIP2_LIBRARIES) # # Find LZMA # IF(ENABLE_LZMA) FIND_PACKAGE(LibLZMA) ELSE() SET(LIBLZMA_FOUND FALSE) # Override cached value ENDIF() IF(LIBLZMA_FOUND) SET(HAVE_LIBLZMA 1) SET(HAVE_LZMA_H 1) CMAKE_PUSH_CHECK_STATE() SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIR}) SET(CMAKE_REQUIRED_LIBRARIES ${LIBLZMA_LIBRARIES}) INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS}) LIST(APPEND ADDITIONAL_LIBS ${LIBLZMA_LIBRARIES}) # Test if a macro is needed for the library. TRY_MACRO_FOR_LIBRARY( "${LIBLZMA_INCLUDE_DIRS}" "${LIBLZMA_LIBRARIES}" COMPILES "#include \nint main() {return (int)lzma_version_number(); }" "WITHOUT_LZMA_API_STATIC;LZMA_API_STATIC") IF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC) ADD_DEFINITIONS(-DLZMA_API_STATIC) ENDIF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC) CMAKE_POP_CHECK_STATE() ELSE(LIBLZMA_FOUND) # LZMA not found and will not be used. ENDIF(LIBLZMA_FOUND) MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR LIBLZMA_LIBRARY) # # Find LZO2 # IF(ENABLE_LZO) IF (LZO2_INCLUDE_DIR) # Already in cache, be silent SET(LZO2_FIND_QUIETLY TRUE) ENDIF (LZO2_INCLUDE_DIR) FIND_PATH(LZO2_INCLUDE_DIR lzo/lzoconf.h) FIND_LIBRARY(LZO2_LIBRARY NAMES lzo2 liblzo2) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO2 DEFAULT_MSG LZO2_LIBRARY LZO2_INCLUDE_DIR) ELSE(ENABLE_LZO) SET(LZO2_FOUND FALSE) # Override cached value ENDIF(ENABLE_LZO) IF(LZO2_FOUND) SET(HAVE_LIBLZO2 1) SET(HAVE_LZO_LZOCONF_H 1) SET(HAVE_LZO_LZO1X_H 1) INCLUDE_DIRECTORIES(${LZO2_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${LZO2_LIBRARY}) # # TODO: test for static library. # ENDIF(LZO2_FOUND) MARK_AS_ADVANCED(CLEAR LZO2_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR LZO2_LIBRARY) # # Find libb2 # IF(ENABLE_LIBB2) IF (LIBB2_INCLUDE_DIR) # Already in cache, be silent SET(LIBB2_FIND_QUIETLY TRUE) ENDIF (LIBB2_INCLUDE_DIR) FIND_PATH(LIBB2_INCLUDE_DIR blake2.h) FIND_LIBRARY(LIBB2_LIBRARY NAMES b2 libb2) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBB2 DEFAULT_MSG LIBB2_LIBRARY LIBB2_INCLUDE_DIR) ELSE(ENABLE_LIBB2) SET(LIBB2_FOUND FALSE) # Override cached value ENDIF(ENABLE_LIBB2) IF(LIBB2_FOUND) SET(HAVE_LIBB2 1) SET(HAVE_BLAKE2_H 1) SET(ARCHIVE_BLAKE2 FALSE) LIST(APPEND ADDITIONAL_LIBS ${LIBB2_LIBRARY}) CMAKE_PUSH_CHECK_STATE() SET(CMAKE_REQUIRED_LIBRARIES ${LIBB2_LIBRARY}) SET(CMAKE_REQUIRED_INCLUDES ${LIBB2_INCLUDE_DIR}) CHECK_FUNCTION_EXISTS(blake2sp_init HAVE_LIBB2) CMAKE_POP_CHECK_STATE() ELSE(LIBB2_FOUND) SET(ARCHIVE_BLAKE2 TRUE) ENDIF(LIBB2_FOUND) # # Find LZ4 # IF(ENABLE_LZ4) IF (LZ4_INCLUDE_DIR) # Already in cache, be silent SET(LZ4_FIND_QUIETLY TRUE) ENDIF (LZ4_INCLUDE_DIR) FIND_PATH(LZ4_INCLUDE_DIR lz4.h) FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR) ELSE(ENABLE_LZ4) SET(LZ4_FOUND FALSE) # Override cached value ENDIF(ENABLE_LZ4) IF(LZ4_FOUND) SET(HAVE_LIBLZ4 1) SET(HAVE_LZ4_H 1) CMAKE_PUSH_CHECK_STATE() # Save the state of the variables SET(CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIR}) CHECK_INCLUDE_FILES("lz4hc.h" HAVE_LZ4HC_H) CMAKE_POP_CHECK_STATE() # Restore the state of the variables INCLUDE_DIRECTORIES(${LZ4_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${LZ4_LIBRARY}) # # TODO: test for static library. # ENDIF(LZ4_FOUND) MARK_AS_ADVANCED(CLEAR LZ4_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR LZ4_LIBRARY) # # Find Zstd # IF(ENABLE_ZSTD) IF (ZSTD_INCLUDE_DIR) # Already in cache, be silent SET(ZSTD_FIND_QUIETLY TRUE) ENDIF (ZSTD_INCLUDE_DIR) FIND_PATH(ZSTD_INCLUDE_DIR zstd.h) FIND_LIBRARY(ZSTD_LIBRARY NAMES zstd libzstd) INCLUDE(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZSTD DEFAULT_MSG ZSTD_LIBRARY ZSTD_INCLUDE_DIR) ELSE(ENABLE_ZSTD) SET(ZSTD_FOUND FALSE) # Override cached value ENDIF(ENABLE_ZSTD) IF(ZSTD_FOUND) SET(HAVE_ZSTD_H 1) INCLUDE_DIRECTORIES(${ZSTD_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${ZSTD_LIBRARY}) CMAKE_PUSH_CHECK_STATE() SET(CMAKE_REQUIRED_LIBRARIES ${ZSTD_LIBRARY}) SET(CMAKE_REQUIRED_INCLUDES ${ZSTD_INCLUDE_DIR}) CHECK_FUNCTION_EXISTS(ZSTD_compressStream HAVE_LIBZSTD) # # TODO: test for static library. # CMAKE_POP_CHECK_STATE() ENDIF(ZSTD_FOUND) MARK_AS_ADVANCED(CLEAR ZSTD_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR ZSTD_LIBRARY) # # Check headers # CHECK_HEADER_DIRENT() SET(INCLUDES "") MACRO (LA_CHECK_INCLUDE_FILE header var) CHECK_INCLUDE_FILES("${INCLUDES};${header}" ${var}) IF (${var}) SET(INCLUDES ${INCLUDES} ${header}) ENDIF (${var}) ENDMACRO (LA_CHECK_INCLUDE_FILE) # Some FreeBSD headers assume sys/types.h was already included. LA_CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H) # Alphabetize the rest unless there's a compelling reason LA_CHECK_INCLUDE_FILE("acl/libacl.h" HAVE_ACL_LIBACL_H) LA_CHECK_INCLUDE_FILE("attr/xattr.h" HAVE_ATTR_XATTR_H) LA_CHECK_INCLUDE_FILE("ctype.h" HAVE_CTYPE_H) LA_CHECK_INCLUDE_FILE("copyfile.h" HAVE_COPYFILE_H) LA_CHECK_INCLUDE_FILE("direct.h" HAVE_DIRECT_H) LA_CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H) LA_CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H) LA_CHECK_INCLUDE_FILE("ext2fs/ext2_fs.h" HAVE_EXT2FS_EXT2_FS_H) CHECK_C_SOURCE_COMPILES("#include #include int main(void) { return EXT2_IOC_GETFLAGS; }" HAVE_WORKING_EXT2_IOC_GETFLAGS) LA_CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H) LA_CHECK_INCLUDE_FILE("grp.h" HAVE_GRP_H) LA_CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H) LA_CHECK_INCLUDE_FILE("io.h" HAVE_IO_H) LA_CHECK_INCLUDE_FILE("langinfo.h" HAVE_LANGINFO_H) LA_CHECK_INCLUDE_FILE("limits.h" HAVE_LIMITS_H) LA_CHECK_INCLUDE_FILE("linux/types.h" HAVE_LINUX_TYPES_H) LA_CHECK_INCLUDE_FILE("linux/fiemap.h" HAVE_LINUX_FIEMAP_H) LA_CHECK_INCLUDE_FILE("linux/fs.h" HAVE_LINUX_FS_H) CHECK_C_SOURCE_COMPILES("#include #include int main(void) { return FS_IOC_GETFLAGS; }" HAVE_WORKING_FS_IOC_GETFLAGS) LA_CHECK_INCLUDE_FILE("linux/magic.h" HAVE_LINUX_MAGIC_H) LA_CHECK_INCLUDE_FILE("locale.h" HAVE_LOCALE_H) LA_CHECK_INCLUDE_FILE("membership.h" HAVE_MEMBERSHIP_H) LA_CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H) LA_CHECK_INCLUDE_FILE("paths.h" HAVE_PATHS_H) LA_CHECK_INCLUDE_FILE("poll.h" HAVE_POLL_H) LA_CHECK_INCLUDE_FILE("process.h" HAVE_PROCESS_H) LA_CHECK_INCLUDE_FILE("pthread.h" HAVE_PTHREAD_H) LA_CHECK_INCLUDE_FILE("pwd.h" HAVE_PWD_H) LA_CHECK_INCLUDE_FILE("readpassphrase.h" HAVE_READPASSPHRASE_H) LA_CHECK_INCLUDE_FILE("regex.h" HAVE_REGEX_H) LA_CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H) LA_CHECK_INCLUDE_FILE("spawn.h" HAVE_SPAWN_H) LA_CHECK_INCLUDE_FILE("stdarg.h" HAVE_STDARG_H) LA_CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H) LA_CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H) LA_CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H) LA_CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H) LA_CHECK_INCLUDE_FILE("sys/acl.h" HAVE_SYS_ACL_H) LA_CHECK_INCLUDE_FILE("sys/cdefs.h" HAVE_SYS_CDEFS_H) LA_CHECK_INCLUDE_FILE("sys/extattr.h" HAVE_SYS_EXTATTR_H) LA_CHECK_INCLUDE_FILE("sys/ioctl.h" HAVE_SYS_IOCTL_H) LA_CHECK_INCLUDE_FILE("sys/mkdev.h" HAVE_SYS_MKDEV_H) LA_CHECK_INCLUDE_FILE("sys/mount.h" HAVE_SYS_MOUNT_H) LA_CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H) LA_CHECK_INCLUDE_FILE("sys/poll.h" HAVE_SYS_POLL_H) LA_CHECK_INCLUDE_FILE("sys/richacl.h" HAVE_SYS_RICHACL_H) LA_CHECK_INCLUDE_FILE("sys/select.h" HAVE_SYS_SELECT_H) LA_CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H) LA_CHECK_INCLUDE_FILE("sys/statfs.h" HAVE_SYS_STATFS_H) LA_CHECK_INCLUDE_FILE("sys/statvfs.h" HAVE_SYS_STATVFS_H) LA_CHECK_INCLUDE_FILE("sys/sysmacros.h" HAVE_SYS_SYSMACROS_H) LA_CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H) LA_CHECK_INCLUDE_FILE("sys/utime.h" HAVE_SYS_UTIME_H) LA_CHECK_INCLUDE_FILE("sys/utsname.h" HAVE_SYS_UTSNAME_H) LA_CHECK_INCLUDE_FILE("sys/vfs.h" HAVE_SYS_VFS_H) LA_CHECK_INCLUDE_FILE("sys/wait.h" HAVE_SYS_WAIT_H) LA_CHECK_INCLUDE_FILE("sys/xattr.h" HAVE_SYS_XATTR_H) LA_CHECK_INCLUDE_FILE("time.h" HAVE_TIME_H) LA_CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H) LA_CHECK_INCLUDE_FILE("utime.h" HAVE_UTIME_H) LA_CHECK_INCLUDE_FILE("wchar.h" HAVE_WCHAR_H) LA_CHECK_INCLUDE_FILE("wctype.h" HAVE_WCTYPE_H) LA_CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H) IF(ENABLE_CNG) LA_CHECK_INCLUDE_FILE("Bcrypt.h" HAVE_BCRYPT_H) IF(HAVE_BCRYPT_H) LIST(APPEND ADDITIONAL_LIBS "Bcrypt") ENDIF(HAVE_BCRYPT_H) ELSE(ENABLE_CNG) UNSET(HAVE_BCRYPT_H CACHE) ENDIF(ENABLE_CNG) # Following files need windows.h, so we should test it after windows.h test. LA_CHECK_INCLUDE_FILE("wincrypt.h" HAVE_WINCRYPT_H) LA_CHECK_INCLUDE_FILE("winioctl.h" HAVE_WINIOCTL_H) # # Check whether use of __EXTENSIONS__ is safe. # We need some macro such as _GNU_SOURCE to use extension functions. # SET(_INCLUDE_FILES) FOREACH (it ${_HEADER}) SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") ENDFOREACH (it) CHECK_C_SOURCE_COMPILES( "#define __EXTENSIONS__ 1 ${_INCLUDE_FILES} int main() { return 0;}" SAFE_TO_DEFINE_EXTENSIONS) # # Find mbed TLS # IF(ENABLE_MBEDTLS) FIND_PACKAGE(MbedTLS) IF(MBEDTLS_FOUND) SET(HAVE_LIBMBEDCRYPTO 1) LIST(APPEND ADDITIONAL_LIBS ${MBEDCRYPTO_LIBRARY}) INCLUDE_DIRECTORIES(${MBEDTLS_INCLUDE_DIRS}) LIST(APPEND CMAKE_REQUIRED_INCLUDES ${MBEDTLS_INCLUDE_DIRS}) LA_CHECK_INCLUDE_FILE("mbedtls/aes.h" HAVE_MBEDTLS_AES_H) LA_CHECK_INCLUDE_FILE("mbedtls/md.h" HAVE_MBEDTLS_MD_H) LA_CHECK_INCLUDE_FILE("mbedtls/pkcs5.h" HAVE_MBEDTLS_PKCS5_H) ENDIF(MBEDTLS_FOUND) MARK_AS_ADVANCED(CLEAR MBEDTLS_INCLUDE_DIRS) MARK_AS_ADVANCED(CLEAR MBEDCRYPTO_LIBRARY) ENDIF(ENABLE_MBEDTLS) # # Find Nettle # IF(ENABLE_NETTLE) FIND_PACKAGE(Nettle) IF(NETTLE_FOUND) SET(HAVE_LIBNETTLE 1) LIST(APPEND ADDITIONAL_LIBS ${NETTLE_LIBRARIES}) INCLUDE_DIRECTORIES(${NETTLE_INCLUDE_DIR}) LIST(APPEND CMAKE_REQUIRED_INCLUDES ${NETTLE_INCLUDE_DIR}) LA_CHECK_INCLUDE_FILE("nettle/aes.h" HAVE_NETTLE_AES_H) LA_CHECK_INCLUDE_FILE("nettle/hmac.h" HAVE_NETTLE_HMAC_H) LA_CHECK_INCLUDE_FILE("nettle/md5.h" HAVE_NETTLE_MD5_H) LA_CHECK_INCLUDE_FILE("nettle/pbkdf2.h" HAVE_NETTLE_PBKDF2_H) LA_CHECK_INCLUDE_FILE("nettle/ripemd160.h" HAVE_NETTLE_RIPEMD160_H) LA_CHECK_INCLUDE_FILE("nettle/sha.h" HAVE_NETTLE_SHA_H) ENDIF(NETTLE_FOUND) MARK_AS_ADVANCED(CLEAR NETTLE_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR NETTLE_LIBRARIES) ENDIF(ENABLE_NETTLE) # # Find OpenSSL # (Except on Mac, where OpenSSL is deprecated.) # IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") FIND_PACKAGE(OpenSSL) IF(OPENSSL_FOUND) SET(HAVE_LIBCRYPTO 1) INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_CRYPTO_LIBRARY}) ENDIF(OPENSSL_FOUND) ELSE() SET(OPENSSL_FOUND FALSE) # Override cached value ENDIF() # FreeBSD libmd IF(NOT OPENSSL_FOUND) CHECK_LIBRARY_EXISTS(md "MD5Init" "" LIBMD_FOUND) IF(LIBMD_FOUND) CMAKE_PUSH_CHECK_STATE() # Save the state of the variables SET(CMAKE_REQUIRED_LIBRARIES "md") FIND_LIBRARY(LIBMD_LIBRARY NAMES md) LIST(APPEND ADDITIONAL_LIBS ${LIBMD_LIBRARY}) CMAKE_POP_CHECK_STATE() # Restore the state of the variables ENDIF(LIBMD_FOUND) ENDIF(NOT OPENSSL_FOUND) # # How to prove that CRYPTO functions, which have several names on various # platforms, just see if archive_digest.c can compile and link against # required libraries. # MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) FOREACH(ALGORITHM ${ALGORITHMS}) IF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) STRING(TOLOWER "${ALGORITHM}" lower_algorithm) STRING(TOUPPER "${ALGORITHM}" algorithm) IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND NOT OPENSSL_FOUND) SET(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} FALSE) ELSEIF("${IMPLEMENTATION}" MATCHES "^MBEDTLS$" AND NOT MBEDTLS_FOUND) SET(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} FALSE) ELSEIF("${IMPLEMENTATION}" MATCHES "^NETTLE$" AND NOT NETTLE_FOUND) SET(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} FALSE) ENDIF("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND NOT OPENSSL_FOUND) IF(NOT DEFINED ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) # Probe the local implementation for whether this # crypto implementation is available on this platform. SET(TRY_CRYPTO_REQUIRED_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libarchive;${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp") SET(TRY_CRYPTO_REQUIRED_LIBS) IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) SET(TRY_CRYPTO_REQUIRED_INCLUDES "${TRY_CRYPTO_REQUIRED_INCLUDES};${OPENSSL_INCLUDE_DIR}") SET(TRY_CRYPTO_REQUIRED_LIBS "-DLINK_LIBRARIES:STRING=${OPENSSL_LIBRARIES}") ELSEIF("${IMPLEMENTATION}" MATCHES "^MBEDTLS$" AND MBEDTLS_FOUND) SET(TRY_CRYPTO_REQUIRED_INCLUDES "${TRY_CRYPTO_REQUIRED_INCLUDES};${MBEDTLS_INCLUDE_DIRS}") SET(TRY_CRYPTO_REQUIRED_LIBS "-DLINK_LIBRARIES:STRING=${MBEDCRYPTO_LIBRARY}") ELSEIF("${IMPLEMENTATION}" MATCHES "^NETTLE$" AND NETTLE_FOUND) SET(TRY_CRYPTO_REQUIRED_INCLUDES "${TRY_CRYPTO_REQUIRED_INCLUDES};${NETTLE_INCLUDE_DIR}") SET(TRY_CRYPTO_REQUIRED_LIBS "-DLINK_LIBRARIES:STRING=${NETTLE_LIBRARY}") ELSEIF("${IMPLEMENTATION}" MATCHES "^LIBMD$" AND LIBMD_FOUND) SET(TRY_CRYPTO_REQUIRED_LIBS "-DLINK_LIBRARIES:STRING=${LIBMD_LIBRARY}") ENDIF("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h) FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h" CONFDEFS_H) FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/libarchive/archive_digest.c" ARCHIVE_CRYPTO_C) SET(SOURCE "${CONFDEFS_H} #define ARCHIVE_${algorithm}_COMPILE_TEST #define ARCHIVE_CRYPTO_${algorithm}_${IMPLEMENTATION} #define PLATFORM_CONFIG_H \"check_crypto_md.h\" ${ARCHIVE_CRYPTO_C} int main(int argc, char **argv) { archive_${lower_algorithm}_ctx ctx; archive_${lower_algorithm}_init(&ctx); archive_${lower_algorithm}_update(&ctx, *argv, argc); archive_${lower_algorithm}_final(&ctx, NULL); return 0; } ") FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.h" "") FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.c" "${SOURCE}") MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}") TRY_COMPILE(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.c CMAKE_FLAGS "${TRY_CRYPTO_REQUIRED_LIBS}" "${TRY_CRYPTO_REQUIRED_INCLUDES}" OUTPUT_VARIABLE OUTPUT) # Inform user whether or not we found it; if not, log why we didn't. IF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} -- found") SET(ARCHIVE_CRYPTO_${ALGORITHM} 1) ELSE (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} -- not found") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} failed with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) ENDIF(NOT DEFINED ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) # Add appropriate libs/includes depending on whether the implementation # was found on this platform. IF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_LIBRARIES}) LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS) ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) ENDIF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) ENDFOREACH(ALGORITHM ${ALGORITHMS}) ENDMACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) # # CRYPTO functions on Windows is defined at archive_windows.c, thus we do not # need the test what the functions can be mapped to archive_{crypto name}_init, # archive_{crypto name}_update and archive_{crypto name}_final. # The functions on Windows use CALG_{crypto name} macro to create a crypt object # and then we need to know what CALG_{crypto name} macros is available to show # ARCHIVE_CRYPTO_{crypto name}_WIN macros because Windows 2000 and earlier version # of Windows XP do not support SHA256, SHA384 and SHA512. # MACRO(CHECK_CRYPTO_WIN CRYPTO_LIST) IF(WIN32 AND NOT CYGWIN) FOREACH(CRYPTO ${CRYPTO_LIST}) IF(NOT ARCHIVE_CRYPTO_${CRYPTO}) IF(NOT DEFINED ARCHIVE_CRYPTO_${CRYPTO}_WIN) STRING(TOUPPER "${CRYPTO}" crypto) SET(ALGID "") IF ("${CRYPTO}" MATCHES "^MD5$") SET(ALGID "CALG_MD5") ENDIF ("${CRYPTO}" MATCHES "^MD5$") IF ("${CRYPTO}" MATCHES "^SHA1$") SET(ALGID "CALG_SHA1") ENDIF ("${CRYPTO}" MATCHES "^SHA1$") IF ("${CRYPTO}" MATCHES "^SHA256$") SET(ALGID "CALG_SHA_256") ENDIF ("${CRYPTO}" MATCHES "^SHA256$") IF ("${CRYPTO}" MATCHES "^SHA384$") SET(ALGID "CALG_SHA_384") ENDIF ("${CRYPTO}" MATCHES "^SHA384$") IF ("${CRYPTO}" MATCHES "^SHA512$") SET(ALGID "CALG_SHA_512") ENDIF ("${CRYPTO}" MATCHES "^SHA512$") CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h) FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h" CONFDEFS_H) SET(SOURCE "${CONFDEFS_H} #define ${crypto}_COMPILE_TEST #include #include int main(int argc, char **argv) { return ${ALGID}; } ") SET(SOURCE_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_win.c") FILE(WRITE "${SOURCE_FILE}" "${SOURCE}") MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN") TRY_COMPILE(ARCHIVE_CRYPTO_${CRYPTO}_WIN ${CMAKE_BINARY_DIR} ${SOURCE_FILE} CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libarchive" OUTPUT_VARIABLE OUTPUT) IF (ARCHIVE_CRYPTO_${CRYPTO}_WIN) MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN -- found") SET(ARCHIVE_CRYPTO_${CRYPTO} 1) ELSE (ARCHIVE_CRYPTO_${CRYPTO}_WIN) MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN -- not found") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN failed with the following output:\n" "${OUTPUT}\n" "Source file was:\n${SOURCE}\n") ENDIF (ARCHIVE_CRYPTO_${CRYPTO}_WIN) ENDIF(NOT DEFINED ARCHIVE_CRYPTO_${CRYPTO}_WIN) ENDIF(NOT ARCHIVE_CRYPTO_${CRYPTO}) ENDFOREACH(CRYPTO) ENDIF(WIN32 AND NOT CYGWIN) ENDMACRO(CHECK_CRYPTO_WIN CRYPTO_LIST) # # Find iconv # POSIX defines the second arg as const char ** # and requires it to be in libc. But we can accept # a non-const argument here and can support iconv() # being in libiconv. # MACRO(CHECK_ICONV LIB TRY_ICONV_CONST) IF(NOT HAVE_ICONV) CMAKE_PUSH_CHECK_STATE() # Save the state of the variables IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR CMAKE_C_COMPILER_ID MATCHES "^Clang$") # # During checking iconv proto type, we should use -Werror to avoid the # success of iconv detection with a warnig which success is a miss # detection. So this needs for all build mode(even it's a release mode). # SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR CMAKE_C_COMPILER_ID MATCHES "^Clang$") IF (CMAKE_C_COMPILER_ID MATCHES "^XL$") SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -qhalt=w -qflag=w:w") ENDIF (CMAKE_C_COMPILER_ID MATCHES "^XL$") IF (MSVC) # NOTE: /WX option is the same as gcc's -Werror option. SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /WX") ENDIF (MSVC) # CHECK_C_SOURCE_COMPILES( "#include #include int main() { ${TRY_ICONV_CONST} char *ccp; iconv_t cd = iconv_open(\"\", \"\"); iconv(cd, &ccp, (size_t *)0, (char **)0, (size_t *)0); iconv_close(cd); return 0; }" HAVE_ICONV_${LIB}_${TRY_ICONV_CONST}) IF(HAVE_ICONV_${LIB}_${TRY_ICONV_CONST}) SET(HAVE_ICONV true) SET(ICONV_CONST ${TRY_ICONV_CONST}) ENDIF(HAVE_ICONV_${LIB}_${TRY_ICONV_CONST}) CMAKE_POP_CHECK_STATE() # Restore the state of the variables ENDIF(NOT HAVE_ICONV) ENDMACRO(CHECK_ICONV TRY_ICONV_CONST) IF(ENABLE_ICONV) CMAKE_PUSH_CHECK_STATE() # Save the state of the variables FIND_PATH(ICONV_INCLUDE_DIR iconv.h) IF(ICONV_INCLUDE_DIR) #SET(INCLUDES ${INCLUDES} "iconv.h") SET(HAVE_ICONV_H 1) INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR}) SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) CHECK_ICONV("libc" "const") CHECK_ICONV("libc" "") # If iconv isn't in libc and we have a libiconv, try that. FIND_LIBRARY(LIBICONV_PATH NAMES iconv libiconv) IF(NOT HAVE_ICONV AND LIBICONV_PATH) LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBICONV_PATH}) # Test if a macro is needed for the library. TRY_MACRO_FOR_LIBRARY( "${ICONV_INCLUDE_DIR}" "${LIBICONV_PATH}" COMPILES "#include \nint main() {return iconv_close((iconv_t)0);}" "WITHOUT_LIBICONV_STATIC;LIBICONV_STATIC") IF(NOT WITHOUT_LIBICONV_STATIC AND LIBICONV_STATIC) ADD_DEFINITIONS(-DLIBICONV_STATIC) ENDIF(NOT WITHOUT_LIBICONV_STATIC AND LIBICONV_STATIC) # # Set up CMAKE_REQUIRED_* for CHECK_ICONV # SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) SET(CMAKE_REQUIRED_LIBRARIES ${LIBICONV_PATH}) IF(LIBICONV_STATIC) # LIBICONV_STATIC is necessary for the success of CHECK_ICONV # on Windows. SET(CMAKE_REQUIRED_DEFINITIONS "-DLIBICONV_STATIC") ELSE(LIBICONV_STATIC) SET(CMAKE_REQUIRED_DEFINITIONS) ENDIF(LIBICONV_STATIC) CHECK_ICONV("libiconv" "const") CHECK_ICONV("libiconv" "") IF (HAVE_ICONV) LIST(APPEND ADDITIONAL_LIBS ${LIBICONV_PATH}) ENDIF(HAVE_ICONV) ENDIF(NOT HAVE_ICONV AND LIBICONV_PATH) ENDIF(ICONV_INCLUDE_DIR) # # Find locale_charset() for libiconv. # IF(LIBICONV_PATH) SET(CMAKE_REQUIRED_DEFINITIONS) SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) SET(CMAKE_REQUIRED_LIBRARIES) CHECK_INCLUDE_FILES("localcharset.h" HAVE_LOCALCHARSET_H) FIND_LIBRARY(LIBCHARSET_PATH NAMES charset libcharset) IF(LIBCHARSET_PATH) SET(CMAKE_REQUIRED_LIBRARIES ${LIBCHARSET_PATH}) IF(WIN32 AND NOT CYGWIN) # Test if a macro is needed for the library. TRY_MACRO_FOR_LIBRARY( "${ICONV_INCLUDE_DIR}" "${LIBCHARSET_PATH}" COMPILES "#include \nint main() {return locale_charset()?1:0;}" "WITHOUT_LIBCHARSET_STATIC;LIBCHARSET_STATIC") IF(NOT WITHOUT_LIBCHARSET_STATIC AND LIBCHARSET_STATIC) ADD_DEFINITIONS(-DLIBCHARSET_STATIC) ENDIF(NOT WITHOUT_LIBCHARSET_STATIC AND LIBCHARSET_STATIC) IF(WITHOUT_LIBCHARSET_STATIC OR LIBCHARSET_STATIC) SET(HAVE_LOCALE_CHARSET ON CACHE INTERNAL "Have function locale_charset") ENDIF(WITHOUT_LIBCHARSET_STATIC OR LIBCHARSET_STATIC) ELSE(WIN32 AND NOT CYGWIN) CHECK_FUNCTION_EXISTS_GLIBC(locale_charset HAVE_LOCALE_CHARSET) ENDIF(WIN32 AND NOT CYGWIN) IF(HAVE_LOCALE_CHARSET) LIST(APPEND ADDITIONAL_LIBS ${LIBCHARSET_PATH}) ENDIF(HAVE_LOCALE_CHARSET) ENDIF(LIBCHARSET_PATH) ENDIF(LIBICONV_PATH) CMAKE_POP_CHECK_STATE() # Restore the state of the variables ELSE(ENABLE_ICONV) # Make sure ICONV variables are not in CACHE after ENABLE_ICONV disabled # (once enabled). UNSET(HAVE_LOCALE_CHARSET CACHE) UNSET(HAVE_ICONV CACHE) UNSET(HAVE_ICONV_libc_ CACHE) UNSET(HAVE_ICONV_libc_const CACHE) UNSET(HAVE_ICONV_libiconv_ CACHE) UNSET(HAVE_ICONV_libiconv_const CACHE) UNSET(ICONV_INCLUDE_DIR CACHE) UNSET(LIBICONV_PATH CACHE) UNSET(LIBICONV_DLL CACHE) UNSET(LIBICONV_STATIC CACHE) UNSET(LIBCHARSET_DLL CACHE) UNSET(LIBCHARSET_STATIC CACHE) ENDIF(ENABLE_ICONV) # # Find Libxml2 # IF(ENABLE_LIBXML2) FIND_PACKAGE(LibXml2) ELSE() SET(LIBXML2_FOUND FALSE) ENDIF() IF(LIBXML2_FOUND) CMAKE_PUSH_CHECK_STATE() # Save the state of the variables INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${LIBXML2_LIBRARIES}) SET(HAVE_LIBXML2 1) # libxml2's include files use iconv.h SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR}) CHECK_INCLUDE_FILES("libxml/xmlreader.h" HAVE_LIBXML_XMLREADER_H) CHECK_INCLUDE_FILES("libxml/xmlwriter.h" HAVE_LIBXML_XMLWRITER_H) # Test if a macro is needed for the library. TRY_MACRO_FOR_LIBRARY( "${ICONV_INCLUDE_DIR};${LIBXML2_INCLUDE_DIR}" "ws2_32.lib;${ZLIB_LIBRARIES};${LIBICONV_PATH};${LIBXML2_LIBRARIES}" COMPILES "#include \n#include \nint main() {return xmlTextReaderRead((xmlTextReaderPtr)(void *)0);}" "WITHOUT_LIBXML_STATIC;LIBXML_STATIC") IF(NOT WITHOUT_LIBXML_STATIC AND LIBXML_STATIC) ADD_DEFINITIONS(-DLIBXML_STATIC) ENDIF(NOT WITHOUT_LIBXML_STATIC AND LIBXML_STATIC) CMAKE_POP_CHECK_STATE() # Restore the state of the variables ELSE(LIBXML2_FOUND) # # Find Expat # IF(ENABLE_EXPAT) FIND_PACKAGE(EXPAT) ELSE() SET(EXPAT_FOUND FALSE) ENDIF() IF(EXPAT_FOUND) CMAKE_PUSH_CHECK_STATE() # Save the state of the variables INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${EXPAT_LIBRARIES}) SET(HAVE_LIBEXPAT 1) LA_CHECK_INCLUDE_FILE("expat.h" HAVE_EXPAT_H) CMAKE_POP_CHECK_STATE() # Restore the state of the variables ENDIF(EXPAT_FOUND) ENDIF(LIBXML2_FOUND) MARK_AS_ADVANCED(CLEAR LIBXML2_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR LIBXML2_LIBRARIES) # # POSIX Regular Expression support # IF(POSIX_REGEX_LIB MATCHES "^(AUTO|LIBC|LIBREGEX)$") # # If PCREPOSIX is not found or not requested, try using regex # from libc or libregex # FIND_PATH(REGEX_INCLUDE_DIR regex.h) IF(REGEX_INCLUDE_DIR) CHECK_FUNCTION_EXISTS_GLIBC(regcomp HAVE_REGCOMP_LIBC) # # If libc does not provide regex, find libregex. # IF(NOT HAVE_REGCOMP_LIBC) CMAKE_PUSH_CHECK_STATE() # Save the state of the variables FIND_LIBRARY(REGEX_LIBRARY regex) IF(REGEX_LIBRARY) SET(CMAKE_REQUIRED_LIBRARIES ${REGEX_LIBRARY}) CHECK_FUNCTION_EXISTS_GLIBC(regcomp HAVE_REGCOMP_LIBREGEX) IF(HAVE_REGCOMP_LIBREGEX) LIST(APPEND ADDITIONAL_LIBS ${REGEX_LIBRARY}) # # If regex.h is not found, retry looking for regex.h at # REGEX_INCLUDE_DIR # IF(NOT HAVE_REGEX_H) UNSET(HAVE_REGEX_H CACHE) INCLUDE_DIRECTORIES(${REGEX_INCLUDE_DIR}) SET(CMAKE_REQUIRED_INCLUDES ${REGEX_INCLUDE_DIR}) LA_CHECK_INCLUDE_FILE("regex.h" HAVE_REGEX_H) ENDIF(NOT HAVE_REGEX_H) # Test if a macro is needed for the library. TRY_MACRO_FOR_LIBRARY( "${REGEX_INCLUDE_DIR}" "${REGEX_LIBRARY}" COMPILES "#include \n#include \nint main() {regex_t r;return regcomp(&r, \"\", 0);}" "USE_REGEX_DLL;USE_REGEX_STATIC") IF(USE_REGEX_DLL) ADD_DEFINITIONS(-DUSE_REGEX_DLL) ELSEIF(USE_REGEX_STATIC) ADD_DEFINITIONS(-DUSE_REGEX_STATIC) ENDIF(USE_REGEX_DLL) ENDIF(HAVE_REGCOMP_LIBREGEX) ENDIF(REGEX_LIBRARY) CMAKE_POP_CHECK_STATE() # Restore the state of the variables ENDIF(NOT HAVE_REGCOMP_LIBC) ENDIF(REGEX_INCLUDE_DIR) IF(HAVE_REGCOMP_LIBC OR HAVE_REGCOMP_LIBREGEX) SET(FOUND_POSIX_REGEX_LIB 1) ENDIF(HAVE_REGCOMP_LIBC OR HAVE_REGCOMP_LIBREGEX) ENDIF(POSIX_REGEX_LIB MATCHES "^(AUTO|LIBC|LIBREGEX)$") IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$") # # If requested, try finding library for PCREPOSIX # IF(ENABLE_LibGCC) FIND_PACKAGE(LibGCC) ELSE() SET(LIBGCC_FOUND FALSE) # Override cached value ENDIF() IF(ENABLE_PCREPOSIX) FIND_PACKAGE(PCREPOSIX) ELSE() SET(PCREPOSIX_FOUND FALSE) # Override cached value ENDIF() IF(PCREPOSIX_FOUND) INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${PCREPOSIX_LIBRARIES}) # Test if a macro is needed for the library. TRY_MACRO_FOR_LIBRARY( "${PCRE_INCLUDE_DIR}" "${PCREPOSIX_LIBRARIES}" COMPILES "#include \nint main() {regex_t r;return regcomp(&r, \"\", 0);}" "WITHOUT_PCRE_STATIC;PCRE_STATIC") IF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) ADD_DEFINITIONS(-DPCRE_STATIC) ELSEIF(NOT WITHOUT_PCRE_STATIC AND NOT PCRE_STATIC AND PCRE_FOUND) # Determine if pcre static libraries are to be used. LIST(APPEND ADDITIONAL_LIBS ${PCRE_LIBRARIES}) SET(TMP_LIBRARIES ${PCREPOSIX_LIBRARIES} ${PCRE_LIBRARIES}) MESSAGE(STATUS "trying again with -lpcre included") TRY_MACRO_FOR_LIBRARY( "${PCRE_INCLUDE_DIR}" "${TMP_LIBRARIES}" COMPILES "#include \nint main() {regex_t r;return regcomp(&r, \"\", 0);}" "WITHOUT_PCRE_STATIC;PCRE_STATIC") IF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) ADD_DEFINITIONS(-DPCRE_STATIC) ELSEIF(NOT WITHOUT_PCRE_STATIC AND NOT PCRE_STATIC AND MSVC AND LIBGCC_FOUND) # When doing a Visual Studio build using pcre static libraries # built using the mingw toolchain, -lgcc is needed to resolve # ___chkstk_ms. MESSAGE(STATUS "Visual Studio build detected, trying again with -lgcc included") LIST(APPEND ADDITIONAL_LIBS ${LIBGCC_LIBRARIES}) SET(TMP_LIBRARIES ${PCREPOSIX_LIBRARIES} ${PCRE_LIBRARIES} ${LIBGCC_LIBRARIES}) TRY_MACRO_FOR_LIBRARY( "${PCRE_INCLUDE_DIR}" "${TMP_LIBRARIES}" COMPILES "#include \nint main() {regex_t r;return regcomp(&r, \"\", 0);}" "WITHOUT_PCRE_STATIC;PCRE_STATIC") IF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) ADD_DEFINITIONS(-DPCRE_STATIC) ENDIF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) ENDIF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) ENDIF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) ENDIF(PCREPOSIX_FOUND) MARK_AS_ADVANCED(CLEAR PCRE_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR PCREPOSIX_LIBRARIES) MARK_AS_ADVANCED(CLEAR PCRE_LIBRARIES) MARK_AS_ADVANCED(CLEAR LIBGCC_LIBRARIES) ENDIF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$") # # Check functions # CMAKE_PUSH_CHECK_STATE() # Save the state of the variables IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR CMAKE_C_COMPILER_ID MATCHES "^Clang$") # # During checking functions, we should use -fno-builtin to avoid the # failure of function detection which failure is an error "conflicting # types for built-in function" caused by using -Werror option. # SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-builtin") ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR CMAKE_C_COMPILER_ID MATCHES "^Clang$") CHECK_SYMBOL_EXISTS(_CrtSetReportMode "crtdbg.h" HAVE__CrtSetReportMode) CHECK_FUNCTION_EXISTS_GLIBC(arc4random_buf HAVE_ARC4RANDOM_BUF) CHECK_FUNCTION_EXISTS_GLIBC(chflags HAVE_CHFLAGS) CHECK_FUNCTION_EXISTS_GLIBC(chown HAVE_CHOWN) CHECK_FUNCTION_EXISTS_GLIBC(chroot HAVE_CHROOT) CHECK_FUNCTION_EXISTS_GLIBC(ctime_r HAVE_CTIME_R) CHECK_FUNCTION_EXISTS_GLIBC(fchdir HAVE_FCHDIR) CHECK_FUNCTION_EXISTS_GLIBC(fchflags HAVE_FCHFLAGS) CHECK_FUNCTION_EXISTS_GLIBC(fchmod HAVE_FCHMOD) CHECK_FUNCTION_EXISTS_GLIBC(fchown HAVE_FCHOWN) CHECK_FUNCTION_EXISTS_GLIBC(fcntl HAVE_FCNTL) CHECK_FUNCTION_EXISTS_GLIBC(fdopendir HAVE_FDOPENDIR) CHECK_FUNCTION_EXISTS_GLIBC(fork HAVE_FORK) CHECK_FUNCTION_EXISTS_GLIBC(fstat HAVE_FSTAT) CHECK_FUNCTION_EXISTS_GLIBC(fstatat HAVE_FSTATAT) CHECK_FUNCTION_EXISTS_GLIBC(fstatfs HAVE_FSTATFS) CHECK_FUNCTION_EXISTS_GLIBC(fstatvfs HAVE_FSTATVFS) CHECK_FUNCTION_EXISTS_GLIBC(ftruncate HAVE_FTRUNCATE) CHECK_FUNCTION_EXISTS_GLIBC(futimens HAVE_FUTIMENS) CHECK_FUNCTION_EXISTS_GLIBC(futimes HAVE_FUTIMES) CHECK_FUNCTION_EXISTS_GLIBC(futimesat HAVE_FUTIMESAT) CHECK_FUNCTION_EXISTS_GLIBC(geteuid HAVE_GETEUID) CHECK_FUNCTION_EXISTS_GLIBC(getgrgid_r HAVE_GETGRGID_R) CHECK_FUNCTION_EXISTS_GLIBC(getgrnam_r HAVE_GETGRNAM_R) CHECK_FUNCTION_EXISTS_GLIBC(getpwnam_r HAVE_GETPWNAM_R) CHECK_FUNCTION_EXISTS_GLIBC(getpwuid_r HAVE_GETPWUID_R) CHECK_FUNCTION_EXISTS_GLIBC(getpid HAVE_GETPID) CHECK_FUNCTION_EXISTS_GLIBC(getvfsbyname HAVE_GETVFSBYNAME) CHECK_FUNCTION_EXISTS_GLIBC(gmtime_r HAVE_GMTIME_R) CHECK_FUNCTION_EXISTS_GLIBC(lchflags HAVE_LCHFLAGS) CHECK_FUNCTION_EXISTS_GLIBC(lchmod HAVE_LCHMOD) CHECK_FUNCTION_EXISTS_GLIBC(lchown HAVE_LCHOWN) CHECK_FUNCTION_EXISTS_GLIBC(link HAVE_LINK) CHECK_FUNCTION_EXISTS_GLIBC(localtime_r HAVE_LOCALTIME_R) CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT) CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES) CHECK_FUNCTION_EXISTS_GLIBC(mbrtowc HAVE_MBRTOWC) CHECK_FUNCTION_EXISTS_GLIBC(memmove HAVE_MEMMOVE) CHECK_FUNCTION_EXISTS_GLIBC(mkdir HAVE_MKDIR) CHECK_FUNCTION_EXISTS_GLIBC(mkfifo HAVE_MKFIFO) CHECK_FUNCTION_EXISTS_GLIBC(mknod HAVE_MKNOD) CHECK_FUNCTION_EXISTS_GLIBC(mkstemp HAVE_MKSTEMP) CHECK_FUNCTION_EXISTS_GLIBC(nl_langinfo HAVE_NL_LANGINFO) CHECK_FUNCTION_EXISTS_GLIBC(openat HAVE_OPENAT) CHECK_FUNCTION_EXISTS_GLIBC(pipe HAVE_PIPE) CHECK_FUNCTION_EXISTS_GLIBC(poll HAVE_POLL) CHECK_FUNCTION_EXISTS_GLIBC(posix_spawnp HAVE_POSIX_SPAWNP) CHECK_FUNCTION_EXISTS_GLIBC(readlink HAVE_READLINK) CHECK_FUNCTION_EXISTS_GLIBC(readpassphrase HAVE_READPASSPHRASE) CHECK_FUNCTION_EXISTS_GLIBC(select HAVE_SELECT) CHECK_FUNCTION_EXISTS_GLIBC(setenv HAVE_SETENV) CHECK_FUNCTION_EXISTS_GLIBC(setlocale HAVE_SETLOCALE) CHECK_FUNCTION_EXISTS_GLIBC(sigaction HAVE_SIGACTION) CHECK_FUNCTION_EXISTS_GLIBC(statfs HAVE_STATFS) CHECK_FUNCTION_EXISTS_GLIBC(statvfs HAVE_STATVFS) CHECK_FUNCTION_EXISTS_GLIBC(strchr HAVE_STRCHR) CHECK_FUNCTION_EXISTS_GLIBC(strdup HAVE_STRDUP) CHECK_FUNCTION_EXISTS_GLIBC(strerror HAVE_STRERROR) CHECK_FUNCTION_EXISTS_GLIBC(strncpy_s HAVE_STRNCPY_S) CHECK_FUNCTION_EXISTS_GLIBC(strnlen HAVE_STRNLEN) CHECK_FUNCTION_EXISTS_GLIBC(strrchr HAVE_STRRCHR) CHECK_FUNCTION_EXISTS_GLIBC(symlink HAVE_SYMLINK) CHECK_FUNCTION_EXISTS_GLIBC(timegm HAVE_TIMEGM) CHECK_FUNCTION_EXISTS_GLIBC(tzset HAVE_TZSET) CHECK_FUNCTION_EXISTS_GLIBC(unlinkat HAVE_UNLINKAT) CHECK_FUNCTION_EXISTS_GLIBC(unsetenv HAVE_UNSETENV) CHECK_FUNCTION_EXISTS_GLIBC(utime HAVE_UTIME) CHECK_FUNCTION_EXISTS_GLIBC(utimes HAVE_UTIMES) CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT) CHECK_FUNCTION_EXISTS_GLIBC(vfork HAVE_VFORK) CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB) CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP) CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY) CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN) CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB) CHECK_FUNCTION_EXISTS_GLIBC(_ctime64_s HAVE__CTIME64_S) CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64) CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE) CHECK_FUNCTION_EXISTS_GLIBC(_gmtime64_s HAVE__GMTIME64_S) CHECK_FUNCTION_EXISTS_GLIBC(_localtime64_s HAVE__LOCALTIME64_S) CHECK_FUNCTION_EXISTS_GLIBC(_mkgmtime64 HAVE__MKGMTIME64) SET(CMAKE_REQUIRED_LIBRARIES "") CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH) CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO) CHECK_FUNCTION_EXISTS(strerror_r HAVE_STRERROR_R) CHECK_FUNCTION_EXISTS(strftime HAVE_STRFTIME) CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF) CHECK_FUNCTION_EXISTS(wmemcmp HAVE_WMEMCMP) CHECK_FUNCTION_EXISTS(wmemcpy HAVE_WMEMCPY) CHECK_FUNCTION_EXISTS(wmemmove HAVE_WMEMMOVE) CMAKE_POP_CHECK_STATE() # Restore the state of the variables CHECK_C_SOURCE_COMPILES( "#include \n#include \nint main(void) { struct vfsconf v; return sizeof(v);}" HAVE_STRUCT_VFSCONF) CHECK_C_SOURCE_COMPILES( "#include \n#include \nint main(void) { struct xvfsconf v; return sizeof(v);}" HAVE_STRUCT_XVFSCONF) # Make sure we have the POSIX version of readdir_r, not the # older 2-argument version. CHECK_C_SOURCE_COMPILES( "#include \nint main() {DIR *d = opendir(\".\"); struct dirent e,*r; return readdir_r(d,&e,&r);}" HAVE_READDIR_R) # dirfd can be either a function or a macro. CHECK_C_SOURCE_COMPILES( "#include \nint main() {DIR *d = opendir(\".\"); return dirfd(d);}" HAVE_DIRFD) # Only detect readlinkat() if we also have AT_FDCWD in unistd.h. # NOTE: linux requires fcntl.h for AT_FDCWD. CHECK_C_SOURCE_COMPILES( "#include \n#include \nint main() {char buf[10]; return readlinkat(AT_FDCWD, \"\", buf, 0);}" HAVE_READLINKAT) # To verify major(), we need to both include the header # of interest and verify that the result can be linked. # CHECK_FUNCTION_EXISTS doesn't accept a header argument, # CHECK_SYMBOL_EXISTS doesn't test linkage. CHECK_C_SOURCE_COMPILES( "#include \nint main() { return major(256); }" MAJOR_IN_MKDEV) CHECK_C_SOURCE_COMPILES( "#include \nint main() { return major(256); }" MAJOR_IN_SYSMACROS) IF(ENABLE_LZMA) CHECK_C_SOURCE_COMPILES( "#include \n#if LZMA_VERSION < 50020000\n#error unsupported\n#endif\nint main(void){lzma_stream_encoder_mt(0, 0); return 0;}" HAVE_LZMA_STREAM_ENCODER_MT) ELSE() SET(HAVE_LZMA_STREAM_ENCODER_MT 0) ENDIF(ENABLE_LZMA) IF(HAVE_STRERROR_R) SET(HAVE_DECL_STRERROR_R 1) ENDIF(HAVE_STRERROR_R) # # Check defines # SET(headers "limits.h") IF(HAVE_STDINT_H) LIST(APPEND headers "stdint.h") ENDIF(HAVE_STDINT_H) IF(HAVE_INTTYPES_H) LIST(APPEND headers "inttypes.h") ENDIF(HAVE_INTTYPES_H) CHECK_SYMBOL_EXISTS(EFTYPE "errno.h" HAVE_EFTYPE) CHECK_SYMBOL_EXISTS(EILSEQ "errno.h" HAVE_EILSEQ) CHECK_SYMBOL_EXISTS(D_MD_ORDER "langinfo.h" HAVE_D_MD_ORDER) CHECK_SYMBOL_EXISTS(INT32_MAX "${headers}" HAVE_DECL_INT32_MAX) CHECK_SYMBOL_EXISTS(INT32_MIN "${headers}" HAVE_DECL_INT32_MIN) CHECK_SYMBOL_EXISTS(INT64_MAX "${headers}" HAVE_DECL_INT64_MAX) CHECK_SYMBOL_EXISTS(INT64_MIN "${headers}" HAVE_DECL_INT64_MIN) CHECK_SYMBOL_EXISTS(INTMAX_MAX "${headers}" HAVE_DECL_INTMAX_MAX) CHECK_SYMBOL_EXISTS(INTMAX_MIN "${headers}" HAVE_DECL_INTMAX_MIN) CHECK_SYMBOL_EXISTS(UINT32_MAX "${headers}" HAVE_DECL_UINT32_MAX) CHECK_SYMBOL_EXISTS(UINT64_MAX "${headers}" HAVE_DECL_UINT64_MAX) CHECK_SYMBOL_EXISTS(UINTMAX_MAX "${headers}" HAVE_DECL_UINTMAX_MAX) CHECK_SYMBOL_EXISTS(SIZE_MAX "${headers}" HAVE_DECL_SIZE_MAX) CHECK_SYMBOL_EXISTS(SSIZE_MAX "limits.h" HAVE_DECL_SSIZE_MAX) # # Check struct members # # Check for tm_gmtoff in struct tm CHECK_STRUCT_HAS_MEMBER("struct tm" tm_gmtoff "time.h" HAVE_STRUCT_TM_TM_GMTOFF) CHECK_STRUCT_HAS_MEMBER("struct tm" __tm_gmtoff "time.h" HAVE_STRUCT_TM___TM_GMTOFF) # Check for f_namemax in struct statfs CHECK_STRUCT_HAS_MEMBER("struct statfs" f_namemax "sys/param.h;sys/mount.h" HAVE_STRUCT_STATFS_F_NAMEMAX) # Check for birthtime in struct stat CHECK_STRUCT_HAS_MEMBER("struct stat" st_birthtime "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIME) # Check for high-resolution timestamps in struct stat CHECK_STRUCT_HAS_MEMBER("struct stat" st_birthtimespec.tv_nsec "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC) CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC) CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtime_n "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIME_N) CHECK_STRUCT_HAS_MEMBER("struct stat" st_umtime "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_UMTIME) CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtime_usec "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIME_USEC) # Check for block size support in struct stat CHECK_STRUCT_HAS_MEMBER("struct stat" st_blksize "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BLKSIZE) # Check for st_flags in struct stat (BSD fflags) CHECK_STRUCT_HAS_MEMBER("struct stat" st_flags "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_FLAGS) IF(HAVE_SYS_STATVFS_H) CHECK_STRUCT_HAS_MEMBER("struct statvfs" f_iosize "sys/types.h;sys/statvfs.h" HAVE_STRUCT_STATVFS_F_IOSIZE) ENDIF() # # CHECK_STRUCT_HAS_MEMBER("struct tm" tm_sec "sys/types.h;sys/time.h;time.h" TIME_WITH_SYS_TIME) # # Check for integer types # # CHECK_TYPE_SIZE("short" SIZE_OF_SHORT) CHECK_TYPE_SIZE("int" SIZE_OF_INT) CHECK_TYPE_SIZE("long" SIZE_OF_LONG) CHECK_TYPE_SIZE("long long" SIZE_OF_LONG_LONG) CHECK_TYPE_SIZE("unsigned short" SIZE_OF_UNSIGNED_SHORT) CHECK_TYPE_SIZE("unsigned" SIZE_OF_UNSIGNED) CHECK_TYPE_SIZE("unsigned long" SIZE_OF_UNSIGNED_LONG) CHECK_TYPE_SIZE("unsigned long long" SIZE_OF_UNSIGNED_LONG_LONG) CHECK_TYPE_SIZE("__int64" __INT64) CHECK_TYPE_SIZE("unsigned __int64" UNSIGNED___INT64) CHECK_TYPE_SIZE(int16_t INT16_T) CHECK_TYPE_SIZE(int32_t INT32_T) CHECK_TYPE_SIZE(int64_t INT64_T) CHECK_TYPE_SIZE(intmax_t INTMAX_T) CHECK_TYPE_SIZE(uint8_t UINT8_T) CHECK_TYPE_SIZE(uint16_t UINT16_T) CHECK_TYPE_SIZE(uint32_t UINT32_T) CHECK_TYPE_SIZE(uint64_t UINT64_T) CHECK_TYPE_SIZE(uintmax_t UINTMAX_T) CHECK_TYPE_SIZE(dev_t DEV_T) IF(NOT HAVE_DEV_T) IF(MSVC) SET(dev_t "unsigned int") ENDIF(MSVC) ENDIF(NOT HAVE_DEV_T) # CHECK_TYPE_SIZE(gid_t GID_T) IF(NOT HAVE_GID_T) IF(WIN32) SET(gid_t "short") ELSE(WIN32) SET(gid_t "unsigned int") ENDIF(WIN32) ENDIF(NOT HAVE_GID_T) # CHECK_TYPE_SIZE(id_t ID_T) IF(NOT HAVE_ID_T) IF(WIN32) SET(id_t "short") ELSE(WIN32) SET(id_t "unsigned int") ENDIF(WIN32) ENDIF(NOT HAVE_ID_T) # CHECK_TYPE_SIZE(mode_t MODE_T) IF(NOT HAVE_MODE_T) IF(WIN32) SET(mode_t "unsigned short") ELSE(WIN32) SET(mode_t "int") ENDIF(WIN32) ENDIF(NOT HAVE_MODE_T) # CHECK_TYPE_SIZE(off_t OFF_T) IF(NOT HAVE_OFF_T) SET(off_t "__int64") ENDIF(NOT HAVE_OFF_T) # CHECK_TYPE_SIZE(size_t SIZE_T) IF(NOT HAVE_SIZE_T) IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) SET(size_t "uint64_t") ELSE("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) SET(size_t "uint32_t") ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) ENDIF(NOT HAVE_SIZE_T) # CHECK_TYPE_SIZE(ssize_t SSIZE_T) IF(NOT HAVE_SSIZE_T) IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) SET(ssize_t "int64_t") ELSE("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) SET(ssize_t "long") ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) ENDIF(NOT HAVE_SSIZE_T) # CHECK_TYPE_SIZE(uid_t UID_T) IF(NOT HAVE_UID_T) IF(WIN32) SET(uid_t "short") ELSE(WIN32) SET(uid_t "unsigned int") ENDIF(WIN32) ENDIF(NOT HAVE_UID_T) # CHECK_TYPE_SIZE(pid_t PID_T) IF(NOT HAVE_PID_T) IF(WIN32) SET(pid_t "int") ELSE(WIN32) MESSAGE(FATAL_ERROR "pid_t doesn't exist on this platform?") ENDIF(WIN32) ENDIF(NOT HAVE_PID_T) # CHECK_TYPE_SIZE(intptr_t INTPTR_T) IF(NOT HAVE_INTPTR_T) IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) SET(intptr_t "int64_t") ELSE() SET(intptr_t "int32_t") ENDIF() ENDIF(NOT HAVE_INTPTR_T) # CHECK_TYPE_SIZE(uintptr_t UINTPTR_T) IF(NOT HAVE_UINTPTR_T) IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) SET(uintptr_t "uint64_t") ELSE() SET(uintptr_t "uint32_t") ENDIF() ENDIF(NOT HAVE_UINTPTR_T) # CHECK_TYPE_SIZE(wchar_t SIZEOF_WCHAR_T) IF(HAVE_SIZEOF_WCHAR_T) SET(HAVE_WCHAR_T 1) ENDIF(HAVE_SIZEOF_WCHAR_T) # # Check if _FILE_OFFSET_BITS macro needed for large files # CHECK_FILE_OFFSET_BITS() # # Check for Extended Attribute libraries, headers, and functions # IF(ENABLE_XATTR) CHECK_LIBRARY_EXISTS(attr "setxattr" "" HAVE_LIBATTR) IF(HAVE_LIBATTR) SET(CMAKE_REQUIRED_LIBRARIES "attr") ELSE() CHECK_LIBRARY_EXISTS(gnu "setxattr" "" HAVE_LIBATTR_GNU) IF(HAVE_LIBATTR_GNU) SET(CMAKE_REQUIRED_LIBRARIES "gnu") ENDIF() ENDIF(HAVE_LIBATTR) CHECK_SYMBOL_EXISTS(EXTATTR_NAMESPACE_USER "sys/types.h;sys/extattr.h" HAVE_DECL_EXTATTR_NAMESPACE_USER) CHECK_SYMBOL_EXISTS(XATTR_NOFOLLOW "sys/xattr.h" HAVE_DECL_XATTR_NOFOLLOW) IF(HAVE_SYS_XATTR_H AND HAVE_DECL_XATTR_NOFOLLOW) CHECK_FUNCTION_EXISTS(fgetxattr HAVE_FGETXATTR) CHECK_FUNCTION_EXISTS(flistxattr HAVE_FLISTXATTR) CHECK_FUNCTION_EXISTS(fsetxattr HAVE_FSETXATTR) CHECK_FUNCTION_EXISTS(getxattr HAVE_GETXATTR) CHECK_FUNCTION_EXISTS(listxattr HAVE_LISTXATTR) CHECK_FUNCTION_EXISTS(setxattr HAVE_SETXATTR) IF(HAVE_FGETXATTR AND HAVE_FLISTXATTR AND HAVE_FSETXATTR AND HAVE_GETXATTR AND HAVE_LISTXATTR AND HAVE_SETXATTR) SET(ARCHIVE_XATTR_DARWIN TRUE) ENDIF() ELSEIF(HAVE_SYS_EXTATTR_H AND HAVE_DECL_EXTATTR_NAMESPACE_USER) # FreeBSD xattr support CHECK_FUNCTION_EXISTS(extattr_get_fd HAVE_EXTATTR_GET_FD) CHECK_FUNCTION_EXISTS(extattr_get_file HAVE_EXTATTR_GET_FILE) CHECK_FUNCTION_EXISTS(extattr_get_link HAVE_EXTATTR_GET_LINK) CHECK_FUNCTION_EXISTS(extattr_list_fd HAVE_EXTATTR_LIST_FD) CHECK_FUNCTION_EXISTS(extattr_list_file HAVE_EXTATTR_LIST_FILE) CHECK_FUNCTION_EXISTS(extattr_list_link HAVE_EXTATTR_LIST_LINK) CHECK_FUNCTION_EXISTS(extattr_set_fd HAVE_EXTATTR_SET_FD) CHECK_FUNCTION_EXISTS(extattr_set_link HAVE_EXTATTR_SET_LINK) IF(HAVE_EXTATTR_GET_FD AND HAVE_EXTATTR_GET_FILE AND HAVE_EXTATTR_GET_LINK AND HAVE_EXTATTR_LIST_FD AND HAVE_EXTATTR_LIST_FILE AND HAVE_EXTATTR_LIST_LINK AND HAVE_EXTATTR_SET_FD AND HAVE_EXTATTR_SET_LINK) SET(ARCHIVE_XATTR_FREEBSD TRUE) ENDIF() ELSEIF(HAVE_SYS_XATTR_H OR HAVE_ATTR_XATTR_H) # Linux xattr support CHECK_FUNCTION_EXISTS_GLIBC(fgetxattr HAVE_FGETXATTR) CHECK_FUNCTION_EXISTS_GLIBC(flistxattr HAVE_FLISTXATTR) CHECK_FUNCTION_EXISTS_GLIBC(fsetxattr HAVE_FSETXATTR) CHECK_FUNCTION_EXISTS_GLIBC(getxattr HAVE_GETXATTR) CHECK_FUNCTION_EXISTS_GLIBC(lgetxattr HAVE_LGETXATTR) CHECK_FUNCTION_EXISTS_GLIBC(listxattr HAVE_LISTXATTR) CHECK_FUNCTION_EXISTS_GLIBC(llistxattr HAVE_LLISTXATTR) CHECK_FUNCTION_EXISTS_GLIBC(lsetxattr HAVE_LSETXATTR) IF(HAVE_FGETXATTR AND HAVE_FLISTXATTR AND HAVE_FSETXATTR AND HAVE_GETXATTR AND HAVE_LGETXATTR AND HAVE_LISTXATTR AND HAVE_LLISTXATTR AND HAVE_LSETXATTR) SET(ARCHIVE_XATTR_LINUX TRUE) ENDIF() ELSEIF(HAVE_SYS_EA_H) # AIX xattr support CHECK_FUNCTION_EXISTS(fgetea HAVE_FGETEA) CHECK_FUNCTION_EXISTS(flistea HAVE_FLISTEA) CHECK_FUNCTION_EXISTS(fsetea HAVE_FSETEA) CHECK_FUNCTION_EXISTS(getea HAVE_GETEA) CHECK_FUNCTION_EXISTS(lgetea HAVE_LGETEA) CHECK_FUNCTION_EXISTS(listea HAVE_LISTEA) CHECK_FUNCTION_EXISTS(llistea HAVE_LLISTEA) CHECK_FUNCTION_EXISTS(lsetea HAVE_LSETEA) IF(HAVE_FGETEA AND HAVE_FLISTEA AND HAVE_FSETEA AND HAVE_GETEA AND HAVE_LGETEA AND HAVE_LISTEA AND HAVE_LLISTEA AND HAVE_LSETEA) SET(ARCHIVE_XATTR_AIX TRUE) ENDIF() ENDIF() IF(ARCHIVE_XATTR_DARWIN) MESSAGE(STATUS "Extended attributes support: Darwin") ELSEIF(ARCHIVE_XATTR_FREEBSD) MESSAGE(STATUS "Extended attributes support: FreeBSD") ELSEIF(ARCHIVE_XATTR_LINUX) MESSAGE(STATUS "Extended attributes support: Linux") ELSEIF(ARCHIVE_XATTR_AIX) MESSAGE(STATUS "Extended attributes support: AIX") ELSE() MESSAGE(STATUS "Extended attributes support: none") ENDIF() ELSE(ENABLE_XATTR) SET(ARCHIVE_XATTR_DARWIN FALSE) SET(ARCHIVE_XATTR_FREEBSD FALSE) SET(ARCHIVE_XATTR_LINUX FALSE) SET(ARCHIVE_XATTR_AIX FALSE) ENDIF(ENABLE_XATTR) # # Check for ACL libraries, headers, and functions # # The ACL support in libarchive is written against the POSIX1e draft, # which was never officially approved and varies quite a bit across # platforms. Worse, some systems have completely non-POSIX acl functions, # which makes the following checks rather more complex than I would like. # IF(ENABLE_ACL) # Solaris and derivates ACLs CHECK_FUNCTION_EXISTS(acl HAVE_ACL) CHECK_FUNCTION_EXISTS(facl HAVE_FACL) # Libacl CHECK_LIBRARY_EXISTS(acl "acl_get_file" "" HAVE_LIBACL) IF(HAVE_LIBACL) SET(CMAKE_REQUIRED_LIBRARIES "acl") FIND_LIBRARY(ACL_LIBRARY NAMES acl) LIST(APPEND ADDITIONAL_LIBS ${ACL_LIBRARY}) ENDIF(HAVE_LIBACL) CHECK_TYPE_EXISTS(acl_t "sys/types.h;sys/acl.h" HAVE_ACL_T) CHECK_TYPE_EXISTS(acl_entry_t "sys/types.h;sys/acl.h" HAVE_ACL_ENTRY_T) CHECK_TYPE_EXISTS(acl_permset_t "sys/types.h;sys/acl.h" HAVE_ACL_PERMSET_T) CHECK_TYPE_EXISTS(acl_tag_t "sys/types.h;sys/acl.h" HAVE_ACL_TAG_T) IF(HAVE_ACL AND HAVE_FACL) CHECK_TYPE_EXISTS(aclent_t "sys/acl.h" HAVE_ACLENT_T) IF(HAVE_ACLENT_T) CHECK_SYMBOL_EXISTS(GETACL "sys/acl.h" HAVE_DECL_GETACL) CHECK_SYMBOL_EXISTS(GETACLCNT "sys/acl.h" HAVE_DECL_GETACLCNT) CHECK_SYMBOL_EXISTS(SETACL "sys/acl.h" HAVE_DECL_SETACL) IF(HAVE_DECL_GETACL AND HAVE_DECL_GETACLCNT AND HAVE_DECL_SETACL) SET(ARCHIVE_ACL_SUNOS TRUE) ENDIF() CHECK_TYPE_EXISTS(ace_t "sys/acl.h" HAVE_ACE_T) IF(HAVE_ACE_T) CHECK_SYMBOL_EXISTS(ACE_GETACL "sys/acl.h" HAVE_DECL_ACE_GETACL) CHECK_SYMBOL_EXISTS(ACE_GETACLCNT "sys/acl.h" HAVE_DECL_ACE_GETACLCNT) CHECK_SYMBOL_EXISTS(ACE_SETACL "sys/acl.h" HAVE_DECL_ACE_SETACL) IF(HAVE_DECL_ACE_GETACL AND HAVE_DECL_ACE_GETACLCNT AND HAVE_DECL_ACE_SETACL) SET(ARCHIVE_ACL_SUNOS_NFS4 TRUE) ENDIF() ENDIF(HAVE_ACE_T) ENDIF(HAVE_ACLENT_T) ENDIF(HAVE_ACL AND HAVE_FACL) IF(HAVE_ACL_T AND HAVE_ACL_ENTRY_T AND HAVE_ACL_PERMSET_T AND HAVE_ACL_TAG_T) CHECK_FUNCTION_EXISTS_GLIBC(acl_add_perm HAVE_ACL_ADD_PERM) CHECK_FUNCTION_EXISTS_GLIBC(acl_clear_perms HAVE_ACL_CLEAR_PERMS) CHECK_FUNCTION_EXISTS_GLIBC(acl_create_entry HAVE_ACL_CREATE_ENTRY) CHECK_FUNCTION_EXISTS_GLIBC(acl_delete_def_file HAVE_ACL_DELETE_DEF_FILE) CHECK_FUNCTION_EXISTS_GLIBC(acl_free HAVE_ACL_FREE) CHECK_FUNCTION_EXISTS_GLIBC(acl_get_entry HAVE_ACL_GET_ENTRY) CHECK_FUNCTION_EXISTS_GLIBC(acl_get_fd HAVE_ACL_GET_FD) CHECK_FUNCTION_EXISTS_GLIBC(acl_get_file HAVE_ACL_GET_FILE) CHECK_FUNCTION_EXISTS_GLIBC(acl_get_permset HAVE_ACL_GET_PERMSET) CHECK_FUNCTION_EXISTS_GLIBC(acl_get_qualifier HAVE_ACL_GET_QUALIFIER) CHECK_FUNCTION_EXISTS_GLIBC(acl_get_tag_type HAVE_ACL_GET_TAG_TYPE) CHECK_FUNCTION_EXISTS_GLIBC(acl_init HAVE_ACL_INIT) CHECK_FUNCTION_EXISTS_GLIBC(acl_set_fd HAVE_ACL_SET_FD) CHECK_FUNCTION_EXISTS_GLIBC(acl_set_file HAVE_ACL_SET_FILE) CHECK_FUNCTION_EXISTS_GLIBC(acl_set_qualifier HAVE_ACL_SET_QUALIFIER) CHECK_FUNCTION_EXISTS_GLIBC(acl_set_tag_type HAVE_ACL_SET_TAG_TYPE) IF(HAVE_ACL_ADD_PERM AND HAVE_ACL_CLEAR_PERMS AND HAVE_ACL_CREATE_ENTRY AND HAVE_ACL_DELETE_DEF_FILE AND HAVE_ACL_FREE AND HAVE_ACL_GET_ENTRY AND HAVE_ACL_GET_FD AND HAVE_ACL_GET_FILE AND HAVE_ACL_GET_PERMSET AND HAVE_ACL_GET_QUALIFIER AND HAVE_ACL_GET_TAG_TYPE AND HAVE_ACL_INIT AND HAVE_ACL_SET_FD AND HAVE_ACL_SET_FILE AND HAVE_ACL_SET_QUALIFIER AND HAVE_ACL_SET_TAG_TYPE) SET(HAVE_POSIX_ACL_FUNCS 1) ENDIF() CHECK_FUNCTION_EXISTS_GLIBC(acl_get_perm HAVE_ACL_GET_PERM) IF(HAVE_POSIX_ACL_FUNCS AND HAVE_ACL_LIBACL_H AND HAVE_LIBACL AND HAVE_ACL_GET_PERM) SET(ARCHIVE_ACL_LIBACL TRUE) ELSE() CHECK_FUNCTION_EXISTS(acl_add_flag_np HAVE_ACL_ADD_FLAG_NP) CHECK_FUNCTION_EXISTS(acl_clear_flags_np HAVE_ACL_CLEAR_FLAGS_NP) CHECK_FUNCTION_EXISTS(acl_get_brand_np HAVE_ACL_GET_BRAND_NP) CHECK_FUNCTION_EXISTS(acl_get_entry_type_np HAVE_ACL_GET_ENTRY_TYPE_NP) CHECK_FUNCTION_EXISTS(acl_get_flag_np HAVE_ACL_GET_FLAG_NP) CHECK_FUNCTION_EXISTS(acl_get_flagset_np HAVE_ACL_GET_FLAGSET_NP) CHECK_FUNCTION_EXISTS(acl_get_fd_np HAVE_ACL_GET_FD_NP) CHECK_FUNCTION_EXISTS(acl_get_link_np HAVE_ACL_GET_LINK_NP) CHECK_FUNCTION_EXISTS(acl_get_perm_np HAVE_ACL_GET_PERM_NP) CHECK_FUNCTION_EXISTS(acl_is_trivial_np HAVE_ACL_IS_TRIVIAL_NP) CHECK_FUNCTION_EXISTS(acl_set_entry_type_np HAVE_ACL_SET_ENTRY_TYPE_NP) CHECK_FUNCTION_EXISTS(acl_set_fd_np HAVE_ACL_SET_FD_NP) CHECK_FUNCTION_EXISTS(acl_set_link_np HAVE_ACL_SET_LINK_NP) CHECK_FUNCTION_EXISTS(mbr_gid_to_uuid HAVE_MBR_GID_TO_UUID) CHECK_FUNCTION_EXISTS(mbr_uid_to_uuid HAVE_MBR_UID_TO_UUID) CHECK_FUNCTION_EXISTS(mbr_uuid_to_id HAVE_MBR_UUID_TO_ID) CHECK_C_SOURCE_COMPILES("#include #include int main(void) { return ACL_TYPE_EXTENDED; }" HAVE_DECL_ACL_TYPE_EXTENDED) CHECK_C_SOURCE_COMPILES("#include #include int main(void) { return ACL_SYNCHRONIZE; }" HAVE_DECL_ACL_SYNCHRONIZE) CHECK_SYMBOL_EXISTS(ACL_TYPE_NFS4 "sys/acl.h" HAVE_DECL_ACL_TYPE_NFS4) CHECK_SYMBOL_EXISTS(ACL_USER "sys/acl.h" HAVE_DECL_ACL_USER) IF(HAVE_POSIX_ACL_FUNCS AND HAVE_ACL_GET_FD_NP AND HAVE_ACL_GET_PERM_NP AND NOT HAVE_ACL_GET_PERM AND HAVE_ACL_SET_FD_NP) IF(HAVE_DECL_ACL_USER) SET(ARCHIVE_ACL_FREEBSD TRUE) IF(HAVE_DECL_ACL_TYPE_NFS4 AND HAVE_ACL_ADD_FLAG_NP AND HAVE_ACL_CLEAR_FLAGS_NP AND HAVE_ACL_GET_BRAND_NP AND HAVE_ACL_GET_ENTRY_TYPE_NP AND HAVE_ACL_GET_FLAGSET_NP AND HAVE_ACL_SET_ENTRY_TYPE_NP) SET(ARCHIVE_ACL_FREEBSD_NFS4 TRUE) ENDIF() ELSEIF(HAVE_DECL_ACL_TYPE_EXTENDED AND HAVE_MEMBERSHIP_H AND HAVE_ACL_ADD_FLAG_NP AND HAVE_ACL_CLEAR_FLAGS_NP AND HAVE_ACL_GET_FLAGSET_NP AND HAVE_ACL_GET_LINK_NP AND HAVE_ACL_SET_LINK_NP AND HAVE_MBR_UID_TO_UUID AND HAVE_MBR_GID_TO_UUID AND HAVE_MBR_UUID_TO_ID) SET(ARCHIVE_ACL_DARWIN TRUE) ENDIF() ENDIF() ENDIF() ENDIF(HAVE_ACL_T AND HAVE_ACL_ENTRY_T AND HAVE_ACL_PERMSET_T AND HAVE_ACL_TAG_T) # Richacl CHECK_LIBRARY_EXISTS(richacl "richacl_get_file" "" HAVE_LIBRICHACL) IF(HAVE_LIBRICHACL) SET(CMAKE_REQUIRED_LIBRARIES "richacl") FIND_LIBRARY(RICHACL_LIBRARY NAMES richacl) LIST(APPEND ADDITIONAL_LIBS ${RICHACL_LIBRARY}) ENDIF(HAVE_LIBRICHACL) CHECK_STRUCT_HAS_MEMBER("struct richace" e_type "sys/richacl.h" HAVE_STRUCT_RICHACE) CHECK_STRUCT_HAS_MEMBER("struct richacl" a_flags "sys/richacl.h" HAVE_STRUCT_RICHACL) IF(HAVE_LIBRICHACL AND HAVE_STRUCT_RICHACL AND HAVE_STRUCT_RICHACE) CHECK_FUNCTION_EXISTS_GLIBC(richacl_alloc HAVE_RICHACL_ALLOC) CHECK_FUNCTION_EXISTS_GLIBC(richacl_equiv_mode HAVE_RICHACL_EQUIV_MODE) CHECK_FUNCTION_EXISTS_GLIBC(richacl_free HAVE_RICHACL_FREE) CHECK_FUNCTION_EXISTS_GLIBC(richacl_get_fd HAVE_RICHACL_GET_FD) CHECK_FUNCTION_EXISTS_GLIBC(richacl_get_file HAVE_RICHACL_GET_FILE) CHECK_FUNCTION_EXISTS_GLIBC(richacl_set_fd HAVE_RICHACL_SET_FD) CHECK_FUNCTION_EXISTS_GLIBC(richacl_set_file HAVE_RICHACL_SET_FILE) IF(HAVE_RICHACL_ALLOC AND HAVE_RICHACL_EQUIV_MODE AND HAVE_RICHACL_FREE AND HAVE_RICHACL_GET_FD AND HAVE_RICHACL_GET_FILE AND HAVE_RICHACL_SET_FD AND HAVE_RICHACL_SET_FILE) SET(ARCHIVE_ACL_LIBRICHACL TRUE) ENDIF() ENDIF(HAVE_LIBRICHACL AND HAVE_STRUCT_RICHACL AND HAVE_STRUCT_RICHACE) IF(ARCHIVE_ACL_DARWIN) MESSAGE(STATUS "ACL support: Darwin (limited NFSv4)") ELSEIF(ARCHIVE_ACL_FREEBSD_NFS4) MESSAGE(STATUS "ACL support: FreeBSD (POSIX.1e and NFSv4)") ELSEIF(ARCHIVE_ACL_FREEBSD) MESSAGE(STATUS "ACL support: FreeBSD (POSIX.1e)") ELSEIF(ARCHIVE_ACL_LIBACL OR ARCHIVE_ACL_LIBRICHACL) IF(ARCHIVE_ACL_LIBACL AND ARCHIVE_ACL_LIBRICHACL) MESSAGE(STATUS "ACL support: libacl (POSIX.1e) + librichacl (NFSv4)") ELSEIF(ARCHIVE_ACL_LIBRICHACL) MESSAGE(STATUS "ACL support: librichacl (NFSv4)") ELSE() MESSAGE(STATUS "ACL support: libacl (POSIX.1e)") ENDIF() ELSEIF(ARCHIVE_ACL_SUNOS_NFS4) MESSAGE(STATUS "ACL support: Solaris (POSIX.1e and NFSv4)") ELSEIF(ARCHIVE_ACL_SUNOS) MESSAGE(STATUS "ACL support: Solaris (POSIX.1e)") ELSE() MESSAGE(STATUS "ACL support: none") ENDIF() ELSE(ENABLE_ACL) # If someone runs cmake, then disables ACL support, we need # to forcibly override the cached values for these. SET(ARCHIVE_ACL_DARWIN FALSE) SET(ARCHIVE_ACL_FREEBSD FALSE) SET(ARCHIVE_ACL_FREEBSD_NFS4 FALSE) SET(ARCHIVE_ACL_LIBACL FALSE) SET(ARCHIVE_ACL_SUNOS FALSE) SET(ARCHIVE_ACL_SUNOS_NFS4 FALSE) ENDIF(ENABLE_ACL) # # Check MD5/RMD160/SHA support # NOTE: Crypto checks must be run last before generating config.h # CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" LIBC) CHECK_CRYPTO("SHA256;SHA384;SHA512" LIBC2) CHECK_CRYPTO("SHA256;SHA384;SHA512" LIBC3) CHECK_CRYPTO("MD5;SHA1;SHA256;SHA384;SHA512" LIBSYSTEM) CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" MBEDTLS) CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" NETTLE) CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" OPENSSL) # Libmd has to be probed after OpenSSL. CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA512" LIBMD) CHECK_CRYPTO_WIN("MD5;SHA1;SHA256;SHA384;SHA512") # Generate "config.h" from "build/cmake/config.h.in" CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) ADD_DEFINITIONS(-DHAVE_CONFIG_H) # Handle generation of the libarchive.pc file for pkg-config INCLUDE(CreatePkgConfigFile) # # Register installation of PDF documents. # IF(WIN32 AND NOT CYGWIN) # # On Windows platform, It's better that we install PDF documents # on one's computer. # These PDF documents are available in the release package. # IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf) INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf DESTINATION share/man FILES_MATCHING PATTERN "*.pdf" ) ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf) ENDIF(WIN32 AND NOT CYGWIN) # # # INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/libarchive) # IF(MSVC) ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE) ENDIF(MSVC) IF(APPLE) # CC_MD5_Init() functions are deprecated on macOS 10.15, but we want to use them ADD_DEFINITIONS(-Wno-deprecated-declarations) ENDIF(APPLE) IF(ENABLE_TEST) ADD_CUSTOM_TARGET(run_all_tests) ENDIF(ENABLE_TEST) add_subdirectory(libarchive) add_subdirectory(cat) add_subdirectory(tar) add_subdirectory(cpio) diff --git a/NEWS b/NEWS index 598cf75166b1..47cebdd4b9b7 100644 --- a/NEWS +++ b/NEWS @@ -1,737 +1,739 @@ +Dec 26, 2020: libarchive 3.5.1 released + Dec 01, 2020: libarchive 3.5.0 released Oct 14, 2020: Support for system extended attributes May 20, 2020: libarchive 3.4.3 released Apr 30, 2020: Support for pzstd compressed files Apr 16, 2020: Support for RHT.security.selinux tar extended attribute Feb 11, 2020: libarchive 3.4.2 released Jan 23, 2020: Important fixes for writing XAR archives Jan 20, 2020: New tar option: --safe-writes (atomical file extraction) Jan 03, 2020: Support mbed TLS (PolarSSL) as optional crypto provider Dec 30, 2019: libarchive 3.4.1 released Dec 11, 2019: New pax write option "xattrhdr" Nov 17, 2019: Unicode filename support for reading lha/lzh archives Jun 11, 2019: libarchive 3.4.0 released May 18, 2019: Fixes for reading Android APK and JAR archives Apr 16, 2019: Support for non-recursive list and extract Apr 14, 2019: New tar option: --exclude-vcs Mar 27, 2019: Support for file and directory symlinks on Windows Mar 12, 2019: Important fixes for storing file attributes and flags Jan 20, 2019: Support for xz, lzma, ppmd8 and bzip2 decompression in ZIP files Oct 06, 2018: RAR 5.0 reader Sep 03, 2018: libarchive 3.3.3 released Jul 19, 2018: Avoid super-linear slowdown on malformed mtree files Jan 27, 2018: Many fixes for building with Visual Studio Oct 19, 2017: NO_OVERWRITE doesn't change existing directory attributes Aug 12, 2017: New support for Zstandard read and write filters Jul 09, 2017: libarchive 3.3.2 released Mar 16, 2017: NFSv4 ACL support for Linux (librichacl) Feb 26, 2017: libarchive 3.3.1 released Security & Feature release Feb 19, 2017: libarchive 3.3.0 released Security & Feature release Jan 29, 2017: Limited NFSv4 ACL support for Mac OS (Darwin) Jan 10, 2017: POSIX.1e and NFSv4 ACL support for Solaris and derivates Dec 27, 2016: NFSv4 ACL read and write support for pax Deprecated functions: archive_entry_acl_text(), archive_entry_acl_text_w() Nov, 2016: libarchive is now being tested by the OSS-Fuzz project Oct 26, 2016: Remove liblzmadec support Oct 23, 2016: libarchive 3.2.2 released Security release Jun 20, 2016: libarchive 3.2.1 released This fixes a handful of security and other critical issues with 3.2.0 May 01, 2016: libarchive 3.2.0 released Apr 09, 2016: libarchive 3.1.901a released Another test release in preparation for 3.2.0 Feb 13, 2016: libarchive 3.1.900a released This is a test release in preparation for 3.2.0 Oct 21, 2015: Preliminary port to OSF Apr 11, 2015: libarchive's issue tracker is now hosted at GitHub. https://github.com/libarchive/libarchive/issues Early 2015: Many fixes to crash and overflow bugs thanks to Hanno Boeck Oct 13, 2014: Zip encryption and decryption support Aug 13, 2014: Add support for lz4 compression. Jun 10, 2014: Add warc format support May 3, 2014: Add experimental Zip streaming extension Apr 6, 2014: Add bsdcat command-line tool Jan 12, 2014: Add Zip64 support Dec 1, 2013: Rewrite Zip write logic Jul 1, 2013: Add ability to detect encrypted entries for many formats (This does not add the ability to *decrypt* those entries, however) Feb 23, 2013: "raw" write support added Feb 09, 2013: libarchive 3.1.2 released Jan 28, 2013: libarchive's new website moved to http://www.libarchive.org. Jan 13, 2013: libarchive 3.1.1 released Jan 13, 2013: libarchive 3.1.0 released Dec 07, 2012: Implement functions to manually set the format and filters used. Nov 11, 2012: Add support for __MACOSX directory in Zip archives, which resource forks are stored in. Oct 20, 2012: Add support for writing v7 tar format. Oct 09, 2012: Add support for grzip compression. Oct 07, 2012: Introduce b64encode filter. Oct 07, 2012: Introduce uuencode filter. Oct 06, 2012: Add support for lzop. Sep 27, 2012: Implement function used to seek within data blocks. (Currently only supported for uncompressed RAR archives). Apr 22, 2012: Add basic archive read and write filter support for lrzip. Mar 27, 2012: libarchive 3.0.4 released Feb 05, 2012: libarchive development now hosted at GitHub. http://libarchive.github.com/ Feb 05, 2012: libarchive's issue tracker remains at Google Code. http://code.google.com/p/libarchive/issues/list Feb 05, 2012: libarchive's mailing lists remain at Google Groups. Dec 24, 2011: libarchive 3.0.2 released Dec 23, 2011: Various fixes merged from FreeBSD Dec 23, 2011: Symlink support in Zip reader and writer Dec 23, 2011: Robustness fixes to 7Zip reader Nov 27, 2011: libarchive 3.0.1b released Nov 26, 2011: 7Zip reader Nov 26, 2011: Small fixes to ISO and Zip to improve robustness with corrupted input Nov 24, 2011: Improve streaming Zip reader's support for uncompressed entries Nov 20, 2011: New seeking Zip reader supports SFX Zip archives Nov 20, 2011: Build fixes on Windows Nov 13, 2011: libarchive 3.0.0a released Nov 06, 2011: Update shared-library version calculations for libarchive 3.x Sep 04, 2011: Fix tar -s; follow GNU tar for controlling hardlink/symlink substitutions Aug 18, 2011: Fix reading ISO images built by NetBSD's mkisofs Aug 15, 2011: Old archive_read_support_compression_XXX functions are deprecated and will disappear in libarchive 4.0. Jun 26, 2011: RAR reader Jun 16, 2011: Add tar:compat-2x option to emulate broken libarchive 2.x handling of pax UTF-8 headers Apr 25, 2011: Refactor read_open() into a collection of single-item setters; support the old interfaces as wrappers Apr 12, 2011: Split disk writer into separate POSIX and Windows implementations Apr 10, 2011: Improvements to character translations on Windows. Mar 30, 2011: More work to return errors instead of calling abort() Mar 23, 2011: Add charset option to many writers to control MBCS filenames Mar 17, 2011: Overhauled support for per-format extension options Mar 17, 2011: Track character set used for mbcs strings, support translating to/from user-specified locale Mar 09, 2011: Recognize mtree files without requiring a signature Mar 06, 2011: Use iconv to convert to/from Unicode instead of making bad assumptions about the C90 character set translation functions Feb 17, 2011: Fixes for AIX, TRU64, and other platforms Dec 22, 2010: CAB reader Dec 20, 2010: LHA/LZH reader Jul 03, 2010: minitar example demonstrates archive_read_disk directory traversal Jun 29, 2010: Many improvements to ISO reader compatibility Jun 26, 2010: Use larger buffers when copy files into an archive Jun 18, 2010: Reimplement Mac OS extensions in libarchive Jun 09, 2010: archive_read_disk now supports traversals May 28, 2010: XAR writer May 16, 2010: Fix ^T handling; don't exit on interrupted reads and writes May 09, 2010: Improved detection of platform-specific crypto support May 04, 2010: lzip read and write filters May 01, 2010: New options: tar --gid --gname --uid --uname Apr 28, 2010: Use Red-black tree for ISO reader/writer to improve performance Apr 17, 2010: Minimal writer for legacy GNU tar format Mar 12, 2010: Don't dereference symlinks on Linux when reading ACLs. Mar 06, 2010: Fix build when an older libarchive is already installed Feb 28, 2010: Relax handling of state failures; misuse by clients now generally results in a sticky ARCHIVE_FATAL rather than a visit to abort() Feb 25, 2010: ISO writer Feb 21, 2010: Split many man pages into smaller chunks. Feb 21, 2010: Performance: Cheat on block sizes when reading archives from disk. Feb 21, 2010: Use int64_t instead of off_t, dev_t, ino_t, uid_t, and gid_t Feb 20, 2010: Document new ACL functions. Feb 19, 2010: Support multiple write filters Feb 07, 2010: Remove some legacy libarchive 1.x APIs Feb 04, 2010: Read afio headers Feb 02, 2010: Archive sparse files compatibly with GNU tar Feb 01, 2010: Integrate Apple extensions for Mac OS extended attributes into bsdtar Jan 31, 2010: Support cpio -V Feb 04, 2010: libarchive 2.8.0 released Jan 17, 2010: Fix error handling for 'echo nonexistent | cpio -o' Jan 17, 2010: Don't use futimes() on Cygwin Jan 02, 2010: libarchive 2.7.902a released (test release for 2.8) Jan 02, 2010: Fix tar/test/test_windows on MinGW Jan 02, 2010: Fix memory leaks in libarchive tests Jan 01, 2010: Fix memory leak when filter startup fails Dec 27, 2009: libarchive 2.7.901a released (test release for 2.8) Aug 04, 2009: libarchive 2.7.1 released Jul 20, 2009: Suppress bogus warning about unxz Jul 19, 2009: Support Cygwin 1.7 Jun 11, 2009: Support lzma/xz files compressed with larger buffer sizes. May 24, 2009: Handle gzip files signed with OpenBSD "gzsig" program. May 07, 2009: Avoid false failures when reading from pipe. Apr 16, 2009: libarchive 2.7.0 released Apr 10, 2009: libarchive 2.6.992a released Apr 09, 2009: Fix SIGPIPE issue building with MSVC. Apr 09, 2009: Fix several minor memory leaks in libarchive and libarchive_test Apr 08, 2009: libarchive 2.6.991a released Apr 07, 2009: Additional tests added to bsdcpio_test Apr 01, 2009: libarchive 2.6.990a released Apr 01, 2009: Use command-line gunzip, bunzip2, unxz, unlzma for decompression if the library is built without suitable libraries. The setup functions return ARCHIVE_WARN in this case so clients can adapt if necessary. Apr 01, 2009: Use getpw*_r and getgr*_r functions for thread-safety. Mar 24, 2009: Add archive_read_next_header2(), which is up to 25% more efficient for some clients; from Brian Harring. Mar 22, 2009: PDF versions of manpages are now included in the distribution. Mar, 2009: Major work to improve Cygwin build by Charles Wilson. Feb/Mar, 2009: Major work on cmake build support, mostly by Michihiro NAKAJIMA. Feb/Mar, 2009: Major work on Visual Studio support by Michihiro NAKAJIMA. All tests now pass. Feb 25, 2009: Fix Debian Bug #516577 Feb 21, 2009: Yacc is no longer needed to build; date parser rewritten in C. Jan/Feb, 2009: Mtree work by Michihiro. Feb, 2009: Joliet support by Andreas Henriksson. Jan/Feb, 2009: New options framework by Michihiro. Feb, 2009: High-res timestamps on Tru64, AIX, and GNU Hurd, by Björn Jacke. Jan 18, 2009: Extended attributes work on FreeBSD and Linux now with pax format. Jan 07, 2009: New archive_read_disk_entry_from_file() knows about ACLs, extended attributes, etc so that bsdtar and bsdcpio don't require such system-specific knowledge. Jan 03, 2009: Read filter system extensively refactored. In particular, read filter pipelines are now built out automatically and individual filters should be much easier to implement. Documentation on the Googlecode Wiki explains how to implement new filters. Dec 28, 2008: Many Windows/Visual Studio fixes from Michihiro NAKAJIMA. Dec 28, 2008: Main libarchive development moved from FreeBSD Perforce server to Google Code. This should make it easier for more people to participate in libarchive development. Dec 28, 2008: libarchive 2.6.0 released Dec 25, 2008: libarchive 2.5.905a released Dec 10, 2008: libarchive 2.5.904a released Dec 04, 2008: libarchive 2.5.903a released Nov 09, 2008: libarchive 2.5.902a released Nov 08, 2008: libarchive 2.5.901a released Nov 08, 2008: Start of pre-release testing for libarchive 2.6 Nov 07, 2008: Read filter refactor: The decompression routines just consume and produce arbitrarily-sized blocks. The reblocking from read_support_compression_none() has been pulled into the read core. Also, the decompression bid now makes multiple passes and stacks read filters. Oct 21, 2008: bsdcpio: New command-line parser. Oct 19, 2008: Internal read_ahead change: short reads are now an error Oct 06, 2008: bsdtar: option parser no longer uses getopt_long(), gives consistent option parsing on all platforms. Sep 19, 2008: Jaakko Heinonen: shar utility built on libarchive Sep 17, 2008: Pedro Giffuni: birthtime support Sep 17, 2008: Miklos Vajna: lzma reader and test. Note: I still have some concerns about the auto-detection (LZMA file format doesn't support auto-detection well), so this is not yet enabled under archive_read_support_compression_all(). For now, you must call archive_read_support_compression_lzma() if you want LZMA read support. Sep 11, 2008: Ivailo Petrov: Many fixes to Windows build, new solution files Jul 26, 2008: archive_entry now tracks which values have not been set. This helps zip extraction (file size is often "unknown") and time restores (tar usually doesn't know atime). Jul 26, 2008: Joerg Sonnenberger: Performance improvements to shar writer Jul 25, 2008: Joerg Sonnenberger: mtree write support Jul 02, 2008: libarchive 2.5.5 released Jul 02, 2008: libarchive 2.5.5b released Jul 01, 2008: bsdcpio is being used by enough people, we can call it 1.0.0 now Jun 20, 2008: bsdcpio: If a -l link fails with EXDEV, copy the file instead Jun 19, 2008: bsdcpio: additional long options for better GNU cpio compat Jun 15, 2008: Many small portability and bugfixes since 2.5.4b. May 25, 2008: libarchive 2.5.4b released May 21, 2008: Joerg Sonnenberger: fix bsdtar hardlink handling for newc format May 21, 2008: More progress on Windows building. Thanks to "Scott" for the Windows makefiles, thanks to Kees Zeelenberg for code contributions. May 21, 2008: Fix a number of non-exploitable integer and buffer overflows, thanks to David Remahl at Apple for pointing these out. May 21, 2008: Colin Percival: SIGINFO or SIGUSR1 to bsdtar prints progress info May 16, 2008: bsdtar's test harness no longer depends on file ordering. This was causing spurious test failures on a lot of systems. Thanks to Bernhard R. Link for the diagnosis. May 14, 2008: Joerg Sonnenberger: -s substitution support for bsdtar May 13, 2008: Joerg Sonnenberger: Many mtree improvements May 11, 2008: Joerg Sonnenberger: fix hardlink extraction when hardlinks have different permissions from original file April 30, 2008: Primary libarchive work has been moved into the FreeBSD project's Perforce repository: http://perforce.freebsd.org/ The libarchive project can be browsed at //depot/user/kientzle/libarchive-portable Direct link: http://preview.tinyurl.com/46mdgr May 04, 2008: libarchive 2.5.3b released * libarchive: Several fixes to link resolver to address bsdcpio crashes * bsdcpio: -p hardlink handling fixes * tar/pax: Ensure ustar dirnames end in '/'; be more careful about measuring filenames when deciding what pathname fields to use * libarchive: Mark which entry strings are set; be accurate about distinguishing empty strings ("") from unset ones (NULL) * tar: Don't crash reading entries with empty filenames * libarchive_test, bsdtar_test, bsdcpio_test: Better defaults: run all tests, delete temp dirs, summarize repeated failures * -no-undefined to libtool for Cygwin * libarchive_test: Skip large file tests on systems with 32-bit off_t * iso9660: Don't bother trying to find the body of an empty file; this works around strange behavior from some ISO9660 writers * tar: allow -r -T to be used together * tar: allow --format with -r or -u * libarchive: Don't build archive.h May 04, 2008: Simplified building: archive.h is no longer constructed This may require additional #if conditionals on some platforms. Mar 30, 2008: libarchive 2.5.1b released Mar 15, 2008: libarchive 2.5.0b released Mar 15, 2008: bsdcpio now seems to correctly write hardlinks into newc, ustar, and old cpio archives. Just a little more testing before bsdcpio 1.0 becomes a reality. Mar 15, 2008: I think the new linkify() interface is finally handling all known hardlink strategies. Mar 15, 2008: Mtree read fixes from Joerg Sonnenberger. Mar 15, 2008: Many new bsdtar and bsdcpio options from Joerg Sonnenberger. Mar 15, 2008: test harnesses no longer require uudecode; they now have built-in decoding logic that decodes the reference files as they are needed. Mar 14, 2008: libarchive 2.4.14 released; identical to 2.4.13 except for a point fix for gname/uname mixup in pax format that was introduced with the UTF-8 fixes. Feb 26, 2008: libarchive 2.4.13 released Feb 25, 2008: Handle path, linkname, gname, or uname that can't be converted to/from UTF-8. Implement "hdrcharset" attribute from SUS-2008. Feb 25, 2008: Fix name clash on NetBSD. Feb 18, 2008: Fix writing empty 'ar' archives, per Kai Wang Feb 18, 2008: [bsdtar] Permit appending on block devices. Feb 09, 2008: New "linkify" resolver to help with newc hardlink writing; bsdcpio still needs to be converted to use this. Feb 02, 2008: Windows compatibility fixes from Ivailo Petrov, Kees Zeelenberg Jan 30, 2008: Ignore hardlink size for non-POSIX tar archives. Jan 22, 2008: libarchive 2.4.12 released Jan 22, 2008: Fix bad padding when writing symlinks to newc cpio archives. Jan 22, 2008: Verify bsdcpio_test by getting it to work against GNU cpio 2.9. bsdcpio_test complains about missing options (-y and -z), format of informational messages (--version, --help), and a minor formatting issue in odc format output. After this update, bsdcpio_test uncovered several more cosmetic issues in bsdcpio, all now fixed. Jan 22, 2008: Experimental support for self-extracting Zip archives. Jan 22, 2008: Extend hardlink restore strategy to work correctly with hardlinks extracted from newc cpio files. (Which store the body only with the last occurrence of a link.) Dec 30, 2007: libarchive 2.4.11 released Dec 30, 2007: Fixed a compile error in bsdcpio on some systems. Dec 29, 2007: libarchive 2.4.10 released Dec 29, 2007: bsdcpio 0.9.0 is ready for wider use. Dec 29, 2007: Completed initial test harness for bsdcpio. Dec 22, 2007: libarchive 2.4.9 released Dec 22, 2007: Implement the remaining options for bsdcpio: -a, -q, -L, -f, pattern selection for -i and -it. Dec 13, 2007: libarchive 2.4.8 released Dec 13, 2007: gzip and bzip2 compression now handle zero-byte writes correctly, Thanks to Damien Golding for bringing this to my attention. Dec 12, 2007: libarchive 2.4.7 released Dec 10, 2007: libarchive 2.4.6 released Dec 09, 2007: tar/test/test_copy.c verifies "tar -c | tar -x" copy pipeline Dec 07, 2007: Fix a couple of minor memory leaks. Dec 04, 2007: libarchive 2.4.5 released Dec 04, 2007: Fix cpio/test/test_write_odc by setting the umask first. Dec 03, 2007: libarchive 2.4.4 released Dec 03, 2007: New configure options --disable-xattr and --disable-acl, thanks to Samuli Suominen. Dec 03, 2007: libarchive 2.4.3 released Dec 03, 2007: Thanks to Lapo Luchini for sending me a ZIP file that libarchive couldn't handle. Fixed a bug in handling of "length at end" flags in ZIP files. Dec 03, 2007: Fixed bsdcpio -help, bsdtar -help tests. Dec 02, 2007: First cut at real bsdtar test harness. Dec 02, 2007: libarchive 2.4.2 released Dec 02, 2007: libarchive 2.4.1 released Dec 02, 2007: Minor fixes, rough cut of mdoc-to-man conversion for man pages. Oct 30, 2007: libarchive 2.4.0 released Oct 30, 2007: Minor compile fix thanks to Joerg Schilling. Oct 30, 2007: Only run the format auction once at the beginning of the archive. This is simpler and supports better error recovery. Oct 29, 2007: Test support for very large entries in tar archives: libarchive_test now exercises entries from 2GB up to 1TB. Oct 27, 2007: libarchive 2.3.5 released Oct 27, 2007: Correct some unnecessary internal data copying in the "compression none" reader and writer; this reduces user time by up to 2/3 in some tests. (Thanks to Jan Psota for publishing his performance test results to GNU tar's bug-tar mailing list; those results pointed me towards this problem.) Oct 27, 2007: Fix for skipping archive entries that are exactly a multiple of 4G on 32-bit platforms. Oct 25, 2007: Fix for reading very large (>8G) tar archives; this was broken when I put in support for new GNU tar sparse formats. Oct 20, 2007: Initial work on new pattern-matching code for cpio; I hope this eventually replaces the code currently in bsdtar. Oct 08, 2007: libarchive 2.3.4 released Oct 05, 2007: Continuing work on bsdcpio test suite. Oct 05, 2007: New cpio.5 manpage, updates to "History" of bsdcpio.1 and bsdtar.1 manpages. Oct 05, 2007: Fix zip reader to immediately return EOF if you try to read body of non-regular file. In particular, this fixes bsdtar extraction of zip archives. Sep 30, 2007: libarchive 2.3.3 released Sep 26, 2007: Rework Makefile.am so that the enable/disable options actually do the right things. Sep 26, 2007: cpio-odc and cpio-newc archives no longer write bodies for non-regular files. Sep 26, 2007: Test harness for bsdcpio is in place, needs more tests written. This is much nicer than the ragtag collection of test scripts that bsdtar has. Sep 20, 2007: libarchive 2.3.2 released Sep 20, 2007: libarchive 2.3.1 broke bsdtar because the archive_write_data() fix was implemented incorrectly. Sep 16, 2007: libarchive 2.3.1 released Sep 16, 2007: Many fixes to bsdcpio 0.3: handle hardlinks with -p, recognize block size on writing, fix a couple of segfaults. Sep 16, 2007: Fixed return value from archive_write_data() when used with archive_write_disk() to match the documentation and other instances of this same function. Sep 15, 2007: Add archive_entry_link_resolver, archive_entry_strmode Sep 11, 2007: libarchive 2.2.8 released Sep 09, 2007: bsdcpio 0.2 supports most (not yet all) of the old POSIX spec. Sep 01, 2007: libarchive 2.2.7 released Aug 31, 2007: Support for reading mtree files, including an mtree.5 manpage (A little experimental still.) Aug 18, 2007: Read gtar 1.17 --posix --sparse entries. Aug 13, 2007: Refined suid/sgid restore handling; it is no longer an error if suid/sgid bits are dropped when you request perm restore but don't request owner restore. Aug 06, 2007: Use --enable-bsdcpio if you want to try bsdcpio Aug 05, 2007: libarchive 2.2.6 released Aug 05, 2007: New configure option --disable-bsdtar, thanks to Joerg Sonnenberger. Aug 05, 2007: Several bug fixes from FreeBSD CVS repo. Jul 13, 2007: libarchive 2.2.5 released Jul 12, 2007: libarchive 2.2.4 released Jul 12, 2007: Thanks to Colin Percival's help in diagnosing and fixing several critical security bugs. Details available at http://security.freebsd.org/advisories/FreeBSD-SA-07:05.libarchive.asc May 26, 2007: libarchive 2.2.3 released May 26, 2007: Fix memory leaks in ZIP reader and shar writer, add some missing system headers to archive_entry.h, dead code cleanup from Colin Percival, more tests for gzip/bzip2, fix an EOF anomaly in bzip2 decompression. May 12, 2007: libarchive 2.2.2 released May 12, 2007: Fix archive_write_disk permission restore by cloning entry passed into write_header so that permission info is still available at finish_entry time. (archive_read_extract() worked okay because it held onto the passed-in entry, but direct consumers of archive_write_disk would break). This required fixing archive_entry_clone(), which now works and has a reasonably complete test case. May 10, 2007: Skeletal cpio implementation. May 06, 2007: libarchive 2.2.1 released May 06, 2007: Flesh out a lot more of test_entry.c so as to catch problems such as the device node breakage before releasing . May 05, 2007: Fix a bad bug introduced in 2.1.9 that broke device node entries in tar archives. May 03, 2007: Move 'struct stat' out of archive_entry core as well. This removes some portability headaches and fixes a bunch of corner cases that arise when manipulating archives on dissimilar systems. Apr 30, 2007: libarchive 2.1.10 released Apr 31, 2007: Minor code cleanup. Apr 24, 2007: libarchive 2.1.9 released Apr 24, 2007: Fix some recently-introduced problems with libraries (Just let automake handle it and it all works much better.) Finish isolating major()/minor()/makedev() in archive_entry.c. Apr 23, 2007: libarchive 2.1.8 released Apr 23, 2007: Minor fixes found from building on MacOS X Apr 22, 2007: libarchive 2.1.7 released Apr 22, 2007: Eliminated all uses of 'struct stat' from the format readers/writers. This should improve portability; 'struct stat' is now only used in archive_entry and in code that actually touches the disk. Apr 17, 2007: libarchive 2.1.6 released Libarchive now compiles and passes all tests on Interix. Apr 16, 2007: libarchive 2.1.5 released Apr 15, 2007: libarchive 2.1b2 released Apr 15, 2007: New libarchive_internals.3 documentation of internal APIs. Not complete, but should prove helpful. Apr 15, 2007: Experimental "read_compress_program" and "write_compress_program" for using libarchive with external compression. Not yet well tested, and likely has portability issues. Feedback appreciated. Apr 14, 2007: libarchive 2.0.31 released Apr 14, 2007: More fixes for Interix, more 'ar' work Apr 14, 2007: libarchive 2.0.30 released Apr 13, 2007: libarchive now enforces trailing '/' on dirs written to tar archives Apr 11, 2007: libarchive 2.0.29 released Apr 11, 2007: Make it easier to statically configure for different platforms. Apr 11, 2007: Updated config.guess, config.sub, libtool Apr 06, 2007: libarchive 2.0.28 released Apr 06, 2007: 'ar' format read/write support thanks to Kai Wang. Apr 01, 2007: libarchive 2.0.27 released Mar 31, 2007: Several minor fixes from Colin Percival and Joerg Sonnenberger. Mar 12, 2007: libarchive 2.0.25 released Mar 12, 2007: Fix broken --unlink flag. Mar 11, 2007: libarchive 2.0.24 released Mar 10, 2007: Correct an ACL blunder that causes any ACL with an entry that refers to a non-existent user or group to not be restored correctly. The fix both makes the parser more tolerant (so that archives created with the buggy ACLs can be read now) and corrects the ACL formatter. Mar 10, 2007: More work on test portability to Linux. Mar 10, 2007: libarchive 2.0.22 released Mar 10, 2007: Header cleanups; added linux/fs.h, removed some unnecessary headers, added #include guards in bsdtar. If you see any obvious compile failures from this, let me know. Mar 10, 2007: Work on bsdtar test scripts: not yet robust enough to enable as part of "make check", but getting better. Mar 10, 2007: libarchive now returns ARCHIVE_FAILED when a header write fails in a way that only affects this item. Less bad than ARCHIVE_FATAL, but worse than ARCHIVE_WARN. Mar 07, 2007: libarchive 2.0.21 released Mar 07, 2007: Add some ACL tests (only for the system-independent portion of the ACL support for now). Mar 07, 2007: tar's ability to read ACLs off disk got turned off for FreeBSD; re-enable it. (ACL restores and libarchive support for storing/reading ACLs from pax archives was unaffected.) Mar 02, 2007: libarchive 2.0.20 released Mar 2, 2007: It's not perfect, but it's pretty good. Libarchive 2.0 is officially out of beta. Feb 28, 2007: libarchive 2.0b17 released Feb 27, 2007: Make the GID restore checks more robust by checking whether the current user has too few or too many privileges. Feb 26, 2007: libarchive 2.0b15 released Feb 26, 2007: Don't lose symlinks when extracting from ISOs. Thanks to Diego "Flameeyes" Pettenò for telling me about the broken testcase on Gentoo that (finally!) led me to the cause of this long-standing bug. Feb 26, 2007: libarchive 2.0b14 released Feb 26, 2007: Fix a broken test on platforms that lack lchmod(). Feb 25, 2007: libarchive 2.0b13 released Feb 25, 2007: Empty archives were being written as empty files, without a proper end-of-archive marker. Fixed. Feb 23, 2007: libarchive 2.0b12 released Feb 22, 2007: Basic security checks added: _EXTRACT_SECURE_NODOTDOT and _EXTRACT_SECURE_SYMLINK. These checks used to be in bsdtar, but they belong down in libarchive where they can be used by other tools and where they can be better optimized. Feb 11, 2007: libarchive 2.0b11 released Feb 10, 2007: Fixed a bunch of errors in libarchive's handling of EXTRACT_PERM and EXTRACT_OWNER, especially relating to SUID and SGID bits. Jan 31, 2007: libarchive 2.0b9 released Jan 31, 2007: Added read support for "empty" archives as a distinct archive format. Bsdtar uses this to handle, e.g., "touch foo.tar; tar -rf foo.tar" Jan 22, 2007: libarchive 2.0b6 released Jan 22, 2007: archive_write_disk API is now in place. It provides a finer-grained interface than archive_read_extract. In particular, you can use it to create objects on disk without having an archive around (just feed it archive_entry objects describing what you want to create), you can override the uname/gname-to-uid/gid lookups (minitar uses this to avoid getpwXXX() and getgrXXX() bloat). Jan 09, 2007: libarchive 2.0a3 released Jan 9, 2007: archive_extract is now much better; it handles the most common cases with a minimal number of system calls. Some features still need a lot of testing, especially corner cases involving objects that already exist on disk. I expect the next round of API overhaul will simplify building test cases. Jan 9, 2007: a number of fixes thanks to Colin Percival, especially corrections to the skip() framework and handling of large files. Jan 9, 2007: Fixes for large ISOs. The code should correctly handle very large ISOs with entries up to 4G. Thanks to Robert Sciuk for pointing out these issues. Sep 05, 2006: libarchive 1.3.1 released Sep 5, 2006: Bump version to 1.3 for new I/O wrappers. Sep 4, 2006: New memory and FILE read/write wrappers. Sep 4, 2006: libarchive test harness is now minimally functional; it's located a few minor bugs in error-handling logic Aug 17, 2006: libarchive 1.2.54 released Aug 17, 2006: Outline ABI changes for libarchive 2.0; these are protected behind #ifdef's until I think I've found everything that needs to change. Aug 17, 2006: Fix error-handling in archive_read/write_close() They weren't returning any errors before. Aug 17, 2006: Fix recursive-add logic to not trigger if it's not set Fixes a bug adding files when writing archive to pipe or when using archive_write_open() directly. Jul 2006: New "skip" handling improves performance extracting single files from large uncompressed archives. Mar 21, 2006: 1.2.52 released Mar 21, 2006: Fix -p on platforms that don't have platform-specific extended attribute code. Mar 20, 2006: Add NEWS file; fill in some older history from other files. I'll try to keep this file up-to-date from now on. OLDER NEWS SUMMARIES Mar 19, 2006: libarchive 1.2.51 released Mar 18, 2006: Many fixes to extended attribute support, including a redesign of the storage format to simplify debugging. Mar 12, 2006: Remove 'tp' support; it was a fun idea, but not worth spending much time on. Mar 11, 2006: Incorporated Jaakko Heinonen's still-experimental support for extended attributes (Currently Linux-only.). Mar 11, 2006: Reorganized distribution package: There is now one tar.gz file that builds both libarchive and bsdtar. Feb 13, 2006: Minor bug fixes: correctly read cpio device entries, write Pax attribute entry names. Nov 7, 2005: Experimental 'tp' format support in libarchive. Feedback appreciated; this is not enabled by archive_read_support_format_all() yet as I'm not quite content with the format detection heuristics. Nov 7, 2005: Some more portability improvements thanks to Darin Broady, minor bugfixes. Oct 12, 2005: Use GNU libtool to build shared libraries on many systems. Aug 9, 2005: Correctly detect that MacOS X does not have POSIX ACLs. Apr 17, 2005: Kees Zeelenberg has ported libarchive and bsdtar to Windows: http://gnuwin32.sourceforge.net/ Apr 11, 2005: Extended Zip/Zip64 support thanks to Dan Nelson. -L/-h fix from Jaakko Heinonen. Mar 12, 2005: archive_read_extract can now handle very long pathnames (I've tested with pathnames up to 1MB). Mar 12, 2005: Marcus Geiger has written an article about libarchive http://xsnil.antbear.org/2005/02/05/archive-mit-libarchive-verarbeiten/ including examples of using it from Objective-C. His MoinX http://moinx.antbear.org/ desktop Wiki uses libarchive for archiving and restoring Wiki pages. Jan 22, 2005: Preliminary ZIP extraction support, new directory-walking code for bsdtar. Jan 16, 2005: ISO9660 extraction code added; manpage corrections. May 22, 2004: Many gtar-compatible long options have been added; almost all FreeBSD ports extract correctly with bsdtar. May 18, 2004: bsdtar can read Solaris, HP-UX, Unixware, star, gtar, and pdtar archives. diff --git a/build/ci/github_actions/ci.cmd b/build/ci/github_actions/ci.cmd index 84818b5054aa..23e2a949ea1a 100755 --- a/build/ci/github_actions/ci.cmd +++ b/build/ci/github_actions/ci.cmd @@ -1,132 +1,132 @@ @ECHO OFF SET ZLIB_VERSION=1.2.11 SET BZIP2_VERSION=b7a672291188a6469f71dd13ad14f2f9a7344fc8 -SET XZ_VERSION=2327a461e1afce862c22269b80d3517801103c1b +SET XZ_VERSION=5.2.5 IF NOT "%BE%"=="mingw-gcc" ( IF NOT "%BE%"=="msvc" ( ECHO Environment variable BE must be mingw-gcc or msvc EXIT /b 1 ) ) SET ORIGPATH=%PATH% IF "%BE%"=="mingw-gcc" ( SET MINGWPATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin ) IF "%1"=="deplibs" ( IF NOT EXIST build_ci\libs ( MKDIR build_ci\libs ) CD build_ci\libs IF NOT EXIST zlib-%ZLIB_VERSION%.zip ( ECHO Downloading https://github.com/libarchive/zlib/archive/v%ZLIB_VERSION%.zip curl -L -o zlib-%ZLIB_VERSION%.zip https://github.com/libarchive/zlib/archive/v%ZLIB_VERSION%.zip || EXIT /b 1 ) IF NOT EXIST zlib-%ZLIB_VERSION% ( ECHO Unpacking zlib-%ZLIB_VERSION%.zip C:\windows\system32\tar.exe -x -f zlib-%ZLIB_VERSION%.zip || EXIT /b 1 ) IF NOT EXIST bzip2-%BZIP2_VERSION%.zip ( echo Downloading https://github.com/libarchive/bzip2/archive/%BZIP2_VERSION%.zip curl -L -o bzip2-%BZIP2_VERSION%.zip https://github.com/libarchive/bzip2/archive/%BZIP2_VERSION%.zip || EXIT /b 1 ) IF NOT EXIST bzip2-%BZIP2_VERSION% ( echo Unpacking bzip2-%BZIP2_VERSION%.zip C:\windows\system32\tar.exe -x -f bzip2-%BZIP2_VERSION%.zip || EXIT /b 1 ) IF NOT EXIST xz-%XZ_VERSION%.zip ( echo Downloading https://github.com/libarchive/xz/archive/%XZ_VERSION%.zip - curl -L -o xz-%XZ_VERSION%.zip https://github.com/libarchive/xz/archive/%XZ_VERSION%.zip || EXIT /b 1 + curl -L -o xz-%XZ_VERSION%.zip https://github.com/libarchive/xz/archive/v%XZ_VERSION%.zip || EXIT /b 1 ) IF NOT EXIST xz-%XZ_VERSION% ( echo Unpacking xz-%XZ_VERSION%.zip C:\windows\system32\tar.exe -x -f xz-%XZ_VERSION%.zip || EXIT /b 1 ) CD zlib-%ZLIB_VERSION% IF "%BE%"=="mingw-gcc" ( SET PATH=%MINGWPATH% cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="Release" . || EXIT /b 1 mingw32-make || EXIT /b 1 mingw32-make test || EXIT /b 1 mingw32-make install || EXIT /b 1 ) ELSE IF "%BE%"=="msvc" ( cmake -G "Visual Studio 16 2019" . || EXIT /b 1 cmake --build . --target ALL_BUILD --config Release || EXIT /b 1 cmake --build . --target RUN_TESTS --config Release || EXIT /b 1 cmake --build . --target INSTALL --config Release || EXIT /b 1 ) CD .. CD bzip2-%BZIP2_VERSION% IF "%BE%"=="mingw-gcc" ( SET PATH=%MINGWPATH% cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="Release" -D ENABLE_LIB_ONLY=ON -D ENABLE_SHARED_LIB=OFF -D ENABLE_STATIC_LIB=ON . || EXIT /b 1 mingw32-make || EXIT /b 1 REM mingw32-make test || EXIT /b 1 mingw32-make install || EXIT /b 1 ) ELSE IF "%BE%"=="msvc" ( cmake -G "Visual Studio 16 2019" -D CMAKE_BUILD_TYPE="Release" -D ENABLE_LIB_ONLY=ON -D ENABLE_SHARED_LIB=OFF -D ENABLE_STATIC_LIB=ON . || EXIT /b 1 cmake --build . --target ALL_BUILD --config Release || EXIT /b 1 REM cmake --build . --target RUN_TESTS --config Release || EXIT /b 1 cmake --build . --target INSTALL --config Release || EXIT /b 1 ) CD .. CD xz-%XZ_VERSION% IF "%BE%"=="mingw-gcc" ( SET PATH=%MINGWPATH% cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="Release" . || EXIT /b 1 mingw32-make || EXIT /b 1 mingw32-make install || EXIT /b 1 ) ELSE IF "%BE%"=="msvc" ( cmake -G "Visual Studio 16 2019" -D CMAKE_BUILD_TYPE="Release" . || EXIT /b 1 cmake --build . --target ALL_BUILD --config Release || EXIT /b 1 cmake --build . --target INSTALL --config Release || EXIT /b 1 ) ) ELSE IF "%1%"=="configure" ( IF "%BE%"=="mingw-gcc" ( SET PATH=%MINGWPATH% MKDIR build_ci\cmake CD build_ci\cmake cmake -G "MinGW Makefiles" -D ZLIB_LIBRARY="C:/Program Files (x86)/zlib/lib/libzlibstatic.a" -D ZLIB_INCLUDE_DIR="C:/Program Files (x86)/zlib/include" -D BZIP2_LIBRARIES="C:/Program Files (x86)/bzip2/lib/libbz2.a" -D BZIP2_INCLUDE_DIR="C:/Program Files (x86)/bzip2/include" -D LIBLZMA_LIBRARY="C:/Program Files (x86)/xz/lib/liblzma.a" -D LIBLZMA_INCLUDE_DIR="C:/Program Files (x86)/xz/include" ..\.. || EXIT /b 1 ) ELSE IF "%BE%"=="msvc" ( MKDIR build_ci\cmake CD build_ci\cmake cmake -G "Visual Studio 16 2019" -D CMAKE_BUILD_TYPE="Release" -D ZLIB_LIBRARY="C:/Program Files (x86)/zlib/lib/zlibstatic.lib" -D ZLIB_INCLUDE_DIR="C:/Program Files (x86)/zlib/include" -D BZIP2_LIBRARIES="C:/Program Files (x86)/bzip2/lib/bz2.lib" -D BZIP2_INCLUDE_DIR="C:/Program Files (x86)/bzip2/include" -D LIBLZMA_LIBRARY="C:/Program Files (x86)/xz/lib/liblzma.lib" -D LIBLZMA_INCLUDE_DIR="C:/Program Files (x86)/xz/include" ..\.. || EXIT /b 1 ) ) ELSE IF "%1%"=="build" ( IF "%BE%"=="mingw-gcc" ( SET PATH=%MINGWPATH% CD build_ci\cmake mingw32-make VERBOSE=1 || EXIT /b 1 ) ELSE IF "%BE%"=="msvc" ( CD build_ci\cmake cmake --build . --target ALL_BUILD --config Release || EXIT /b 1 ) ) ELSE IF "%1%"=="test" ( IF "%BE%"=="mingw-gcc" ( SET PATH=%MINGWPATH% CD build_ci\cmake SET SKIP_TEST_SPARSE=1 mingw32-make test VERBOSE=1 || EXIT /b 1 ) ELSE IF "%BE%"=="msvc" ( ECHO "Skipping tests on this platform" EXIT /b 0 REM CD build_ci\cmake REM cmake --build . --target RUN_TESTS --config Release || EXIT /b 1 ) ) ELSE IF "%1%"=="install" ( IF "%BE%"=="mingw-gcc" ( SET PATH=%MINGWPATH% CD build_ci\cmake mingw32-make install || EXIT /b 1 ) ELSE IF "%BE%"=="msvc" ( CD build_ci\cmake cmake --build . --target INSTALL --config Release || EXIT /b 1 ) ) ELSE IF "%1"=="artifact" ( C:\windows\system32\tar.exe -c -C "C:\Program Files (x86)" --format=zip -f libarchive.zip libarchive ) ELSE ( ECHO "Usage: %0% deplibs|configure|build|test|install|artifact" @EXIT /b 0 ) @EXIT /b 0 diff --git a/build/version b/build/version index ea39081c3023..205791c6d996 100644 --- a/build/version +++ b/build/version @@ -1 +1 @@ -3005001dev +3005001 diff --git a/configure.ac b/configure.ac index cb823bd473a2..84eb9a9faa86 100644 --- a/configure.ac +++ b/configure.ac @@ -1,1231 +1,1231 @@ dnl Process this file with autoconf to produce a configure script. 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],[3.5.1dev]) +m4_define([LIBARCHIVE_VERSION_S],[3.5.1]) m4_define([LIBARCHIVE_VERSION_N],[3005001]) dnl bsdtar and bsdcpio versioning tracks libarchive m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) m4_define([BSDCPIO_VERSION_S],LIBARCHIVE_VERSION_S()) m4_define([BSDCAT_VERSION_S],LIBARCHIVE_VERSION_S()) AC_PREREQ([2.69]) # # Now starts the "real" configure script. # AC_INIT([libarchive],[LIBARCHIVE_VERSION_S()],[libarchive-discuss@googlegroups.com]) # Make sure the srcdir contains "libarchive" directory AC_CONFIG_SRCDIR([libarchive]) # Use auxiliary subscripts from this subdirectory (cleans up root) AC_CONFIG_AUX_DIR([build/autoconf]) # M4 scripts AC_CONFIG_MACRO_DIR([build/autoconf]) # Must follow AC_CONFIG macros above... AM_INIT_AUTOMAKE([1.11 dist-xz dist-zip]) AM_MAINTAINER_MODE([enable]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # 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.1 == libtool interface 13 ARCHIVE_INTERFACE=`echo $((13 + ${ARCHIVE_MINOR}))` # Libarchive revision is bumped on any source change === libtool revision ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 )) # 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_CONFIG_H_INCLUDED], [1], [Internal macro for sanity checks]) AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()", [Version number of libarchive]) AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_NUMBER],"LIBARCHIVE_VERSION_N()", [Version number of libarchive as a single integer]) AC_DEFINE([BSDCPIO_VERSION_STRING],"BSDCPIO_VERSION_S()", [Version number of bsdcpio]) AC_DEFINE([BSDTAR_VERSION_STRING],"BSDTAR_VERSION_S()", [Version number of bsdtar]) AC_DEFINE([BSDCAT_VERSION_STRING],"BSDTAR_VERSION_S()", [Version number of bsdcat]) # The shell variables here must be the same as the AC_SUBST() variables # below, but the shell variable names apparently cannot be the same as # the m4 macro names above. Why? Ask autoconf. BSDCPIO_VERSION_STRING=BSDCPIO_VERSION_S() BSDTAR_VERSION_STRING=BSDTAR_VERSION_S() BSDCAT_VERSION_STRING=BSDCAT_VERSION_S() LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S() LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N() # Substitute the above version numbers into the various files below. # Yes, I believe this is the fourth time we define what are essentially # the same symbols. Why? Ask autoconf. AC_SUBST(ARCHIVE_LIBTOOL_VERSION) AC_SUBST(BSDCPIO_VERSION_STRING) AC_SUBST(BSDTAR_VERSION_STRING) AC_SUBST(BSDCAT_VERSION_STRING) AC_SUBST(LIBARCHIVE_VERSION_STRING) AC_SUBST(LIBARCHIVE_VERSION_NUMBER) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([build/pkgconfig/libarchive.pc]) # Check for host type AC_CANONICAL_HOST dnl Compilation on mingw and Cygwin needs special Makefile rules inc_windows_files=no inc_cygwin_files=no case "$host_os" in *mingw* ) inc_windows_files=yes ;; *cygwin* | *msys*) inc_cygwin_files=yes ;; esac AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes]) AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes]) dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc) PLATFORMCPPFLAGS= case "$host_os" in *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO ;; esac AC_SUBST(PLATFORMCPPFLAGS) # Checks for programs. AC_PROG_CC AC_PROG_CC_C99 AM_PROG_CC_C_O AC_USE_SYSTEM_EXTENSIONS AC_LIBTOOL_WIN32_DLL AC_PROG_LIBTOOL AC_CHECK_TOOL([STRIP],[strip]) AC_PROG_MKDIR_P # # Options for building bsdtar. # # Default is to build bsdtar, but allow people to override that. # AC_ARG_ENABLE([bsdtar], [AS_HELP_STRING([--enable-bsdtar], [enable build of bsdtar (default)]) AS_HELP_STRING([--enable-bsdtar=static], [force static build of bsdtar]) AS_HELP_STRING([--enable-bsdtar=shared], [force dynamic build of bsdtar]) AS_HELP_STRING([--disable-bsdtar], [disable build of bsdtar])], [], [enable_bsdtar=yes]) case "$enable_bsdtar" in yes) if test "$enable_static" = "no"; then static_bsdtar=no else static_bsdtar=yes fi build_bsdtar=yes ;; dynamic|shared) if test "$enable_shared" = "no"; then AC_MSG_FAILURE([Shared linking of bsdtar requires shared libarchive]) fi build_bsdtar=yes static_bsdtar=no ;; static) build_bsdtar=yes static_bsdtar=yes ;; no) build_bsdtar=no static_bsdtar=no ;; *) AC_MSG_FAILURE([Unsupported value for --enable-bsdtar]) ;; esac AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ]) AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ]) # # Options for building bsdcat. # # Default is to build bsdcat, but allow people to override that. # AC_ARG_ENABLE([bsdcat], [AS_HELP_STRING([--enable-bsdcat], [enable build of bsdcat (default)]) AS_HELP_STRING([--enable-bsdcat=static], [force static build of bsdcat]) AS_HELP_STRING([--enable-bsdcat=shared], [force dynamic build of bsdcat]) AS_HELP_STRING([--disable-bsdcat], [disable build of bsdcat])], [], [enable_bsdcat=yes]) case "$enable_bsdcat" in yes) if test "$enable_static" = "no"; then static_bsdcat=no else static_bsdcat=yes fi build_bsdcat=yes ;; dynamic|shared) if test "$enable_shared" = "no"; then AC_MSG_FAILURE([Shared linking of bsdcat requires shared libarchive]) fi build_bsdcat=yes static_bsdcat=no ;; static) build_bsdcat=yes static_bsdcat=yes ;; no) build_bsdcat=no static_bsdcat=no ;; *) AC_MSG_FAILURE([Unsupported value for --enable-bsdcat]) ;; esac AM_CONDITIONAL([BUILD_BSDCAT], [ test "$build_bsdcat" = yes ]) AM_CONDITIONAL([STATIC_BSDCAT], [ test "$static_bsdcat" = yes ]) # # Options for building bsdcpio. # # Default is not to build bsdcpio, but that can be overridden. # AC_ARG_ENABLE([bsdcpio], [AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio (default)]) AS_HELP_STRING([--enable-bsdcpio=static], [static build of bsdcpio]) AS_HELP_STRING([--enable-bsdcpio=shared], [dynamic build of bsdcpio]) AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio])], [], [enable_bsdcpio=yes]) case "$enable_bsdcpio" in yes) if test "$enable_static" = "no"; then static_bsdcpio=no else static_bsdcpio=yes fi build_bsdcpio=yes ;; dynamic|shared) if test "$enabled_shared" = "no"; then AC_MSG_FAILURE([Shared linking of bsdcpio requires shared libarchive]) fi build_bsdcpio=yes ;; static) build_bsdcpio=yes static_bsdcpio=yes ;; no) build_bsdcpio=no static_bsdcpio=no ;; *) AC_MSG_FAILURE([Unsupported value for --enable-bsdcpio]) ;; esac AM_CONDITIONAL([BUILD_BSDCPIO], [ test "$build_bsdcpio" = yes ]) AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ]) # Set up defines needed before including any headers case $host in *mingw* | *cygwin* | *msys* ) AC_PREPROC_IFELSE([AC_LANG_PROGRAM( [[#ifdef _WIN32_WINNT # error _WIN32_WINNT already defined #endif ]],[[;]]) ],[ AC_DEFINE([_WIN32_WINNT], 0x0502, [Define to '0x0502' for Windows Server 2003 APIs.]) AC_DEFINE([NTDDI_VERSION], 0x05020000, [Define to '0x05020000' for Windows Server 2003 APIs.]) ]) AC_PREPROC_IFELSE([AC_LANG_PROGRAM( [[#ifdef WINVER # error WINVER already defined #endif ]],[[;]]) ],[ AC_DEFINE([WINVER], 0x0502, [Define to '0x0502' for Windows Server 2003 APIs.]) ]) ;; esac # Checks for header files. AC_HEADER_DIRENT AC_HEADER_SYS_WAIT AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h]) AC_CHECK_HEADERS([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 @%:@include ], [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 linux/types.h]) AC_CACHE_CHECK([whether FS_IOC_GETFLAGS is usable], [ac_cv_have_decl_FS_IOC_GETFLAGS], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include @%:@include ], [int x = FS_IOC_GETFLAGS])], [AS_VAR_SET([ac_cv_have_decl_FS_IOC_GETFLAGS], [yes])], [AS_VAR_SET([ac_cv_have_decl_FS_IOC_GETFLAGS], [no])])]) AS_VAR_IF([ac_cv_have_decl_FS_IOC_GETFLAGS], [yes], [AC_DEFINE_UNQUOTED([HAVE_WORKING_FS_IOC_GETFLAGS], [1], [Define to 1 if you have a working FS_IOC_GETFLAGS])]) AC_CHECK_HEADERS([locale.h membership.h paths.h poll.h pthread.h pwd.h]) AC_CHECK_HEADERS([readpassphrase.h signal.h spawn.h]) AC_CHECK_HEADERS([stdarg.h stdint.h stdlib.h string.h]) AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/ea.h sys/extattr.h]) AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h]) AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/richacl.h]) AC_CHECK_HEADERS([sys/select.h sys/statfs.h sys/statvfs.h sys/sysmacros.h]) AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h sys/xattr.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 #endif ]]) # Checks for libraries. AC_ARG_WITH([zlib], AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib])) if test "x$with_zlib" != "xno"; then AC_CHECK_HEADERS([zlib.h]) AC_CHECK_LIB(z,inflate) fi AC_ARG_WITH([bz2lib], AS_HELP_STRING([--without-bz2lib], [Don't build support for bzip2 through bz2lib])) if test "x$with_bz2lib" != "xno"; then AC_CHECK_HEADERS([bzlib.h]) case "$host_os" in *mingw* | *cygwin* | *msys*) dnl AC_CHECK_LIB cannot be used on the Windows port of libbz2, therefore dnl use AC_LINK_IFELSE. AC_MSG_CHECKING([for BZ2_bzDecompressInit in -lbz2]) old_LIBS="$LIBS" LIBS="-lbz2 $LIBS" AC_LINK_IFELSE( [AC_LANG_SOURCE(#include int main() { return BZ2_bzDecompressInit(NULL, 0, 0); })], [ac_cv_lib_bz2_BZ2_bzDecompressInit=yes], [ac_cv_lib_bz2_BZ2_bzDecompressInit=no]) LIBS="$old_LIBS" AC_MSG_RESULT($ac_cv_lib_bz2_BZ2_bzDecompressInit) if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then AC_DEFINE([HAVE_LIBBZ2], [1], [Define to 1 if you have the `bz2' library (-lbz2).]) LIBS="-lbz2 $LIBS" fi ;; *) AC_CHECK_LIB(bz2,BZ2_bzDecompressInit) ;; esac fi AC_ARG_WITH([libb2], AS_HELP_STRING([--without-libb2], [Don't build support for BLAKE2 through libb2])) if test "x$with_libb2" != "xno"; then AC_CHECK_HEADERS([blake2.h]) AC_CHECK_LIB(b2,blake2sp_init) fi AM_CONDITIONAL([INC_BLAKE2], [test "x$ac_cv_lib_b2_blake2sp_init" != "xyes"]) AC_ARG_WITH([iconv], AS_HELP_STRING([--without-iconv], [Don't try to link against iconv])) if test "x$with_iconv" != "xno"; then AM_ICONV AC_CHECK_HEADERS([iconv.h],[],[],[#include ]) 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([lz4], AS_HELP_STRING([--without-lz4], [Don't build support for lz4 through liblz4])) if test "x$with_lz4" != "xno"; then AC_CHECK_HEADERS([lz4.h lz4hc.h]) AC_CHECK_LIB(lz4,LZ4_decompress_safe) fi AC_ARG_WITH([zstd], AS_HELP_STRING([--without-zstd], [Don't build support for zstd through libzstd])) if test "x$with_zstd" != "xno"; then AC_CHECK_HEADERS([zstd.h]) AC_CHECK_LIB(zstd,ZSTD_compressStream) fi AC_ARG_WITH([lzma], AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma])) if test "x$with_lzma" != "xno"; then AC_CHECK_HEADERS([lzma.h]) AC_CHECK_LIB(lzma,lzma_stream_decoder) # Some pre-release (but widely distributed) versions of liblzma # included a disabled version of lzma_stream_encoder_mt that # fools a naive AC_CHECK_LIB or AC_CHECK_FUNC, so we need # to do something more complex here: AC_CACHE_CHECK( [whether we have multithread support in lzma], ac_cv_lzma_has_mt, [AC_LINK_IFELSE([ AC_LANG_PROGRAM([[#include ] [#if LZMA_VERSION < 50020000] [#error unsupported] [#endif]], [[lzma_stream_encoder_mt(0, 0);]])], [ac_cv_lzma_has_mt=yes], [ac_cv_lzma_has_mt=no])]) if test "x$ac_cv_lzma_has_mt" != xno; then AC_DEFINE([HAVE_LZMA_STREAM_ENCODER_MT], [1], [Define to 1 if you have the `lzma_stream_encoder_mt' function.]) fi fi AC_ARG_WITH([lzo2], AS_HELP_STRING([--with-lzo2], [Build with LZO support from liblzo2])) if test "x$with_lzo2" = "xyes"; then AC_CHECK_HEADERS([lzo/lzoconf.h lzo/lzo1x.h]) AC_CHECK_LIB(lzo2,lzo1x_decompress_safe) fi AC_ARG_WITH([cng], AS_HELP_STRING([--without-cng], [Don't build support of CNG(Crypto Next Generation)])) AC_ARG_WITH([mbedtls], AS_HELP_STRING([--with-mbedtls], [Build with crypto support from mbed TLS])) AC_ARG_WITH([nettle], AS_HELP_STRING([--with-nettle], [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])) AC_ARG_WITH([expat], AS_HELP_STRING([--without-expat], [Don't build support for xar through expat])) if test "x$with_xml2" != "xno"; then PKG_PROG_PKG_CONFIG PKG_CHECK_MODULES(LIBXML2_PC, [libxml-2.0], [ CPPFLAGS="${CPPFLAGS} ${LIBXML2_PC_CFLAGS}" LIBS="${LIBS} ${LIBXML2_PC_LIBS}" AC_CHECK_LIB(xml2,xmlInitParser,[true],AC_MSG_FAILURE(Missing xml2 library)) ], [ 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 AC_CHECK_HEADERS([expat.h]) AC_CHECK_LIB(expat,XML_ParserCreate) fi fi AC_ARG_ENABLE([posix-regex-lib], [AS_HELP_STRING([--enable-posix-regex-lib], [choose what library to use for POSIX regular expression support (default: auto)]) AS_HELP_STRING([--enable-posix-regex-lib=libc], [use libc POSIX regular expression support]) AS_HELP_STRING([--enable-posix-regex-lib=libregex], [use libregex POSIX regular expression support]) AS_HELP_STRING([--enable-posix-regex-lib=libpcreposix], [use libpcreposix POSIX regular expression support]) AS_HELP_STRING([--disable-posix-regex-lib], [don't enable POSIX regular expression support])], [], [enable_posix_regex_lib=auto]) posix_regex_lib_found= if test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libc" || test "$enable_posix_regex_lib" = "libregex"; then AC_CHECK_HEADERS([regex.h]) if test "x$ac_cv_header_regex_h" != "xno"; then AC_CHECK_FUNC(regcomp) if test "x$ac_cv_func_regcomp" = xyes; then posix_regex_lib_found=1 else AC_CHECK_LIB(regex,regcomp) if test "x$ac_cv_lib_regex_regcomp" = xyes; then posix_regex_lib_found=1 fi fi fi fi if test -z $posix_regex_lib_found && (test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libpcreposix"); then AC_CHECK_HEADERS([pcreposix.h]) AC_CHECK_LIB(pcreposix,regcomp) if test "x$ac_cv_lib_pcreposix_regcomp" != xyes; then AC_MSG_NOTICE(trying libpcreposix check again with libpcre) unset ac_cv_lib_pcreposix_regcomp AC_CHECK_LIB(pcre,pcre_exec) AC_CHECK_LIB(pcreposix,regcomp) if test "x$ac_cv_lib_pcre_pcre_exec" = xyes && test "x$ac_cv_lib_pcreposix_regcomp" = xyes; then AC_MSG_CHECKING(if PCRE_STATIC needs to be defined) AC_LINK_IFELSE( [AC_LANG_SOURCE(#include int main() { return regcomp(NULL, NULL, 0); })], [without_pcre_static=yes], [without_pcre_static=no]) AC_LINK_IFELSE( [AC_LANG_SOURCE(#define PCRE_STATIC #include int main() { return regcomp(NULL, NULL, 0); })], [with_pcre_static=yes], [with_pcre_static=no]) if test "x$without_pcre_static" != xyes && test "x$with_pcre_static" = xyes; then AC_MSG_RESULT(yes) AC_DEFINE([PCRE_STATIC], [1], [Define to 1 if PCRE_STATIC needs to be defined.]) elif test "x$without_pcre_static" = xyes || test "x$with_pcre_static" = xyes; then AC_MSG_RESULT(no) fi posix_regex_lib_found=1 fi else posix_regex_lib_found=1 fi fi # 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. # Need to include Makefile.am magic to link against system # -larchive in that case. #AC_CHECK_LIB(archive,archive_version) # Checks for supported compiler flags AX_APPEND_COMPILE_FLAGS([-Wall -Wformat -Wformat-security]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST # la_TYPE_UID_T defaults to "int", which is incorrect for MinGW # and MSVC. Use a customized version. la_TYPE_UID_T AC_TYPE_MODE_T # AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on # most systems... default to "long long" instead. AC_CHECK_TYPE(off_t, [long long]) 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 ]) # Check for f_namemax in struct statfs AC_CHECK_MEMBERS([struct statfs.f_namemax],,, [ #include #include ]) # Check for f_iosize in struct statvfs AC_CHECK_MEMBERS([struct statvfs.f_iosize],,, [ #include ]) # Check for birthtime in struct stat AC_CHECK_MEMBERS([struct stat.st_birthtime]) # Check for high-resolution timestamps in struct stat AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec]) AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec]) AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec]) AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64 AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd # Check for block size support in struct stat AC_CHECK_MEMBERS([struct stat.st_blksize]) # Check for st_flags in struct stat (BSD fflags) AC_CHECK_MEMBERS([struct stat.st_flags]) # If you have uintmax_t, we assume printf supports %ju # If you have unsigned long long, we assume printf supports %llu # TODO: Check for %ju and %llu support directly. AC_CHECK_TYPES([uintmax_t, unsigned long long]) # We use C99-style integer types # Declare them if the local platform doesn't already do so. AC_TYPE_INTMAX_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 AC_CHECK_DECLS([SIZE_MAX, INT32_MAX, INT32_MIN]) AC_CHECK_DECLS([INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX]) AC_CHECK_DECLS([INTMAX_MAX, INTMAX_MIN, UINTMAX_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 ]) AC_CHECK_DECL([EFTYPE], [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])], [], [#include ]) AC_CHECK_DECL([EILSEQ], [AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])], [], [#include ]) AC_CHECK_TYPE([wchar_t], [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]wchar_t), 1, [Define to 1 if the system has the type `wchar_t'.])dnl AC_CHECK_SIZEOF([wchar_t])], []) AC_HEADER_TIME # Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_HEADER_MAJOR AC_FUNC_FSEEKO AC_FUNC_MEMCMP AC_FUNC_LSTAT AC_FUNC_STAT AC_FUNC_STRERROR_R AC_FUNC_STRFTIME AC_FUNC_VPRINTF # check for: # CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES) # 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([arc4random_buf 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 memmove memset]) AC_CHECK_FUNCS([mkdir mkfifo mknod mkstemp]) AC_CHECK_FUNCS([nl_langinfo openat pipe poll posix_spawnp readlink readlinkat]) AC_CHECK_FUNCS([readpassphrase]) AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs]) AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strnlen strrchr symlink]) AC_CHECK_FUNCS([timegm tzset unlinkat unsetenv utime utimensat utimes vfork]) AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy wmemmove]) AC_CHECK_FUNCS([_ctime64_s _fseeki64]) AC_CHECK_FUNCS([_get_timezone _gmtime64_s _localtime64_s _mkgmtime64]) # detects cygwin-1.7, as opposed to older versions AC_CHECK_FUNCS([cygwin_conv_path]) # DragonFly uses vfsconf, FreeBSD xvfsconf. AC_CHECK_TYPES(struct vfsconf,,, [#if HAVE_SYS_TYPES_H #include #endif #include ]) AC_CHECK_TYPES(struct xvfsconf,,, [#if HAVE_SYS_TYPES_H #include #endif #include ]) # There are several variants of readdir_r around; we only # accept the POSIX-compliant version. AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include ]], [[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])] ) # dirfd can be either a function or a macro. AC_COMPILE_IFELSE( [AC_LANG_PROGRAM([[#include DIR *dir;]], [[return(dirfd(dir));]])], [AC_DEFINE(HAVE_DIRFD,1,[Define to 1 if you have a dirfd function or macro])] ) # 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... AC_CHECK_DECL([D_MD_ORDER], [AC_DEFINE(HAVE_D_MD_ORDER, 1, [Define to 1 if nl_langinfo supports D_MD_ORDER])], [], [#if HAVE_LANGINFO_H #include #endif ]) # Check for dirent.d_namlen field explicitly # (This is a bit more straightforward than, if not quite as portable as, # the recipe given by the autoconf maintainers.) AC_CHECK_MEMBER(struct dirent.d_namlen,,, [#if HAVE_DIRENT_H #include #endif ]) # Check for Extended Attributes support AC_ARG_ENABLE([xattr], AS_HELP_STRING([--disable-xattr], [Disable Extended Attributes support (default: check)])) if test "x$enable_xattr" != "xno"; then AC_SEARCH_LIBS([setxattr], [attr gnu]) AC_CHECK_DECLS([EXTATTR_NAMESPACE_USER], [], [], [#include #include ]) AC_CHECK_DECLS([XATTR_NOFOLLOW], [], [], [#include ]) if test "x$ac_cv_header_sys_xattr_h" = "xyes" \ -a "x$ac_cv_have_decl_XATTR_NOFOLLOW" = "xyes"; then # Darwin extended attributes support AC_CACHE_VAL([ac_cv_archive_xattr_darwin], [AC_CHECK_FUNCS(fgetxattr \ flistxattr \ fsetxattr \ getxattr \ listxattr \ setxattr, [ac_cv_archive_xattr_darwin=yes], [ac_cv_archive_xattr_darwin=no], [#include ]) ] ) elif test "x$ac_cv_header_sys_extattr_h" = "xyes" \ -a "x$ac_cv_have_decl_EXTATTR_NAMESPACE_USER" = "xyes"; then # FreeBSD extended attributes support AC_CACHE_VAL([ac_cv_archive_xattr_freebsd], [AC_CHECK_FUNCS(extattr_get_fd \ extattr_get_file \ extattr_get_link \ extattr_list_fd \ extattr_list_file \ extattr_list_link \ extattr_set_fd \ extattr_set_link, [ac_cv_archive_xattr_freebsd=yes], [ac_cv_archive_xattr_freebsd=no], [#include #include ]) ] ) elif test "x$ac_cv_header_sys_xattr_h" = "xyes" \ -o "x$ac_cv_header_attr_xattr_h" = "xyes"; then # Linux extended attributes support AC_CACHE_VAL([ac_cv_archive_xattr_linux], [AC_CHECK_FUNCS(fgetxattr \ flistxattr \ fsetxattr \ getxattr \ lgetxattr \ listxattr \ llistxattr \ lsetxattr, [ac_cv_archive_xattr_linux=yes], [ac_cv_archive_xattr_linux=no], [#if HAVE_SYS_TYPES_H #include #endif #if HAVE_SYS_XATTR_H #include #endif #if HAVE_ATTR_XATTR_H #include #endif ]) ] ) elif test "x$ac_cv_header_sys_ea_h" = "xyes"; then # AIX extended attributes support AC_CACHE_VAL([ac_cv_archive_xattr_aix], [AC_CHECK_FUNCS(fgetea \ flistea \ fsetea \ getea \ lgetea \ listea \ llistea \ lsetea, [ac_cv_archive_xattr_aix=yes], [ac_cv_archive_xattr_aix=no], [#include ]) ] ) fi AC_MSG_CHECKING([for extended attributes support]) if test "x$ac_cv_archive_xattr_linux" = "xyes"; then AC_DEFINE([ARCHIVE_XATTR_LINUX], [1], [Linux xattr support]) AC_MSG_RESULT([Linux]) elif test "x$ac_cv_archive_xattr_darwin" = "xyes"; then AC_DEFINE([ARCHIVE_XATTR_DARWIN], [1], [Darwin xattr support]) AC_MSG_RESULT([Darwin]) elif test "x$ac_cv_archive_xattr_freebsd" = "xyes"; then AC_DEFINE([ARCHIVE_XATTR_FREEBSD], [1], [FreeBSD xattr support]) AC_MSG_RESULT([FreeBSD]) elif test "x$ac_cv_archive_xattr_aix" = "xyes"; then AC_DEFINE([ARCHIVE_XATTR_AIX], [1], [AIX xattr support]) AC_MSG_RESULT([AIX]) else AC_MSG_RESULT([none]) fi fi # Check for ACL support # # The ACL support in libarchive is written against the POSIX1e draft, # which was never officially approved and varies quite a bit across # platforms. Worse, some systems have completely non-POSIX acl functions, # which makes the following checks rather more complex than I would like. # AC_ARG_ENABLE([acl], AS_HELP_STRING([--disable-acl], [Disable ACL support (default: check)])) if test "x$enable_acl" != "xno"; then # Libacl AC_CHECK_LIB([acl], [acl_get_file]) AC_CHECK_TYPES([acl_t, acl_entry_t, acl_permset_t, acl_tag_t], [], [], [ #if HAVE_SYS_TYPES_H #include #endif #if HAVE_SYS_ACL_H #include #endif ]) AC_CHECK_LIB([richacl], [richacl_get_file]) AC_CHECK_TYPES([[struct richace], [struct richacl]], [], [], [ #if HAVE_SYS_RICHACL_H #include #endif ]) # Solaris and derivates ACLs AC_CHECK_FUNCS(acl facl) if test "x$ac_cv_lib_richacl_richacl_get_file" = "xyes" \ -a "x$ac_cv_type_struct_richace" = "xyes" \ -a "x$ac_cv_type_struct_richacl" = "xyes"; then AC_CACHE_VAL([ac_cv_archive_acl_librichacl], [AC_CHECK_FUNCS(richacl_alloc \ richacl_equiv_mode \ richacl_free \ richacl_get_fd \ richacl_get_file \ richacl_set_fd \ richacl_set_file, [ac_cv_archive_acl_librichacl=yes], [ac_cv_archive_acl_librichacl=no], [#include ])]) fi if test "x$ac_cv_func_acl" = "xyes" \ -a "x$ac_cv_func_facl" = "xyes"; then AC_CHECK_TYPES([aclent_t], [], [], [[#include ]]) if test "x$ac_cv_type_aclent_t" = "xyes"; then AC_CACHE_VAL([ac_cv_archive_acl_sunos], [AC_CHECK_DECLS([GETACL, SETACL, GETACLCNT], [ac_cv_archive_acl_sunos=yes], [ac_cv_archive_acl_sunos=no], [#include ])]) AC_CHECK_TYPES([ace_t], [], [], [[#include ]]) if test "x$ac_cv_type_ace_t" = "xyes"; then AC_CACHE_VAL([ac_cv_archive_acl_sunos_nfs4], [AC_CHECK_DECLS([ACE_GETACL, ACE_SETACL, ACE_GETACLCNT], [ac_cv_archive_acl_sunos_nfs4=yes], [ac_cv_archive_acl_sonos_nfs4=no], [#include ])]) fi fi elif test "x$ac_cv_type_acl_t" = "xyes" \ -a "x$ac_cv_type_acl_entry_t" = "xyes" \ -a "x$ac_cv_type_acl_permset_t" = "xyes" \ -a "x$ac_cv_type_acl_tag_t" = "xyes"; then # POSIX.1e ACL functions AC_CACHE_VAL([ac_cv_posix_acl_funcs], [AC_CHECK_FUNCS(acl_add_perm \ acl_clear_perms \ acl_create_entry \ acl_delete_def_file \ acl_free \ acl_get_entry \ acl_get_fd \ acl_get_file \ acl_get_permset \ acl_get_qualifier \ acl_get_tag_type \ acl_init \ acl_set_fd \ acl_set_file \ acl_set_qualifier \ acl_set_tag_type, [ac_cv_posix_acl_funcs=yes], [ac_cv_posix_acl_funcs=no], [#if HAVE_SYS_TYPES_H #include #endif #if HAVE_SYS_ACL_H #include #endif ]) ]) AC_CHECK_FUNCS(acl_get_perm) if test "x$ac_cv_posix_acl_funcs" = "xyes" \ -a "x$ac_cv_header_acl_libacl_h" = "xyes" \ -a "x$ac_cv_lib_acl_acl_get_file" = "xyes" \ -a "x$ac_cv_func_acl_get_perm"; then AC_CACHE_VAL([ac_cv_archive_acl_libacl], [ac_cv_archive_acl_libacl=yes]) AC_DEFINE([ARCHIVE_ACL_LIBACL], [1], [POSIX.1e ACL support via libacl]) else # FreeBSD/Darwin AC_CHECK_FUNCS(acl_add_flag_np \ acl_clear_flags_np \ acl_get_brand_np \ acl_get_entry_type_np \ acl_get_flag_np \ acl_get_flagset_np \ acl_get_fd_np \ acl_get_link_np \ acl_get_perm_np \ acl_is_trivial_np \ acl_set_entry_type_np \ acl_set_fd_np \ acl_set_link_np,,, [#include #include ]) AC_CHECK_FUNCS(mbr_uid_to_uuid \ mbr_uuid_to_id \ mbr_gid_to_uuid,,, [#include ]) AC_CHECK_DECLS([ACL_TYPE_EXTENDED, ACL_TYPE_NFS4, ACL_USER, ACL_SYNCHRONIZE], [], [], [#include #include ]) if test "x$ac_cv_posix_acl_funcs" = "xyes" \ -a "x$ac_cv_func_acl_get_fd_np" = "xyes" \ -a "x$ac_cv_func_acl_get_perm" != "xyes" \ -a "x$ac_cv_func_acl_get_perm_np" = "xyes" \ -a "x$ac_cv_func_acl_set_fd_np" = "xyes"; then if test "x$ac_cv_have_decl_ACL_USER" = "xyes"; then AC_CACHE_VAL([ac_cv_archive_acl_freebsd], [ac_cv_archive_acl_freebsd=yes]) if test "x$ac_cv_have_decl_ACL_TYPE_NFS4" = "xyes" \ -a "x$ac_cv_func_acl_add_flag_np" = "xyes" \ -a "x$ac_cv_func_acl_get_brand_np" = "xyes" \ -a "x$ac_cv_func_acl_get_entry_type_np" = "xyes" \ -a "x$ac_cv_func_acl_get_flagset_np" = "xyes" \ -a "x$ac_cv_func_acl_set_entry_type_np" = "xyes"; then AC_CACHE_VAL([ac_cv_archive_acl_freebsd_nfs4], [ac_cv_archive_acl_freebsd_nfs4=yes]) fi elif test "x$ac_cv_have_decl_ACL_TYPE_EXTENDED" = "xyes" \ -a "x$ac_cv_func_acl_add_flag_np" = "xyes" \ -a "x$ac_cv_func_acl_get_flagset_np" = "xyes" \ -a "x$ac_cv_func_acl_get_link_np" = "xyes" \ -a "x$ac_cv_func_acl_set_link_np" = "xyes" \ -a "x$ac_cv_func_mbr_uid_to_uuid" = "xyes" \ -a "x$ac_cv_func_mbr_uuid_to_id" = "xyes" \ -a "x$ac_cv_func_mbr_gid_to_uuid" = "xyes"; then AC_CACHE_VAL([ac_cv_archive_acl_darwin], [ac_cv_archive_acl_darwin=yes]) fi fi fi fi AC_MSG_CHECKING([for ACL support]) if test "x$ac_cv_archive_acl_libacl" = "xyes" \ -a "x$ac_cv_archive_acl_librichacl" = "xyes"; then AC_MSG_RESULT([libacl (POSIX.1e) + librichacl (NFSv4)]) AC_DEFINE([ARCHIVE_ACL_LIBACL], [1], [Linux POSIX.1e ACL support via libacl]) AC_DEFINE([ARCHIVE_ACL_LIBRICHACL], [1], [Linux NFSv4 ACL support via librichacl]) elif test "x$ac_cv_archive_acl_libacl" = "xyes"; then AC_MSG_RESULT([libacl (POSIX.1e)]) AC_DEFINE([ARCHIVE_ACL_LIBACL], [1], [Linux POSIX.1e ACL support via libacl]) elif test "x$ac_cv_archive_acl_librichacl" = "xyes"; then AC_MSG_RESULT([librichacl (NFSv4)]) AC_DEFINE([ARCHIVE_ACL_LIBRICHACL], [1], [Linux NFSv4 ACL support via librichacl]) elif test "x$ac_cv_archive_acl_darwin" = "xyes"; then AC_DEFINE([ARCHIVE_ACL_DARWIN], [1], [Darwin ACL support]) AC_MSG_RESULT([Darwin (limited NFSv4)]) elif test "x$ac_cv_archive_acl_sunos" = "xyes"; then AC_DEFINE([ARCHIVE_ACL_SUNOS], [1], [Solaris ACL support]) if test "x$ac_cv_archive_acl_sunos_nfs4" = "xyes"; then AC_DEFINE([ARCHIVE_ACL_SUNOS_NFS4], [1], [Solaris NFSv4 ACL support]) AC_MSG_RESULT([Solaris (POSIX.1e and NFSv4)]) else AC_MSG_RESULT([Solaris (POSIX.1e)]) fi elif test "x$ac_cv_archive_acl_freebsd" = "xyes"; then AC_DEFINE([ARCHIVE_ACL_FREEBSD], [1], [FreeBSD ACL support]) if test "x$ac_cv_archive_acl_freebsd_nfs4" = "xyes"; then AC_DEFINE([ARCHIVE_ACL_FREEBSD_NFS4], [1], [FreeBSD NFSv4 ACL support]) AC_MSG_RESULT([FreeBSD (POSIX.1e and NFSv4)]) else AC_MSG_RESULT([FreeBSD (POSIX.1e)]) fi else AC_MSG_RESULT([none]) fi fi AM_CONDITIONAL([INC_LINUX_ACL], [test "x$ac_cv_archive_acl_libacl" = "xyes" \ -o "x$ac_cv_archive_acl_librichacl" = "xyes"]) AM_CONDITIONAL([INC_SUNOS_ACL], [test "x$ac_cv_archive_acl_sunos" = "xyes"]) AM_CONDITIONAL([INC_DARWIN_ACL], [test "x$ac_cv_archive_acl_darwin" = "xyes"]) AM_CONDITIONAL([INC_FREEBSD_ACL], [test "x$ac_cv_archive_acl_freebsd" = "xyes"]) # Additional requirements AC_SYS_LARGEFILE dnl NOTE: Crypto checks must run last. AC_DEFUN([CRYPTO_CHECK], [ if test "$found_$1" != yes; then saved_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" 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_digest.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 found_$2=yes AC_DEFINE(ARCHIVE_CRYPTO_$1_$2, 1, [ $1 via ARCHIVE_CRYPTO_$1_$2 supported.]) ], [ AC_MSG_RESULT([no])]) CPPFLAGS="$saved_CPPFLAGS" rm "check_crypto_md.h" fi ]) AC_DEFUN([CRYPTO_CHECK_WIN], [ if test "$found_$1" != yes; then AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_WIN]) AC_LINK_IFELSE([AC_LANG_SOURCE([ #define ARCHIVE_$1_COMPILE_TEST #include #include int main(int argc, char **argv) { (void)argc; (void)argv; return ($2); } ])], [ AC_MSG_RESULT([yes]) found_$1=yes found_WIN=yes AC_DEFINE(ARCHIVE_CRYPTO_$1_WIN, 1, [ $1 via ARCHIVE_CRYPTO_$1_WIN supported.]) ], [ AC_MSG_RESULT([no])]) fi ]) case "$host_os" in *mingw* | *cygwin* | *msys*) ;; *) 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) ;; esac if test "x$with_cng" != "xno"; then AC_CHECK_HEADERS([bcrypt.h],[ LIBS="$LIBS -lbcrypt" ],[], [[#ifdef HAVE_WINDOWS_H # include #endif ]]) fi if test "x$with_mbedtls" = "xyes"; then AC_CHECK_HEADERS([mbedtls/aes.h mbedtls/md.h mbedtls/pkcs5.h]) saved_LIBS=$LIBS AC_CHECK_LIB(mbedcrypto,mbedtls_sha1_init) CRYPTO_CHECK(MD5, MBEDTLS, md5) CRYPTO_CHECK(RMD160, MBEDTLS, rmd160) CRYPTO_CHECK(SHA1, MBEDTLS, sha1) CRYPTO_CHECK(SHA256, MBEDTLS, sha256) CRYPTO_CHECK(SHA384, MBEDTLS, sha384) CRYPTO_CHECK(SHA512, MBEDTLS, sha512) if test "x$found_MBEDTLS" != "xyes"; then LIBS=$saved_LIBS fi fi if test "x$with_nettle" = "xyes"; then AC_CHECK_HEADERS([nettle/md5.h nettle/ripemd160.h nettle/sha.h]) AC_CHECK_HEADERS([nettle/pbkdf2.h nettle/aes.h nettle/hmac.h]) saved_LIBS=$LIBS AC_CHECK_LIB(nettle,nettle_sha1_init) CRYPTO_CHECK(MD5, NETTLE, md5) CRYPTO_CHECK(RMD160, NETTLE, rmd160) CRYPTO_CHECK(SHA1, NETTLE, sha1) CRYPTO_CHECK(SHA256, NETTLE, sha256) CRYPTO_CHECK(SHA384, NETTLE, sha384) CRYPTO_CHECK(SHA512, NETTLE, sha512) if test "x$found_NETTLE" != "xyes"; then LIBS=$saved_LIBS fi fi if test "x$with_openssl" != "xno"; then AC_CHECK_HEADERS([openssl/evp.h]) saved_LIBS=$LIBS case "$host_os" in *mingw* | *cygwin* | *msys*) case "$host_cpu" in x86_64) AC_CHECK_LIB(eay64,OPENSSL_config) if test "x$ac_cv_lib_eay64_main" != "xyes"; then AC_CHECK_LIB(eay32,OPENSSL_config) fi ;; *) AC_CHECK_LIB(eay32,OPENSSL_config) ;; esac ;; *) AC_CHECK_LIB(crypto,OPENSSL_config) ;; esac CRYPTO_CHECK(MD5, OPENSSL, md5) CRYPTO_CHECK(RMD160, OPENSSL, rmd160) CRYPTO_CHECK(SHA1, OPENSSL, sha1) CRYPTO_CHECK(SHA256, OPENSSL, sha256) CRYPTO_CHECK(SHA384, OPENSSL, sha384) CRYPTO_CHECK(SHA512, OPENSSL, sha512) AC_CHECK_FUNCS([PKCS5_PBKDF2_HMAC_SHA1]) fi # Probe libmd AFTER OpenSSL/libcrypto. # The two are incompatible and OpenSSL is more complete. AC_CHECK_HEADERS([md5.h ripemd.h sha.h sha256.h sha512.h]) saved_LIBS=$LIBS AC_CHECK_LIB(md,MD5Init) CRYPTO_CHECK(MD5, LIBMD, md5) CRYPTO_CHECK(RMD160, LIBMD, rmd160) CRYPTO_CHECK(SHA1, LIBMD, sha1) CRYPTO_CHECK(SHA256, LIBMD, sha256) CRYPTO_CHECK(SHA512, LIBMD, sha512) if test "x$found_LIBMD" != "xyes"; then LIBS=$saved_LIBS fi case "$host_os" in *mingw* | *cygwin* | *msys*) CRYPTO_CHECK_WIN(MD5, CALG_MD5) CRYPTO_CHECK_WIN(SHA1, CALG_SHA1) CRYPTO_CHECK_WIN(SHA256, CALG_SHA_256) CRYPTO_CHECK_WIN(SHA384, CALG_SHA_384) CRYPTO_CHECK_WIN(SHA512, CALG_SHA_512) ;; esac # Ensure test directories are present if building out-of-tree AC_CONFIG_COMMANDS([mkdirs], [mkdir -p libarchive/test tar/test cat/test cpio/test]) AC_OUTPUT diff --git a/libarchive/archive.h b/libarchive/archive.h index 48abb3bc994e..52f4d782953b 100644 --- a/libarchive/archive.h +++ b/libarchive/archive.h @@ -1,1204 +1,1204 @@ /*- * Copyright (c) 2003-2010 Tim Kientzle * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/lib/libarchive/archive.h.in,v 1.50 2008/05/26 17:00:22 kientzle Exp $ */ #ifndef ARCHIVE_H_INCLUDED #define ARCHIVE_H_INCLUDED /* * The version number is expressed as a single integer that makes it * easy to compare versions at build time: for version a.b.c, the * version number is printf("%d%03d%03d",a,b,c). For example, if you * know your application requires version 2.12.108 or later, you can * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ #define ARCHIVE_VERSION_NUMBER 3005001 #include #include /* for wchar_t */ #include /* For FILE * */ #include /* For time_t */ /* * Note: archive.h is for use outside of libarchive; the configuration * headers (config.h, archive_platform.h, etc.) are purely internal. * Do NOT use HAVE_XXX configuration macros to control the behavior of * this header! If you must conditionalize, use predefined compiler and/or * platform macros. */ #if defined(__BORLANDC__) && __BORLANDC__ >= 0x560 # include #elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__) && !defined(_SCO_DS) && !defined(__osf__) && !defined(__CLANG_INTTYPES_H) # include #endif /* Get appropriate definitions of 64-bit integer */ #if !defined(__LA_INT64_T_DEFINED) /* Older code relied on the __LA_INT64_T macro; after 4.0 we'll switch to the typedef exclusively. */ # if ARCHIVE_VERSION_NUMBER < 4000000 #define __LA_INT64_T la_int64_t # endif #define __LA_INT64_T_DEFINED # if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__) typedef __int64 la_int64_t; # else # include /* ssize_t */ # if defined(_SCO_DS) || defined(__osf__) typedef long long la_int64_t; # else typedef int64_t la_int64_t; # endif # endif #endif /* The la_ssize_t should match the type used in 'struct stat' */ #if !defined(__LA_SSIZE_T_DEFINED) /* Older code relied on the __LA_SSIZE_T macro; after 4.0 we'll switch to the typedef exclusively. */ # if ARCHIVE_VERSION_NUMBER < 4000000 #define __LA_SSIZE_T la_ssize_t # endif #define __LA_SSIZE_T_DEFINED # if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__) # if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_) typedef ssize_t la_ssize_t; # elif defined(_WIN64) typedef __int64 la_ssize_t; # else typedef long la_ssize_t; # endif # else # include /* ssize_t */ typedef ssize_t la_ssize_t; # endif #endif /* Large file support for Android */ #ifdef __ANDROID__ #include "android_lf.h" #endif /* * On Windows, define LIBARCHIVE_STATIC if you're building or using a * .lib. The default here assumes you're building a DLL. Only * libarchive source should ever define __LIBARCHIVE_BUILD. */ #if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC) # ifdef __LIBARCHIVE_BUILD # ifdef __GNUC__ # define __LA_DECL __attribute__((dllexport)) extern # else # define __LA_DECL __declspec(dllexport) # endif # else # ifdef __GNUC__ # define __LA_DECL # else # define __LA_DECL __declspec(dllimport) # endif # endif #else /* Static libraries or non-Windows needs no special declaration. */ # define __LA_DECL #endif #if defined(__GNUC__) && __GNUC__ >= 3 && !defined(__MINGW32__) #define __LA_PRINTF(fmtarg, firstvararg) \ __attribute__((__format__ (__printf__, fmtarg, firstvararg))) #else #define __LA_PRINTF(fmtarg, firstvararg) /* nothing */ #endif #if defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >= 1 # define __LA_DEPRECATED __attribute__((deprecated)) #else # define __LA_DEPRECATED #endif #ifdef __cplusplus extern "C" { #endif /* * The version number is provided as both a macro and a function. * The macro identifies the installed header; the function identifies * the library version (which may not be the same if you're using a * dynamically-linked version of the library). Of course, if the * header and library are very different, you should expect some * strangeness. Don't do that. */ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.5.1dev" +#define ARCHIVE_VERSION_ONLY_STRING "3.5.1" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); /* * Detailed textual name/version of the library and its dependencies. * This has the form: * "libarchive x.y.z zlib/a.b.c liblzma/d.e.f ... etc ..." * the list of libraries described here will vary depending on how * libarchive was compiled. */ __LA_DECL const char * archive_version_details(void); /* * Returns NULL if libarchive was compiled without the associated library. * Otherwise, returns the version number that libarchive was compiled * against. */ __LA_DECL const char * archive_zlib_version(void); __LA_DECL const char * archive_liblzma_version(void); __LA_DECL const char * archive_bzlib_version(void); __LA_DECL const char * archive_liblz4_version(void); __LA_DECL const char * archive_libzstd_version(void); /* Declare our basic types. */ struct archive; struct archive_entry; /* * Error codes: Use archive_errno() and archive_error_string() * to retrieve details. Unless specified otherwise, all functions * that return 'int' use these codes. */ #define ARCHIVE_EOF 1 /* Found end of archive. */ #define ARCHIVE_OK 0 /* Operation was successful. */ #define ARCHIVE_RETRY (-10) /* Retry might succeed. */ #define ARCHIVE_WARN (-20) /* Partial success. */ /* For example, if write_header "fails", then you can't push data. */ #define ARCHIVE_FAILED (-25) /* Current operation cannot complete. */ /* But if write_header is "fatal," then this archive is dead and useless. */ #define ARCHIVE_FATAL (-30) /* No more operations are possible. */ /* * As far as possible, archive_errno returns standard platform errno codes. * Of course, the details vary by platform, so the actual definitions * here are stored in "archive_platform.h". The symbols are listed here * for reference; as a rule, clients should not need to know the exact * platform-dependent error code. */ /* Unrecognized or invalid file format. */ /* #define ARCHIVE_ERRNO_FILE_FORMAT */ /* Illegal usage of the library. */ /* #define ARCHIVE_ERRNO_PROGRAMMER_ERROR */ /* Unknown or unclassified error. */ /* #define ARCHIVE_ERRNO_MISC */ /* * Callbacks are invoked to automatically read/skip/write/open/close the * archive. You can provide your own for complex tasks (like breaking * archives across multiple tapes) or use standard ones built into the * library. */ /* Returns pointer and size of next block of data from archive. */ typedef la_ssize_t archive_read_callback(struct archive *, void *_client_data, const void **_buffer); /* Skips at most request bytes from archive and returns the skipped amount. * This may skip fewer bytes than requested; it may even skip zero bytes. * If you do skip fewer bytes than requested, libarchive will invoke your * read callback and discard data as necessary to make up the full skip. */ typedef la_int64_t archive_skip_callback(struct archive *, void *_client_data, la_int64_t request); /* Seeks to specified location in the file and returns the position. * Whence values are SEEK_SET, SEEK_CUR, SEEK_END from stdio.h. * Return ARCHIVE_FATAL if the seek fails for any reason. */ typedef la_int64_t archive_seek_callback(struct archive *, void *_client_data, la_int64_t offset, int whence); /* Returns size actually written, zero on EOF, -1 on error. */ typedef la_ssize_t archive_write_callback(struct archive *, void *_client_data, const void *_buffer, size_t _length); typedef int archive_open_callback(struct archive *, void *_client_data); typedef int archive_close_callback(struct archive *, void *_client_data); typedef int archive_free_callback(struct archive *, void *_client_data); /* Switches from one client data object to the next/prev client data object. * This is useful for reading from different data blocks such as a set of files * that make up one large file. */ typedef int archive_switch_callback(struct archive *, void *_client_data1, void *_client_data2); /* * Returns a passphrase used for encryption or decryption, NULL on nothing * to do and give it up. */ typedef const char *archive_passphrase_callback(struct archive *, void *_client_data); /* * Codes to identify various stream filters. */ #define ARCHIVE_FILTER_NONE 0 #define ARCHIVE_FILTER_GZIP 1 #define ARCHIVE_FILTER_BZIP2 2 #define ARCHIVE_FILTER_COMPRESS 3 #define ARCHIVE_FILTER_PROGRAM 4 #define ARCHIVE_FILTER_LZMA 5 #define ARCHIVE_FILTER_XZ 6 #define ARCHIVE_FILTER_UU 7 #define ARCHIVE_FILTER_RPM 8 #define ARCHIVE_FILTER_LZIP 9 #define ARCHIVE_FILTER_LRZIP 10 #define ARCHIVE_FILTER_LZOP 11 #define ARCHIVE_FILTER_GRZIP 12 #define ARCHIVE_FILTER_LZ4 13 #define ARCHIVE_FILTER_ZSTD 14 #if ARCHIVE_VERSION_NUMBER < 4000000 #define ARCHIVE_COMPRESSION_NONE ARCHIVE_FILTER_NONE #define ARCHIVE_COMPRESSION_GZIP ARCHIVE_FILTER_GZIP #define ARCHIVE_COMPRESSION_BZIP2 ARCHIVE_FILTER_BZIP2 #define ARCHIVE_COMPRESSION_COMPRESS ARCHIVE_FILTER_COMPRESS #define ARCHIVE_COMPRESSION_PROGRAM ARCHIVE_FILTER_PROGRAM #define ARCHIVE_COMPRESSION_LZMA ARCHIVE_FILTER_LZMA #define ARCHIVE_COMPRESSION_XZ ARCHIVE_FILTER_XZ #define ARCHIVE_COMPRESSION_UU ARCHIVE_FILTER_UU #define ARCHIVE_COMPRESSION_RPM ARCHIVE_FILTER_RPM #define ARCHIVE_COMPRESSION_LZIP ARCHIVE_FILTER_LZIP #define ARCHIVE_COMPRESSION_LRZIP ARCHIVE_FILTER_LRZIP #endif /* * Codes returned by archive_format. * * Top 16 bits identifies the format family (e.g., "tar"); lower * 16 bits indicate the variant. This is updated by read_next_header. * Note that the lower 16 bits will often vary from entry to entry. * In some cases, this variation occurs as libarchive learns more about * the archive (for example, later entries might utilize extensions that * weren't necessary earlier in the archive; in this case, libarchive * will change the format code to indicate the extended format that * was used). In other cases, it's because different tools have * modified the archive and so different parts of the archive * actually have slightly different formats. (Both tar and cpio store * format codes in each entry, so it is quite possible for each * entry to be in a different format.) */ #define ARCHIVE_FORMAT_BASE_MASK 0xff0000 #define ARCHIVE_FORMAT_CPIO 0x10000 #define ARCHIVE_FORMAT_CPIO_POSIX (ARCHIVE_FORMAT_CPIO | 1) #define ARCHIVE_FORMAT_CPIO_BIN_LE (ARCHIVE_FORMAT_CPIO | 2) #define ARCHIVE_FORMAT_CPIO_BIN_BE (ARCHIVE_FORMAT_CPIO | 3) #define ARCHIVE_FORMAT_CPIO_SVR4_NOCRC (ARCHIVE_FORMAT_CPIO | 4) #define ARCHIVE_FORMAT_CPIO_SVR4_CRC (ARCHIVE_FORMAT_CPIO | 5) #define ARCHIVE_FORMAT_CPIO_AFIO_LARGE (ARCHIVE_FORMAT_CPIO | 6) #define ARCHIVE_FORMAT_SHAR 0x20000 #define ARCHIVE_FORMAT_SHAR_BASE (ARCHIVE_FORMAT_SHAR | 1) #define ARCHIVE_FORMAT_SHAR_DUMP (ARCHIVE_FORMAT_SHAR | 2) #define ARCHIVE_FORMAT_TAR 0x30000 #define ARCHIVE_FORMAT_TAR_USTAR (ARCHIVE_FORMAT_TAR | 1) #define ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE (ARCHIVE_FORMAT_TAR | 2) #define ARCHIVE_FORMAT_TAR_PAX_RESTRICTED (ARCHIVE_FORMAT_TAR | 3) #define ARCHIVE_FORMAT_TAR_GNUTAR (ARCHIVE_FORMAT_TAR | 4) #define ARCHIVE_FORMAT_ISO9660 0x40000 #define ARCHIVE_FORMAT_ISO9660_ROCKRIDGE (ARCHIVE_FORMAT_ISO9660 | 1) #define ARCHIVE_FORMAT_ZIP 0x50000 #define ARCHIVE_FORMAT_EMPTY 0x60000 #define ARCHIVE_FORMAT_AR 0x70000 #define ARCHIVE_FORMAT_AR_GNU (ARCHIVE_FORMAT_AR | 1) #define ARCHIVE_FORMAT_AR_BSD (ARCHIVE_FORMAT_AR | 2) #define ARCHIVE_FORMAT_MTREE 0x80000 #define ARCHIVE_FORMAT_RAW 0x90000 #define ARCHIVE_FORMAT_XAR 0xA0000 #define ARCHIVE_FORMAT_LHA 0xB0000 #define ARCHIVE_FORMAT_CAB 0xC0000 #define ARCHIVE_FORMAT_RAR 0xD0000 #define ARCHIVE_FORMAT_7ZIP 0xE0000 #define ARCHIVE_FORMAT_WARC 0xF0000 #define ARCHIVE_FORMAT_RAR_V5 0x100000 /* * Codes returned by archive_read_format_capabilities(). * * This list can be extended with values between 0 and 0xffff. * The original purpose of this list was to let different archive * format readers expose their general capabilities in terms of * encryption. */ #define ARCHIVE_READ_FORMAT_CAPS_NONE (0) /* no special capabilities */ #define ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA (1<<0) /* reader can detect encrypted data */ #define ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA (1<<1) /* reader can detect encryptable metadata (pathname, mtime, etc.) */ /* * Codes returned by archive_read_has_encrypted_entries(). * * In case the archive does not support encryption detection at all * ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned. If the reader * for some other reason (e.g. not enough bytes read) cannot say if * there are encrypted entries, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW * is returned. */ #define ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED -2 #define ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW -1 /*- * Basic outline for reading an archive: * 1) Ask archive_read_new for an archive reader object. * 2) Update any global properties as appropriate. * In particular, you'll certainly want to call appropriate * archive_read_support_XXX functions. * 3) Call archive_read_open_XXX to open the archive * 4) Repeatedly call archive_read_next_header to get information about * successive archive entries. Call archive_read_data to extract * data for entries of interest. * 5) Call archive_read_free to end processing. */ __LA_DECL struct archive *archive_read_new(void); /* * The archive_read_support_XXX calls enable auto-detect for this * archive handle. They also link in the necessary support code. * For example, if you don't want bzlib linked in, don't invoke * support_compression_bzip2(). The "all" functions provide the * obvious shorthand. */ #if ARCHIVE_VERSION_NUMBER < 4000000 __LA_DECL int archive_read_support_compression_all(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_read_support_compression_bzip2(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_read_support_compression_compress(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_read_support_compression_gzip(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_read_support_compression_lzip(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_read_support_compression_lzma(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_read_support_compression_none(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_read_support_compression_program(struct archive *, const char *command) __LA_DEPRECATED; __LA_DECL int archive_read_support_compression_program_signature (struct archive *, const char *, const void * /* match */, size_t) __LA_DEPRECATED; __LA_DECL int archive_read_support_compression_rpm(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_read_support_compression_uu(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_read_support_compression_xz(struct archive *) __LA_DEPRECATED; #endif __LA_DECL int archive_read_support_filter_all(struct archive *); __LA_DECL int archive_read_support_filter_by_code(struct archive *, int); __LA_DECL int archive_read_support_filter_bzip2(struct archive *); __LA_DECL int archive_read_support_filter_compress(struct archive *); __LA_DECL int archive_read_support_filter_gzip(struct archive *); __LA_DECL int archive_read_support_filter_grzip(struct archive *); __LA_DECL int archive_read_support_filter_lrzip(struct archive *); __LA_DECL int archive_read_support_filter_lz4(struct archive *); __LA_DECL int archive_read_support_filter_lzip(struct archive *); __LA_DECL int archive_read_support_filter_lzma(struct archive *); __LA_DECL int archive_read_support_filter_lzop(struct archive *); __LA_DECL int archive_read_support_filter_none(struct archive *); __LA_DECL int archive_read_support_filter_program(struct archive *, const char *command); __LA_DECL int archive_read_support_filter_program_signature (struct archive *, const char * /* cmd */, const void * /* match */, size_t); __LA_DECL int archive_read_support_filter_rpm(struct archive *); __LA_DECL int archive_read_support_filter_uu(struct archive *); __LA_DECL int archive_read_support_filter_xz(struct archive *); __LA_DECL int archive_read_support_filter_zstd(struct archive *); __LA_DECL int archive_read_support_format_7zip(struct archive *); __LA_DECL int archive_read_support_format_all(struct archive *); __LA_DECL int archive_read_support_format_ar(struct archive *); __LA_DECL int archive_read_support_format_by_code(struct archive *, int); __LA_DECL int archive_read_support_format_cab(struct archive *); __LA_DECL int archive_read_support_format_cpio(struct archive *); __LA_DECL int archive_read_support_format_empty(struct archive *); __LA_DECL int archive_read_support_format_gnutar(struct archive *); __LA_DECL int archive_read_support_format_iso9660(struct archive *); __LA_DECL int archive_read_support_format_lha(struct archive *); __LA_DECL int archive_read_support_format_mtree(struct archive *); __LA_DECL int archive_read_support_format_rar(struct archive *); __LA_DECL int archive_read_support_format_rar5(struct archive *); __LA_DECL int archive_read_support_format_raw(struct archive *); __LA_DECL int archive_read_support_format_tar(struct archive *); __LA_DECL int archive_read_support_format_warc(struct archive *); __LA_DECL int archive_read_support_format_xar(struct archive *); /* archive_read_support_format_zip() enables both streamable and seekable * zip readers. */ __LA_DECL int archive_read_support_format_zip(struct archive *); /* Reads Zip archives as stream from beginning to end. Doesn't * correctly handle SFX ZIP files or ZIP archives that have been modified * in-place. */ __LA_DECL int archive_read_support_format_zip_streamable(struct archive *); /* Reads starting from central directory; requires seekable input. */ __LA_DECL int archive_read_support_format_zip_seekable(struct archive *); /* Functions to manually set the format and filters to be used. This is * useful to bypass the bidding process when the format and filters to use * is known in advance. */ __LA_DECL int archive_read_set_format(struct archive *, int); __LA_DECL int archive_read_append_filter(struct archive *, int); __LA_DECL int archive_read_append_filter_program(struct archive *, const char *); __LA_DECL int archive_read_append_filter_program_signature (struct archive *, const char *, const void * /* match */, size_t); /* Set various callbacks. */ __LA_DECL int archive_read_set_open_callback(struct archive *, archive_open_callback *); __LA_DECL int archive_read_set_read_callback(struct archive *, archive_read_callback *); __LA_DECL int archive_read_set_seek_callback(struct archive *, archive_seek_callback *); __LA_DECL int archive_read_set_skip_callback(struct archive *, archive_skip_callback *); __LA_DECL int archive_read_set_close_callback(struct archive *, archive_close_callback *); /* Callback used to switch between one data object to the next */ __LA_DECL int archive_read_set_switch_callback(struct archive *, archive_switch_callback *); /* This sets the first data object. */ __LA_DECL int archive_read_set_callback_data(struct archive *, void *); /* This sets data object at specified index */ __LA_DECL int archive_read_set_callback_data2(struct archive *, void *, unsigned int); /* This adds a data object at the specified index. */ __LA_DECL int archive_read_add_callback_data(struct archive *, void *, unsigned int); /* This appends a data object to the end of list */ __LA_DECL int archive_read_append_callback_data(struct archive *, void *); /* This prepends a data object to the beginning of list */ __LA_DECL int archive_read_prepend_callback_data(struct archive *, void *); /* Opening freezes the callbacks. */ __LA_DECL int archive_read_open1(struct archive *); /* Convenience wrappers around the above. */ __LA_DECL int archive_read_open(struct archive *, void *_client_data, archive_open_callback *, archive_read_callback *, archive_close_callback *); __LA_DECL int archive_read_open2(struct archive *, void *_client_data, archive_open_callback *, archive_read_callback *, archive_skip_callback *, archive_close_callback *); /* * A variety of shortcuts that invoke archive_read_open() with * canned callbacks suitable for common situations. The ones that * accept a block size handle tape blocking correctly. */ /* Use this if you know the filename. Note: NULL indicates stdin. */ __LA_DECL int archive_read_open_filename(struct archive *, const char *_filename, size_t _block_size); /* Use this for reading multivolume files by filenames. * NOTE: Must be NULL terminated. Sorting is NOT done. */ __LA_DECL int archive_read_open_filenames(struct archive *, const char **_filenames, size_t _block_size); __LA_DECL int archive_read_open_filename_w(struct archive *, const wchar_t *_filename, size_t _block_size); /* archive_read_open_file() is a deprecated synonym for ..._open_filename(). */ __LA_DECL int archive_read_open_file(struct archive *, const char *_filename, size_t _block_size) __LA_DEPRECATED; /* Read an archive that's stored in memory. */ __LA_DECL int archive_read_open_memory(struct archive *, const void * buff, size_t size); /* A more involved version that is only used for internal testing. */ __LA_DECL int archive_read_open_memory2(struct archive *a, const void *buff, size_t size, size_t read_size); /* Read an archive that's already open, using the file descriptor. */ __LA_DECL int archive_read_open_fd(struct archive *, int _fd, size_t _block_size); /* Read an archive that's already open, using a FILE *. */ /* Note: DO NOT use this with tape drives. */ __LA_DECL int archive_read_open_FILE(struct archive *, FILE *_file); /* Parses and returns next entry header. */ __LA_DECL int archive_read_next_header(struct archive *, struct archive_entry **); /* Parses and returns next entry header using the archive_entry passed in */ __LA_DECL int archive_read_next_header2(struct archive *, struct archive_entry *); /* * Retrieve the byte offset in UNCOMPRESSED data where last-read * header started. */ __LA_DECL la_int64_t archive_read_header_position(struct archive *); /* * Returns 1 if the archive contains at least one encrypted entry. * If the archive format not support encryption at all * ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned. * If for any other reason (e.g. not enough data read so far) * we cannot say whether there are encrypted entries, then * ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW is returned. * In general, this function will return values below zero when the * reader is uncertain or totally incapable of encryption support. * When this function returns 0 you can be sure that the reader * supports encryption detection but no encrypted entries have * been found yet. * * NOTE: If the metadata/header of an archive is also encrypted, you * cannot rely on the number of encrypted entries. That is why this * function does not return the number of encrypted entries but# * just shows that there are some. */ __LA_DECL int archive_read_has_encrypted_entries(struct archive *); /* * Returns a bitmask of capabilities that are supported by the archive format reader. * If the reader has no special capabilities, ARCHIVE_READ_FORMAT_CAPS_NONE is returned. */ __LA_DECL int archive_read_format_capabilities(struct archive *); /* Read data from the body of an entry. Similar to read(2). */ __LA_DECL la_ssize_t archive_read_data(struct archive *, void *, size_t); /* Seek within the body of an entry. Similar to lseek(2). */ __LA_DECL la_int64_t archive_seek_data(struct archive *, la_int64_t, int); /* * A zero-copy version of archive_read_data that also exposes the file offset * of each returned block. Note that the client has no way to specify * the desired size of the block. The API does guarantee that offsets will * be strictly increasing and that returned blocks will not overlap. */ __LA_DECL int archive_read_data_block(struct archive *a, const void **buff, size_t *size, la_int64_t *offset); /*- * Some convenience functions that are built on archive_read_data: * 'skip': skips entire entry * 'into_buffer': writes data into memory buffer that you provide * 'into_fd': writes data to specified filedes */ __LA_DECL int archive_read_data_skip(struct archive *); __LA_DECL int archive_read_data_into_fd(struct archive *, int fd); /* * Set read options. */ /* Apply option to the format only. */ __LA_DECL int archive_read_set_format_option(struct archive *_a, const char *m, const char *o, const char *v); /* Apply option to the filter only. */ __LA_DECL int archive_read_set_filter_option(struct archive *_a, const char *m, const char *o, const char *v); /* Apply option to both the format and the filter. */ __LA_DECL int archive_read_set_option(struct archive *_a, const char *m, const char *o, const char *v); /* Apply option string to both the format and the filter. */ __LA_DECL int archive_read_set_options(struct archive *_a, const char *opts); /* * Add a decryption passphrase. */ __LA_DECL int archive_read_add_passphrase(struct archive *, const char *); __LA_DECL int archive_read_set_passphrase_callback(struct archive *, void *client_data, archive_passphrase_callback *); /*- * Convenience function to recreate the current entry (whose header * has just been read) on disk. * * This does quite a bit more than just copy data to disk. It also: * - Creates intermediate directories as required. * - Manages directory permissions: non-writable directories will * be initially created with write permission enabled; when the * archive is closed, dir permissions are edited to the values specified * in the archive. * - Checks hardlinks: hardlinks will not be extracted unless the * linked-to file was also extracted within the same session. (TODO) */ /* The "flags" argument selects optional behavior, 'OR' the flags you want. */ /* Default: Do not try to set owner/group. */ #define ARCHIVE_EXTRACT_OWNER (0x0001) /* Default: Do obey umask, do not restore SUID/SGID/SVTX bits. */ #define ARCHIVE_EXTRACT_PERM (0x0002) /* Default: Do not restore mtime/atime. */ #define ARCHIVE_EXTRACT_TIME (0x0004) /* Default: Replace existing files. */ #define ARCHIVE_EXTRACT_NO_OVERWRITE (0x0008) /* Default: Try create first, unlink only if create fails with EEXIST. */ #define ARCHIVE_EXTRACT_UNLINK (0x0010) /* Default: Do not restore ACLs. */ #define ARCHIVE_EXTRACT_ACL (0x0020) /* Default: Do not restore fflags. */ #define ARCHIVE_EXTRACT_FFLAGS (0x0040) /* Default: Do not restore xattrs. */ #define ARCHIVE_EXTRACT_XATTR (0x0080) /* Default: Do not try to guard against extracts redirected by symlinks. */ /* Note: With ARCHIVE_EXTRACT_UNLINK, will remove any intermediate symlink. */ #define ARCHIVE_EXTRACT_SECURE_SYMLINKS (0x0100) /* Default: Do not reject entries with '..' as path elements. */ #define ARCHIVE_EXTRACT_SECURE_NODOTDOT (0x0200) /* Default: Create parent directories as needed. */ #define ARCHIVE_EXTRACT_NO_AUTODIR (0x0400) /* Default: Overwrite files, even if one on disk is newer. */ #define ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER (0x0800) /* Detect blocks of 0 and write holes instead. */ #define ARCHIVE_EXTRACT_SPARSE (0x1000) /* Default: Do not restore Mac extended metadata. */ /* This has no effect except on Mac OS. */ #define ARCHIVE_EXTRACT_MAC_METADATA (0x2000) /* Default: Use HFS+ compression if it was compressed. */ /* This has no effect except on Mac OS v10.6 or later. */ #define ARCHIVE_EXTRACT_NO_HFS_COMPRESSION (0x4000) /* Default: Do not use HFS+ compression if it was not compressed. */ /* This has no effect except on Mac OS v10.6 or later. */ #define ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED (0x8000) /* Default: Do not reject entries with absolute paths */ #define ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS (0x10000) /* Default: Do not clear no-change flags when unlinking object */ #define ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS (0x20000) /* Default: Do not extract atomically (using rename) */ #define ARCHIVE_EXTRACT_SAFE_WRITES (0x40000) __LA_DECL int archive_read_extract(struct archive *, struct archive_entry *, int flags); __LA_DECL int archive_read_extract2(struct archive *, struct archive_entry *, struct archive * /* dest */); __LA_DECL void archive_read_extract_set_progress_callback(struct archive *, void (*_progress_func)(void *), void *_user_data); /* Record the dev/ino of a file that will not be written. This is * generally set to the dev/ino of the archive being read. */ __LA_DECL void archive_read_extract_set_skip_file(struct archive *, la_int64_t, la_int64_t); /* Close the file and release most resources. */ __LA_DECL int archive_read_close(struct archive *); /* Release all resources and destroy the object. */ /* Note that archive_read_free will call archive_read_close for you. */ __LA_DECL int archive_read_free(struct archive *); #if ARCHIVE_VERSION_NUMBER < 4000000 /* Synonym for archive_read_free() for backwards compatibility. */ __LA_DECL int archive_read_finish(struct archive *) __LA_DEPRECATED; #endif /*- * To create an archive: * 1) Ask archive_write_new for an archive writer object. * 2) Set any global properties. In particular, you should set * the compression and format to use. * 3) Call archive_write_open to open the file (most people * will use archive_write_open_file or archive_write_open_fd, * which provide convenient canned I/O callbacks for you). * 4) For each entry: * - construct an appropriate struct archive_entry structure * - archive_write_header to write the header * - archive_write_data to write the entry data * 5) archive_write_close to close the output * 6) archive_write_free to cleanup the writer and release resources */ __LA_DECL struct archive *archive_write_new(void); __LA_DECL int archive_write_set_bytes_per_block(struct archive *, int bytes_per_block); __LA_DECL int archive_write_get_bytes_per_block(struct archive *); /* XXX This is badly misnamed; suggestions appreciated. XXX */ __LA_DECL int archive_write_set_bytes_in_last_block(struct archive *, int bytes_in_last_block); __LA_DECL int archive_write_get_bytes_in_last_block(struct archive *); /* The dev/ino of a file that won't be archived. This is used * to avoid recursively adding an archive to itself. */ __LA_DECL int archive_write_set_skip_file(struct archive *, la_int64_t, la_int64_t); #if ARCHIVE_VERSION_NUMBER < 4000000 __LA_DECL int archive_write_set_compression_bzip2(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_write_set_compression_compress(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_write_set_compression_gzip(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_write_set_compression_lzip(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_write_set_compression_lzma(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_write_set_compression_none(struct archive *) __LA_DEPRECATED; __LA_DECL int archive_write_set_compression_program(struct archive *, const char *cmd) __LA_DEPRECATED; __LA_DECL int archive_write_set_compression_xz(struct archive *) __LA_DEPRECATED; #endif /* A convenience function to set the filter based on the code. */ __LA_DECL int archive_write_add_filter(struct archive *, int filter_code); __LA_DECL int archive_write_add_filter_by_name(struct archive *, const char *name); __LA_DECL int archive_write_add_filter_b64encode(struct archive *); __LA_DECL int archive_write_add_filter_bzip2(struct archive *); __LA_DECL int archive_write_add_filter_compress(struct archive *); __LA_DECL int archive_write_add_filter_grzip(struct archive *); __LA_DECL int archive_write_add_filter_gzip(struct archive *); __LA_DECL int archive_write_add_filter_lrzip(struct archive *); __LA_DECL int archive_write_add_filter_lz4(struct archive *); __LA_DECL int archive_write_add_filter_lzip(struct archive *); __LA_DECL int archive_write_add_filter_lzma(struct archive *); __LA_DECL int archive_write_add_filter_lzop(struct archive *); __LA_DECL int archive_write_add_filter_none(struct archive *); __LA_DECL int archive_write_add_filter_program(struct archive *, const char *cmd); __LA_DECL int archive_write_add_filter_uuencode(struct archive *); __LA_DECL int archive_write_add_filter_xz(struct archive *); __LA_DECL int archive_write_add_filter_zstd(struct archive *); /* A convenience function to set the format based on the code or name. */ __LA_DECL int archive_write_set_format(struct archive *, int format_code); __LA_DECL int archive_write_set_format_by_name(struct archive *, const char *name); /* To minimize link pollution, use one or more of the following. */ __LA_DECL int archive_write_set_format_7zip(struct archive *); __LA_DECL int archive_write_set_format_ar_bsd(struct archive *); __LA_DECL int archive_write_set_format_ar_svr4(struct archive *); __LA_DECL int archive_write_set_format_cpio(struct archive *); __LA_DECL int archive_write_set_format_cpio_newc(struct archive *); __LA_DECL int archive_write_set_format_gnutar(struct archive *); __LA_DECL int archive_write_set_format_iso9660(struct archive *); __LA_DECL int archive_write_set_format_mtree(struct archive *); __LA_DECL int archive_write_set_format_mtree_classic(struct archive *); /* TODO: int archive_write_set_format_old_tar(struct archive *); */ __LA_DECL int archive_write_set_format_pax(struct archive *); __LA_DECL int archive_write_set_format_pax_restricted(struct archive *); __LA_DECL int archive_write_set_format_raw(struct archive *); __LA_DECL int archive_write_set_format_shar(struct archive *); __LA_DECL int archive_write_set_format_shar_dump(struct archive *); __LA_DECL int archive_write_set_format_ustar(struct archive *); __LA_DECL int archive_write_set_format_v7tar(struct archive *); __LA_DECL int archive_write_set_format_warc(struct archive *); __LA_DECL int archive_write_set_format_xar(struct archive *); __LA_DECL int archive_write_set_format_zip(struct archive *); __LA_DECL int archive_write_set_format_filter_by_ext(struct archive *a, const char *filename); __LA_DECL int archive_write_set_format_filter_by_ext_def(struct archive *a, const char *filename, const char * def_ext); __LA_DECL int archive_write_zip_set_compression_deflate(struct archive *); __LA_DECL int archive_write_zip_set_compression_store(struct archive *); /* Deprecated; use archive_write_open2 instead */ __LA_DECL int archive_write_open(struct archive *, void *, archive_open_callback *, archive_write_callback *, archive_close_callback *); __LA_DECL int archive_write_open2(struct archive *, void *, archive_open_callback *, archive_write_callback *, archive_close_callback *, archive_free_callback *); __LA_DECL int archive_write_open_fd(struct archive *, int _fd); __LA_DECL int archive_write_open_filename(struct archive *, const char *_file); __LA_DECL int archive_write_open_filename_w(struct archive *, const wchar_t *_file); /* A deprecated synonym for archive_write_open_filename() */ __LA_DECL int archive_write_open_file(struct archive *, const char *_file) __LA_DEPRECATED; __LA_DECL int archive_write_open_FILE(struct archive *, FILE *); /* _buffSize is the size of the buffer, _used refers to a variable that * will be updated after each write into the buffer. */ __LA_DECL int archive_write_open_memory(struct archive *, void *_buffer, size_t _buffSize, size_t *_used); /* * Note that the library will truncate writes beyond the size provided * to archive_write_header or pad if the provided data is short. */ __LA_DECL int archive_write_header(struct archive *, struct archive_entry *); __LA_DECL la_ssize_t archive_write_data(struct archive *, const void *, size_t); /* This interface is currently only available for archive_write_disk handles. */ __LA_DECL la_ssize_t archive_write_data_block(struct archive *, const void *, size_t, la_int64_t); __LA_DECL int archive_write_finish_entry(struct archive *); __LA_DECL int archive_write_close(struct archive *); /* Marks the archive as FATAL so that a subsequent free() operation * won't try to close() cleanly. Provides a fast abort capability * when the client discovers that things have gone wrong. */ __LA_DECL int archive_write_fail(struct archive *); /* This can fail if the archive wasn't already closed, in which case * archive_write_free() will implicitly call archive_write_close(). */ __LA_DECL int archive_write_free(struct archive *); #if ARCHIVE_VERSION_NUMBER < 4000000 /* Synonym for archive_write_free() for backwards compatibility. */ __LA_DECL int archive_write_finish(struct archive *) __LA_DEPRECATED; #endif /* * Set write options. */ /* Apply option to the format only. */ __LA_DECL int archive_write_set_format_option(struct archive *_a, const char *m, const char *o, const char *v); /* Apply option to the filter only. */ __LA_DECL int archive_write_set_filter_option(struct archive *_a, const char *m, const char *o, const char *v); /* Apply option to both the format and the filter. */ __LA_DECL int archive_write_set_option(struct archive *_a, const char *m, const char *o, const char *v); /* Apply option string to both the format and the filter. */ __LA_DECL int archive_write_set_options(struct archive *_a, const char *opts); /* * Set a encryption passphrase. */ __LA_DECL int archive_write_set_passphrase(struct archive *_a, const char *p); __LA_DECL int archive_write_set_passphrase_callback(struct archive *, void *client_data, archive_passphrase_callback *); /*- * ARCHIVE_WRITE_DISK API * * To create objects on disk: * 1) Ask archive_write_disk_new for a new archive_write_disk object. * 2) Set any global properties. In particular, you probably * want to set the options. * 3) For each entry: * - construct an appropriate struct archive_entry structure * - archive_write_header to create the file/dir/etc on disk * - archive_write_data to write the entry data * 4) archive_write_free to cleanup the writer and release resources * * In particular, you can use this in conjunction with archive_read() * to pull entries out of an archive and create them on disk. */ __LA_DECL struct archive *archive_write_disk_new(void); /* This file will not be overwritten. */ __LA_DECL int archive_write_disk_set_skip_file(struct archive *, la_int64_t, la_int64_t); /* Set flags to control how the next item gets created. * This accepts a bitmask of ARCHIVE_EXTRACT_XXX flags defined above. */ __LA_DECL int archive_write_disk_set_options(struct archive *, int flags); /* * The lookup functions are given uname/uid (or gname/gid) pairs and * return a uid (gid) suitable for this system. These are used for * restoring ownership and for setting ACLs. The default functions * are naive, they just return the uid/gid. These are small, so reasonable * for applications that don't need to preserve ownership; they * are probably also appropriate for applications that are doing * same-system backup and restore. */ /* * The "standard" lookup functions use common system calls to lookup * the uname/gname, falling back to the uid/gid if the names can't be * found. They cache lookups and are reasonably fast, but can be very * large, so they are not used unless you ask for them. In * particular, these match the specifications of POSIX "pax" and old * POSIX "tar". */ __LA_DECL int archive_write_disk_set_standard_lookup(struct archive *); /* * If neither the default (naive) nor the standard (big) functions suit * your needs, you can write your own and register them. Be sure to * include a cleanup function if you have allocated private data. */ __LA_DECL int archive_write_disk_set_group_lookup(struct archive *, void * /* private_data */, la_int64_t (*)(void *, const char *, la_int64_t), void (* /* cleanup */)(void *)); __LA_DECL int archive_write_disk_set_user_lookup(struct archive *, void * /* private_data */, la_int64_t (*)(void *, const char *, la_int64_t), void (* /* cleanup */)(void *)); __LA_DECL la_int64_t archive_write_disk_gid(struct archive *, const char *, la_int64_t); __LA_DECL la_int64_t archive_write_disk_uid(struct archive *, const char *, la_int64_t); /* * ARCHIVE_READ_DISK API * * This is still evolving and somewhat experimental. */ __LA_DECL struct archive *archive_read_disk_new(void); /* The names for symlink modes here correspond to an old BSD * command-line argument convention: -L, -P, -H */ /* Follow all symlinks. */ __LA_DECL int archive_read_disk_set_symlink_logical(struct archive *); /* Follow no symlinks. */ __LA_DECL int archive_read_disk_set_symlink_physical(struct archive *); /* Follow symlink initially, then not. */ __LA_DECL int archive_read_disk_set_symlink_hybrid(struct archive *); /* TODO: Handle Linux stat32/stat64 ugliness. */ __LA_DECL int archive_read_disk_entry_from_file(struct archive *, struct archive_entry *, int /* fd */, const struct stat *); /* Look up gname for gid or uname for uid. */ /* Default implementations are very, very stupid. */ __LA_DECL const char *archive_read_disk_gname(struct archive *, la_int64_t); __LA_DECL const char *archive_read_disk_uname(struct archive *, la_int64_t); /* "Standard" implementation uses getpwuid_r, getgrgid_r and caches the * results for performance. */ __LA_DECL int archive_read_disk_set_standard_lookup(struct archive *); /* You can install your own lookups if you like. */ __LA_DECL int archive_read_disk_set_gname_lookup(struct archive *, void * /* private_data */, const char *(* /* lookup_fn */)(void *, la_int64_t), void (* /* cleanup_fn */)(void *)); __LA_DECL int archive_read_disk_set_uname_lookup(struct archive *, void * /* private_data */, const char *(* /* lookup_fn */)(void *, la_int64_t), void (* /* cleanup_fn */)(void *)); /* Start traversal. */ __LA_DECL int archive_read_disk_open(struct archive *, const char *); __LA_DECL int archive_read_disk_open_w(struct archive *, const wchar_t *); /* * Request that current entry be visited. If you invoke it on every * directory, you'll get a physical traversal. This is ignored if the * current entry isn't a directory or a link to a directory. So, if * you invoke this on every returned path, you'll get a full logical * traversal. */ __LA_DECL int archive_read_disk_descend(struct archive *); __LA_DECL int archive_read_disk_can_descend(struct archive *); __LA_DECL int archive_read_disk_current_filesystem(struct archive *); __LA_DECL int archive_read_disk_current_filesystem_is_synthetic(struct archive *); __LA_DECL int archive_read_disk_current_filesystem_is_remote(struct archive *); /* Request that the access time of the entry visited by traversal be restored. */ __LA_DECL int archive_read_disk_set_atime_restored(struct archive *); /* * Set behavior. The "flags" argument selects optional behavior. */ /* Request that the access time of the entry visited by traversal be restored. * This is the same as archive_read_disk_set_atime_restored. */ #define ARCHIVE_READDISK_RESTORE_ATIME (0x0001) /* Default: Do not skip an entry which has nodump flags. */ #define ARCHIVE_READDISK_HONOR_NODUMP (0x0002) /* Default: Skip a mac resource fork file whose prefix is "._" because of * using copyfile. */ #define ARCHIVE_READDISK_MAC_COPYFILE (0x0004) /* Default: Traverse mount points. */ #define ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS (0x0008) /* Default: Xattrs are read from disk. */ #define ARCHIVE_READDISK_NO_XATTR (0x0010) /* Default: ACLs are read from disk. */ #define ARCHIVE_READDISK_NO_ACL (0x0020) /* Default: File flags are read from disk. */ #define ARCHIVE_READDISK_NO_FFLAGS (0x0040) __LA_DECL int archive_read_disk_set_behavior(struct archive *, int flags); /* * Set archive_match object that will be used in archive_read_disk to * know whether an entry should be skipped. The callback function * _excluded_func will be invoked when an entry is skipped by the result * of archive_match. */ __LA_DECL int archive_read_disk_set_matching(struct archive *, struct archive *_matching, void (*_excluded_func) (struct archive *, void *, struct archive_entry *), void *_client_data); __LA_DECL int archive_read_disk_set_metadata_filter_callback(struct archive *, int (*_metadata_filter_func)(struct archive *, void *, struct archive_entry *), void *_client_data); /* Simplified cleanup interface; * This calls archive_read_free() or archive_write_free() as needed. */ __LA_DECL int archive_free(struct archive *); /* * Accessor functions to read/set various information in * the struct archive object: */ /* Number of filters in the current filter pipeline. */ /* Filter #0 is the one closest to the format, -1 is a synonym for the * last filter, which is always the pseudo-filter that wraps the * client callbacks. */ __LA_DECL int archive_filter_count(struct archive *); __LA_DECL la_int64_t archive_filter_bytes(struct archive *, int); __LA_DECL int archive_filter_code(struct archive *, int); __LA_DECL const char * archive_filter_name(struct archive *, int); #if ARCHIVE_VERSION_NUMBER < 4000000 /* These don't properly handle multiple filters, so are deprecated and * will eventually be removed. */ /* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, -1); */ __LA_DECL la_int64_t archive_position_compressed(struct archive *) __LA_DEPRECATED; /* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, 0); */ __LA_DECL la_int64_t archive_position_uncompressed(struct archive *) __LA_DEPRECATED; /* As of libarchive 3.0, this is an alias for archive_filter_name(a, 0); */ __LA_DECL const char *archive_compression_name(struct archive *) __LA_DEPRECATED; /* As of libarchive 3.0, this is an alias for archive_filter_code(a, 0); */ __LA_DECL int archive_compression(struct archive *) __LA_DEPRECATED; #endif __LA_DECL int archive_errno(struct archive *); __LA_DECL const char *archive_error_string(struct archive *); __LA_DECL const char *archive_format_name(struct archive *); __LA_DECL int archive_format(struct archive *); __LA_DECL void archive_clear_error(struct archive *); __LA_DECL void archive_set_error(struct archive *, int _err, const char *fmt, ...) __LA_PRINTF(3, 4); __LA_DECL void archive_copy_error(struct archive *dest, struct archive *src); __LA_DECL int archive_file_count(struct archive *); /* * ARCHIVE_MATCH API */ __LA_DECL struct archive *archive_match_new(void); __LA_DECL int archive_match_free(struct archive *); /* * Test if archive_entry is excluded. * This is a convenience function. This is the same as calling all * archive_match_path_excluded, archive_match_time_excluded * and archive_match_owner_excluded. */ __LA_DECL int archive_match_excluded(struct archive *, struct archive_entry *); /* * Test if pathname is excluded. The conditions are set by following functions. */ __LA_DECL int archive_match_path_excluded(struct archive *, struct archive_entry *); /* Control recursive inclusion of directory content when directory is included. Default on. */ __LA_DECL int archive_match_set_inclusion_recursion(struct archive *, int); /* Add exclusion pathname pattern. */ __LA_DECL int archive_match_exclude_pattern(struct archive *, const char *); __LA_DECL int archive_match_exclude_pattern_w(struct archive *, const wchar_t *); /* Add exclusion pathname pattern from file. */ __LA_DECL int archive_match_exclude_pattern_from_file(struct archive *, const char *, int _nullSeparator); __LA_DECL int archive_match_exclude_pattern_from_file_w(struct archive *, const wchar_t *, int _nullSeparator); /* Add inclusion pathname pattern. */ __LA_DECL int archive_match_include_pattern(struct archive *, const char *); __LA_DECL int archive_match_include_pattern_w(struct archive *, const wchar_t *); /* Add inclusion pathname pattern from file. */ __LA_DECL int archive_match_include_pattern_from_file(struct archive *, const char *, int _nullSeparator); __LA_DECL int archive_match_include_pattern_from_file_w(struct archive *, const wchar_t *, int _nullSeparator); /* * How to get statistic information for inclusion patterns. */ /* Return the amount number of unmatched inclusion patterns. */ __LA_DECL int archive_match_path_unmatched_inclusions(struct archive *); /* Return the pattern of unmatched inclusion with ARCHIVE_OK. * Return ARCHIVE_EOF if there is no inclusion pattern. */ __LA_DECL int archive_match_path_unmatched_inclusions_next( struct archive *, const char **); __LA_DECL int archive_match_path_unmatched_inclusions_next_w( struct archive *, const wchar_t **); /* * Test if a file is excluded by its time stamp. * The conditions are set by following functions. */ __LA_DECL int archive_match_time_excluded(struct archive *, struct archive_entry *); /* * Flags to tell a matching type of time stamps. These are used for * following functions. */ /* Time flag: mtime to be tested. */ #define ARCHIVE_MATCH_MTIME (0x0100) /* Time flag: ctime to be tested. */ #define ARCHIVE_MATCH_CTIME (0x0200) /* Comparison flag: Match the time if it is newer than. */ #define ARCHIVE_MATCH_NEWER (0x0001) /* Comparison flag: Match the time if it is older than. */ #define ARCHIVE_MATCH_OLDER (0x0002) /* Comparison flag: Match the time if it is equal to. */ #define ARCHIVE_MATCH_EQUAL (0x0010) /* Set inclusion time. */ __LA_DECL int archive_match_include_time(struct archive *, int _flag, time_t _sec, long _nsec); /* Set inclusion time by a date string. */ __LA_DECL int archive_match_include_date(struct archive *, int _flag, const char *_datestr); __LA_DECL int archive_match_include_date_w(struct archive *, int _flag, const wchar_t *_datestr); /* Set inclusion time by a particular file. */ __LA_DECL int archive_match_include_file_time(struct archive *, int _flag, const char *_pathname); __LA_DECL int archive_match_include_file_time_w(struct archive *, int _flag, const wchar_t *_pathname); /* Add exclusion entry. */ __LA_DECL int archive_match_exclude_entry(struct archive *, int _flag, struct archive_entry *); /* * Test if a file is excluded by its uid ,gid, uname or gname. * The conditions are set by following functions. */ __LA_DECL int archive_match_owner_excluded(struct archive *, struct archive_entry *); /* Add inclusion uid, gid, uname and gname. */ __LA_DECL int archive_match_include_uid(struct archive *, la_int64_t); __LA_DECL int archive_match_include_gid(struct archive *, la_int64_t); __LA_DECL int archive_match_include_uname(struct archive *, const char *); __LA_DECL int archive_match_include_uname_w(struct archive *, const wchar_t *); __LA_DECL int archive_match_include_gname(struct archive *, const char *); __LA_DECL int archive_match_include_gname_w(struct archive *, const wchar_t *); /* Utility functions */ /* Convenience function to sort a NULL terminated list of strings */ __LA_DECL int archive_utility_string_sort(char **); #ifdef __cplusplus } #endif /* These are meaningless outside of this header. */ #undef __LA_DECL #endif /* !ARCHIVE_H_INCLUDED */ diff --git a/libarchive/config_freebsd.h b/libarchive/config_freebsd.h index a05121c7836b..a484618b4885 100644 --- a/libarchive/config_freebsd.h +++ b/libarchive/config_freebsd.h @@ -1,261 +1,262 @@ /*- * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #define __LIBARCHIVE_CONFIG_H_INCLUDED 1 #include /* FreeBSD 5.0 and later has ACL and extattr support. */ #if __FreeBSD__ > 4 #define ARCHIVE_ACL_FREEBSD 1 #define HAVE_ACL_GET_PERM_NP 1 #define HAVE_ARC4RANDOM_BUF 1 #define HAVE_EXTATTR_GET_FILE 1 #define HAVE_EXTATTR_LIST_FILE 1 #define HAVE_EXTATTR_SET_FD 1 #define HAVE_EXTATTR_SET_FILE 1 #define HAVE_STRUCT_XVFSCONF 1 #define HAVE_SYS_ACL_H 1 #define HAVE_SYS_EXTATTR_H 1 #if __FreeBSD__ > 7 /* FreeBSD 8.0 and later has NFSv4 ACL support */ #define ARCHIVE_ACL_FREEBSD_NFS4 1 #define HAVE_ACL_GET_LINK_NP 1 #define HAVE_ACL_IS_TRIVIAL_NP 1 #define HAVE_ACL_SET_LINK_NP 1 #endif /* __FreeBSD__ > 7 */ #endif /* __FreeBSD__ > 4 */ #ifdef WITH_OPENSSL #define HAVE_LIBCRYPTO 1 #define HAVE_OPENSSL_EVP_H 1 #define HAVE_OPENSSL_MD5_H 1 #define HAVE_OPENSSL_RIPEMD_H 1 #define HAVE_OPENSSL_SHA_H 1 #define HAVE_OPENSSL_SHA256_INIT 1 #define HAVE_OPENSSL_SHA384_INIT 1 #define HAVE_OPENSSL_SHA512_INIT 1 #define HAVE_PKCS5_PBKDF2_HMAC_SHA1 1 #define HAVE_SHA256 1 #define HAVE_SHA384 1 #define HAVE_SHA512 1 #else #define HAVE_LIBMD 1 #define HAVE_MD5_H 1 #define HAVE_MD5INIT 1 #define HAVE_RIPEMD_H 1 #define HAVE_SHA_H 1 #define HAVE_SHA1 1 #define HAVE_SHA1_INIT 1 #define HAVE_SHA256 1 #define HAVE_SHA256_H 1 #define HAVE_SHA256_INIT 1 #define HAVE_SHA512 1 #define HAVE_SHA512_H 1 #define HAVE_SHA512_INIT 1 #endif #define HAVE_BSDXML_H 1 #define HAVE_BZLIB_H 1 #define HAVE_CHFLAGS 1 #define HAVE_CHOWN 1 #define HAVE_CHROOT 1 #define HAVE_CTIME_R 1 #define HAVE_CTYPE_H 1 #define HAVE_DECL_EXTATTR_NAMESPACE_USER 1 #define HAVE_DECL_INT32_MAX 1 #define HAVE_DECL_INT32_MIN 1 #define HAVE_DECL_INT64_MAX 1 #define HAVE_DECL_INT64_MIN 1 #define HAVE_DECL_INTMAX_MAX 1 #define HAVE_DECL_INTMAX_MIN 1 #define HAVE_DECL_SIZE_MAX 1 #define HAVE_DECL_SSIZE_MAX 1 #define HAVE_DECL_STRERROR_R 1 #define HAVE_DECL_UINT32_MAX 1 #define HAVE_DECL_UINT64_MAX 1 #define HAVE_DECL_UINTMAX_MAX 1 #define HAVE_DIRENT_H 1 #define HAVE_DLFCN_H 1 #define HAVE_D_MD_ORDER 1 #define HAVE_EFTYPE 1 #define HAVE_EILSEQ 1 #define HAVE_ERRNO_H 1 #define HAVE_FCHDIR 1 #define HAVE_FCHFLAGS 1 #define HAVE_FCHMOD 1 #define HAVE_FCHOWN 1 #define HAVE_FCNTL 1 #define HAVE_FCNTL_H 1 #define HAVE_FDOPENDIR 1 #define HAVE_FORK 1 #define HAVE_FSEEKO 1 #define HAVE_FSTAT 1 #define HAVE_FSTATAT 1 #define HAVE_FSTATFS 1 #define HAVE_FSTATVFS 1 #define HAVE_FTRUNCATE 1 #define HAVE_FUTIMES 1 #define HAVE_FUTIMESAT 1 #define HAVE_GETEUID 1 #define HAVE_GETGRGID_R 1 #define HAVE_GETGRNAM_R 1 #define HAVE_GETPID 1 #define HAVE_GETPWNAM_R 1 #define HAVE_GETPWUID_R 1 #define HAVE_GETVFSBYNAME 1 #define HAVE_GMTIME_R 1 #define HAVE_GRP_H 1 #define HAVE_INTMAX_T 1 #define HAVE_INTTYPES_H 1 #define HAVE_LANGINFO_H 1 #define HAVE_LCHFLAGS 1 #define HAVE_LCHMOD 1 #define HAVE_LCHOWN 1 #define HAVE_LIBZ 1 #define HAVE_LIMITS_H 1 #define HAVE_LINK 1 #define HAVE_LOCALE_H 1 #define HAVE_LOCALTIME_R 1 #define HAVE_LONG_LONG_INT 1 #define HAVE_LSTAT 1 #define HAVE_LUTIMES 1 #define HAVE_MBRTOWC 1 #define HAVE_MEMMOVE 1 #define HAVE_MEMORY_H 1 #define HAVE_MEMSET 1 #define HAVE_MKDIR 1 #define HAVE_MKFIFO 1 #define HAVE_MKNOD 1 #define HAVE_MKSTEMP 1 #define HAVE_NL_LANGINFO 1 #define HAVE_OPENAT 1 #define HAVE_PATHS_H 1 #define HAVE_PIPE 1 #define HAVE_POLL 1 #define HAVE_POLL_H 1 #define HAVE_POSIX_SPAWNP 1 #define HAVE_PTHREAD_H 1 #define HAVE_PWD_H 1 #define HAVE_READDIR_R 1 #define HAVE_READLINK 1 #define HAVE_READLINKAT 1 #define HAVE_READPASSPHRASE 1 #define HAVE_READPASSPHRASE_H 1 #define HAVE_REGEX_H 1 #define HAVE_SELECT 1 #define HAVE_SETENV 1 #define HAVE_SETLOCALE 1 #define HAVE_SIGACTION 1 #define HAVE_SIGNAL_H 1 #define HAVE_SPAWN_H 1 #define HAVE_STATFS 1 #define HAVE_STATVFS 1 #define HAVE_STDARG_H 1 #define HAVE_STDINT_H 1 #define HAVE_STDLIB_H 1 #define HAVE_STRCHR 1 #define HAVE_STRDUP 1 #define HAVE_STRERROR 1 #define HAVE_STRERROR_R 1 #define HAVE_STRFTIME 1 #define HAVE_STRINGS_H 1 #define HAVE_STRING_H 1 +#define HAVE_STRNLEN 1 #define HAVE_STRRCHR 1 #define HAVE_STRUCT_STATFS_F_NAMEMAX 1 #define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 #define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1 #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 #define HAVE_STRUCT_STAT_ST_FLAGS 1 #define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 #define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 #define HAVE_STRUCT_TM_TM_GMTOFF 1 #define HAVE_SYMLINK 1 #define HAVE_SYS_CDEFS_H 1 #define HAVE_SYS_IOCTL_H 1 #define HAVE_SYS_MOUNT_H 1 #define HAVE_SYS_PARAM_H 1 #define HAVE_SYS_POLL_H 1 #define HAVE_SYS_SELECT_H 1 #define HAVE_SYS_STATVFS_H 1 #define HAVE_SYS_STAT_H 1 #define HAVE_SYS_TIME_H 1 #define HAVE_SYS_TYPES_H 1 #define HAVE_SYS_UTSNAME_H 1 #define HAVE_SYS_WAIT_H 1 #define HAVE_TIMEGM 1 #define HAVE_TIME_H 1 #define HAVE_TZSET 1 #define HAVE_UINTMAX_T 1 #define HAVE_UNISTD_H 1 #define HAVE_UNLINKAT 1 #define HAVE_UNSETENV 1 #define HAVE_UNSIGNED_LONG_LONG 1 #define HAVE_UNSIGNED_LONG_LONG_INT 1 #define HAVE_UTIME 1 #define HAVE_UTIMES 1 #define HAVE_UTIME_H 1 #define HAVE_VFORK 1 #define HAVE_VPRINTF 1 #define HAVE_WCHAR_H 1 #define HAVE_WCHAR_T 1 #define HAVE_WCRTOMB 1 #define HAVE_WCSCMP 1 #define HAVE_WCSCPY 1 #define HAVE_WCSLEN 1 #define HAVE_WCTOMB 1 #define HAVE_WCTYPE_H 1 #define HAVE_WMEMCMP 1 #define HAVE_WMEMCPY 1 #define HAVE_WMEMMOVE 1 #define HAVE_ZLIB_H 1 #define TIME_WITH_SYS_TIME 1 #if __FreeBSD_version >= 1100056 #define HAVE_FUTIMENS 1 #define HAVE_UTIMENSAT 1 #endif /* FreeBSD 4 and earlier lack intmax_t/uintmax_t */ #if __FreeBSD__ < 5 #define intmax_t int64_t #define uintmax_t uint64_t #endif /* FreeBSD defines for archive_hash.h */ #ifdef WITH_OPENSSL #define ARCHIVE_CRYPTO_MD5_OPENSSL 1 #define ARCHIVE_CRYPTO_RMD160_OPENSSL 1 #define ARCHIVE_CRYPTO_SHA1_OPENSSL #define ARCHIVE_CRYPTO_SHA256_OPENSSL 1 #define ARCHIVE_CRYPTO_SHA384_OPENSSL 1 #define ARCHIVE_CRYPTO_SHA512_OPENSSL 1 #else #define ARCHIVE_CRYPTO_MD5_LIBMD 1 #define ARCHIVE_CRYPTO_SHA1_LIBMD 1 #define ARCHIVE_CRYPTO_SHA256_LIBMD 1 #define ARCHIVE_CRYPTO_SHA512_LIBMD 1 #endif