2
0
Эх сурвалжийг харах

Archive.Core. Initial Import.

Brucey 3 жил өмнө
parent
commit
0b5637f0c1
100 өөрчлөгдсөн 15253 нэмэгдсэн , 0 устгасан
  1. 6 0
      .gitignore
  2. 237 0
      core.mod/common.bmx
  3. 949 0
      core.mod/core.bmx
  4. 447 0
      core.mod/glue.c
  5. 1491 0
      core.mod/include/config.h
  6. 46 0
      core.mod/libarchive/.cirrus.yml
  7. 18 0
      core.mod/libarchive/.editorconfig
  8. 2073 0
      core.mod/libarchive/CMakeLists.txt
  9. 98 0
      core.mod/libarchive/CONTRIBUTING.md
  10. 65 0
      core.mod/libarchive/COPYING
  11. 11 0
      core.mod/libarchive/CTestConfig.cmake
  12. 35 0
      core.mod/libarchive/INSTALL
  13. 1424 0
      core.mod/libarchive/Makefile.am
  14. 741 0
      core.mod/libarchive/NEWS
  15. 227 0
      core.mod/libarchive/README.md
  16. 35 0
      core.mod/libarchive/build/README.txt
  17. 67 0
      core.mod/libarchive/build/autoconf/ax_append_compile_flags.m4
  18. 71 0
      core.mod/libarchive/build/autoconf/ax_append_flag.m4
  19. 74 0
      core.mod/libarchive/build/autoconf/ax_check_compile_flag.m4
  20. 37 0
      core.mod/libarchive/build/autoconf/ax_require_defined.m4
  21. 51 0
      core.mod/libarchive/build/autoconf/check_stdcall_func.m4
  22. 696 0
      core.mod/libarchive/build/autoconf/config.rpath
  23. 271 0
      core.mod/libarchive/build/autoconf/iconv.m4
  24. 20 0
      core.mod/libarchive/build/autoconf/la_uid_t.m4
  25. 109 0
      core.mod/libarchive/build/autoconf/lib-ld.m4
  26. 777 0
      core.mod/libarchive/build/autoconf/lib-link.m4
  27. 224 0
      core.mod/libarchive/build/autoconf/lib-prefix.m4
  28. 115 0
      core.mod/libarchive/build/autoconf/m4_ax_compile_check_sizeof.m4
  29. 68 0
      core.mod/libarchive/build/autogen.sh
  30. 36 0
      core.mod/libarchive/build/bump-version.sh
  31. 172 0
      core.mod/libarchive/build/ci/build.sh
  32. 4 0
      core.mod/libarchive/build/ci/cirrus_ci/Dockerfile.cygwin
  33. 3 0
      core.mod/libarchive/build/ci/cirrus_ci/Dockerfile.fc31
  34. 3 0
      core.mod/libarchive/build/ci/cirrus_ci/Dockerfile.fc31.distcheck
  35. 8 0
      core.mod/libarchive/build/ci/cirrus_ci/Dockerfile.mingw
  36. 9 0
      core.mod/libarchive/build/ci/cirrus_ci/Dockerfile.msvc
  37. 12 0
      core.mod/libarchive/build/ci/cirrus_ci/Dockerfile.windows
  38. 122 0
      core.mod/libarchive/build/ci/cirrus_ci/ci.cmd
  39. 58 0
      core.mod/libarchive/build/ci/cirrus_ci/ci.sh
  40. 132 0
      core.mod/libarchive/build/ci/github_actions/ci.cmd
  41. 25 0
      core.mod/libarchive/build/ci/github_actions/macos.sh
  42. 148 0
      core.mod/libarchive/build/ci/test_driver
  43. 33 0
      core.mod/libarchive/build/ci/travis_ci.sh
  44. 99 0
      core.mod/libarchive/build/clean.sh
  45. 14 0
      core.mod/libarchive/build/cmake/CheckFileOffsetBits.c
  46. 44 0
      core.mod/libarchive/build/cmake/CheckFileOffsetBits.cmake
  47. 49 0
      core.mod/libarchive/build/cmake/CheckFuncs.cmake
  48. 16 0
      core.mod/libarchive/build/cmake/CheckFuncs_stub.c.in
  49. 32 0
      core.mod/libarchive/build/cmake/CheckHeaderDirent.cmake
  50. 42 0
      core.mod/libarchive/build/cmake/CheckTypeExists.cmake
  51. 33 0
      core.mod/libarchive/build/cmake/CreatePkgConfigFile.cmake
  52. 22 0
      core.mod/libarchive/build/cmake/FindLibGCC.cmake
  53. 13 0
      core.mod/libarchive/build/cmake/FindMbedTLS.cmake
  54. 23 0
      core.mod/libarchive/build/cmake/FindNettle.cmake
  55. 34 0
      core.mod/libarchive/build/cmake/FindPCREPOSIX.cmake
  56. 68 0
      core.mod/libarchive/build/cmake/LibarchiveCodeCoverage.cmake
  57. 1349 0
      core.mod/libarchive/build/cmake/config.h.in
  58. 58 0
      core.mod/libarchive/build/makerelease.sh
  59. 12 0
      core.mod/libarchive/build/pkgconfig/libarchive.pc.in
  60. 13 0
      core.mod/libarchive/build/release/Dockerfile
  61. 8 0
      core.mod/libarchive/build/release/release.sh
  62. 455 0
      core.mod/libarchive/build/utils/gen_archive_string_composition_h.sh
  63. 1 0
      core.mod/libarchive/build/version
  64. 37 0
      core.mod/libarchive/cat/CMakeLists.txt
  65. 61 0
      core.mod/libarchive/cat/bsdcat.1
  66. 156 0
      core.mod/libarchive/cat/bsdcat.c
  67. 61 0
      core.mod/libarchive/cat/bsdcat.h
  68. 75 0
      core.mod/libarchive/cat/bsdcat_platform.h
  69. 283 0
      core.mod/libarchive/cat/cmdline.c
  70. 80 0
      core.mod/libarchive/cat/test/CMakeLists.txt
  71. 40 0
      core.mod/libarchive/cat/test/test.h
  72. 67 0
      core.mod/libarchive/cat/test/test_0.c
  73. 4 0
      core.mod/libarchive/cat/test/test_empty.gz.uu
  74. 4 0
      core.mod/libarchive/cat/test/test_empty.lz4.uu
  75. 4 0
      core.mod/libarchive/cat/test/test_empty.xz.uu
  76. 4 0
      core.mod/libarchive/cat/test/test_empty.zst.uu
  77. 41 0
      core.mod/libarchive/cat/test/test_empty_gz.c
  78. 41 0
      core.mod/libarchive/cat/test/test_empty_lz4.c
  79. 41 0
      core.mod/libarchive/cat/test/test_empty_xz.c
  80. 41 0
      core.mod/libarchive/cat/test/test_empty_zstd.c
  81. 36 0
      core.mod/libarchive/cat/test/test_error.c
  82. 43 0
      core.mod/libarchive/cat/test/test_error_mixed.c
  83. 3 0
      core.mod/libarchive/cat/test/test_expand.Z.uu
  84. 5 0
      core.mod/libarchive/cat/test/test_expand.bz2.uu
  85. 4 0
      core.mod/libarchive/cat/test/test_expand.gz.uu
  86. 5 0
      core.mod/libarchive/cat/test/test_expand.lz4.uu
  87. 3 0
      core.mod/libarchive/cat/test/test_expand.plain.uu
  88. 4 0
      core.mod/libarchive/cat/test/test_expand.xz.uu
  89. 4 0
      core.mod/libarchive/cat/test/test_expand.zst.uu
  90. 36 0
      core.mod/libarchive/cat/test/test_expand_Z.c
  91. 42 0
      core.mod/libarchive/cat/test/test_expand_bz2.c
  92. 42 0
      core.mod/libarchive/cat/test/test_expand_gz.c
  93. 42 0
      core.mod/libarchive/cat/test/test_expand_lz4.c
  94. 41 0
      core.mod/libarchive/cat/test/test_expand_mixed.c
  95. 36 0
      core.mod/libarchive/cat/test/test_expand_plain.c
  96. 42 0
      core.mod/libarchive/cat/test/test_expand_xz.c
  97. 41 0
      core.mod/libarchive/cat/test/test_expand_zstd.c
  98. 75 0
      core.mod/libarchive/cat/test/test_help.c
  99. 42 0
      core.mod/libarchive/cat/test/test_stdin.c
  100. 34 0
      core.mod/libarchive/cat/test/test_version.c

+ 6 - 0
.gitignore

@@ -0,0 +1,6 @@
+
+.DS_Store
+.bmx
+*.a
+*.i
+*.i2

+ 237 - 0
core.mod/common.bmx

@@ -0,0 +1,237 @@
+' Copyright (c) 2022 Bruce A Henderson
+' All rights reserved.
+'
+' Redistribution and use in source and binary forms, with or without
+' modification, are permitted provided that the following conditions are met:
+'     * Redistributions of source code must retain the above copyright
+'       notice, this list of conditions and the following disclaimer.
+'     * 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 COPYRIGHT HOLDER ``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 COPYRIGHT HOLDER 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.
+'
+SuperStrict
+
+Import "source.bmx"
+
+Extern
+
+	Function bmx_libarchive_read_archive_new:Byte Ptr()
+
+	Function bmx_libarchive_archive_read_open_memory:Int(handle:Byte Ptr, buf:Byte Ptr, size:Size_T)
+
+	Function bmx_libarchive_archive_read_next_header:Int(handle:Byte Ptr, entry:Byte Ptr)
+	Function bmx_libarchive_archive_read_data_skip:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_read_extract:Int(handle:Byte Ptr, entry:Byte Ptr, flags:Int)
+	Function bmx_libarchive_archive_read_open:Int(handle:Byte Ptr, data:Object)
+	Function bmx_libarchive_archive_read_set_read_callback:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_read_set_seek_callback:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_read_set_callback_data:Int(handle:Byte Ptr, callbackData:Object)
+	Function bmx_libarchive_archive_read_data:Int(handle:Byte Ptr, buf:Byte Ptr, size:Size_T)
+	Function bmx_libarchive_archive_read_add_passphrase:Int(handle:Byte Ptr, passphrase:String)
+	Function bmx_libarchive_archive_read_has_encrypted_entries:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_read_set_filter_option:Int(handle:Byte Ptr, option:String, value:String, moduleName:String)
+	Function bmx_libarchive_archive_read_set_format_option:Int(handle:Byte Ptr, option:String, value:String, moduleName:String)
+
+	Function archive_read_set_read_callback:Int(handle:Byte Ptr, cb:Int(arc:Byte Ptr, cbData:Object, block:Byte Ptr Ptr))
+
+	Function bmx_libarchive_archive_read_free:Int(handle:Byte Ptr)
+	
+	Function bmx_libarchive_write_archive_new:Byte Ptr()
+	Function bmx_libarchive_archive_write_free:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_write_open_memory:Int(handle:Byte Ptr, buf:Byte Ptr, size:Int, used:Int Ptr)
+	Function bmx_libarchive_archive_write_data:Int(handle:Byte Ptr, data:Byte Ptr, size:Size_T)
+	Function bmx_libarchive_archive_write_header:Int(handle:Byte Ptr, entry:Byte Ptr)
+	Function bmx_libarchive_archive_write_close:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_write_finish_entry:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_write_set_passphrase:Int(handle:Byte Ptr, passphrase:String)
+	Function bmx_libarchive_archive_write_set_filter_option:Int(handle:Byte Ptr, option:String, value:String, moduleName:String)
+	Function bmx_libarchive_archive_write_set_format_option:Int(handle:Byte Ptr, option:String, value:String, moduleName:String)
+	Function bmx_libarchive_archive_write_open:Int(handle:Byte Ptr, data:Object)
+		
+	Function bmx_libarchive_archive_clear_error(handle:Byte Ptr)
+	Function bmx_libarchive_archive_errno:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_error_string:String(handle:Byte Ptr)
+	Function bmx_libarchive_archive_file_count:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_filter_code:Int(handle:Byte Ptr, filter:Int)
+	Function bmx_libarchive_archive_filter_count:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_filter_name:String(handle:Byte Ptr, filter:Int)
+	Function bmx_libarchive_archive_format:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_format_name:String(handle:Byte Ptr)
+	Function bmx_libarchive_archive_position(handle:Byte Ptr, filter:Int, v:Long Ptr)
+
+	Function bmx_libarchive_archive_entry_new:Byte Ptr()
+	Function bmx_libarchive_archive_entry_free(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_clear:Byte Ptr(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_clone:Byte Ptr(handle:Byte Ptr)
+	
+	Function bmx_libarchive_archive_entry_hardlink:String(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_sourcepath:String(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_symlink:String(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_pathname:String(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_set_link(handle:Byte Ptr, path:String)
+	Function bmx_libarchive_archive_entry_set_pathname(handle:Byte Ptr, path:String)
+	Function bmx_libarchive_archive_entry_set_sourcepath(handle:Byte Ptr, path:String)
+	Function bmx_libarchive_archive_entry_set_symlink(handle:Byte Ptr, path:String)
+	Function bmx_libarchive_archive_entry_set_size(handle:Byte Ptr, size:Long)
+	Function bmx_libarchive_archive_entry_unset_size(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_set_ctime(handle:Byte Ptr, time:Long, nanoseconds:Long)
+	Function bmx_libarchive_archive_entry_set_mtime(handle:Byte Ptr, time:Long, nanoseconds:Long)
+	Function bmx_libarchive_archive_entry_set_filetype(handle:Byte Ptr, fType:EArchiveFileType)
+	Function bmx_libarchive_archive_entry_set_perm(handle:Byte Ptr, perm:Int)
+	Function bmx_libarchive_archive_entry_is_data_encrypted:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_is_metadata_encrypted:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_is_encrypted:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_size_is_set:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_entry_size:Long(handle:Byte Ptr)
+
+	Function bmx_libarchive_archive_read_disk_new:Byte Ptr()
+	Function bmx_libarchive_archive_read_disk_entry_from_file:Int(handle:Byte Ptr, entry:Byte Ptr)
+	Function bmx_libarchive_archive_read_disk_set_standard_lookup:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_read_disk_set_symlink_logical:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_read_disk_set_symlink_physical:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_read_disk_set_symlink_hybrid:Int(handle:Byte Ptr)
+	Function bmx_libarchive_archive_read_disk_gname:String(handle:Byte Ptr, gid:Long)
+	Function bmx_libarchive_archive_read_disk_uname:String(handle:Byte Ptr, uid:Long)
+
+	Function archive_error_string:Byte Ptr(handle:Byte Ptr)
+End Extern
+
+Enum EArchiveFilter
+	NONE
+	GZIP
+	BZIP2
+	COMPRESS
+	PROGRAM
+	LZMA
+	XZ
+	UU
+	RPM
+	LZIP
+	LRZIP
+	LZOP
+	GRZIP
+	LZ4
+	ZSTD
+End Enum
+
+Enum EArchiveFormat
+	CPIO = $10000
+	SHAR = $20000
+	TAR = $30000
+	PAX = $30000 | 3
+	GNUTAR = $30000 | 4
+	ISO9660 = $40000
+	ZIP = $50000
+	EMPTY = $60000
+	AR = $70000
+	MTREE = $80000
+	RAW = $90000
+	XAR = $A0000
+	LHA = $B0000
+	CAB = $C0000
+	RAR = $D0000
+	SEVEN_ZIP = $E0000
+	WARC = $F0000
+	RAR_V5 = $100000
+End Enum
+
+Enum EArchiveFileType:UInt
+	File = 100000 ' regular file
+	Link = 120000 ' symbolic link
+	Socket = 140000 ' socket
+	CharDevice = 20000 ' character device
+	BlockDevice = 60000 ' block device
+	Dir = 40000 ' directory
+	Fifo = 10000 ' named pipe
+End Enum
+
+Const ARCHIVE_FILTER_NONE:Int = 0
+Const ARCHIVE_FILTER_GZIP:Int = 1
+Const ARCHIVE_FILTER_BZIP2:Int = 2
+Const ARCHIVE_FILTER_COMPRESS:Int = 3
+Const ARCHIVE_FILTER_PROGRAM:Int = 4
+Const ARCHIVE_FILTER_LZMA:Int = 5
+Const ARCHIVE_FILTER_XZ:Int = 6
+Const ARCHIVE_FILTER_UU:Int = 7
+Const ARCHIVE_FILTER_RPM:Int = 8
+Const ARCHIVE_FILTER_LZIP:Int = 9
+Const ARCHIVE_FILTER_LRZIP:Int = 10
+Const ARCHIVE_FILTER_LZOP:Int = 11
+Const ARCHIVE_FILTER_GRZIP:Int = 12
+Const ARCHIVE_FILTER_LZ4:Int = 13
+Const ARCHIVE_FILTER_ZSTD:Int = 14
+
+Const ARCHIVE_FORMAT_BASE_MASK:Int = $ff0000
+Const ARCHIVE_FORMAT_CPIO:Int = $10000
+Const ARCHIVE_FORMAT_CPIO_POSIX:Int = ARCHIVE_FORMAT_CPIO | 1
+Const ARCHIVE_FORMAT_CPIO_BIN_LE:Int = ARCHIVE_FORMAT_CPIO | 2
+Const ARCHIVE_FORMAT_CPIO_BIN_BE:Int = ARCHIVE_FORMAT_CPIO | 3
+Const ARCHIVE_FORMAT_CPIO_SVR4_NOCRC:Int = ARCHIVE_FORMAT_CPIO | 4
+Const ARCHIVE_FORMAT_CPIO_SVR4_CRC:Int = ARCHIVE_FORMAT_CPIO | 5
+Const ARCHIVE_FORMAT_CPIO_AFIO_LARGE:Int = ARCHIVE_FORMAT_CPIO | 6
+Const ARCHIVE_FORMAT_SHAR:Int = $20000
+Const ARCHIVE_FORMAT_SHAR_BASE:Int = ARCHIVE_FORMAT_SHAR | 1
+Const ARCHIVE_FORMAT_SHAR_DUMP:Int = ARCHIVE_FORMAT_SHAR | 2
+Const ARCHIVE_FORMAT_TAR:Int = $30000
+Const ARCHIVE_FORMAT_TAR_USTAR:Int = ARCHIVE_FORMAT_TAR | 1
+Const ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE:Int = ARCHIVE_FORMAT_TAR | 2
+Const ARCHIVE_FORMAT_TAR_PAX_RESTRICTED:Int = ARCHIVE_FORMAT_TAR | 3
+Const ARCHIVE_FORMAT_TAR_GNUTAR:Int = ARCHIVE_FORMAT_TAR | 4
+Const ARCHIVE_FORMAT_ISO9660:Int = $40000
+Const ARCHIVE_FORMAT_ISO9660_ROCKRIDGE:Int = ARCHIVE_FORMAT_ISO9660 | 1
+Const ARCHIVE_FORMAT_ZIP:Int = $50000
+Const ARCHIVE_FORMAT_EMPTY:Int = $60000
+Const ARCHIVE_FORMAT_AR:Int = $70000
+Const ARCHIVE_FORMAT_AR_GNU:Int = ARCHIVE_FORMAT_AR | 1
+Const ARCHIVE_FORMAT_AR_BSD:Int = ARCHIVE_FORMAT_AR | 2
+Const ARCHIVE_FORMAT_MTREE:Int = $80000
+Const ARCHIVE_FORMAT_RAW:Int = $90000
+Const ARCHIVE_FORMAT_XAR:Int = $A0000
+Const ARCHIVE_FORMAT_LHA:Int = $B0000
+Const ARCHIVE_FORMAT_CAB:Int = $C0000
+Const ARCHIVE_FORMAT_RAR:Int = $D0000
+Const ARCHIVE_FORMAT_7ZIP:Int = $E0000
+Const ARCHIVE_FORMAT_WARC:Int = $F0000
+Const ARCHIVE_FORMAT_RAR_V5:Int = $100000
+
+Rem
+bbdoc:  Found end of archive.
+End Rem
+Const ARCHIVE_EOF:Int = 1
+Rem
+bbdoc:  Operation was successful.
+End Rem
+Const ARCHIVE_OK:Int = 0
+Rem
+bbdoc:  Retry might succeed.
+End Rem
+Const ARCHIVE_RETRY:Int = -10
+Rem
+bbdoc:  Partial success.
+End Rem
+Const ARCHIVE_WARN:Int = -20
+Rem
+bbdoc:  Current operation cannot complete.
+about: For example, if WriteHeader "fails", tThen you can't push data.
+End Rem
+Const ARCHIVE_FAILED:Int = -25
+Rem
+bbdoc:  No more operations are possible.
+about: For example, if WriteHeader is "fatal," then this archive is dead and useless.
+End Rem
+Const ARCHIVE_FATAL:Int = -30
+
+Const ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED:Int = -2
+Const ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW:Int = -1
+

+ 949 - 0
core.mod/core.bmx

@@ -0,0 +1,949 @@
+' Copyright (c) 2022 Bruce A Henderson
+' All rights reserved.
+'
+' Redistribution and use in source and binary forms, with or without
+' modification, are permitted provided that the following conditions are met:
+'     * Redistributions of source code must retain the above copyright
+'       notice, this list of conditions and the following disclaimer.
+'     * 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 COPYRIGHT HOLDER ``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 COPYRIGHT HOLDER 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.
+'
+SuperStrict
+
+Rem
+bbdoc: Streaming Archive Library
+End Rem
+Module Archive.Core
+
+
+ModuleInfo "Version: 1.06"
+ModuleInfo "License: BSD"
+ModuleInfo "Copyright: libarchive - 2003-2018 Tim Kientzle"
+ModuleInfo "Copyright: Wrapper - 2013-2019 Bruce A Henderson"
+
+ModuleInfo "History: 1.06"
+ModuleInfo "History: Update to libarchive 3.5.2.b967588."
+ModuleInfo "History: 1.05"
+ModuleInfo "History: Update to libarchive 3.3.4.458e493."
+ModuleInfo "History: 1.04"
+ModuleInfo "History: Update to libarchive 3.3.4.c16ce12."
+ModuleInfo "History: 1.03"
+ModuleInfo "History: Added zstd support."
+ModuleInfo "History: 1.02"
+ModuleInfo "History: Update to libarchive 3.3.2.77d26b0."
+ModuleInfo "History: 1.01"
+ModuleInfo "History: Removed libiconv requirement from Win32."
+ModuleInfo "History: 1.00"
+ModuleInfo "History: Initial Release. libarchive 3.1.2"
+
+ModuleInfo "CC_OPTS: -DHAVE_CONFIG_H -D_FILE_OFFSET_BITS=64"
+?win32
+ModuleInfo "CC_OPTS: -DLIBARCHIVE_STATIC"
+?
+
+Import "common.bmx"
+
+Import BRL.Stream
+Import BRL.FileSystem
+
+Rem
+bbdoc: Archive base type.
+End Rem
+Type TArchive
+
+	Field archivePtr:Byte Ptr
+
+	Rem
+	bbdoc: Clears any error information left over from a previous call.
+	about: Not generally used in client code.
+	End Rem
+	Method ClearError()
+		bmx_libarchive_archive_clear_error(archivePtr)
+	End Method
+	
+	Rem
+	bbdoc: Returns a numeric error code indicating the reason for the most recent error return.
+	about: Note that this can not be reliably used to detect whether an error has occurred.
+	It should be used only after another libarchive function has returned an error status.
+	End Rem
+	Method Errno:Int()
+		Return bmx_libarchive_archive_errno(archivePtr)
+	End Method
+	
+	Rem
+	bbdoc: Returns a textual error message suitable for display.
+	about: The error message here is usually more specific than that obtained from passing the result of archive_errno() to strerror(3).
+	End Rem
+	Method ErrorString:String()
+		Return bmx_libarchive_archive_error_string(archivePtr)
+	End Method
+	
+	Rem
+	bbdoc: Returns a count of the number of files processed by this archive object.
+	about: The count is incremented by calls to WriteHeader or ReadNextHeader.
+	End Rem
+	Method FileCount:Int()
+		Return bmx_libarchive_archive_file_count(archivePtr)
+	End Method
+	
+	Rem
+	bbdoc: Returns a numeric code identifying the indicated filter.
+	about: See FilterCount() for details of the numbering.
+	End Rem
+	Method FilterCode:Int(filter:Int)
+		Return bmx_libarchive_archive_filter_code(archivePtr, filter)
+	End Method
+	
+	Rem
+	bbdoc: Returns the number of filters in the current pipeline.
+	about: For read archive handles, these filters are added automatically by the automatic format detection.
+	For write archive handles, these filters are added by calls to the various AddFilterXXX() methods. Filters in the
+	resulting pipeline are numbered so that filter 0 is the filter closest to the format handler. As a convenience,
+	methods that expect a filter number will accept -1 as a synonym for the highest-numbered filter.
+	<p>
+	For example, when reading a uuencoded gzipped tar archive, there are three filters: filter 0 is the gunzip filter, filter 1 is the uudecode
+	filter, and filter 2 is the pseudo-filter that wraps the archive read methods. In this case, requesting Position(-1) would be a synonym
+	for Position(2) which would return the number of bytes currently read from the archive, while Position(1) would return the number of
+	bytes after uudecoding, and Position(0) would return the number of bytes after decompression.
+	</p>
+	End Rem
+	Method FilterCount:Int()
+		Return bmx_libarchive_archive_filter_count(archivePtr)
+	End Method
+	
+	Rem
+	bbdoc: Returns a textual name identifying the indicated filter.
+	about: See FilterCount() for details of the numbering.
+	End Rem
+	Method FilterName:String(filter:Int)
+		Return bmx_libarchive_archive_filter_name(archivePtr, filter)
+	End Method
+	
+	Rem
+	bbdoc: Returns a numeric code indicating the format of the current archive entry.
+	about: This value is set by a successful call to ReadNextHeader(). Note that it is common for this value to
+	change from entry to entry. For example, a tar archive might have several entries that utilize GNU
+	tar extensions and several entries that do not. These entries will have different format codes.
+	End Rem
+	Method Format:Int()
+		Return bmx_libarchive_archive_format(archivePtr)
+	End Method
+	
+	Rem
+	bbdoc: A textual description of the format of the current entry.
+	End Rem
+	Method FormatName:String()
+		Return bmx_libarchive_archive_format_name(archivePtr)
+	End Method
+	
+	Rem
+	bbdoc: Returns the number of bytes read from or written to the indicated filter.
+	about: In particular, Position(0) returns the number of bytes read or written by the format handler,
+	while Position(-1) returns the number of bytes read or written to the archive. See FilterCount() for details of the numbering here.
+	End Rem
+	Method Position:Long(filter:Int)
+		Local v:Long
+		bmx_libarchive_archive_position(archivePtr, filter, Varptr v)
+		Return v
+	End Method
+
+	Method Data:Int(data:Byte Ptr, size:Size_T) Abstract
+	Method Free() Abstract
+	
+	Method Delete()
+		Free()
+	End Method
+	
+End Type
+
+Rem
+bbdoc: A readable archive.
+about: This is used for extracting data from existing archives.
+End Rem
+Type TReadArchive Extends TArchive
+
+	Field callbackData:TArchiveCallbackData
+
+	Function CreateArchive:TReadArchive()
+		Return New TReadArchive()
+	End Function
+	
+	Rem
+	bbdoc: Creates a new instance of #TReadArchive.
+	End Rem
+	Method New()
+		archivePtr = bmx_libarchive_read_archive_new()
+	End Method
+
+	Rem
+	bbdoc: Sets the passphrase for the archive.
+	End Rem
+	Method SetPassphrase:Int(passphrase:String)
+		Return bmx_libarchive_archive_read_add_passphrase(archivePtr, passphrase)
+	End Method
+
+	Rem
+	bbdoc: Returns #True if the archive has encrypted entries.
+	End Rem
+	Method HasEncryptedEntries:Int()
+		Return bmx_libarchive_archive_read_has_encrypted_entries(archivePtr)
+	End Method
+
+	Rem
+	bbdoc: Opens archive for reading from a file of the given @filename, with a block size of @blockSize bytes.
+	about: The file should be readable.
+	End Rem
+	Method Open:Int(filename:String, blockSize:Int = 10240)
+		Local stream:TStream = ReadStream(filename)
+
+		If Not stream Then
+			Throw New TArchiveException("Unable to create stream for reading")
+		End If
+
+		Return Open(stream, blockSize, True)
+	End Method
+	
+	Rem
+	bbdoc: Opens archive for reading from memory.
+	about: @size indicates the size of the archive in memory at location @buf.
+	End Rem
+	Method Open:Int(buf:Byte Ptr, size:Size_T)
+		Return bmx_libarchive_archive_read_open_memory(archivePtr, buf, size)
+	End Method
+	
+	Rem
+	bbdoc: Opens archive for reading from a @stream, with a block size of @blockSize bytes.
+	about: @stream should already be created and readable.
+	If @closeAfterRead is set, the stream will be closed when the archive is closed.
+	End Rem
+	Method Open:Int(stream:TStream, blockSize:Int = 10240, closeAfterRead:Int = False)
+
+		If Not stream Then
+			Throw New TArchiveException("stream cannot be Null")
+		End If
+
+		If Not callbackData Then
+			callbackData = New TArchiveCallbackData(stream, blockSize)
+		Else
+			callbackData.Update(stream, blockSize)
+		End If
+
+		callbackData.shouldClose = closeAfterRead
+
+		Return bmx_libarchive_archive_read_open(archivePtr, callbackData)
+	End Method
+	
+	Rem
+	bbdoc: Read the header for the next entry and populate the provided entry
+	returns: ARCHIVE_OK (the operation succeeded), ARCHIVE_WARN (the operation succeeded but a non-critical error was encountered), ARCHIVE_EOF (end-of-archive was encountered), ARCHIVE_RETRY (the operation failed but can be retried), and ARCHIVE_FATAL (there was a fatal error; the archive should be closed immediately).
+	End Rem
+	Method ReadNextHeader:Int(entry:TArchiveEntry)
+		Return bmx_libarchive_archive_read_next_header(archivePtr, entry.entryPtr)
+	End Method
+
+	Rem
+	bbdoc: A convenience method that repeatedly skips all of the data for this archive entry. 
+	End Rem
+	Method DataSkip:Int()
+		Return bmx_libarchive_archive_read_data_skip(archivePtr)
+	End Method
+	
+	Rem
+	bbdoc: Read data associated with the header just read.
+	returns: A count of bytes actually read or zero at the end of the entry. On error, a value of #ARCHIVE_FATAL, #ARCHIVE_WARN, or #ARCHIVE_RETRY is returned.
+	End Rem
+	Method Data:Int(buf:Byte Ptr, size:Size_T) Override
+		Return bmx_libarchive_archive_read_data(archivePtr, buf, size)
+	End Method
+	
+	Rem
+	bbdoc: Returns a readable #TStream of the current entry data.
+	about: This can be used by any #TStream supported functionality.
+	End Rem
+	Method DataStream:TStream()
+		Return New TArchiveStream(Self)
+	End Method
+
+	Rem
+	bbdoc: Adds a filter for reading.
+	End Rem
+	Method AddFilter(filter:EArchiveFilter)
+		ArchiveAddReadFilter(archivePtr, filter)
+	End Method
+
+	Rem
+	bbdoc: Sets a format for reading.
+	End Rem
+	Method SetFormat(format:EArchiveFormat)
+		ArchiveSetReadFormat(archivePtr, format)
+	End Method
+
+	Rem
+	bbdoc: Sets a filter option.
+	End Rem
+	Method SetFilterOption:Int(option:String, value:String = Null, moduleName:String = Null)
+		Return bmx_libarchive_archive_read_set_filter_option(archivePtr, option, value, moduleName)
+	End Method
+
+	Rem
+	bbdoc: Sets a format option.
+	End Rem
+	Method SetFormatOption:Int(option:String, value:String = Null, moduleName:String = Null)
+		Return bmx_libarchive_archive_read_set_format_option(archivePtr, option, value, moduleName)
+	End Method
+
+	Method Free() Override
+		If archivePtr Then
+			bmx_libarchive_archive_read_free(archivePtr)
+			archivePtr = Null
+		End If
+	End Method
+
+End Type
+
+Rem
+bbdoc: Data from a TReadArchive entry as a stream.
+End Rem
+Type TArchiveStream Extends TStream
+
+	Field archive:TArchive
+	
+	Field _eof:Int
+	
+	Method New(archive:TArchive)
+		Self.archive = archive
+	End Method
+
+	Method Read:Long( buf:Byte Ptr,count:Long )
+		Local size:Long = archive.Data(buf, Size_T(count))
+		If Not size Then
+			_eof = True
+		End If
+		Return size
+	End Method
+
+	Method ReadBytes:Long( buf:Byte Ptr,count:Long )
+		Local t:Long=0
+		While count>0
+			Local n:Long=Read( buf,count )
+			If Not n Exit
+			count:-n
+			buf:+n
+			t:+ n
+		Wend
+		Return t
+	End Method
+
+	Method Eof:Int()
+		Return _eof
+	End Method
+
+End Type
+
+Type TArchiveCallbackData
+
+	Field data:Byte[]
+	Field stream:TStream
+	Field shouldClose:Int
+
+	Method New(stream:TStream, blockSize:Int = 10240)
+		Self.data = New Byte[blockSize]
+		Self.stream = stream
+	End Method
+	
+	Function _read:Byte Ptr(cbData:Object, count:Long Var) { nomangle }
+		Local data:TArchiveCallbackData = TArchiveCallbackData(cbData)
+		
+		Local buf:Byte Ptr = data.data
+		Local c:Long = data.data.Length
+		Local ncount:Long
+		While c
+			Local n:Long = data.stream.Read(buf, c)
+			If Not n Then
+				Exit
+			End If
+			c:-n
+			ncount:+ n
+			buf:+n
+		Wend
+
+		count = ncount
+		Return data.data
+	End Function
+	
+	Function _seek(cbData:Object, offset:Long, whence:Int, count:Long Var) { nomangle }
+		Local data:TArchiveCallbackData = TArchiveCallbackData(cbData)
+
+		Select whence
+			Case SEEK_SET_
+				count = data.stream.seek(offset)
+			Case SEEK_CUR_
+				count = data.stream.seek(offset + data.stream.pos())
+			Case SEEK_END_
+				count = data.stream.seek(data.stream.size())
+		End Select
+	End Function
+
+	Function _write(cbData:Object, buf:Byte Ptr, length:Size_T, count:Long Var) { nomangle }
+		Local data:TArchiveCallbackData = TArchiveCallbackData(cbData)
+		count = data.stream.Write(buf, length)
+	End Function
+
+	Function _close:Int(cbData:Object) { nomangle }
+		Local data:TArchiveCallbackData = TArchiveCallbackData(cbData)
+		data.Close()
+		Return ARCHIVE_OK
+	End Function
+
+	Method Update(stream:TStream, size:Int)
+		Self.stream = stream
+		data = data[..size]
+	End Method
+
+	Method Close()
+		If shouldClose Then
+			stream.Close()
+		End If
+	End Method
+
+	Method Delete()
+		data = Null
+	End Method
+End Type
+
+Rem
+bbdoc: A writeable archive.
+End Rem
+Type TWriteArchive Extends TArchive
+
+	Field callbackData:TArchiveCallbackData
+
+	Function CreateArchive:TWriteArchive()
+		Return New TWriteArchive()
+	End Function
+	
+	Rem
+	bbdoc: Creates a new instance of #TWriteArchive.
+	End Rem
+	Method New()
+		archivePtr = bmx_libarchive_write_archive_new()
+	End Method
+
+	Rem
+	bbdoc: Opens archive for writing to a file of the given @filename.
+	about: The file should be writeable.
+	End Rem
+	Method Open:Int(filename:String)
+		Local stream:TStream = WriteStream(filename)
+
+		If Not stream Then
+			Throw New TArchiveException("Unable to create stream for writing")
+		End If
+
+		Return Open(stream, True)
+	End Method
+	
+	Rem
+	bbdoc: Opens archive for writing to memory.
+	about: The @size should be large enough for the final archive.
+	After writing, @used will be populated with the total bytes used, so the pointer should remain valid until then.
+	End Rem
+	Method Open:Int(buf:Byte Ptr, size:Int, used:Size_T Ptr)
+		Return bmx_libarchive_archive_write_open_memory(archivePtr, buf, size, Varptr used)
+	End Method
+	
+	Rem
+	bbdoc: Opens archive for writing to a @stream.
+	about: @stream should already be created and writeable.
+	If @closeAfterWrite is set, the stream will be closed once the write completes.
+	End Rem
+	Method Open:Int(stream:TStream, closeAfterWrite:Int = False)
+
+		If Not stream Then
+			Throw New TArchiveException("stream cannot be Null")
+		End If
+
+		If Not callbackData Then
+			callbackData = New TArchiveCallbackData(stream, 0)
+		Else
+			callbackData.Update(stream, 0)
+		End If
+
+		callbackData.shouldClose = closeAfterWrite
+
+		Return bmx_libarchive_archive_write_open(archivePtr, callbackData)
+	End Method
+
+	Rem
+	bbdoc: Convience method for adding a file or #TStream to the archive.
+	about: If adding a #TStream, you will also need to provide @pathname, @size and @ftime values.
+	By default, files are added with the permission '0644' (decimal 420).
+	End Rem
+	Method AddEntry(file:Object, pathname:String = Null, size:Long = 0, ftime:Long = 0)
+		If String(file) Then
+			If Not pathname Then
+				pathname = StripDir(String(file))
+			End If
+
+			If Not ftime Then
+				ftime = FileTime(String(file))
+			End If
+		End If
+
+		If Not pathname Then
+			Throw New TArchiveException("Pathname is required. Unable to determine pathname from input")
+		End If
+
+		Local stream:TStream = ReadStream(file)
+
+		If Not stream Then
+			Throw New TArchiveException("Unabled to open stream for input file for path '" + pathname + "'")
+		End If
+
+		If Not size Then
+			size = stream.Size()
+		End If
+
+		Local entry:TArchiveEntry = New TArchiveEntry
+		entry.SetPathname(pathname)
+		entry.SetSize(size)
+		entry.SetFileType(EArchiveFileType.File)
+		entry.SetPermission(420) ' 0644
+		If ftime Then
+			entry.SetModifiedTime(ftime)
+		End If
+
+		If Header(entry) <> ARCHIVE_OK Then
+			Throw New TArchiveException(String.FromUTF8String(archive_error_string(archivePtr)))
+		End If
+
+		Local StaticArray buf:Byte[8192]
+		Local count:Size_T = size
+		While count
+			Local nCount:Long = stream.Read(buf, Min(count, buf.Length))
+			If nCount <= 0 Then
+				Exit
+			End If
+			Data(buf, Size_T(nCount))
+			count :- nCount
+		Wend
+
+		If Not TStream(file) Then
+			stream.Close()
+		End If
+
+		FinishEntry()
+		entry.Free()
+	End Method
+	
+	Rem
+	bbdoc: Build and write a header using the data in the provided in the TArchiveEntry object.
+	about: See TArchiveEntry for information on creating and populating such objects.
+	End Rem
+	Method Header:Int(entry:TArchiveEntry)
+		Return bmx_libarchive_archive_write_header(archivePtr, entry.entryPtr)
+	End Method
+	
+	Rem
+	bbdoc: Closes the archive.
+	End Rem
+	Method Close:Int()
+		Return bmx_libarchive_archive_write_close(archivePtr)
+	End Method
+
+	Rem
+	bbdoc: Informs the archive that the current archive entry is finished.
+	End Rem
+	Method FinishEntry:Int()
+		Return bmx_libarchive_archive_write_finish_entry(archivePtr)
+	End Method
+	
+	Rem
+	bbdoc: Writes @size bytes of data to the current archive entry.
+	End Rem
+	Method Data:Int(data:Byte Ptr, size:Size_T) Override
+		Return bmx_libarchive_archive_write_data(archivePtr, data, size)
+	End Method
+
+	Rem
+	bbdoc: Sets a passphrase for the archive.
+	End Rem
+	Method SetPassphrase:Int(passphrase:String)
+		Return bmx_libarchive_archive_write_set_passphrase(archivePtr, passphrase)
+	End Method
+
+	Rem
+	bbdoc: Adds a filter for writing.
+	End Rem
+	Method AddFilter(filter:EArchiveFilter)
+		ArchiveAddWriteFilter(archivePtr, filter)
+	End Method
+
+	Rem
+	bbdoc: Adds a format for writing.
+	End Rem
+	Method SetFormat(format:EArchiveFormat)
+		ArchiveSetWriteFormat(archivePtr, format)
+	End Method
+
+	Rem
+	bbdoc: Sets a filter option.
+	End Rem
+	Method SetFilterOption:Int(option:String, value:String = Null, moduleName:String = Null)
+		Return bmx_libarchive_archive_write_set_filter_option(archivePtr, option, value, moduleName)
+	End Method
+
+	Rem
+	bbdoc: Sets a format option.
+	End Rem
+	Method SetFormatOption:Int(option:String, value:String = Null, moduleName:String = Null)
+		Return bmx_libarchive_archive_write_set_format_option(archivePtr, option, value, moduleName)
+	End Method
+
+	Rem
+	bbdoc: Frees the archive.
+	End Rem
+	Method Free() Override
+		If archivePtr Then
+			bmx_libarchive_archive_write_free(archivePtr)
+			archivePtr = Null
+		End If
+	End Method
+
+End Type
+
+Type TReadDiskArchive Extends TArchive
+
+	Method New()
+		archivePtr = bmx_libarchive_archive_read_disk_new()
+	End Method
+	
+	Method EntryFromFile:Int(entry:TArchiveEntry)
+		Return bmx_libarchive_archive_read_disk_entry_from_file(archivePtr, entry.entryPtr)
+	End Method
+
+	Method SetSymlinkLogical:Int()
+		Return bmx_libarchive_archive_read_disk_set_symlink_logical(archivePtr)
+	End Method
+
+	Method SetSymlinkPhysical:Int()
+		Return bmx_libarchive_archive_read_disk_set_symlink_physical(archivePtr)
+	End Method
+
+	Method SetSymlinkhybrid:Int()
+		Return bmx_libarchive_archive_read_disk_set_symlink_hybrid(archivePtr)
+	End Method
+	
+	Method GName:String(gid:Long)
+		Return bmx_libarchive_archive_read_disk_gname(archivePtr, gid)
+	End Method
+	
+	Method UName:String(uid:Long)
+		Return bmx_libarchive_archive_read_disk_uname(archivePtr, uid)
+	End Method
+	
+	Method SetStandardLookup:Int()
+		Return bmx_libarchive_archive_read_disk_set_standard_lookup(archivePtr)
+	End Method
+	
+	Method Free()
+		If archivePtr Then
+			bmx_libarchive_archive_read_free(archivePtr)
+			archivePtr = Null
+		End If
+	End Method
+
+End Type
+
+Rem
+bbdoc: Represents entries within an archive.
+about: You can think of a #TArchiveEntry as a heavy-duty version of the c struct stat: it includes everything from struct stat plus
+associated pathname, textual group and user names, etc. These objects are used by libarchive to represent the metadata associated
+with a particular entry in an archive.
+End Rem
+Type TArchiveEntry
+
+	Field entryPtr:Byte Ptr
+	
+	Function _create:TArchiveEntry(entryPtr:Byte Ptr)
+		If entryPtr Then
+			Local this:TArchiveEntry = New TArchiveEntry(entryPtr)
+			Return this
+		End If
+		Return Null
+	End Function
+	
+	Rem
+	bbdoc: Creates a new #TArchiveEntry instance.
+	End Rem
+	Method New()
+		entryPtr = bmx_libarchive_archive_entry_new()
+	End Method
+
+	Rem
+	bbdoc: Creates a new #TArchiveEntry instance using the specified @entryPtr handle.
+	End Rem
+	Method New(entryPtr:Byte Ptr)
+		Self.entryPtr = entryPtr
+	End Method
+	
+	Rem
+	bbdoc: Erases the object, resetting all internal fields to the same state as a newly-created object.
+	about: This is provided to allow you to quickly recycle objects.
+	End Rem
+	Method Clear()
+		entryPtr = bmx_libarchive_archive_entry_clear(entryPtr)
+	End Method
+	
+	Rem
+	bbdoc: A deep copy operation; all text fields are duplicated.
+	End Rem
+	Method Clone:TArchiveEntry()
+		Return TArchiveEntry._create(bmx_libarchive_archive_entry_clone(entryPtr))
+	End Method
+
+	Rem
+	bbdoc: Destination of the hardlink.
+	End Rem
+	Method Hardlink:String()
+		Return bmx_libarchive_archive_entry_hardlink(entryPtr)
+	End Method
+
+	Rem
+	bbdoc: Returns #True if the entry data is encrypted.
+	End Rem
+	Method IsDataEncrypted:Int()
+		Return bmx_libarchive_archive_entry_is_data_encrypted(entryPtr)
+	End Method
+
+	Rem
+	bbdoc: Returns #True if the entry metadata is encrypted.
+	End Rem
+	Method IsMetadataEncrypted:Int()
+		Return bmx_libarchive_archive_entry_is_metadata_encrypted(entryPtr)
+	End Method
+
+	Rem
+	bbdoc: Returns #True if the entry is encrypted.
+	End Rem
+	Method IsEncrypted:Int()
+		Return bmx_libarchive_archive_entry_is_encrypted(entryPtr)
+	End Method
+
+	Rem
+	bbdoc: Path in the archive.
+	End Rem
+	Method Pathname:String()
+		Return bmx_libarchive_archive_entry_pathname(entryPtr)
+	End Method
+	
+	Rem
+	bbdoc: Path on the disk for use by TReadArchive.Disk()
+	End Rem
+	Method SourcePath:String()
+		Return bmx_libarchive_archive_entry_sourcepath(entryPtr)
+	End Method
+	
+	Rem
+	bbdoc: Destination of the symbolic link.
+	End Rem
+	Method Symlink:String()
+		Return bmx_libarchive_archive_entry_symlink(entryPtr)
+	End Method
+	
+	Rem
+	bbdoc: Sets the creation time of the entry.
+	End Rem
+	Method SetCreationTime(time:Long, nanoseconds:Long = 0)
+		bmx_libarchive_archive_entry_set_ctime(entryPtr, time, nanoseconds)
+	End Method
+
+	Rem
+	bbdoc: Sets the file type of the entry.
+	End Rem
+	Method SetFileType(fType:EArchiveFileType)
+		bmx_libarchive_archive_entry_set_filetype(entryPtr, fType)
+	End Method
+
+	Rem
+	bbdoc: 
+	End Rem
+	Method SetHardlink(path:String)
+	End Method
+	
+	Rem
+	bbdoc: For a symlink, update the destination, otherwise, make the entry a hardlink and alter the destination for that.
+	about: Update only. 
+	End Rem
+	Method SetLink(path:String)
+		bmx_libarchive_archive_entry_set_link(entryPtr, path)
+	End Method
+	
+	Rem
+	bbdoc: Sets the modified time of the entry.
+	End Rem
+	Method SetModifiedTime(time:Long, nanoseconds:Long = 0)
+		bmx_libarchive_archive_entry_set_mtime(entryPtr, time, nanoseconds)
+	End Method
+
+	Rem
+	bbdoc: Sets the pathname of the entry.
+	End Rem
+	Method SetPathname(path:String)
+		bmx_libarchive_archive_entry_set_pathname(entryPtr, path)
+	End Method
+	
+	Rem
+	bbdoc: Sets the permission of the entry.
+	End Rem
+	Method SetPermission(perm:Int)
+		bmx_libarchive_archive_entry_set_perm(entryPtr, perm)
+	End Method
+
+	Rem
+	bbdoc: Sets the size, in bytes, of the entry.
+	End Rem
+	Method SetSize(size:Long)
+		bmx_libarchive_archive_entry_set_size(entryPtr, size)
+	End Method
+
+	Rem
+	bbdoc: 
+	End Rem
+	Method SetSourcePath(path:String)
+		bmx_libarchive_archive_entry_set_sourcepath(entryPtr, path)
+	End Method
+	
+	Rem
+	bbdoc: 
+	End Rem
+	Method SetSymlink(path:String)
+		bmx_libarchive_archive_entry_set_symlink(entryPtr, path)
+	End Method
+
+	Rem
+	bbdoc: Returns true if the size is set.
+	End Rem
+	Method SizeIsSet:Int()
+		Return bmx_libarchive_archive_entry_size_is_set(entryPtr)
+	End Method
+
+	Rem
+	bbdoc: Returns the uncompressed size of the entry, if available.
+	End Rem
+	Method Size:Long()
+		Return bmx_libarchive_archive_entry_size(entryPtr)
+	End Method
+
+	Rem
+	bbdoc: Unsets the size of the entry.
+	End Rem
+	Method UnsetSize()
+		bmx_libarchive_archive_entry_unset_size(entryPtr)
+	End Method
+
+	Rem
+	bbdoc: Releases the archive entry object.
+	End Rem
+	Method Free()
+		If entryPtr Then
+			bmx_libarchive_archive_entry_free(entryPtr)
+			entryPtr = Null
+		End If
+	End Method
+	
+	Method Delete()
+		Free()
+	End Method
+	
+End Type
+
+
+Private
+
+Global _archive_formats:TArchiveFormat
+
+Function ArchiveSetReadFormat(archive:Byte Ptr, format:EArchiveFormat)
+	Local af:TArchiveFormat=_archive_formats
+
+	While af
+		If af.AddReadFormat(archive, format) Then
+			Return
+		End If
+		af=af._succ
+	Wend
+
+	Throw New TArchiveException("Read format not found. Ensure the module has been imported : " + format.ToString())
+End Function
+
+Function ArchiveSetWriteFormat(archive:Byte Ptr, format:EArchiveFormat)
+	Local af:TArchiveFormat=_archive_formats
+
+	While af
+		If af.AddWriteFormat(archive, format) Then
+			Return
+		End If
+		af=af._succ
+	Wend
+
+	Throw New TArchiveException("Write format not found. Ensure the module has been imported : " + format.ToString())
+End Function
+
+Function ArchiveAddReadFilter(archive:Byte Ptr, filter:EArchiveFilter)
+	Local af:TArchiveFormat=_archive_formats
+
+	While af
+		If af.AddReadFilter(archive, filter) Then
+			Return
+		End If
+		af=af._succ
+	Wend
+
+	Throw New TArchiveException("Read filter not found. Ensure the module has been imported : " + filter.ToString())
+End Function
+
+Function ArchiveAddWriteFilter(archive:Byte Ptr, filter:EArchiveFilter)
+	Local af:TArchiveFormat=_archive_formats
+
+	While af
+		If af.AddWriteFilter(archive, filter) Then
+			Return
+		End If
+		af=af._succ
+	Wend
+
+	Throw New TArchiveException("Write filter not found. Ensure the module has been imported : " + filter.ToString())
+End Function
+
+Public
+
+Type TArchiveFormat
+	Field _succ:TArchiveFormat
+	
+	Method New()
+		_succ=_archive_formats
+		_archive_formats=Self
+	End Method
+	
+	Method AddReadFormat:Int(archive:Byte Ptr, format:EArchiveFormat) Abstract
+	Method AddWriteFormat:Int(archive:Byte Ptr, format:EArchiveFormat) Abstract
+	Method AddReadFilter:Int(archive:Byte Ptr, filter:EArchiveFilter) Abstract
+	Method AddWriteFilter:Int(archive:Byte Ptr, filter:EArchiveFilter) Abstract
+	
+End Type
+
+Type TArchiveException Extends TRuntimeException
+
+End Type

+ 447 - 0
core.mod/glue.c

@@ -0,0 +1,447 @@
+/*
+ Copyright (c) 2022 Bruce A Henderson
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+     * Redistributions of source code must retain the above copyright
+       notice, this list of conditions and the following disclaimer.
+     * 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 COPYRIGHT HOLDER ``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 COPYRIGHT HOLDER 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.
+*/
+
+#include "archive.h"
+#include "archive_entry.h"
+
+#include "brl.mod/blitz.mod/blitz.h"
+
+void * archive_core_TArchiveCallbackData__read(BBObject * data, BBInt64 * count);
+void archive_core_TArchiveCallbackData__seek(BBObject * data, BBInt64 offset, int whence, BBInt64 * count);
+void * archive_core_TArchiveCallbackData__write(BBObject * data, void * buffer, size_t length, BBInt64 * count);
+int archive_core_TArchiveCallbackData__close(BBObject * data);
+
+/* +++++++++++++++++++++++++++++++++++++++++++++++++++++ */
+
+__LA_SSIZE_T bmx_libarchive_read_cb(struct archive * arc, void *data, const void **_buffer) {
+	BBInt64 count;
+	*_buffer = archive_core_TArchiveCallbackData__read((BBObject*)data, &count);
+	return count;
+}
+
+__LA_INT64_T bmx_libarchive_seek_cb(struct archive * arc, void *data, __LA_INT64_T offset, int whence) {
+	__LA_INT64_T ret;
+	archive_core_TArchiveCallbackData__seek((BBObject*)data, offset, whence, &ret);
+	return ret;
+}
+
+__LA_SSIZE_T bmx_libarchive_write_cb(struct archive * arc, void *data, const void *_buffer, size_t length) {
+	BBInt64 ret;
+	archive_core_TArchiveCallbackData__write((BBObject*)data, _buffer, length, &ret);
+	return ret;
+}
+
+int	bmx_libarchive_open_cb(struct archive * arc, void *data) {
+	return ARCHIVE_OK;
+}
+
+int	bmx_libarchive_close_cb(struct archive * arc, void *data) {
+	return archive_core_TArchiveCallbackData__close((BBObject*)data);
+}
+
+/* +++++++++++++++++++++++++++++++++++++++++++++++++++++ */
+
+
+struct archive * bmx_libarchive_read_archive_new() {
+	return archive_read_new();
+}
+
+int bmx_libarchive_archive_read_open_memory(struct archive * arc, void * buf, size_t size) {
+	return archive_read_open_memory(arc, buf, size);
+}
+
+int bmx_libarchive_archive_read_next_header(struct archive * arc, struct archive_entry * entry) {
+	return archive_read_next_header2(arc, entry);
+}
+
+int bmx_libarchive_archive_read_data_skip(struct archive * arc) {
+	return archive_read_data_skip(arc);
+}
+
+int bmx_libarchive_archive_read_extract(struct archive * arc, struct archive_entry * entry, int flags) {
+	return archive_read_extract(arc, entry, flags);
+}
+
+int bmx_libarchive_archive_read_open(struct archive * arc, BBObject * data) {
+	return archive_read_open2(arc, data, bmx_libarchive_open_cb, bmx_libarchive_read_cb,
+		bmx_libarchive_seek_cb, bmx_libarchive_close_cb);
+}
+
+int bmx_libarchive_archive_read_set_read_callback(struct archive * arc) {
+	return archive_read_set_read_callback(arc, bmx_libarchive_read_cb);
+}
+
+int bmx_libarchive_archive_read_set_seek_callback(struct archive * arc) {
+	return archive_read_set_seek_callback(arc, bmx_libarchive_seek_cb);
+}
+
+int bmx_libarchive_archive_read_set_callback_data(struct archive * arc, BBObject * callbackData) {
+	return archive_read_set_callback_data(arc, callbackData);
+}
+
+int bmx_libarchive_archive_read_data(struct archive * arc, void * buf, size_t size) {
+	return archive_read_data(arc, buf, size);
+}
+
+int bmx_libarchive_archive_read_free(struct archive * arc) {
+	return archive_read_free(arc);
+}
+
+int bmx_libarchive_archive_read_add_passphrase(struct archive * arc, BBString * passphrase) {
+	char * p = bbStringToUTF8String(passphrase);
+	int ret = archive_read_add_passphrase(arc, p);
+	bbMemFree(p);
+	return ret;
+}
+
+int bmx_libarchive_archive_read_has_encrypted_entries(struct archive * arc) {
+	return archive_read_has_encrypted_entries(arc);
+}
+
+int bmx_libarchive_archive_read_set_filter_option(struct archive * arc, BBString * option, BBString * value, BBString * moduleName) {
+	char * o = 0;
+	char * v = 0;
+	char * m = 0;
+
+	if (option != &bbEmptyString) {
+		o = bbStringToUTF8String(option);
+	}
+
+	if (value != &bbEmptyString) {
+		v = bbStringToUTF8String(value);
+	}
+
+	if (moduleName != &bbEmptyString) {
+		m = bbStringToUTF8String(moduleName);
+	}
+
+	int ret = archive_read_set_filter_option(arc, o, v, m);
+
+	bbMemFree(m);
+	bbMemFree(v);
+	bbMemFree(o);
+
+	return ret;
+}
+
+int bmx_libarchive_archive_read_set_format_option(struct archive * arc, BBString * option, BBString * value, BBString * moduleName) {
+	char * o = 0;
+	char * v = 0;
+	char * m = 0;
+
+	if (option != &bbEmptyString) {
+		o = bbStringToUTF8String(option);
+	}
+
+	if (value != &bbEmptyString) {
+		v = bbStringToUTF8String(value);
+	}
+
+	if (moduleName != &bbEmptyString) {
+		m = bbStringToUTF8String(moduleName);
+	}
+
+	int ret = archive_read_set_format_option(arc, o, v, m);
+
+	bbMemFree(m);
+	bbMemFree(v);
+	bbMemFree(o);
+
+	return ret;
+}
+
+/* +++++++++++++++++++++++++++++++++++++++++++++++++++++ */
+
+
+struct archive * bmx_libarchive_write_archive_new() {
+	return archive_write_new();
+}
+
+int bmx_libarchive_archive_write_open_memory(struct archive * arc, void * buf, int size, size_t * used) {
+	return archive_write_open_memory(arc, buf, size, used);
+}
+
+int bmx_libarchive_archive_write_data(struct archive * arc, void * buf, size_t size) {
+	return archive_write_data(arc, buf, size);
+}
+
+int bmx_libarchive_archive_write_header(struct archive * arc, struct archive_entry * entry) {
+	return archive_write_header(arc, entry);
+}
+
+int bmx_libarchive_archive_write_close(struct archive * arc) {
+	return archive_write_close(arc);
+}
+
+int bmx_libarchive_archive_write_free(struct archive * arc) {
+	return archive_write_free(arc);
+}
+
+int bmx_libarchive_archive_write_finish_entry(struct archive * arc) {
+	return archive_write_finish_entry(arc);
+}
+
+int bmx_libarchive_archive_write_set_passphrase(struct archive * arc, BBString * passphrase) {
+	char * p = bbStringToUTF8String(passphrase);
+	int ret = archive_write_set_passphrase(arc, p);
+	bbMemFree(p);
+	return ret;
+}
+
+int bmx_libarchive_archive_write_set_filter_option(struct archive * arc, BBString * option, BBString * value, BBString * moduleName) {
+	char * o = 0;
+	char * v = 0;
+	char * m = 0;
+
+	if (option != &bbEmptyString) {
+		o = bbStringToUTF8String(option);
+	}
+
+	if (value != &bbEmptyString) {
+		v = bbStringToUTF8String(value);
+	}
+
+	if (moduleName != &bbEmptyString) {
+		m = bbStringToUTF8String(moduleName);
+	}
+
+	int ret = archive_write_set_filter_option(arc, o, v, m);
+
+	bbMemFree(m);
+	bbMemFree(v);
+	bbMemFree(o);
+
+	return ret;
+}
+
+int bmx_libarchive_archive_write_set_format_option(struct archive * arc, BBString * option, BBString * value, BBString * moduleName) {
+	char * o = 0;
+	char * v = 0;
+	char * m = 0;
+
+	if (option != &bbEmptyString) {
+		o = bbStringToUTF8String(option);
+	}
+
+	if (value != &bbEmptyString) {
+		v = bbStringToUTF8String(value);
+	}
+
+	if (moduleName != &bbEmptyString) {
+		m = bbStringToUTF8String(moduleName);
+	}
+
+	int ret = archive_write_set_format_option(arc, m, o, v);
+
+	bbMemFree(m);
+	bbMemFree(v);
+	bbMemFree(o);
+
+	return ret;
+}
+
+int bmx_libarchive_archive_write_open(struct archive * arc, BBObject * data) {
+	archive_write_set_bytes_in_last_block(arc, 1);
+	return archive_write_open(arc, data, bmx_libarchive_open_cb, bmx_libarchive_write_cb, bmx_libarchive_close_cb);
+}
+
+/* +++++++++++++++++++++++++++++++++++++++++++++++++++++ */
+
+void bmx_libarchive_archive_clear_error(struct archive * arc) {
+	archive_clear_error(arc);
+}
+
+int bmx_libarchive_archive_errno(struct archive * arc) {
+	return archive_errno(arc);
+}
+
+BBString * bmx_libarchive_archive_error_string(struct archive * arc) {
+	return bbStringFromCString(archive_error_string(arc));
+}
+
+int bmx_libarchive_archive_file_count(struct archive * arc) {
+	return archive_file_count(arc);
+}
+
+int bmx_libarchive_archive_filter_code(struct archive * arc, int filter) {
+	return archive_filter_code(arc, filter);
+}
+
+int bmx_libarchive_archive_filter_count(struct archive * arc) {
+	return archive_filter_count(arc);
+}
+
+BBString * bmx_libarchive_archive_filter_name(struct archive * arc, int filter) {
+	return bbStringFromCString(archive_filter_name(arc, filter));
+}
+
+int bmx_libarchive_archive_format(struct archive * arc) {
+	return archive_format(arc);
+}
+
+BBString * bmx_libarchive_archive_format_name(struct archive * arc) {
+	return bbStringFromCString(archive_format_name(arc));
+}
+
+void bmx_libarchive_archive_position(struct archive * arc, int filter, BBInt64 * v) {
+	*v = archive_filter_bytes(arc, filter);
+}
+
+
+/* +++++++++++++++++++++++++++++++++++++++++++++++++++++ */
+
+struct archive_entry * bmx_libarchive_archive_entry_new() {
+	return archive_entry_new();
+}
+
+void bmx_libarchive_archive_entry_free(struct archive_entry * entry) {
+	archive_entry_free(entry);
+}
+
+struct archive_entry * bmx_libarchive_archive_entry_clear(struct archive_entry * entry) {
+	return archive_entry_clear(entry);
+}
+
+struct archive_entry * bmx_libarchive_archive_entry_clone(struct archive_entry * entry) {
+	return archive_entry_clone(entry);
+}
+
+BBString * bmx_libarchive_archive_entry_hardlink(struct archive_entry * entry) {
+	return bbStringFromUTF8String(archive_entry_hardlink(entry));
+}
+
+BBString * bmx_libarchive_archive_entry_sourcepath(struct archive_entry * entry) {
+	return bbStringFromUTF8String(archive_entry_sourcepath(entry));
+}
+
+BBString * bmx_libarchive_archive_entry_symlink(struct archive_entry * entry) {
+	return bbStringFromUTF8String(archive_entry_symlink_utf8(entry));
+}
+
+BBString * bmx_libarchive_archive_entry_pathname(struct archive_entry * entry) {
+	return bbStringFromUTF8String(archive_entry_pathname_utf8(entry));
+}
+
+void bmx_libarchive_archive_entry_set_link(struct archive_entry * entry, BBString * path) {
+	char * n = bbStringToUTF8String(path);
+	archive_entry_set_link(entry, n);
+	bbMemFree(n);
+}
+
+void bmx_libarchive_archive_entry_set_pathname(struct archive_entry * entry, BBString * path) {
+	char * n = bbStringToUTF8String(path);
+	archive_entry_set_pathname_utf8(entry, n);
+	archive_entry_set_pathname(entry, n);
+	bbMemFree(n);
+}
+
+void bmx_libarchive_archive_entry_set_sourcepath(struct archive_entry * entry, BBString * path) {
+	char * n = bbStringToUTF8String(path);
+	archive_entry_copy_sourcepath(entry, n);
+	bbMemFree(n);
+}
+
+void bmx_libarchive_archive_entry_set_symlink(struct archive_entry * entry, BBString * path) {
+	char * n = bbStringToUTF8String(path);
+	archive_entry_set_symlink(entry, n);
+	bbMemFree(n);
+}
+
+void bmx_libarchive_archive_entry_set_size(struct archive_entry * entry, BBInt64 size) {
+	archive_entry_set_size(entry, size);
+}
+
+void bmx_libarchive_archive_entry_unset_size(struct archive_entry * entry) {
+	archive_entry_unset_size(entry);
+}
+
+void  bmx_libarchive_archive_entry_set_ctime(struct archive_entry * entry, time_t time, BBInt64 nanoseconds) {
+	archive_entry_set_ctime(entry, time, nanoseconds);
+}
+
+void  bmx_libarchive_archive_entry_set_mtime(struct archive_entry * entry, time_t time, BBInt64 nanoseconds) {
+	archive_entry_set_mtime(entry, time, nanoseconds);
+}
+
+void bmx_libarchive_archive_entry_set_filetype(struct archive_entry * entry, int filetype) {
+	archive_entry_set_filetype(entry, filetype);
+}
+
+void bmx_libarchive_archive_entry_set_perm(struct archive_entry * entry, int perm) {
+	archive_entry_set_perm(entry, perm);
+}
+
+int bmx_libarchive_archive_entry_is_data_encrypted(struct archive_entry * entry) {
+	return archive_entry_is_data_encrypted(entry);
+}
+
+int bmx_libarchive_archive_entry_is_metadata_encrypted(struct archive_entry * entry) {
+	return archive_entry_is_metadata_encrypted(entry);
+}
+
+int bmx_libarchive_archive_entry_is_encrypted(struct archive_entry * entry) {
+	return archive_entry_is_encrypted(entry);
+}
+
+int bmx_libarchive_archive_entry_size_is_set(struct archive_entry * entry) {
+	return archive_entry_size_is_set(entry);
+}
+
+BBInt64 bmx_libarchive_archive_entry_size(struct archive_entry * entry) {
+	return archive_entry_size(entry);
+}
+
+/* +++++++++++++++++++++++++++++++++++++++++++++++++++++ */
+
+struct archive * bmx_libarchive_archive_read_disk_new() {
+	return archive_read_disk_new();
+}
+
+int bmx_libarchive_archive_read_disk_entry_from_file(struct archive * arc, struct archive_entry * entry) {
+	return archive_read_disk_entry_from_file(arc, entry, -1, NULL);
+}
+
+int bmx_libarchive_archive_read_disk_set_standard_lookup(struct archive * arc) {
+	return archive_read_disk_set_standard_lookup(arc);
+}
+
+int bmx_libarchive_archive_read_disk_set_symlink_logical(struct archive * arc) {
+	return archive_read_disk_set_symlink_logical(arc);
+}
+
+int bmx_libarchive_archive_read_disk_set_symlink_physical(struct archive * arc) {
+	return archive_read_disk_set_symlink_physical(arc);
+}
+
+int bmx_libarchive_archive_read_disk_set_symlink_hybrid(struct archive * arc) {
+	return archive_read_disk_set_symlink_hybrid(arc);
+}
+
+BBString * bmx_libarchive_archive_read_disk_gname(struct archive * arc, __LA_INT64_T gid) {
+	return bbStringFromUTF8String(archive_read_disk_gname(arc, gid));
+}
+
+BBString * bmx_libarchive_archive_read_disk_uname(struct archive * arc, __LA_INT64_T uid) {
+	return bbStringFromUTF8String(archive_read_disk_uname(arc, uid));
+}

+ 1491 - 0
core.mod/include/config.h

@@ -0,0 +1,1491 @@
+/* config.h.  Generated from config.h.in by configure.  */
+/* config.h.in.  Generated from configure.ac by autoheader.  */
+#define __LIBARCHIVE_CONFIG_H_INCLUDED 1
+
+/* Darwin ACL support */
+/* #undef ARCHIVE_ACL_DARWIN */
+
+/* FreeBSD ACL support */
+/* #undef ARCHIVE_ACL_FREEBSD */
+
+/* FreeBSD NFSv4 ACL support */
+/* #undef ARCHIVE_ACL_FREEBSD_NFS4 */
+
+/* Linux POSIX.1e ACL support via libacl */
+/* #undef ARCHIVE_ACL_LIBACL */
+
+/* Linux NFSv4 ACL support via librichacl */
+/* #undef ARCHIVE_ACL_LIBRICHACL */
+
+/* Solaris ACL support */
+/* #undef ARCHIVE_ACL_SUNOS */
+
+/* Solaris NFSv4 ACL support */
+/* #undef ARCHIVE_ACL_SUNOS_NFS4 */
+
+/* MD5 via ARCHIVE_CRYPTO_MD5_LIBC supported. */
+/* #undef ARCHIVE_CRYPTO_MD5_LIBC */
+
+/* MD5 via ARCHIVE_CRYPTO_MD5_LIBMD supported. */
+/* #undef ARCHIVE_CRYPTO_MD5_LIBMD */
+
+#ifdef __APPLE__
+/* MD5 via ARCHIVE_CRYPTO_MD5_LIBSYSTEM supported. */
+#define ARCHIVE_CRYPTO_MD5_LIBSYSTEM 1
+#endif
+
+/* MD5 via ARCHIVE_CRYPTO_MD5_NETTLE supported. */
+/* #undef ARCHIVE_CRYPTO_MD5_NETTLE */
+
+/* MD5 via ARCHIVE_CRYPTO_MD5_OPENSSL supported. */
+/* #undef ARCHIVE_CRYPTO_MD5_OPENSSL */
+
+/* MD5 via ARCHIVE_CRYPTO_MD5_WIN supported. */
+/* #undef ARCHIVE_CRYPTO_MD5_WIN */
+
+/* RMD160 via ARCHIVE_CRYPTO_RMD160_LIBC supported. */
+/* #undef ARCHIVE_CRYPTO_RMD160_LIBC */
+
+/* RMD160 via ARCHIVE_CRYPTO_RMD160_LIBMD supported. */
+/* #undef ARCHIVE_CRYPTO_RMD160_LIBMD */
+
+/* RMD160 via ARCHIVE_CRYPTO_RMD160_NETTLE supported. */
+/* #undef ARCHIVE_CRYPTO_RMD160_NETTLE */
+
+/* RMD160 via ARCHIVE_CRYPTO_RMD160_OPENSSL supported. */
+/* #undef ARCHIVE_CRYPTO_RMD160_OPENSSL */
+
+/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBC supported. */
+/* #undef ARCHIVE_CRYPTO_SHA1_LIBC */
+
+/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBMD supported. */
+/* #undef ARCHIVE_CRYPTO_SHA1_LIBMD */
+
+#ifdef __APPLE__
+/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBSYSTEM supported. */
+#define ARCHIVE_CRYPTO_SHA1_LIBSYSTEM 1
+#endif
+
+/* SHA1 via ARCHIVE_CRYPTO_SHA1_NETTLE supported. */
+/* #undef ARCHIVE_CRYPTO_SHA1_NETTLE */
+
+/* SHA1 via ARCHIVE_CRYPTO_SHA1_OPENSSL supported. */
+/* #undef ARCHIVE_CRYPTO_SHA1_OPENSSL */
+
+/* SHA1 via ARCHIVE_CRYPTO_SHA1_WIN supported. */
+/* #undef ARCHIVE_CRYPTO_SHA1_WIN */
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC supported. */
+/* #undef ARCHIVE_CRYPTO_SHA256_LIBC */
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC2 supported. */
+/* #undef ARCHIVE_CRYPTO_SHA256_LIBC2 */
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC3 supported. */
+/* #undef ARCHIVE_CRYPTO_SHA256_LIBC3 */
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBMD supported. */
+/* #undef ARCHIVE_CRYPTO_SHA256_LIBMD */
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBSYSTEM supported. */
+#ifdef __APPLE__
+#define ARCHIVE_CRYPTO_SHA256_LIBSYSTEM 1
+#endif
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_NETTLE supported. */
+/* #undef ARCHIVE_CRYPTO_SHA256_NETTLE */
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_OPENSSL supported. */
+/* #undef ARCHIVE_CRYPTO_SHA256_OPENSSL */
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_WIN supported. */
+/* #undef ARCHIVE_CRYPTO_SHA256_WIN */
+
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC supported. */
+/* #undef ARCHIVE_CRYPTO_SHA384_LIBC */
+
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC2 supported. */
+/* #undef ARCHIVE_CRYPTO_SHA384_LIBC2 */
+
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC3 supported. */
+/* #undef ARCHIVE_CRYPTO_SHA384_LIBC3 */
+
+#ifdef __APPLE__
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBSYSTEM supported. */
+#define ARCHIVE_CRYPTO_SHA384_LIBSYSTEM 1
+#endif
+
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_NETTLE supported. */
+/* #undef ARCHIVE_CRYPTO_SHA384_NETTLE */
+
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_OPENSSL supported. */
+/* #undef ARCHIVE_CRYPTO_SHA384_OPENSSL */
+
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_WIN supported. */
+/* #undef ARCHIVE_CRYPTO_SHA384_WIN */
+
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC supported. */
+/* #undef ARCHIVE_CRYPTO_SHA512_LIBC */
+
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC2 supported. */
+/* #undef ARCHIVE_CRYPTO_SHA512_LIBC2 */
+
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC3 supported. */
+/* #undef ARCHIVE_CRYPTO_SHA512_LIBC3 */
+
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBMD supported. */
+/* #undef ARCHIVE_CRYPTO_SHA512_LIBMD */
+
+#ifdef __APPLE__
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBSYSTEM supported. */
+#define ARCHIVE_CRYPTO_SHA512_LIBSYSTEM 1
+#endif
+
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_NETTLE supported. */
+/* #undef ARCHIVE_CRYPTO_SHA512_NETTLE */
+
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_OPENSSL supported. */
+/* #undef ARCHIVE_CRYPTO_SHA512_OPENSSL */
+
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_WIN supported. */
+/* #undef ARCHIVE_CRYPTO_SHA512_WIN */
+
+/* AIX xattr support */
+/* #undef ARCHIVE_XATTR_AIX */
+
+/* Darwin xattr support */
+/* #undef ARCHIVE_XATTR_DARWIN */
+
+/* FreeBSD xattr support */
+/* #undef ARCHIVE_XATTR_FREEBSD */
+
+/* Linux xattr support */
+#ifdef __linux
+#define ARCHIVE_XATTR_LINUX 1
+#endif
+
+/* Version number of bsdcat */
+#define BSDCAT_VERSION_STRING "3.3.3dev"
+
+/* Version number of bsdcpio */
+#define BSDCPIO_VERSION_STRING "3.3.3dev"
+
+/* Version number of bsdtar */
+#define BSDTAR_VERSION_STRING "3.3.3dev"
+
+/* Define to 1 if the system has the type `ace_t'. */
+/* #undef HAVE_ACE_T */
+
+/* Define to 1 if you have the `acl' function. */
+/* #undef HAVE_ACL */
+
+/* Define to 1 if the system has the type `aclent_t'. */
+/* #undef HAVE_ACLENT_T */
+
+/* Define to 1 if you have the `acl_add_flag_np' function. */
+/* #undef HAVE_ACL_ADD_FLAG_NP */
+
+/* Define to 1 if you have the `acl_add_perm' function. */
+/* #undef HAVE_ACL_ADD_PERM */
+
+/* Define to 1 if you have the `acl_clear_flags_np' function. */
+/* #undef HAVE_ACL_CLEAR_FLAGS_NP */
+
+/* Define to 1 if you have the `acl_clear_perms' function. */
+/* #undef HAVE_ACL_CLEAR_PERMS */
+
+/* Define to 1 if you have the `acl_create_entry' function. */
+#ifndef __linux
+#define HAVE_ACL_CREATE_ENTRY 1
+#endif
+/* Define to 1 if you have the `acl_delete_def_file' function. */
+/* #undef HAVE_ACL_DELETE_DEF_FILE */
+
+/* Define to 1 if the system has the type `acl_entry_t'. */
+/* #undef HAVE_ACL_ENTRY_T */
+
+/* Define to 1 if you have the `acl_free' function. */
+/* #undef HAVE_ACL_FREE */
+
+/* Define to 1 if you have the `acl_get_brand_np' function. */
+/* #undef HAVE_ACL_GET_BRAND_NP */
+
+/* Define to 1 if you have the `acl_get_entry' function. */
+/* #undef HAVE_ACL_GET_ENTRY */
+
+/* Define to 1 if you have the `acl_get_entry_type_np' function. */
+/* #undef HAVE_ACL_GET_ENTRY_TYPE_NP */
+
+/* Define to 1 if you have the `acl_get_fd' function. */
+/* #undef HAVE_ACL_GET_FD */
+
+/* Define to 1 if you have the `acl_get_fd_np' function. */
+/* #undef HAVE_ACL_GET_FD_NP */
+
+/* Define to 1 if you have the `acl_get_file' function. */
+/* #undef HAVE_ACL_GET_FILE */
+
+/* Define to 1 if you have the `acl_get_flagset_np' function. */
+/* #undef HAVE_ACL_GET_FLAGSET_NP */
+
+/* Define to 1 if you have the `acl_get_flag_np' function. */
+/* #undef HAVE_ACL_GET_FLAG_NP */
+
+/* Define to 1 if you have the `acl_get_link_np' function. */
+#define HAVE_ACL_GET_LINK_NP 1
+
+/* Define to 1 if you have the `acl_get_perm' function. */
+/* #undef HAVE_ACL_GET_PERM */
+
+/* Define to 1 if you have the `acl_get_permset' function. */
+/* #undef HAVE_ACL_GET_PERMSET */
+
+/* Define to 1 if you have the `acl_get_perm_np' function. */
+#define HAVE_ACL_GET_PERM_NP 1
+/* Define to 1 if you have the `acl_get_qualifier' function. */
+/* #undef HAVE_ACL_GET_QUALIFIER */
+
+/* Define to 1 if you have the `acl_get_tag_type' function. */
+/* #undef HAVE_ACL_GET_TAG_TYPE */
+
+/* Define to 1 if you have the `acl_init' function. */
+#define HAVE_ACL_INIT 1
+/* Define to 1 if you have the `acl_is_trivial_np' function. */
+/* #undef HAVE_ACL_IS_TRIVIAL_NP */
+
+/* Define to 1 if you have the <acl/libacl.h> header file. */
+/* #undef HAVE_ACL_LIBACL_H */
+
+/* Define to 1 if the system has the type `acl_permset_t'. */
+#define HAVE_ACL_PERMSET_T 1
+/* Define to 1 if you have the `acl_set_entry_type_np' function. */
+/* #undef HAVE_ACL_SET_ENTRY_TYPE_NP */
+
+/* Define to 1 if you have the `acl_set_fd' function. */
+#define HAVE_ACL_SET_FD 1
+
+/* Define to 1 if you have the `acl_set_fd_np' function. */
+#define HAVE_ACL_SET_FD_NP 1
+
+/* Define to 1 if you have the `acl_set_file' function. */
+#define HAVE_ACL_SET_FILE 1
+/* Define to 1 if you have the `acl_set_link_np' function. */
+/* #undef HAVE_ACL_SET_LINK_NP */
+
+/* Define to 1 if you have the `acl_set_qualifier' function. */
+/* #undef HAVE_ACL_SET_QUALIFIER */
+
+/* Define to 1 if you have the `acl_set_tag_type' function. */
+/* #undef HAVE_ACL_SET_TAG_TYPE */
+
+/* Define to 1 if the system has the type `acl_t'. */
+/* #undef HAVE_ACL_T */
+
+/* Define to 1 if the system has the type `acl_tag_t'. */
+/* #undef HAVE_ACL_TAG_T */
+
+/* Define to 1 if you have the `arc4random_buf' function. */
+#ifdef __APPLE__
+#define HAVE_ARC4RANDOM_BUF 1
+#endif
+
+/* Define to 1 if you have the <attr/xattr.h> header file. */
+/* #undef HAVE_ATTR_XATTR_H */
+
+/* Define to 1 if you have the <bcrypt.h> header file. */
+/* #undef HAVE_BCRYPT_H */
+
+/* Define to 1 if you have the <bzlib.h> header file. */
+// #define HAVE_BZLIB_H 1
+
+/* Define to 1 if you have the `chflags' function. */
+#define HAVE_CHFLAGS 1
+
+/* Define to 1 if you have the `chown' function. */
+#define HAVE_CHOWN 1
+
+/* Define to 1 if you have the `chroot' function. */
+#define HAVE_CHROOT 1
+
+/* Define to 1 if you have the <copyfile.h> header file. */
+#ifdef WIN32
+#define HAVE_COPYFILE_H 1
+#endif
+
+#ifndef WIN32
+/* Define to 1 if you have the `ctime_r' function. */
+#define HAVE_CTIME_R 1
+#endif
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#define HAVE_CTYPE_H 1
+
+/* Define to 1 if you have the `cygwin_conv_path' function. */
+/* #undef HAVE_CYGWIN_CONV_PATH */
+
+/* Define to 1 if you have the declaration of `ACE_GETACL', and to 0 if you
+   don't. */
+/* #undef HAVE_DECL_ACE_GETACL */
+
+/* Define to 1 if you have the declaration of `ACE_GETACLCNT', and to 0 if you
+   don't. */
+/* #undef HAVE_DECL_ACE_GETACLCNT */
+
+/* Define to 1 if you have the declaration of `ACE_SETACL', and to 0 if you
+   don't. */
+/* #undef HAVE_DECL_ACE_SETACL */
+
+/* Define to 1 if you have the declaration of `ACL_SYNCHRONIZE', and to 0 if
+   you don't. */
+/* #undef HAVE_DECL_ACL_SYNCHRONIZE */
+
+/* Define to 1 if you have the declaration of `ACL_TYPE_EXTENDED', and to 0 if
+   you don't. */
+/* #undef HAVE_DECL_ACL_TYPE_EXTENDED */
+
+/* Define to 1 if you have the declaration of `ACL_TYPE_NFS4', and to 0 if you
+   don't. */
+/* #undef HAVE_DECL_ACL_TYPE_NFS4 */
+
+/* Define to 1 if you have the declaration of `ACL_USER', and to 0 if you
+   don't. */
+/* #undef HAVE_DECL_ACL_USER */
+
+/* Define to 1 if you have the declaration of `EXTATTR_NAMESPACE_USER', and to
+   0 if you don't. */
+#define HAVE_DECL_EXTATTR_NAMESPACE_USER 0
+
+/* Define to 1 if you have the declaration of `GETACL', and to 0 if you don't.
+   */
+/* #undef HAVE_DECL_GETACL */
+
+/* Define to 1 if you have the declaration of `GETACLCNT', and to 0 if you
+   don't. */
+/* #undef HAVE_DECL_GETACLCNT */
+
+/* Define to 1 if you have the declaration of `INT32_MAX', and to 0 if you
+   don't. */
+#define HAVE_DECL_INT32_MAX 1
+
+/* Define to 1 if you have the declaration of `INT32_MIN', and to 0 if you
+   don't. */
+#define HAVE_DECL_INT32_MIN 1
+
+/* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you
+   don't. */
+#define HAVE_DECL_INT64_MAX 1
+
+/* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you
+   don't. */
+#define HAVE_DECL_INT64_MIN 1
+
+/* Define to 1 if you have the declaration of `INTMAX_MAX', and to 0 if you
+   don't. */
+#define HAVE_DECL_INTMAX_MAX 1
+
+/* Define to 1 if you have the declaration of `INTMAX_MIN', and to 0 if you
+   don't. */
+#define HAVE_DECL_INTMAX_MIN 1
+
+/* Define to 1 if you have the declaration of `SETACL', and to 0 if you don't.
+   */
+/* #undef HAVE_DECL_SETACL */
+
+/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you
+   don't. */
+#define HAVE_DECL_SIZE_MAX 1
+
+/* Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you
+   don't. */
+#define HAVE_DECL_SSIZE_MAX 1
+
+/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRERROR_R 1
+
+/* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you
+   don't. */
+#define HAVE_DECL_UINT32_MAX 1
+
+/* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you
+   don't. */
+#define HAVE_DECL_UINT64_MAX 1
+
+/* Define to 1 if you have the declaration of `UINTMAX_MAX', and to 0 if you
+   don't. */
+#define HAVE_DECL_UINTMAX_MAX 1
+
+/* Define to 1 if you have the declaration of `XATTR_NOFOLLOW', and to 0 if
+   you don't. */
+#define HAVE_DECL_XATTR_NOFOLLOW 0
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+   */
+#define HAVE_DIRENT_H 1
+
+/* Define to 1 if you have a dirfd function or macro */
+#define HAVE_DIRFD 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#define HAVE_DLFCN_H 1
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+/* #undef HAVE_DOPRNT */
+
+/* Define to 1 if nl_langinfo supports D_MD_ORDER */
+#ifdef WIN32
+#define HAVE_D_MD_ORDER 1
+#endif
+
+#ifdef __APPLE__
+/* A possible errno value for invalid file format errors */
+#define HAVE_EFTYPE 1
+#endif
+
+/* A possible errno value for invalid file format errors */
+#define HAVE_EILSEQ 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the <expat.h> header file. */
+/* #undef HAVE_EXPAT_H */
+
+/* Define to 1 if you have the <ext2fs/ext2_fs.h> header file. */
+/* #undef HAVE_EXT2FS_EXT2_FS_H */
+
+/* Define to 1 if you have the `extattr_get_fd' function. */
+/* #undef HAVE_EXTATTR_GET_FD */
+
+/* Define to 1 if you have the `extattr_get_file' function. */
+/* #undef HAVE_EXTATTR_GET_FILE */
+
+/* Define to 1 if you have the `extattr_get_link' function. */
+/* #undef HAVE_EXTATTR_GET_LINK */
+
+/* Define to 1 if you have the `extattr_list_fd' function. */
+/* #undef HAVE_EXTATTR_LIST_FD */
+
+/* Define to 1 if you have the `extattr_list_file' function. */
+/* #undef HAVE_EXTATTR_LIST_FILE */
+
+/* Define to 1 if you have the `extattr_list_link' function. */
+/* #undef HAVE_EXTATTR_LIST_LINK */
+
+/* Define to 1 if you have the `extattr_set_fd' function. */
+/* #undef HAVE_EXTATTR_SET_FD */
+
+/* Define to 1 if you have the `extattr_set_link' function. */
+/* #undef HAVE_EXTATTR_SET_LINK */
+
+/* Define to 1 if you have the `facl' function. */
+/* #undef HAVE_FACL */
+
+/* Define to 1 if you have the `fchdir' function. */
+#define HAVE_FCHDIR 1
+
+/* Define to 1 if you have the `fchflags' function. */
+#ifdef WIN32
+#define HAVE_FCHFLAGS 1
+#endif
+
+#ifndef WIN32
+/* Define to 1 if you have the `fchmod' function. */
+#define HAVE_FCHMOD 1
+#endif
+
+/* Define to 1 if you have the `fchown' function. */
+#define HAVE_FCHOWN 1
+
+/* Define to 1 if you have the `fcntl' function. */
+#define HAVE_FCNTL 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `fdopendir' function. */
+#ifndef WIN32
+#define HAVE_FDOPENDIR 1
+#endif
+
+/* Define to 1 if you have the `fgetea' function. */
+/* #undef HAVE_FGETEA */
+
+/* Define to 1 if you have the `fgetxattr' function. */
+#define HAVE_FGETXATTR 1
+
+/* Define to 1 if you have the `flistea' function. */
+/* #undef HAVE_FLISTEA */
+
+/* Define to 1 if you have the `flistxattr' function. */
+#define HAVE_FLISTXATTR 1
+
+/* Define to 1 if you have the `fork' function. */
+#define HAVE_FORK 1
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#define HAVE_FSEEKO 1
+
+/* Define to 1 if you have the `fsetea' function. */
+/* #undef HAVE_FSETEA */
+
+/* Define to 1 if you have the `fsetxattr' function. */
+#define HAVE_FSETXATTR 1
+
+/* Define to 1 if you have the `fstat' function. */
+#define HAVE_FSTAT 1
+
+/* Define to 1 if you have the `fstatat' function. */
+#ifndef WIN32
+#define HAVE_FSTATAT 1
+#endif
+
+/* Define to 1 if you have the `fstatfs' function. */
+#define HAVE_FSTATFS 1
+
+/* Define to 1 if you have the `fstatvfs' function. */
+#define HAVE_FSTATVFS 1
+
+/* Define to 1 if you have the `ftruncate' function. */
+#define HAVE_FTRUNCATE 1
+
+/* Define to 1 if you have the `futimens' function. */
+#ifndef WIN32
+#define HAVE_FUTIMENS 1
+#endif
+
+/* Define to 1 if you have the `futimes' function. */
+#define HAVE_FUTIMES 1
+
+/* Define to 1 if you have the `futimesat' function. */
+#ifndef WIN32
+#ifndef __APPLE__
+#define HAVE_FUTIMESAT 1
+#endif
+#endif
+
+/* Define to 1 if you have the `getea' function. */
+/* #undef HAVE_GETEA */
+
+/* Define to 1 if you have the `geteuid' function. */
+#define HAVE_GETEUID 1
+
+/* Define to 1 if you have the `getgrgid_r' function. */
+#define HAVE_GETGRGID_R 1
+
+/* Define to 1 if you have the `getgrnam_r' function. */
+#define HAVE_GETGRNAM_R 1
+
+/* Define to 1 if you have the `getpid' function. */
+#define HAVE_GETPID 1
+
+/* Define to 1 if you have the `getpwnam_r' function. */
+#define HAVE_GETPWNAM_R 1
+
+/* Define to 1 if you have the `getpwuid_r' function. */
+#define HAVE_GETPWUID_R 1
+
+/* Define to 1 if you have the `getvfsbyname' function. */
+#ifdef WIN32
+#define HAVE_GETVFSBYNAME 1
+#endif
+
+/* Define to 1 if you have the `getxattr' function. */
+#define HAVE_GETXATTR 1
+
+
+#ifndef WIN32
+/* Define to 1 if you have the `gmtime_r' function. */
+#define HAVE_GMTIME_R 1
+/* Define to 1 if you have the <grp.h> header file. */
+#define HAVE_GRP_H 1
+#endif
+
+/* Define if you have the iconv() function and it works. */
+//#ifndef WIN32
+//#define HAVE_ICONV 1
+
+/* Define to 1 if you have the <iconv.h> header file. */
+//#define HAVE_ICONV_H 1
+//#endif
+
+/* Define to 1 if the system has the type `intmax_t'. */
+#define HAVE_INTMAX_T 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <io.h> header file. */
+/* #undef HAVE_IO_H */
+
+#ifndef WIN32
+/* Define to 1 if you have the <langinfo.h> header file. */
+#define HAVE_LANGINFO_H 1
+#endif
+
+/* Define to 1 if you have the `lchflags' function. */
+#ifdef WIN32
+#define HAVE_LCHFLAGS 1
+#endif
+
+#ifndef WIN32
+/* Define to 1 if you have the `lchmod' function. */
+#define HAVE_LCHMOD 1
+#endif
+
+/* Define to 1 if you have the `lchown' function. */
+#define HAVE_LCHOWN 1
+
+/* Define to 1 if you have the `lgetea' function. */
+/* #undef HAVE_LGETEA */
+
+/* Define to 1 if you have the `lgetxattr' function. */
+#ifndef WIN32
+#define HAVE_LGETXATTR 1
+#endif
+
+/* Define to 1 if you have the `acl' library (-lacl). */
+/* #undef HAVE_LIBACL */
+
+/* Define to 1 if you have the `bz2' library (-lbz2). */
+#define HAVE_LIBBZ2 1
+
+/* Define to 1 if you have the `charset' library (-lcharset). */
+/* #undef HAVE_LIBCHARSET */
+
+/* Define to 1 if you have the `crypto' library (-lcrypto). */
+/* #undef HAVE_LIBCRYPTO */
+
+/* Define to 1 if you have the `eay32' library (-leay32). */
+/* #undef HAVE_LIBEAY32 */
+
+/* Define to 1 if you have the `eay64' library (-leay64). */
+/* #undef HAVE_LIBEAY64 */
+
+/* Define to 1 if you have the `expat' library (-lexpat). */
+/* #undef HAVE_LIBEXPAT */
+
+/* Define to 1 if you have the `lz4' library (-llz4). */
+/* #undef HAVE_LIBLZ4 */
+
+/* Define to 1 if you have the `lzma' library (-llzma). */
+//#define HAVE_LIBLZMA 1
+
+/* Define to 1 if you have the `lzo2' library (-llzo2). */
+/* #undef HAVE_LIBLZO2 */
+
+/* Define to 1 if you have the `md' library (-lmd). */
+/* #undef HAVE_LIBMD */
+
+/* Define to 1 if you have the `nettle' library (-lnettle). */
+/* #undef HAVE_LIBNETTLE */
+
+/* Define to 1 if you have the `pcre' library (-lpcre). */
+/* #undef HAVE_LIBPCRE */
+
+/* Define to 1 if you have the `pcreposix' library (-lpcreposix). */
+/* #undef HAVE_LIBPCREPOSIX */
+
+/* Define to 1 if you have the `regex' library (-lregex). */
+/* #undef HAVE_LIBREGEX */
+
+/* Define to 1 if you have the `richacl' library (-lrichacl). */
+/* #undef HAVE_LIBRICHACL */
+
+/* Define to 1 if you have the `xml2' library (-lxml2). */
+/* #undef HAVE_LIBXML2 */
+
+/* Define to 1 if you have the <libxml/xmlreader.h> header file. */
+#define HAVE_LIBXML_XMLREADER_H 1
+
+/* Define to 1 if you have the <libxml/xmlwriter.h> header file. */
+#define HAVE_LIBXML_XMLWRITER_H 1
+
+/* Define to 1 if you have the `z' library (-lz). */
+#define HAVE_LIBZ 1
+/* Define to 1 if you have the `zstd' library (-lzstd). */
+#define HAVE_LIBZSTD 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the `link' function. */
+#define HAVE_LINK 1
+
+#ifdef __linux
+/* Define to 1 if you have the <linux/fiemap.h> header file. */
+#define HAVE_LINUX_FIEMAP_H 1
+
+/* Define to 1 if you have the <linux/fs.h> header file. */
+#define HAVE_LINUX_FS_H 1
+
+/* Define to 1 if you have the <linux/magic.h> header file. */
+#define HAVE_LINUX_MAGIC_H 1
+
+/* Define to 1 if you have the <linux/types.h> header file. */
+#define HAVE_LINUX_TYPES_H 1
+#endif
+/* Define to 1 if you have the `listea' function. */
+/* #undef HAVE_LISTEA */
+
+/* Define to 1 if you have the `listxattr' function. */
+#define HAVE_LISTXATTR 1
+
+/* Define to 1 if you have the `llistea' function. */
+/* #undef HAVE_LLISTEA */
+
+/* Define to 1 if you have the `llistxattr' function. */
+#ifdef __linux
+#define HAVE_LLISTXATTR 1
+#endif
+#ifdef __APPLE__
+/* Define to 1 if you have the <localcharset.h> header file. */
+#define HAVE_LOCALCHARSET_H 1
+
+/* Define to 1 if you have the `locale_charset' function. */
+#define HAVE_LOCALE_CHARSET 1
+#endif
+
+/* Define to 1 if you have the <locale.h> header file. */
+#define HAVE_LOCALE_H 1
+
+#ifndef WIN32
+/* Define to 1 if you have the `localtime_r' function. */
+#define HAVE_LOCALTIME_R 1
+#endif
+
+/* Define to 1 if the system has the type `long long int'. */
+#define HAVE_LONG_LONG_INT 1
+
+/* Define to 1 if you have the `lsetea' function. */
+/* #undef HAVE_LSETEA */
+
+/* Define to 1 if you have the `lsetxattr' function. */
+#ifdef __linux
+#define HAVE_LSETXATTR 1
+#endif
+
+/* Define to 1 if you have the `lstat' function. */
+#define HAVE_LSTAT 1
+
+/* Define to 1 if `lstat' has the bug that it succeeds when given the
+   zero-length file name argument. */
+/* #undef HAVE_LSTAT_EMPTY_STRING_BUG */
+
+/* Define to 1 if you have the `lutimes' function. */
+#ifdef __linux
+#define HAVE_LUTIMES 1
+#endif
+
+/* Define to 1 if you have the <lz4hc.h> header file. */
+/* #undef HAVE_LZ4HC_H */
+
+/* Define to 1 if you have the <lz4.h> header file. */
+/* #undef HAVE_LZ4_H */
+
+/* Define to 1 if you have the <lzma.h> header file. */
+//#define HAVE_LZMA_H 1
+/* Define to 1 if you have the `lzma_stream_encoder_mt' function. */
+/* #undef HAVE_LZMA_STREAM_ENCODER_MT */
+
+/* Define to 1 if you have the <lzo/lzo1x.h> header file. */
+/* #undef HAVE_LZO_LZO1X_H */
+
+/* Define to 1 if you have the <lzo/lzoconf.h> header file. */
+/* #undef HAVE_LZO_LZOCONF_H */
+
+/* Define to 1 if you have the `mbrtowc' function. */
+#define HAVE_MBRTOWC 1
+
+/* Define to 1 if you have the `mbr_gid_to_uuid' function. */
+/* #undef HAVE_MBR_GID_TO_UUID */
+
+/* Define to 1 if you have the `mbr_uid_to_uuid' function. */
+/* #undef HAVE_MBR_UID_TO_UUID */
+
+/* Define to 1 if you have the `mbr_uuid_to_id' function. */
+/* #undef HAVE_MBR_UUID_TO_ID */
+
+/* Define to 1 if you have the <md5.h> header file. */
+/* #undef HAVE_MD5_H */
+
+/* Define to 1 if you have the <membership.h> header file. */
+/* #undef HAVE_MEMBERSHIP_H */
+
+/* Define to 1 if you have the `memmove' function. */
+#define HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `memset' function. */
+#define HAVE_MEMSET 1
+
+/* Define to 1 if you have the `mkdir' function. */
+#define HAVE_MKDIR 1
+
+/* Define to 1 if you have the `mkfifo' function. */
+#define HAVE_MKFIFO 1
+
+/* Define to 1 if you have the `mknod' function. */
+#define HAVE_MKNOD 1
+
+/* Define to 1 if you have the `mkstemp' function. */
+#define HAVE_MKSTEMP 1
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+/* #undef HAVE_NDIR_H */
+
+/* Define to 1 if you have the <nettle/aes.h> header file. */
+/* #undef HAVE_NETTLE_AES_H */
+
+/* Define to 1 if you have the <nettle/hmac.h> header file. */
+/* #undef HAVE_NETTLE_HMAC_H */
+
+/* Define to 1 if you have the <nettle/md5.h> header file. */
+/* #undef HAVE_NETTLE_MD5_H */
+
+/* Define to 1 if you have the <nettle/pbkdf2.h> header file. */
+/* #undef HAVE_NETTLE_PBKDF2_H */
+
+/* Define to 1 if you have the <nettle/ripemd160.h> header file. */
+/* #undef HAVE_NETTLE_RIPEMD160_H */
+
+/* Define to 1 if you have the <nettle/sha.h> header file. */
+/* #undef HAVE_NETTLE_SHA_H */
+
+#ifndef WIN32
+/* Define to 1 if you have the `nl_langinfo' function. */
+#define HAVE_NL_LANGINFO 1
+#endif
+
+/* Define to 1 if you have the `openat' function. */
+#ifdef __linux
+#define HAVE_OPENAT 1
+#endif
+
+/* Define to 1 if you have the <openssl/evp.h> header file. */
+/* #undef HAVE_OPENSSL_EVP_H */
+
+/* Define to 1 if you have the <paths.h> header file. */
+#define HAVE_PATHS_H 1
+
+/* Define to 1 if you have the <pcreposix.h> header file. */
+/* #undef HAVE_PCREPOSIX_H */
+
+/* Define to 1 if you have the `pipe' function. */
+#define HAVE_PIPE 1
+
+/* Define to 1 if you have the `PKCS5_PBKDF2_HMAC_SHA1' function. */
+/* #undef HAVE_PKCS5_PBKDF2_HMAC_SHA1 */
+
+/* Define to 1 if you have the `poll' function. */
+#define HAVE_POLL 1
+
+#ifndef WIN32
+/* Define to 1 if you have the <poll.h> header file. */
+#define HAVE_POLL_H 1
+#endif
+
+/* Define to 1 if you have the `posix_spawnp' function. */
+#define HAVE_POSIX_SPAWNP 1
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#ifndef WIN32
+#define HAVE_PTHREAD_H 1
+#endif
+
+#ifndef WIN32
+/* Define to 1 if you have the <pwd.h> header file. */
+#define HAVE_PWD_H 1
+#endif
+
+/* Define to 1 if you have a POSIX compatible readdir_r */
+#define HAVE_READDIR_R 1
+
+/* Define to 1 if you have the `readlink' function. */
+#define HAVE_READLINK 1
+
+/* Define to 1 if you have the `readlinkat' function. */
+#ifdef __linux
+#define HAVE_READLINKAT 1
+#endif
+
+/* Define to 1 if you have the `readpassphrase' function. */
+/* #undef HAVE_READPASSPHRASE */
+
+/* Define to 1 if you have the <readpassphrase.h> header file. */
+/* #undef HAVE_READPASSPHRASE_H */
+
+/* Define to 1 if you have the <regex.h> header file. */
+#ifdef __linux
+#define HAVE_REGEX_H 1
+#endif
+
+/* Define to 1 if you have the `richacl_alloc' function. */
+/* #undef HAVE_RICHACL_ALLOC */
+
+/* Define to 1 if you have the `richacl_equiv_mode' function. */
+/* #undef HAVE_RICHACL_EQUIV_MODE */
+
+/* Define to 1 if you have the `richacl_free' function. */
+/* #undef HAVE_RICHACL_FREE */
+
+/* Define to 1 if you have the `richacl_get_fd' function. */
+/* #undef HAVE_RICHACL_GET_FD */
+
+/* Define to 1 if you have the `richacl_get_file' function. */
+/* #undef HAVE_RICHACL_GET_FILE */
+
+/* Define to 1 if you have the `richacl_set_fd' function. */
+/* #undef HAVE_RICHACL_SET_FD */
+
+/* Define to 1 if you have the `richacl_set_file' function. */
+/* #undef HAVE_RICHACL_SET_FILE */
+
+/* Define to 1 if you have the <ripemd.h> header file. */
+/* #undef HAVE_RIPEMD_H */
+
+/* Define to 1 if you have the `select' function. */
+#define HAVE_SELECT 1
+
+/* Define to 1 if you have the `setenv' function. */
+#define HAVE_SETENV 1
+
+/* Define to 1 if you have the `setlocale' function. */
+#define HAVE_SETLOCALE 1
+
+/* Define to 1 if you have the `setxattr' function. */
+/* #undef HAVE_SETXATTR */
+
+/* Define to 1 if you have the <sha256.h> header file. */
+/* #undef HAVE_SHA256_H */
+
+/* Define to 1 if you have the <sha512.h> header file. */
+/* #undef HAVE_SHA512_H */
+
+/* Define to 1 if you have the <sha.h> header file. */
+/* #undef HAVE_SHA_H */
+
+/* Define to 1 if you have the `sigaction' function. */
+#define HAVE_SIGACTION 1
+
+/* Define to 1 if you have the <signal.h> header file. */
+#define HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have the <spawn.h> header file. */
+#define HAVE_SPAWN_H 1
+
+/* Define to 1 if you have the `statfs' function. */
+#define HAVE_STATFS 1
+
+/* Define to 1 if you have the `statvfs' function. */
+#define HAVE_STATVFS 1
+
+/* Define to 1 if `stat' has the bug that it succeeds when given the
+   zero-length file name argument. */
+/* #undef HAVE_STAT_EMPTY_STRING_BUG */
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#define HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strchr' function. */
+#define HAVE_STRCHR 1
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the `strerror_r' function. */
+#define HAVE_STRERROR_R 1
+
+/* Define to 1 if you have the `strftime' function. */
+#define HAVE_STRFTIME 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strncpy_s' function. */
+/* #undef HAVE_STRNCPY_S */
+
+/* Define to 1 if you have the `strrchr' function. */
+#define HAVE_STRRCHR 1
+
+/* Define to 1 if the system has the type `struct richace'. */
+/* #undef HAVE_STRUCT_RICHACE */
+
+/* Define to 1 if the system has the type `struct richacl'. */
+/* #undef HAVE_STRUCT_RICHACL */
+
+/* Define to 1 if `f_namemax' is a member of `struct statfs'. */
+/* #undef HAVE_STRUCT_STATFS_F_NAMEMAX */
+
+/* Define to 1 if `f_iosize' is a member of `struct statvfs'. */
+/* #undef HAVE_STRUCT_STATVFS_F_IOSIZE */
+
+/* Define to 1 if `st_birthtime' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIME */
+
+/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC */
+
+/* Define to 1 if `st_blksize' is a member of `struct stat'. */
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+
+/* Define to 1 if `st_flags' is a member of `struct stat'. */
+#ifndef __linux
+#define HAVE_STRUCT_STAT_ST_FLAGS 1
+#endif
+
+#ifdef __APPLE__
+/* Define to 1 if `st_mtimespec.tv_nsec' is a member of `struct stat'. */
+#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1
+#endif
+
+/* Define to 1 if `st_mtime_n' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_MTIME_N */
+
+/* Define to 1 if `st_mtime_usec' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_MTIME_USEC */
+
+/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */
+#ifdef __linux
+#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
+#endif
+/* Define to 1 if `st_umtime' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_UMTIME */
+
+#ifndef WIN32
+/* Define to 1 if `tm_gmtoff' is a member of `struct tm'. */
+#define HAVE_STRUCT_TM_TM_GMTOFF 1
+#endif
+
+/* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */
+/* #undef HAVE_STRUCT_TM___TM_GMTOFF */
+
+/* Define to 1 if the system has the type `struct vfsconf'. */
+/* #undef HAVE_STRUCT_VFSCONF */
+
+/* Define to 1 if the system has the type `struct xvfsconf'. */
+/* #undef HAVE_STRUCT_XVFSCONF */
+
+#ifndef WIN32
+/* Define to 1 if you have the `symlink' function. */
+#define HAVE_SYMLINK 1
+
+/* Define to 1 if you have the <sys/acl.h> header file. */
+#ifndef __linux
+#define HAVE_SYS_ACL_H 1
+#endif
+
+/* Define to 1 if you have the <sys/cdefs.h> header file. */
+#define HAVE_SYS_CDEFS_H 1
+#endif
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+   */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define to 1 if you have the <sys/ea.h> header file. */
+/* #undef HAVE_SYS_EA_H */
+
+/* Define to 1 if you have the <sys/extattr.h> header file. */
+/* #undef HAVE_SYS_EXTATTR_H */
+
+#ifndef WIN32
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#define HAVE_SYS_IOCTL_H 1
+#endif
+
+/* Define to 1 if you have the <sys/mkdev.h> header file. */
+/* #undef HAVE_SYS_MKDEV_H */
+
+/* Define to 1 if you have the <sys/mount.h> header file. */
+#define HAVE_SYS_MOUNT_H 1
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+   */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/poll.h> header file. */
+#define HAVE_SYS_POLL_H 1
+
+/* Define to 1 if you have the <sys/richacl.h> header file. */
+/* #undef HAVE_SYS_RICHACL_H */
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#define HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/statfs.h> header file. */
+#ifdef __linux
+#define HAVE_SYS_STATFS_H 1
+#endif
+
+/* Define to 1 if you have the <sys/statvfs.h> header file. */
+#define HAVE_SYS_STATVFS_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#define HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/utime.h> header file. */
+/* #undef HAVE_SYS_UTIME_H */
+
+#ifndef WIN32
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#define HAVE_SYS_UTSNAME_H 1
+
+/* Define to 1 if you have the <sys/vfs.h> header file. */
+#ifdef __linux
+#define HAVE_SYS_VFS_H 1
+#endif
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#define HAVE_SYS_WAIT_H 1
+#endif
+
+/* Define to 1 if you have the <sys/xattr.h> header file. */
+#define HAVE_SYS_XATTR_H 1
+
+#ifndef WIN32
+/* Define to 1 if you have the `timegm' function. */
+#define HAVE_TIMEGM 1
+#endif
+
+/* Define to 1 if you have the <time.h> header file. */
+#define HAVE_TIME_H 1
+
+/* Define to 1 if you have the `tzset' function. */
+#define HAVE_TZSET 1
+
+/* Define to 1 if the system has the type `uintmax_t'. */
+#define HAVE_UINTMAX_T 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `unsetenv' function. */
+#define HAVE_UNSETENV 1
+
+/* Define to 1 if the system has the type `unsigned long long'. */
+#define HAVE_UNSIGNED_LONG_LONG 1
+
+/* Define to 1 if the system has the type `unsigned long long int'. */
+#define HAVE_UNSIGNED_LONG_LONG_INT 1
+
+/* Define to 1 if you have the `utime' function. */
+#define HAVE_UTIME 1
+
+/* Define to 1 if you have the `utimensat' function. */
+#ifdef __linux
+#define HAVE_UTIMENSAT 1
+#endif
+
+/* Define to 1 if you have the `utimes' function. */
+#define HAVE_UTIMES 1
+
+/* Define to 1 if you have the <utime.h> header file. */
+#define HAVE_UTIME_H 1
+
+/* Define to 1 if you have the `vfork' function. */
+#define HAVE_VFORK 1
+
+/* Define to 1 if you have the `vprintf' function. */
+#define HAVE_VPRINTF 1
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#define HAVE_WCHAR_H 1
+
+/* Define to 1 if the system has the type `wchar_t'. */
+#define HAVE_WCHAR_T 1
+
+/* Define to 1 if you have the `wcrtomb' function. */
+#define HAVE_WCRTOMB 1
+
+/* Define to 1 if you have the `wcscmp' function. */
+#define HAVE_WCSCMP 1
+
+/* Define to 1 if you have the `wcscpy' function. */
+#define HAVE_WCSCPY 1
+
+/* Define to 1 if you have the `wcslen' function. */
+#define HAVE_WCSLEN 1
+
+/* Define to 1 if you have the `wctomb' function. */
+#define HAVE_WCTOMB 1
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#define HAVE_WCTYPE_H 1
+
+#ifdef WIN32
+/* Define to 1 if you have the <wincrypt.h> header file. */
+#define HAVE_WINCRYPT_H 1
+
+/* Define to 1 if you have the <windows.h> header file. */
+#define HAVE_WINDOWS_H 1
+#endif
+
+/* Define to 1 if you have the <winioctl.h> header file. */
+/* #undef HAVE_WINIOCTL_H */
+
+/* Define to 1 if you have the `wmemcmp' function. */
+#define HAVE_WMEMCMP 1
+
+/* Define to 1 if you have the `wmemcpy' function. */
+#define HAVE_WMEMCPY 1
+
+/* Define to 1 if you have the `wmemmove' function. */
+#define HAVE_WMEMMOVE 1
+
+/* Define to 1 if you have a working EXT2_IOC_GETFLAGS */
+/* #undef HAVE_WORKING_EXT2_IOC_GETFLAGS */
+
+/* Define to 1 if you have a working FS_IOC_GETFLAGS */
+#ifdef __linux
+#define HAVE_WORKING_FS_IOC_GETFLAGS 1
+#endif
+
+/* Define to 1 if you have the <zlib.h> header file. */
+//#define HAVE_ZLIB_H 1
+/* Define to 1 if you have the <zstd.h> header file. */
+//#define HAVE_ZSTD_H 1
+
+/* Define to 1 if you have the `_ctime64_s' function. */
+/* #undef HAVE__CTIME64_S */
+
+/* Define to 1 if you have the `_fseeki64' function. */
+/* #undef HAVE__FSEEKI64 */
+
+/* Define to 1 if you have the `_get_timezone' function. */
+/* #undef HAVE__GET_TIMEZONE */
+
+/* Define to 1 if you have the `_localtime64_s' function. */
+/* #undef HAVE__LOCALTIME64_S */
+
+/* Define to 1 if you have the `_mkgmtime64' function. */
+/* #undef HAVE__MKGMTIME64 */
+
+/* Define as const if the declaration of iconv() needs const. */
+#define ICONV_CONST 
+
+/* Version number of libarchive as a single integer */
+#define LIBARCHIVE_VERSION_NUMBER "3003003"
+
+/* Version number of libarchive */
+#define LIBARCHIVE_VERSION_STRING "3.3.3dev"
+
+/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
+   slash. */
+#ifdef __linux
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+#endif
+
+/* Define to the sub-directory where libtool stores uninstalled libraries. */
+#define LT_OBJDIR ".libs/"
+
+/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
+   */
+/* #undef MAJOR_IN_MKDEV */
+
+/* Define to 1 if `major', `minor', and `makedev' are declared in
+   <sysmacros.h>. */
+/* #undef MAJOR_IN_SYSMACROS */
+
+/* Define to '0x05020000' for Windows Server 2003 APIs. */
+/* #undef NTDDI_VERSION */
+
+/* Name of package */
+#define PACKAGE "libarchive"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "[email protected]"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "libarchive"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "libarchive 3.3.3dev"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libarchive"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "3.3.3dev"
+
+/* Define to 1 if PCRE_STATIC needs to be defined. */
+/* #undef PCRE_STATIC */
+
+/* The size of `wchar_t', as computed by sizeof. */
+#define SIZEOF_WCHAR_T 4
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if strerror_r returns char *. */
+#ifdef __linux
+#define STRERROR_R_CHAR_P 1
+#endif
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+
+/* Version number of package */
+#define VERSION "3.3.3dev"
+
+/* Define to '0x0502' for Windows Server 2003 APIs. */
+#ifdef WIN32
+#define WINVER 0x0502
+#endif
+
+/* Enable large inode numbers on Mac OS X 10.5.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+/* BaH - Not with BlitzMax...  pub.stdc causes problems linking the correct binaries
+/*# define _DARWIN_USE_64_BIT_INODE 1*/
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+/* #undef _LARGEFILE_SOURCE */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+/* #undef _UINT32_T */
+
+/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+/* #undef _UINT64_T */
+
+/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
+   <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+   #define below would cause a syntax error. */
+/* #undef _UINT8_T */
+
+#ifdef WIN32
+/* Define to '0x0502' for Windows Server 2003 APIs. */
+#define _WIN32_WINNT 0x0502
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to match typeof st_gid field of struct stat if <sys/types.h> doesn't
+   define. */
+#define gid_t short
+
+/* Define to `unsigned long' if <sys/types.h> does not define. */
+#define id_t unsigned long
+#endif
+
+/* Define to the type of a signed integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef int16_t */
+
+/* Define to the type of a signed integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef int32_t */
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef int64_t */
+
+/* Define to the widest signed integer type if <stdint.h> and <inttypes.h> do
+   not define. */
+/* #undef intmax_t */
+
+/* Define to `int' if <sys/types.h> does not define. */
+/* #undef mode_t */
+
+/* Define to `long long' if <sys/types.h> does not define. */
+/* #undef off_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+#ifdef WIN32
+/* Define to match typeof st_uid field of struct stat if <sys/types.h> doesn't
+   define. */
+#define uid_t short
+#endif
+
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef uint16_t */
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef uint32_t */
+
+/* Define to the type of an unsigned integer type of width exactly 64 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef uint64_t */
+
+/* Define to the type of an unsigned integer type of width exactly 8 bits if
+   such a type exists and the standard includes do not define it. */
+/* #undef uint8_t */
+
+/* Define to the widest unsigned integer type if <stdint.h> and <inttypes.h>
+   do not define. */
+/* #undef uintmax_t */
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef uintptr_t */

+ 46 - 0
core.mod/libarchive/.cirrus.yml

@@ -0,0 +1,46 @@
+env:
+  CIRRUS_CLONE_DEPTH: 1
+  ARCH: amd64
+
+FreeBSD_task:
+  matrix:
+    env:
+      BS: autotools
+    env:
+      BS: cmake
+  matrix:
+    freebsd_instance:
+      image_family: freebsd-13-0
+    freebsd_instance:
+      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:
+  - env SKIP_TEST_RESTORE_ATIME=1 ./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

+ 18 - 0
core.mod/libarchive/.editorconfig

@@ -0,0 +1,18 @@
+# To use this config on you editor, follow the instructions at:
+# http://editorconfig.org
+
+root = true
+
+[*]
+charset = utf-8
+indent_style = tab
+insert_final_newline = true
+trim_trailing_whitespace = true
+
+[*.sh]
+indent_style = space
+indent_size = 4
+
+[CMakeLists.txt]
+indent_style = space
+indent_size = 2

+ 2073 - 0
core.mod/libarchive/CMakeLists.txt

@@ -0,0 +1,2073 @@
+#
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR)
+if(POLICY CMP0065)
+  cmake_policy(SET CMP0065 NEW) #3.4 don't use `-rdynamic` with executables
+endif()
+if(POLICY CMP0074)
+  cmake_policy(SET CMP0074 NEW) #3.12.0 `find_package()`` uses ``<PackageName>_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)
+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}")
+
+# Enable 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$" OR
+    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")
+  # Ideally this will be a compile/link time check, yet there's no obvious way
+  # how considering how old our minimum required cmake version is. The official
+  # cmake.org side does not host the manual pages even. Normally we can use
+  # either of the following two, yet neither is supported as of 3.0.2
+  # - check_linker_flag - does not exist
+  # - try_compile - does not support linker flags
+  #
+  # The CI fails with this on MacOS
+  IF(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
+    # Place the functions and data into separate sections, allowing the linker
+    # to garbage collect the unused ones.
+    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
+    SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
+    SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--gc-sections")
+    # Printing the discarded section is "too much", so enable on demand.
+    #SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -Wl,--print-gc-sections")
+    #SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} -Wl,--print-gc-sections")
+  ENDIF(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR
+       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 available 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=<your-GnuWin32-path> <path-to-source>
+  #
+  # 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 <sys/types.h> /* for off_t */
+  #-#  include <unistd.h>    /* for SEEK_* and off_t */
+  #+#  include <stdio.h>    /* for SEEK_* and off_t */
+  # #  ifdef VMS
+  # #    include <unixio.h>   /* 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 <zlib.h>\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 <zlib.h>\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 <bzlib.h>\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 <lzma.h>\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_decompressStream HAVE_LIBZSTD)
+  CHECK_FUNCTION_EXISTS(ZSTD_compressStream HAVE_LIBZSTD_COMPRESSOR)
+  #
+  # 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 <sys/ioctl.h>
+#include <ext2fs/ext2_fs.h>
+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 <sys/ioctl.h>
+#include <linux/fs.h>
+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 <windows.h>
+#include <wincrypt.h>
+
+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 warning 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 <stdlib.h>
+       #include <iconv.h>
+       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 <iconv.h>\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 <localcharset.h>\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 <stddef.h>\n#include <libxml/xmlreader.h>\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 <stddef.h>\n#include <regex.h>\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 <pcreposix.h>\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 <pcreposix.h>\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 <pcreposix.h>\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(linkat HAVE_LINKAT)
+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 <sys/types.h>\n#include <sys/mount.h>\nint main(void) { struct vfsconf v; return sizeof(v);}"
+  HAVE_STRUCT_VFSCONF)
+
+CHECK_C_SOURCE_COMPILES(
+  "#include <sys/types.h>\n#include <sys/mount.h>\nint main(void) { struct xvfsconf v; return sizeof(v);}"
+  HAVE_STRUCT_XVFSCONF)
+
+CHECK_C_SOURCE_COMPILES(
+  "#include <sys/types.h>\n#include <sys/mount.h>\nint main(void) { struct statfs s; return sizeof(s);}"
+  HAVE_STRUCT_STATFS)
+
+# Make sure we have the POSIX version of readdir_r, not the
+# older 2-argument version.
+CHECK_C_SOURCE_COMPILES(
+  "#include <dirent.h>\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 <dirent.h>\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 <fcntl.h>\n#include <unistd.h>\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 <sys/mkdev.h>\nint main() { return major(256); }"
+  MAJOR_IN_MKDEV)
+CHECK_C_SOURCE_COMPILES(
+  "#include <sys/sysmacros.h>\nint main() { return major(256); }"
+  MAJOR_IN_SYSMACROS)
+
+IF(ENABLE_LZMA)
+CHECK_C_SOURCE_COMPILES(
+  "#include <lzma.h>\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)
+
+IF(HAVE_STRUCT_STATFS)
+# 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 f_iosize in struct statfs
+CHECK_STRUCT_HAS_MEMBER("struct statfs" f_iosize
+    "sys/param.h;sys/mount.h" HAVE_STRUCT_STATFS_F_IOSIZE)
+ENDIF(HAVE_STRUCT_STATFS)
+
+# 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" SIZEOF_SHORT)
+CHECK_TYPE_SIZE("int" SIZEOF_INT)
+CHECK_TYPE_SIZE("long" SIZEOF_LONG)
+CHECK_TYPE_SIZE("long long"     SIZEOF_LONG_LONG)
+
+CHECK_TYPE_SIZE("unsigned short" SIZEOF_UNSIGNED_SHORT)
+CHECK_TYPE_SIZE("unsigned" SIZEOF_UNSIGNED)
+CHECK_TYPE_SIZE("unsigned long" SIZEOF_UNSIGNED_LONG)
+CHECK_TYPE_SIZE("unsigned long long" SIZEOF_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 <sys/types.h>
+#include <sys/acl.h>
+int main(void) { return ACL_TYPE_EXTENDED; }" HAVE_DECL_ACL_TYPE_EXTENDED)
+      CHECK_C_SOURCE_COMPILES("#include <sys/types.h>
+#include <sys/acl.h>
+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)

+ 98 - 0
core.mod/libarchive/CONTRIBUTING.md

@@ -0,0 +1,98 @@
+Thank you for helping us improve libarchive.
+The following guidelines will help ensure your contribution gets prompt attention.
+
+# Bugs and other Issues
+
+If you encounter any problems with libarchive,
+[please file an issue on our issue tracker](https://github.com/libarchive/libarchive/issues).
+
+All bug reports should include the following information.  You can copy the text below directly into the issue tracker to get started:
+
+```
+Basic Information
+  Version of libarchive:
+  How you obtained it:  (build from source, pre-packaged binary, etc)
+  Operating system and version:
+  What compiler and/or IDE you are using (include version):
+
+If you are using a pre-packaged binary
+  Exact package name and version:
+  Repository you obtained it from:
+
+Description of the problem you are seeing:
+  What did you do?
+  What did you expect to happen?
+  What actually happened?
+  What log files or error messages were produced?
+
+How the libarchive developers can reproduce your problem:
+  What other software was involved?
+  What other files were involved?
+  How can we obtain any of the above?
+```
+
+Depending on the specific type of issue, other information will be helpful:
+
+## Test Failures
+
+If you see any test failures, please include the information above and also:
+
+* Names of the tests that failed.
+
+* Look for the .log files in the /tmp/libarchive_test_*date-and-time* directories.  (On Mac OS, look in $TMPDIR which is different than /tmp.)
+
+Please paste the .log files you will find there directly into your report.
+
+
+## Problems using libarchive in a program
+
+If you are trying to write a program using libarchive, please include the information above and also:
+
+* It will help us if we can actually run the program.  This is easiest if you can provide source to a short program that illustrates your problem.
+
+* If you have a sufficiently short program that shows the problem, you can either paste it into the report or [put it into a gist](https://gist.github.com).
+
+
+## Libarchive produced incorrect output
+
+Please tell us what program you ran, any command-line arguments you provided, and details of the input files (`ls -l` output is helpful here).  If the problem involved a command-line program, please copy the full terminal text into the report, including the command line and any error messages.
+
+Please try to make the output file available to us.  Unless it is very large, you can upload it into a fresh github repository and provide a link in your issue report.
+
+
+## Libarchive could not read a particular input file
+
+Note: If you can provide a **very small** input file that reproduces the problem, we can add that to our test suite.  This will ensure that the bug does not reappear in the future.
+
+A link to the relevant file is usually sufficient.
+
+If you cannot provide the input file or a link to the file, please let us know if there is some other way to obtain it.
+
+
+## Documentation improvements
+
+We are always interested in improving the libarchive documentation.  Please tell us about any errors you find, including:
+
+* Typos or errors in the manpages provided with libarchive source.
+
+* Mistakes in the [libarchive Wiki](https://github.com/libarchive/libarchive/wiki)
+
+* Problems with the PDF or Wiki files that are automatically generated from the manpages.
+
+
+# Code Submissions
+
+We welcome all code submissions.  But of course, some code submissions are easier for us to respond to than others. The best code submissions:
+
+* Address a single issue.  There have been many cases where a simple fix to an obvious problem did not get handled for months because the patch that was provided also included an unrelated change affecting an especially complex area of the code.
+
+* Follow existing libarchive code style and conventions.  Libarchive generally follows [BSD KNF](https://www.freebsd.org/cgi/man.cgi?query=style&sektion=9) for formatting code.
+
+* Do not make unnecessary changes to existing whitespace, capitalization, or spelling.
+
+* Include detailed instructions for reproducing the problem you're fixing.  We do try to verify that a submission actually fixes a real problem.  If we can't reproduce the problem, it will take us longer to evaluate the fix.  For this reason, we encourage you to file an issue report first with details on reproducing the problem, then refer to that issue in your pull request.
+
+* Includes a test case.  The libarchive Wiki has [detailed documentation for adding new test cases](https://github.com/libarchive/libarchive/wiki/LibarchiveAddingTest).
+
+* Are provided via Github pull requests.  We welcome patches in almost any format, but github's pull request management makes it significantly easier for us to evaluate and test changes.
+

+ 65 - 0
core.mod/libarchive/COPYING

@@ -0,0 +1,65 @@
+The libarchive distribution as a whole is Copyright by Tim Kientzle
+and is subject to the copyright notice reproduced at the bottom of
+this file.
+
+Each individual file in this distribution should have a clear
+copyright/licensing statement at the beginning of the file.  If any do
+not, please let me know and I will rectify it.  The following is
+intended to summarize the copyright status of the individual files;
+the actual statements in the files are controlling.
+
+* Except as listed below, all C sources (including .c and .h files)
+  and documentation files are subject to the copyright notice reproduced
+  at the bottom of this file.
+
+* The following source files are also subject in whole or in part to
+  a 3-clause UC Regents copyright; please read the individual source
+  files for details:
+   libarchive/archive_read_support_filter_compress.c
+   libarchive/archive_write_add_filter_compress.c
+   libarchive/mtree.5
+
+* The following source files are in the public domain:
+   libarchive/archive_getdate.c
+
+* The following source files are triple-licensed with the ability to choose
+  from CC0 1.0 Universal, OpenSSL or Apache 2.0 licenses:
+   libarchive/archive_blake2.h
+   libarchive/archive_blake2_impl.h
+   libarchive/archive_blake2s_ref.c
+   libarchive/archive_blake2sp_ref.c
+
+* The build files---including Makefiles, configure scripts,
+  and auxiliary scripts used as part of the compile process---have
+  widely varying licensing terms.  Please check individual files before
+  distributing them to see if those restrictions apply to you.
+
+I intend for all new source code to use the license below and hope over
+time to replace code with other licenses with new implementations that
+do use the license below.  The varying licensing of the build scripts
+seems to be an unavoidable mess.
+
+
+Copyright (c) 2003-2018 <author(s)>
+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
+   in this position and unchanged.
+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.

+ 11 - 0
core.mod/libarchive/CTestConfig.cmake

@@ -0,0 +1,11 @@
+# TODO: This file should be moved into the build/cmake directory...
+
+# The libarchive CDash page appears at
+#   http://my.cdash.org/index.php?project=libarchive
+set(CTEST_PROJECT_NAME "libarchive")
+set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC")
+
+set(CTEST_DROP_METHOD "http")
+set(CTEST_DROP_SITE "my.cdash.org")
+set(CTEST_DROP_LOCATION "/submit.php?project=libarchive")
+set(CTEST_DROP_SITE_CDASH TRUE)

+ 35 - 0
core.mod/libarchive/INSTALL

@@ -0,0 +1,35 @@
+More complete build documentation is available on the libarchive
+Wiki:  https://github.com/libarchive/libarchive/wiki
+
+On most Unix-like systems, you should be able to install libarchive,
+bsdtar, and bsdcpio using the following common steps:
+    ./configure
+    make
+    make install
+
+If you need to customize the target directories or otherwise adjust
+the build setting, use
+    ./configure --help
+to list the configure options.
+
+If you are developing libarchive and need to update the
+configure script and other build files:
+    /bin/sh build/autogen.sh
+
+To create a distribution, please use the 'distcheck' target:
+    /bin/sh build/autogen.sh && ./configure && make distcheck
+
+On Unix-like and non-Unix-like systems, use the "cmake" utility (available from
+http://cmake.org/) to generate suitable build files for your platform.
+Cmake requires the name of the directory containing CmakeLists.txt and
+the "generator" to use for your build environment.  For example, to
+build with Xcode on Mac OS, you can use the following command:
+    cmake -G "Xcode" ~/libarchive-download-dir/
+The result will be appropriate makefiles, solution files, or project
+files that can be used with the corresponding development tool.
+The default on Unix-like systems is to generate Makefiles, so you
+can also use cmake instead of the configure script:
+    cmake ~/libarchive-download-dir/
+    make
+    make install
+See the libarchive Wiki or the cmake site for further documentation.

+ 1424 - 0
core.mod/libarchive/Makefile.am

@@ -0,0 +1,1424 @@
+## Process this file with automake to produce Makefile.in
+
+AUTOMAKE_OPTIONS= foreign subdir-objects
+ACLOCAL_AMFLAGS = -I build/autoconf
+
+#
+# What to build and install
+#
+lib_LTLIBRARIES=	libarchive.la
+noinst_LTLIBRARIES=	libarchive_fe.la
+bin_PROGRAMS=	$(bsdtar_programs) $(bsdcpio_programs) $(bsdcat_programs)
+man_MANS= $(libarchive_man_MANS) $(bsdtar_man_MANS) $(bsdcpio_man_MANS) $(bsdcat_man_MANS)
+BUILT_SOURCES= libarchive/test/list.h tar/test/list.h cpio/test/list.h cat/test/list.h
+
+#
+# What to test: We always test libarchive, test bsdtar and bsdcpio only
+# if we built them.
+#
+check_PROGRAMS= libarchive_test $(bsdtar_test_programs) $(bsdcpio_test_programs) $(bsdcat_test_programs)
+TESTS= libarchive_test $(bsdtar_test_programs) $(bsdcpio_test_programs) $(bsdcat_test_programs)
+TESTS_ENVIRONMENT= $(libarchive_TESTS_ENVIRONMENT) $(bsdtar_TESTS_ENVIRONMENT) $(bsdcpio_TESTS_ENVIRONMENT) $(bsdcat_TESTS_ENVIRONMENT)
+# Always build and test both bsdtar and bsdcpio as part of 'distcheck'
+DISTCHECK_CONFIGURE_FLAGS = --enable-bsdtar --enable-bsdcpio
+# The next line is commented out by default in shipping libarchive releases.
+# It is uncommented by default in trunk.
+# DEV_CFLAGS=-Werror -Wextra -Wunused -Wshadow -Wmissing-prototypes -Wcast-qual -g
+AM_CFLAGS=$(DEV_CFLAGS)
+PLATFORMCPPFLAGS = @PLATFORMCPPFLAGS@
+AM_CPPFLAGS=$(PLATFORMCPPFLAGS)
+
+#
+# What to include in the distribution
+#
+EXTRA_DIST= \
+	CMakeLists.txt \
+	README.md \
+	build/autogen.sh \
+	build/bump-version.sh \
+	build/clean.sh \
+	build/cmake \
+	build/version \
+	contrib \
+	doc \
+	examples \
+	$(libarchive_EXTRA_DIST) \
+	$(libarchive_test_EXTRA_DIST) \
+	$(bsdtar_EXTRA_DIST) \
+	$(bsdtar_test_EXTRA_DIST) \
+	$(bsdcpio_EXTRA_DIST) \
+	$(bsdcpio_test_EXTRA_DIST) \
+	$(bsdcat_EXTRA_DIST) \
+	$(bsdcat_test_EXTRA_DIST)
+
+# a) Clean out some unneeded files and directories
+# b) Collect all documentation and format it for distribution.
+dist-hook:
+	rm -rf `find $(distdir) -name CVS -type d`
+	rm -rf `find $(distdir) -name .svn -type d`
+	rm -f `find $(distdir) -name '*~'`
+	rm -f `find $(distdir) -name '*.out'`
+	rm -f `find $(distdir) -name '*.core'`
+	-rm -f $(distdir)/*/Makefile $(distdir)/*/*/Makefile
+	cd $(distdir)/doc && /bin/sh update.sh
+
+#
+# Extra rules for cleanup
+#
+DISTCLEANFILES= \
+	libarchive/test/list.h \
+	tar/test/list.h \
+	cpio/test/list.h \
+	cat/test/list.h
+
+distclean-local:
+	-rm -rf .ref
+	-rm -rf autom4te.cache/
+	-rm -f *~
+	-[ -f libarchive/Makefile ] && cd libarchive && make clean
+	-[ -f libarchive/test/Makefile ] && cd libarchive/test && make clean
+	-[ -f tar/Makefile ] && cd tar && make clean
+	-[ -f tar/test/Makefile ] && cd tar/test && make clean
+	-[ -f cpio/Makefile ] && cd cpio && make clean
+	-[ -f cpio/test/Makefile ] && cd cpio/test && make clean
+	-[ -f cat/Makefile ] && cd cat && make clean
+	-[ -f cpio/test/Makefile ] && cd cat/test && make clean
+
+#
+# Libarchive headers, source, etc.
+#
+#
+
+include_HEADERS= libarchive/archive.h libarchive/archive_entry.h
+
+libarchive_la_SOURCES= \
+	libarchive/archive_acl.c \
+	libarchive/archive_acl_private.h \
+	libarchive/archive_check_magic.c \
+	libarchive/archive_cmdline.c \
+	libarchive/archive_cmdline_private.h \
+	libarchive/archive_crc32.h \
+	libarchive/archive_cryptor.c \
+	libarchive/archive_cryptor_private.h \
+	libarchive/archive_digest.c \
+	libarchive/archive_digest_private.h \
+	libarchive/archive_endian.h \
+	libarchive/archive_entry.c \
+	libarchive/archive_entry.h \
+	libarchive/archive_entry_copy_stat.c \
+	libarchive/archive_entry_link_resolver.c \
+	libarchive/archive_entry_locale.h \
+	libarchive/archive_entry_private.h \
+	libarchive/archive_entry_sparse.c \
+	libarchive/archive_entry_stat.c \
+	libarchive/archive_entry_strmode.c \
+	libarchive/archive_entry_xattr.c \
+	libarchive/archive_getdate.c \
+	libarchive/archive_getdate.h \
+	libarchive/archive_hmac.c \
+	libarchive/archive_hmac_private.h \
+	libarchive/archive_match.c \
+	libarchive/archive_openssl_evp_private.h \
+	libarchive/archive_openssl_hmac_private.h \
+	libarchive/archive_options.c \
+	libarchive/archive_options_private.h \
+	libarchive/archive_pack_dev.h \
+	libarchive/archive_pack_dev.c \
+	libarchive/archive_pathmatch.c \
+	libarchive/archive_pathmatch.h \
+	libarchive/archive_platform.h \
+	libarchive/archive_platform_acl.h \
+	libarchive/archive_platform_xattr.h \
+	libarchive/archive_ppmd_private.h \
+	libarchive/archive_ppmd7.c \
+	libarchive/archive_ppmd7_private.h \
+	libarchive/archive_ppmd8.c \
+	libarchive/archive_ppmd8_private.h \
+	libarchive/archive_private.h \
+	libarchive/archive_random.c \
+	libarchive/archive_random_private.h \
+	libarchive/archive_rb.c \
+	libarchive/archive_rb.h \
+	libarchive/archive_read.c \
+	libarchive/archive_read_add_passphrase.c \
+	libarchive/archive_read_append_filter.c \
+	libarchive/archive_read_data_into_fd.c \
+	libarchive/archive_read_disk_entry_from_file.c \
+	libarchive/archive_read_disk_posix.c \
+	libarchive/archive_read_disk_private.h \
+	libarchive/archive_read_disk_set_standard_lookup.c \
+	libarchive/archive_read_extract.c \
+	libarchive/archive_read_extract2.c \
+	libarchive/archive_read_open_fd.c \
+	libarchive/archive_read_open_file.c \
+	libarchive/archive_read_open_filename.c \
+	libarchive/archive_read_open_memory.c \
+	libarchive/archive_read_private.h \
+	libarchive/archive_read_set_format.c \
+	libarchive/archive_read_set_options.c \
+	libarchive/archive_read_support_filter_all.c \
+	libarchive/archive_read_support_filter_bzip2.c \
+	libarchive/archive_read_support_filter_by_code.c \
+	libarchive/archive_read_support_filter_compress.c \
+	libarchive/archive_read_support_filter_grzip.c \
+	libarchive/archive_read_support_filter_gzip.c \
+	libarchive/archive_read_support_filter_lrzip.c \
+	libarchive/archive_read_support_filter_lz4.c \
+	libarchive/archive_read_support_filter_lzop.c \
+	libarchive/archive_read_support_filter_none.c \
+	libarchive/archive_read_support_filter_program.c \
+	libarchive/archive_read_support_filter_rpm.c \
+	libarchive/archive_read_support_filter_uu.c \
+	libarchive/archive_read_support_filter_xz.c \
+	libarchive/archive_read_support_filter_zstd.c \
+	libarchive/archive_read_support_format_7zip.c \
+	libarchive/archive_read_support_format_all.c \
+	libarchive/archive_read_support_format_ar.c \
+	libarchive/archive_read_support_format_by_code.c \
+	libarchive/archive_read_support_format_cab.c \
+	libarchive/archive_read_support_format_cpio.c \
+	libarchive/archive_read_support_format_empty.c \
+	libarchive/archive_read_support_format_iso9660.c \
+	libarchive/archive_read_support_format_lha.c \
+	libarchive/archive_read_support_format_mtree.c \
+	libarchive/archive_read_support_format_rar.c \
+	libarchive/archive_read_support_format_rar5.c \
+	libarchive/archive_read_support_format_raw.c \
+	libarchive/archive_read_support_format_tar.c \
+	libarchive/archive_read_support_format_warc.c \
+	libarchive/archive_read_support_format_xar.c \
+	libarchive/archive_read_support_format_zip.c \
+	libarchive/archive_string.c \
+	libarchive/archive_string.h \
+	libarchive/archive_string_composition.h \
+	libarchive/archive_string_sprintf.c \
+	libarchive/archive_util.c \
+	libarchive/archive_version_details.c \
+	libarchive/archive_virtual.c \
+	libarchive/archive_write.c \
+	libarchive/archive_write_disk_posix.c \
+	libarchive/archive_write_disk_private.h \
+	libarchive/archive_write_disk_set_standard_lookup.c \
+	libarchive/archive_write_open_fd.c \
+	libarchive/archive_write_open_file.c \
+	libarchive/archive_write_open_filename.c \
+	libarchive/archive_write_open_memory.c \
+	libarchive/archive_write_private.h \
+	libarchive/archive_write_add_filter.c \
+	libarchive/archive_write_add_filter_b64encode.c \
+	libarchive/archive_write_add_filter_by_name.c \
+	libarchive/archive_write_add_filter_bzip2.c \
+	libarchive/archive_write_add_filter_compress.c \
+	libarchive/archive_write_add_filter_grzip.c \
+	libarchive/archive_write_add_filter_gzip.c \
+	libarchive/archive_write_add_filter_lrzip.c \
+	libarchive/archive_write_add_filter_lz4.c \
+	libarchive/archive_write_add_filter_lzop.c \
+	libarchive/archive_write_add_filter_none.c \
+	libarchive/archive_write_add_filter_program.c \
+	libarchive/archive_write_add_filter_uuencode.c \
+	libarchive/archive_write_add_filter_xz.c \
+	libarchive/archive_write_add_filter_zstd.c \
+	libarchive/archive_write_set_format.c \
+	libarchive/archive_write_set_format_7zip.c \
+	libarchive/archive_write_set_format_ar.c \
+	libarchive/archive_write_set_format_by_name.c \
+	libarchive/archive_write_set_format_cpio.c \
+	libarchive/archive_write_set_format_cpio_binary.c \
+	libarchive/archive_write_set_format_cpio_newc.c \
+	libarchive/archive_write_set_format_cpio_odc.c \
+	libarchive/archive_write_set_format_filter_by_ext.c \
+	libarchive/archive_write_set_format_iso9660.c \
+	libarchive/archive_write_set_format_mtree.c \
+	libarchive/archive_write_set_format_pax.c \
+	libarchive/archive_write_set_format_private.h \
+	libarchive/archive_write_set_format_raw.c \
+	libarchive/archive_write_set_format_shar.c \
+	libarchive/archive_write_set_format_ustar.c \
+	libarchive/archive_write_set_format_v7tar.c \
+	libarchive/archive_write_set_format_gnutar.c \
+	libarchive/archive_write_set_format_warc.c \
+	libarchive/archive_write_set_format_xar.c \
+	libarchive/archive_write_set_format_zip.c \
+	libarchive/archive_write_set_options.c \
+	libarchive/archive_write_set_passphrase.c \
+	libarchive/archive_xxhash.h \
+	libarchive/config_freebsd.h \
+	libarchive/filter_fork_posix.c \
+	libarchive/filter_fork.h \
+	libarchive/xxhash.c
+
+if INC_WINDOWS_FILES
+libarchive_la_SOURCES+= \
+	libarchive/archive_entry_copy_bhfi.c \
+	libarchive/archive_read_disk_windows.c \
+	libarchive/archive_windows.h \
+	libarchive/archive_windows.c \
+	libarchive/archive_write_disk_windows.c \
+	libarchive/filter_fork_windows.c
+endif
+
+if INC_BLAKE2
+libarchive_la_SOURCES+= \
+	libarchive/archive_blake2.h \
+	libarchive/archive_blake2_impl.h \
+	libarchive/archive_blake2s_ref.c \
+	libarchive/archive_blake2sp_ref.c
+endif
+
+if INC_LINUX_ACL
+libarchive_la_SOURCES+= libarchive/archive_disk_acl_linux.c
+else
+if INC_SUNOS_ACL
+libarchive_la_SOURCES+= libarchive/archive_disk_acl_sunos.c
+else
+if INC_DARWIN_ACL
+libarchive_la_SOURCES+= libarchive/archive_disk_acl_darwin.c
+else
+if INC_FREEBSD_ACL
+libarchive_la_SOURCES+= libarchive/archive_disk_acl_freebsd.c
+endif
+endif
+endif
+endif
+
+# -no-undefined marks that libarchive doesn't rely on symbols
+# defined in the application.  This is mandatory for cygwin.
+libarchive_la_LDFLAGS= -no-undefined -version-info $(ARCHIVE_LIBTOOL_VERSION) $(GC_SECTIONS)
+libarchive_la_LIBADD= $(LTLIBICONV)
+
+# Manpages to install
+libarchive_man_MANS= \
+	libarchive/archive_entry.3 \
+	libarchive/archive_entry_acl.3 \
+	libarchive/archive_entry_linkify.3 \
+	libarchive/archive_entry_misc.3 \
+	libarchive/archive_entry_paths.3 \
+	libarchive/archive_entry_perms.3 \
+	libarchive/archive_entry_stat.3 \
+	libarchive/archive_entry_time.3 \
+	libarchive/archive_read.3 \
+	libarchive/archive_read_add_passphrase.3 \
+	libarchive/archive_read_data.3 \
+	libarchive/archive_read_disk.3 \
+	libarchive/archive_read_extract.3 \
+	libarchive/archive_read_filter.3 \
+	libarchive/archive_read_format.3 \
+	libarchive/archive_read_free.3 \
+	libarchive/archive_read_header.3 \
+	libarchive/archive_read_new.3 \
+	libarchive/archive_read_open.3 \
+	libarchive/archive_read_set_options.3 \
+	libarchive/archive_util.3 \
+	libarchive/archive_write.3 \
+	libarchive/archive_write_blocksize.3 \
+	libarchive/archive_write_data.3 \
+	libarchive/archive_write_disk.3 \
+	libarchive/archive_write_filter.3 \
+	libarchive/archive_write_finish_entry.3 \
+	libarchive/archive_write_format.3 \
+	libarchive/archive_write_free.3 \
+	libarchive/archive_write_header.3 \
+	libarchive/archive_write_new.3 \
+	libarchive/archive_write_open.3 \
+	libarchive/archive_write_set_options.3 \
+	libarchive/archive_write_set_passphrase.3 \
+	libarchive/cpio.5 \
+	libarchive/libarchive.3 \
+	libarchive/libarchive_changes.3 \
+	libarchive/libarchive_internals.3 \
+	libarchive/libarchive-formats.5 \
+	libarchive/mtree.5 \
+	libarchive/tar.5
+
+# Additional libarchive files to include in the distribution
+libarchive_EXTRA_DIST= \
+	libarchive/archive_windows.c \
+	libarchive/archive_windows.h \
+	libarchive/filter_fork_windows.c \
+	libarchive/CMakeLists.txt \
+	$(libarchive_man_MANS)
+
+# pkgconfig
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = build/pkgconfig/libarchive.pc
+
+# Sources needed by all test programs
+test_utils_SOURCES= \
+	test_utils/test_utils.c \
+	test_utils/test_utils.h \
+	test_utils/test_main.c \
+	test_utils/test_common.h
+
+#
+#
+# libarchive_test program
+#
+#
+libarchive_test_SOURCES= \
+	$(libarchive_la_SOURCES) \
+	$(test_utils_SOURCES) \
+	libarchive/test/read_open_memory.c \
+	libarchive/test/test.h \
+	libarchive/test/test_acl_nfs4.c \
+	libarchive/test/test_acl_pax.c \
+	libarchive/test/test_acl_platform_nfs4.c \
+	libarchive/test/test_acl_platform_posix1e.c \
+	libarchive/test/test_acl_posix1e.c \
+	libarchive/test/test_acl_text.c \
+	libarchive/test/test_archive_api_feature.c \
+	libarchive/test/test_archive_clear_error.c \
+	libarchive/test/test_archive_cmdline.c \
+	libarchive/test/test_archive_digest.c \
+	libarchive/test/test_archive_getdate.c \
+	libarchive/test/test_archive_match_owner.c \
+	libarchive/test/test_archive_match_path.c \
+	libarchive/test/test_archive_match_time.c \
+	libarchive/test/test_archive_pathmatch.c \
+	libarchive/test/test_archive_read_add_passphrase.c \
+	libarchive/test/test_archive_read_close_twice.c \
+	libarchive/test/test_archive_read_close_twice_open_fd.c \
+	libarchive/test/test_archive_read_close_twice_open_filename.c \
+	libarchive/test/test_archive_read_multiple_data_objects.c \
+	libarchive/test/test_archive_read_next_header_empty.c \
+	libarchive/test/test_archive_read_next_header_raw.c \
+	libarchive/test/test_archive_read_open2.c \
+	libarchive/test/test_archive_read_set_filter_option.c \
+	libarchive/test/test_archive_read_set_format_option.c \
+	libarchive/test/test_archive_read_set_option.c \
+	libarchive/test/test_archive_read_set_options.c \
+	libarchive/test/test_archive_read_support.c \
+	libarchive/test/test_archive_set_error.c \
+	libarchive/test/test_archive_string.c \
+	libarchive/test/test_archive_string_conversion.c \
+	libarchive/test/test_archive_write_add_filter_by_name.c \
+	libarchive/test/test_archive_write_set_filter_option.c \
+	libarchive/test/test_archive_write_set_format_by_name.c \
+	libarchive/test/test_archive_write_set_format_filter_by_ext.c \
+	libarchive/test/test_archive_write_set_format_option.c \
+	libarchive/test/test_archive_write_set_option.c \
+	libarchive/test/test_archive_write_set_options.c \
+	libarchive/test/test_archive_write_set_passphrase.c \
+	libarchive/test/test_bad_fd.c \
+	libarchive/test/test_compat_bzip2.c \
+	libarchive/test/test_compat_cpio.c \
+	libarchive/test/test_compat_gtar.c \
+	libarchive/test/test_compat_gzip.c \
+	libarchive/test/test_compat_lz4.c \
+	libarchive/test/test_compat_lzip.c \
+	libarchive/test/test_compat_lzma.c \
+	libarchive/test/test_compat_lzop.c \
+	libarchive/test/test_compat_mac.c \
+	libarchive/test/test_compat_perl_archive_tar.c \
+	libarchive/test/test_compat_plexus_archiver_tar.c \
+	libarchive/test/test_compat_solaris_tar_acl.c \
+	libarchive/test/test_compat_solaris_pax_sparse.c \
+	libarchive/test/test_compat_star_acl.c \
+	libarchive/test/test_compat_tar_directory.c \
+	libarchive/test/test_compat_tar_hardlink.c \
+	libarchive/test/test_compat_uudecode.c \
+	libarchive/test/test_compat_uudecode_large.c \
+	libarchive/test/test_compat_xz.c \
+	libarchive/test/test_compat_zip.c \
+	libarchive/test/test_compat_zstd.c \
+	libarchive/test/test_empty_write.c \
+	libarchive/test/test_entry.c \
+	libarchive/test/test_entry_strmode.c \
+	libarchive/test/test_extattr_freebsd.c \
+	libarchive/test/test_filter_count.c \
+	libarchive/test/test_fuzz.c \
+	libarchive/test/test_gnutar_filename_encoding.c \
+	libarchive/test/test_link_resolver.c \
+	libarchive/test/test_open_failure.c \
+	libarchive/test/test_open_fd.c \
+	libarchive/test/test_open_file.c \
+	libarchive/test/test_open_filename.c \
+	libarchive/test/test_pax_filename_encoding.c \
+	libarchive/test/test_pax_xattr_header.c \
+	libarchive/test/test_read_data_large.c \
+	libarchive/test/test_read_disk.c \
+	libarchive/test/test_read_disk_directory_traversals.c \
+	libarchive/test/test_read_disk_entry_from_file.c \
+	libarchive/test/test_read_extract.c \
+	libarchive/test/test_read_file_nonexistent.c \
+	libarchive/test/test_read_filter_compress.c \
+	libarchive/test/test_read_filter_grzip.c \
+	libarchive/test/test_read_filter_lrzip.c \
+	libarchive/test/test_read_filter_lzop.c \
+	libarchive/test/test_read_filter_lzop_multiple_parts.c \
+	libarchive/test/test_read_filter_program.c \
+	libarchive/test/test_read_filter_program_signature.c \
+	libarchive/test/test_read_filter_uudecode.c \
+	libarchive/test/test_read_format_7zip.c \
+	libarchive/test/test_read_format_7zip_encryption_data.c \
+	libarchive/test/test_read_format_7zip_encryption_partially.c \
+	libarchive/test/test_read_format_7zip_encryption_header.c \
+	libarchive/test/test_read_format_7zip_malformed.c \
+	libarchive/test/test_read_format_7zip_packinfo_digests.c \
+	libarchive/test/test_read_format_ar.c \
+	libarchive/test/test_read_format_cab.c \
+	libarchive/test/test_read_format_cab_filename.c \
+	libarchive/test/test_read_format_cpio_afio.c \
+	libarchive/test/test_read_format_cpio_bin.c \
+	libarchive/test/test_read_format_cpio_bin_Z.c \
+	libarchive/test/test_read_format_cpio_bin_be.c \
+	libarchive/test/test_read_format_cpio_bin_bz2.c \
+	libarchive/test/test_read_format_cpio_bin_gz.c \
+	libarchive/test/test_read_format_cpio_bin_le.c \
+	libarchive/test/test_read_format_cpio_bin_lzip.c \
+	libarchive/test/test_read_format_cpio_bin_lzma.c \
+	libarchive/test/test_read_format_cpio_bin_xz.c \
+	libarchive/test/test_read_format_cpio_filename.c \
+	libarchive/test/test_read_format_cpio_odc.c \
+	libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c \
+	libarchive/test/test_read_format_cpio_svr4_gzip.c \
+	libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c \
+	libarchive/test/test_read_format_cpio_svr4c_Z.c \
+	libarchive/test/test_read_format_empty.c \
+	libarchive/test/test_read_format_gtar_filename.c \
+	libarchive/test/test_read_format_gtar_gz.c \
+	libarchive/test/test_read_format_gtar_lzma.c \
+	libarchive/test/test_read_format_gtar_sparse.c \
+	libarchive/test/test_read_format_gtar_sparse_skip_entry.c \
+	libarchive/test/test_read_format_iso_Z.c \
+	libarchive/test/test_read_format_iso_multi_extent.c \
+	libarchive/test/test_read_format_iso_xorriso.c \
+	libarchive/test/test_read_format_isojoliet_bz2.c \
+	libarchive/test/test_read_format_isojoliet_long.c \
+	libarchive/test/test_read_format_isojoliet_rr.c \
+	libarchive/test/test_read_format_isojoliet_versioned.c \
+	libarchive/test/test_read_format_isorr_bz2.c \
+	libarchive/test/test_read_format_isorr_ce.c \
+	libarchive/test/test_read_format_isorr_new_bz2.c \
+	libarchive/test/test_read_format_isorr_rr_moved.c \
+	libarchive/test/test_read_format_isozisofs_bz2.c \
+	libarchive/test/test_read_format_lha.c \
+	libarchive/test/test_read_format_lha_bugfix_0.c \
+	libarchive/test/test_read_format_lha_filename.c \
+	libarchive/test/test_read_format_lha_filename_utf16.c \
+	libarchive/test/test_read_format_mtree.c \
+	libarchive/test/test_read_format_mtree_crash747.c \
+	libarchive/test/test_read_format_pax_bz2.c \
+	libarchive/test/test_read_format_rar.c \
+	libarchive/test/test_read_format_rar_encryption_data.c \
+	libarchive/test/test_read_format_rar_encryption_partially.c \
+	libarchive/test/test_read_format_rar_encryption_header.c \
+	libarchive/test/test_read_format_rar_filter.c \
+	libarchive/test/test_read_format_rar_invalid1.c \
+	libarchive/test/test_read_format_rar5.c \
+	libarchive/test/test_read_format_raw.c \
+	libarchive/test/test_read_format_tar.c \
+	libarchive/test/test_read_format_tar_concatenated.c \
+	libarchive/test/test_read_format_tar_empty_pax.c \
+	libarchive/test/test_read_format_tar_empty_filename.c \
+	libarchive/test/test_read_format_tar_empty_with_gnulabel.c \
+	libarchive/test/test_read_format_tar_filename.c \
+	libarchive/test/test_read_format_tbz.c \
+	libarchive/test/test_read_format_tgz.c \
+	libarchive/test/test_read_format_tlz.c \
+	libarchive/test/test_read_format_txz.c \
+	libarchive/test/test_read_format_tz.c \
+	libarchive/test/test_read_format_ustar_filename.c \
+	libarchive/test/test_read_format_warc.c \
+	libarchive/test/test_read_format_xar.c \
+	libarchive/test/test_read_format_zip.c \
+	libarchive/test/test_read_format_zip_7075_utf8_paths.c \
+	libarchive/test/test_read_format_zip_comment_stored.c \
+	libarchive/test/test_read_format_zip_encryption_data.c \
+	libarchive/test/test_read_format_zip_encryption_partially.c \
+	libarchive/test/test_read_format_zip_encryption_header.c \
+	libarchive/test/test_read_format_zip_extra_padding.c \
+	libarchive/test/test_read_format_zip_filename.c \
+	libarchive/test/test_read_format_zip_high_compression.c \
+	libarchive/test/test_read_format_zip_jar.c \
+	libarchive/test/test_read_format_zip_mac_metadata.c \
+	libarchive/test/test_read_format_zip_malformed.c \
+	libarchive/test/test_read_format_zip_msdos.c \
+	libarchive/test/test_read_format_zip_nested.c \
+	libarchive/test/test_read_format_zip_nofiletype.c \
+	libarchive/test/test_read_format_zip_padded.c \
+	libarchive/test/test_read_format_zip_sfx.c \
+	libarchive/test/test_read_format_zip_traditional_encryption_data.c \
+	libarchive/test/test_read_format_zip_winzip_aes.c \
+	libarchive/test/test_read_format_zip_winzip_aes_large.c \
+	libarchive/test/test_read_format_zip_zip64.c \
+	libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.c \
+	libarchive/test/test_read_large.c \
+	libarchive/test/test_read_pax_xattr_rht_security_selinux.c \
+	libarchive/test/test_read_pax_xattr_schily.c \
+	libarchive/test/test_read_pax_truncated.c \
+	libarchive/test/test_read_position.c \
+	libarchive/test/test_read_set_format.c \
+	libarchive/test/test_read_too_many_filters.c \
+	libarchive/test/test_read_truncated.c \
+	libarchive/test/test_read_truncated_filter.c \
+	libarchive/test/test_short_writes.c \
+	libarchive/test/test_sparse_basic.c \
+	libarchive/test/test_tar_filenames.c \
+	libarchive/test/test_tar_large.c \
+	libarchive/test/test_ustar_filenames.c \
+	libarchive/test/test_ustar_filename_encoding.c \
+	libarchive/test/test_warn_missing_hardlink_target.c \
+	libarchive/test/test_write_disk.c \
+	libarchive/test/test_write_disk_appledouble.c \
+	libarchive/test/test_write_disk_failures.c \
+	libarchive/test/test_write_disk_fixup.c \
+	libarchive/test/test_write_disk_hardlink.c \
+	libarchive/test/test_write_disk_hfs_compression.c \
+	libarchive/test/test_write_disk_lookup.c \
+	libarchive/test/test_write_disk_mac_metadata.c \
+	libarchive/test/test_write_disk_no_hfs_compression.c \
+	libarchive/test/test_write_disk_perms.c \
+	libarchive/test/test_write_disk_secure.c \
+	libarchive/test/test_write_disk_secure744.c \
+	libarchive/test/test_write_disk_secure745.c \
+	libarchive/test/test_write_disk_secure746.c \
+	libarchive/test/test_write_disk_sparse.c \
+	libarchive/test/test_write_disk_symlink.c \
+	libarchive/test/test_write_disk_times.c \
+	libarchive/test/test_write_filter_b64encode.c \
+	libarchive/test/test_write_filter_bzip2.c \
+	libarchive/test/test_write_filter_compress.c \
+	libarchive/test/test_write_filter_gzip.c \
+	libarchive/test/test_write_filter_gzip_timestamp.c \
+	libarchive/test/test_write_filter_lrzip.c \
+	libarchive/test/test_write_filter_lz4.c \
+	libarchive/test/test_write_filter_lzip.c \
+	libarchive/test/test_write_filter_lzma.c \
+	libarchive/test/test_write_filter_lzop.c \
+	libarchive/test/test_write_filter_program.c \
+	libarchive/test/test_write_filter_uuencode.c \
+	libarchive/test/test_write_filter_xz.c \
+	libarchive/test/test_write_filter_zstd.c \
+	libarchive/test/test_write_format_7zip.c \
+	libarchive/test/test_write_format_7zip_empty.c \
+	libarchive/test/test_write_format_7zip_large.c \
+	libarchive/test/test_write_format_ar.c \
+	libarchive/test/test_write_format_cpio.c \
+	libarchive/test/test_write_format_cpio_empty.c \
+	libarchive/test/test_write_format_cpio_newc.c \
+	libarchive/test/test_write_format_cpio_odc.c \
+	libarchive/test/test_write_format_gnutar.c \
+	libarchive/test/test_write_format_gnutar_filenames.c \
+	libarchive/test/test_write_format_iso9660.c \
+	libarchive/test/test_write_format_iso9660_boot.c \
+	libarchive/test/test_write_format_iso9660_empty.c \
+	libarchive/test/test_write_format_iso9660_filename.c \
+	libarchive/test/test_write_format_iso9660_zisofs.c \
+	libarchive/test/test_write_format_mtree.c \
+	libarchive/test/test_write_format_mtree_absolute_path.c \
+	libarchive/test/test_write_format_mtree_classic.c \
+	libarchive/test/test_write_format_mtree_classic_indent.c\
+	libarchive/test/test_write_format_mtree_fflags.c \
+	libarchive/test/test_write_format_mtree_no_separator.c \
+	libarchive/test/test_write_format_mtree_quoted_filename.c\
+	libarchive/test/test_write_format_pax.c \
+	libarchive/test/test_write_format_raw.c \
+	libarchive/test/test_write_format_raw_b64.c \
+	libarchive/test/test_write_format_shar_empty.c \
+	libarchive/test/test_write_format_tar.c \
+	libarchive/test/test_write_format_tar_empty.c \
+	libarchive/test/test_write_format_tar_sparse.c \
+	libarchive/test/test_write_format_tar_ustar.c \
+	libarchive/test/test_write_format_tar_v7tar.c \
+	libarchive/test/test_write_format_warc.c \
+	libarchive/test/test_write_format_warc_empty.c \
+	libarchive/test/test_write_format_xar.c \
+	libarchive/test/test_write_format_xar_empty.c \
+	libarchive/test/test_write_format_zip.c \
+	libarchive/test/test_write_format_zip_compression_store.c \
+	libarchive/test/test_write_format_zip_entry_size_unset.c \
+	libarchive/test/test_write_format_zip_empty.c \
+	libarchive/test/test_write_format_zip_empty_zip64.c \
+	libarchive/test/test_write_format_zip_file.c \
+	libarchive/test/test_write_format_zip_file_zip64.c \
+	libarchive/test/test_write_format_zip_large.c \
+	libarchive/test/test_write_format_zip_zip64.c \
+	libarchive/test/test_write_open_memory.c \
+	libarchive/test/test_write_read_format_zip.c \
+	libarchive/test/test_xattr_platform.c \
+	libarchive/test/test_zip_filename_encoding.c
+
+libarchive_test_CPPFLAGS= \
+	-I$(top_srcdir)/libarchive \
+	-I$(top_srcdir)/libarchive/test \
+	-I$(top_srcdir)/test_utils \
+	-I$(top_builddir)/libarchive/test \
+	-DLIBARCHIVE_STATIC $(PLATFORMCPPFLAGS)
+
+libarchive_test_LDADD= $(LTLIBICONV)
+
+# The "list.h" file just lists all of the tests defined in all of the sources.
+# Building it automatically provides a sanity-check on libarchive_test_SOURCES
+# above.
+libarchive/test/list.h: Makefile
+	$(MKDIR_P) libarchive/test
+	cat $(top_srcdir)/libarchive/test/test_*.c | grep '^DEFINE_TEST' > libarchive/test/list.h
+
+libarchive_TESTS_ENVIRONMENT= LIBARCHIVE_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/libarchive/test LRZIP=NOCONFIG
+
+libarchive_test_EXTRA_DIST=\
+	libarchive/test/list.h \
+	libarchive/test/test_acl_pax_posix1e.tar.uu \
+	libarchive/test/test_acl_pax_nfs4.tar.uu \
+	libarchive/test/test_archive_string_conversion.txt.Z.uu \
+	libarchive/test/test_compat_bzip2_1.tbz.uu \
+	libarchive/test/test_compat_bzip2_2.tbz.uu \
+	libarchive/test/test_compat_cpio_1.cpio.uu \
+	libarchive/test/test_compat_gtar_1.tar.uu \
+	libarchive/test/test_compat_gtar_2.tar.uu \
+	libarchive/test/test_compat_gzip_1.tgz.uu \
+	libarchive/test/test_compat_gzip_2.tgz.uu \
+	libarchive/test/test_compat_lz4_1.tar.lz4.uu \
+	libarchive/test/test_compat_lz4_2.tar.lz4.uu \
+	libarchive/test/test_compat_lz4_3.tar.lz4.uu \
+	libarchive/test/test_compat_lz4_B4.tar.lz4.uu \
+	libarchive/test/test_compat_lz4_B4BD.tar.lz4.uu \
+	libarchive/test/test_compat_lz4_B4BDBX.tar.lz4.uu \
+	libarchive/test/test_compat_lz4_B5.tar.lz4.uu \
+	libarchive/test/test_compat_lz4_B5BD.tar.lz4.uu \
+	libarchive/test/test_compat_lz4_B6.tar.lz4.uu \
+	libarchive/test/test_compat_lz4_B6BD.tar.lz4.uu \
+	libarchive/test/test_compat_lz4_B7.tar.lz4.uu \
+	libarchive/test/test_compat_lz4_B7BD.tar.lz4.uu \
+	libarchive/test/test_compat_lzip_1.tlz.uu \
+	libarchive/test/test_compat_lzip_2.tlz.uu \
+	libarchive/test/test_compat_lzma_1.tlz.uu \
+	libarchive/test/test_compat_lzma_2.tlz.uu \
+	libarchive/test/test_compat_lzma_3.tlz.uu \
+	libarchive/test/test_compat_lzop_1.tar.lzo.uu \
+	libarchive/test/test_compat_lzop_2.tar.lzo.uu \
+	libarchive/test/test_compat_lzop_3.tar.lzo.uu \
+	libarchive/test/test_compat_mac-1.tar.Z.uu \
+	libarchive/test/test_compat_mac-2.tar.Z.uu \
+	libarchive/test/test_compat_perl_archive_tar.tar.uu \
+	libarchive/test/test_compat_plexus_archiver_tar.tar.uu \
+	libarchive/test/test_compat_solaris_pax_sparse_1.pax.Z.uu \
+	libarchive/test/test_compat_solaris_pax_sparse_2.pax.Z.uu \
+	libarchive/test/test_compat_solaris_tar_acl.tar.uu \
+	libarchive/test/test_compat_star_acl_nfs4.tar.uu \
+	libarchive/test/test_compat_star_acl_posix1e.tar.uu \
+	libarchive/test/test_compat_tar_directory_1.tar.uu \
+	libarchive/test/test_compat_tar_hardlink_1.tar.uu \
+	libarchive/test/test_compat_uudecode_large.tar.Z.uu \
+	libarchive/test/test_compat_xz_1.txz.uu \
+	libarchive/test/test_compat_zip_1.zip.uu \
+	libarchive/test/test_compat_zip_2.zip.uu \
+	libarchive/test/test_compat_zip_3.zip.uu \
+	libarchive/test/test_compat_zip_4.zip.uu \
+	libarchive/test/test_compat_zip_5.zip.uu \
+	libarchive/test/test_compat_zip_6.zip.uu \
+	libarchive/test/test_compat_zip_7.xps.uu \
+	libarchive/test/test_compat_zip_8.zip.uu \
+	libarchive/test/test_compat_zstd_1.tar.zst.uu \
+	libarchive/test/test_compat_zstd_2.tar.zst.uu \
+	libarchive/test/test_fuzz.cab.uu \
+	libarchive/test/test_fuzz.lzh.uu \
+	libarchive/test/test_fuzz_1.iso.Z.uu \
+	libarchive/test/test_pax_filename_encoding.tar.uu \
+	libarchive/test/test_pax_xattr_header_all.tar.uu \
+	libarchive/test/test_pax_xattr_header_libarchive.tar.uu \
+	libarchive/test/test_pax_xattr_header_schily.tar.uu \
+	libarchive/test/test_rar_multivolume_multiple_files.part1.rar.uu \
+	libarchive/test/test_rar_multivolume_multiple_files.part2.rar.uu \
+	libarchive/test/test_rar_multivolume_multiple_files.part3.rar.uu \
+	libarchive/test/test_rar_multivolume_multiple_files.part4.rar.uu \
+	libarchive/test/test_rar_multivolume_multiple_files.part5.rar.uu \
+	libarchive/test/test_rar_multivolume_multiple_files.part6.rar.uu \
+	libarchive/test/test_rar_multivolume_single_file.part1.rar.uu \
+	libarchive/test/test_rar_multivolume_single_file.part2.rar.uu \
+	libarchive/test/test_rar_multivolume_single_file.part3.rar.uu \
+	libarchive/test/test_rar_multivolume_uncompressed_files.part01.rar.uu \
+	libarchive/test/test_rar_multivolume_uncompressed_files.part02.rar.uu \
+	libarchive/test/test_rar_multivolume_uncompressed_files.part03.rar.uu \
+	libarchive/test/test_rar_multivolume_uncompressed_files.part04.rar.uu \
+	libarchive/test/test_rar_multivolume_uncompressed_files.part05.rar.uu \
+	libarchive/test/test_rar_multivolume_uncompressed_files.part06.rar.uu \
+	libarchive/test/test_rar_multivolume_uncompressed_files.part07.rar.uu \
+	libarchive/test/test_rar_multivolume_uncompressed_files.part08.rar.uu \
+	libarchive/test/test_rar_multivolume_uncompressed_files.part09.rar.uu \
+	libarchive/test/test_rar_multivolume_uncompressed_files.part10.rar.uu \
+	libarchive/test/test_read_filter_grzip.tar.grz.uu \
+	libarchive/test/test_read_filter_lrzip.tar.lrz.uu \
+	libarchive/test/test_read_filter_lzop.tar.lzo.uu \
+	libarchive/test/test_read_filter_lzop_multiple_parts.tar.lzo.uu \
+	libarchive/test/test_read_format_mtree_crash747.mtree.bz2.uu \
+	libarchive/test/test_read_format_mtree_noprint.mtree.uu \
+	libarchive/test/test_read_format_7zip_bcj2_bzip2.7z.uu \
+	libarchive/test/test_read_format_7zip_bcj2_copy_1.7z.uu \
+	libarchive/test/test_read_format_7zip_bcj2_copy_2.7z.uu \
+	libarchive/test/test_read_format_7zip_bcj2_copy_lzma.7z.uu \
+	libarchive/test/test_read_format_7zip_bcj2_deflate.7z.uu \
+	libarchive/test/test_read_format_7zip_bcj2_lzma1_1.7z.uu \
+	libarchive/test/test_read_format_7zip_bcj2_lzma1_2.7z.uu \
+	libarchive/test/test_read_format_7zip_bcj2_lzma2_1.7z.uu \
+	libarchive/test/test_read_format_7zip_bcj2_lzma2_2.7z.uu \
+	libarchive/test/test_read_format_7zip_bcj_bzip2.7z.uu \
+	libarchive/test/test_read_format_7zip_bcj_copy.7z.uu \
+	libarchive/test/test_read_format_7zip_bcj_deflate.7z.uu \
+	libarchive/test/test_read_format_7zip_bcj_lzma1.7z.uu \
+	libarchive/test/test_read_format_7zip_bcj_lzma2.7z.uu \
+	libarchive/test/test_read_format_7zip_bzip2.7z.uu \
+	libarchive/test/test_read_format_7zip_copy.7z.uu \
+	libarchive/test/test_read_format_7zip_copy_2.7z.uu \
+	libarchive/test/test_read_format_7zip_deflate.7z.uu \
+	libarchive/test/test_read_format_7zip_delta_lzma1.7z.uu \
+	libarchive/test/test_read_format_7zip_delta4_lzma1.7z.uu \
+	libarchive/test/test_read_format_7zip_delta_lzma2.7z.uu \
+	libarchive/test/test_read_format_7zip_delta4_lzma2.7z.uu \
+	libarchive/test/test_read_format_7zip_empty_archive.7z.uu \
+	libarchive/test/test_read_format_7zip_empty_file.7z.uu \
+	libarchive/test/test_read_format_7zip_encryption.7z.uu \
+	libarchive/test/test_read_format_7zip_encryption_header.7z.uu \
+	libarchive/test/test_read_format_7zip_encryption_partially.7z.uu \
+	libarchive/test/test_read_format_7zip_lzma1.7z.uu \
+	libarchive/test/test_read_format_7zip_lzma1_2.7z.uu \
+	libarchive/test/test_read_format_7zip_lzma1_lzma2.7z.uu \
+	libarchive/test/test_read_format_7zip_lzma2.7z.uu \
+	libarchive/test/test_read_format_7zip_malformed.7z.uu \
+	libarchive/test/test_read_format_7zip_malformed2.7z.uu \
+	libarchive/test/test_read_format_7zip_packinfo_digests.7z.uu \
+	libarchive/test/test_read_format_7zip_ppmd.7z.uu \
+	libarchive/test/test_read_format_7zip_symbolic_name.7z.uu \
+	libarchive/test/test_read_format_ar.ar.uu \
+	libarchive/test/test_read_format_cab_1.cab.uu \
+	libarchive/test/test_read_format_cab_2.cab.uu \
+	libarchive/test/test_read_format_cab_3.cab.uu \
+	libarchive/test/test_read_format_cab_filename_cp932.cab.uu \
+	libarchive/test/test_read_format_cpio_bin_be.cpio.uu \
+	libarchive/test/test_read_format_cpio_bin_le.cpio.uu \
+	libarchive/test/test_read_format_cpio_filename_cp866.cpio.uu \
+	libarchive/test/test_read_format_cpio_filename_eucjp.cpio.uu \
+	libarchive/test/test_read_format_cpio_filename_koi8r.cpio.uu \
+	libarchive/test/test_read_format_cpio_filename_utf8_jp.cpio.uu \
+	libarchive/test/test_read_format_cpio_filename_utf8_ru.cpio.uu \
+	libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu \
+	libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu \
+	libarchive/test/test_read_format_gtar_filename_cp866.tar.Z.uu \
+	libarchive/test/test_read_format_gtar_filename_eucjp.tar.Z.uu \
+	libarchive/test/test_read_format_gtar_filename_koi8r.tar.Z.uu \
+	libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu \
+	libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu \
+	libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu \
+	libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu \
+	libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu \
+	libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu \
+	libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu \
+	libarchive/test/test_read_format_iso.iso.Z.uu \
+	libarchive/test/test_read_format_iso_2.iso.Z.uu \
+	libarchive/test/test_read_format_iso_joliet.iso.Z.uu \
+	libarchive/test/test_read_format_iso_joliet_by_nero.iso.Z.uu \
+	libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu \
+	libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu \
+	libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu \
+	libarchive/test/test_read_format_iso_rockridge.iso.Z.uu \
+	libarchive/test/test_read_format_iso_rockridge_ce.iso.Z.uu \
+	libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu \
+	libarchive/test/test_read_format_iso_rockridge_rr_moved.iso.Z.uu \
+	libarchive/test/test_read_format_iso_xorriso.iso.Z.uu \
+	libarchive/test/test_read_format_iso_zisofs.iso.Z.uu \
+	libarchive/test/test_read_format_lha_bugfix_0.lzh.uu \
+	libarchive/test/test_read_format_lha_filename_cp932.lzh.uu \
+	libarchive/test/test_read_format_lha_filename_utf16.lzh.uu \
+	libarchive/test/test_read_format_lha_header0.lzh.uu \
+	libarchive/test/test_read_format_lha_header1.lzh.uu \
+	libarchive/test/test_read_format_lha_header2.lzh.uu \
+	libarchive/test/test_read_format_lha_header3.lzh.uu \
+	libarchive/test/test_read_format_lha_lh0.lzh.uu \
+	libarchive/test/test_read_format_lha_lh6.lzh.uu \
+	libarchive/test/test_read_format_lha_lh7.lzh.uu \
+	libarchive/test/test_read_format_lha_withjunk.lzh.uu \
+	libarchive/test/test_read_format_mtree.mtree.uu \
+	libarchive/test/test_read_format_mtree_nomagic.mtree.uu \
+	libarchive/test/test_read_format_mtree_nomagic2.mtree.uu \
+	libarchive/test/test_read_format_mtree_nomagic3.mtree.uu \
+	libarchive/test/test_read_format_rar.rar.uu \
+	libarchive/test/test_read_format_rar_binary_data.rar.uu \
+	libarchive/test/test_read_format_rar_compress_best.rar.uu \
+	libarchive/test/test_read_format_rar_compress_normal.rar.uu \
+	libarchive/test/test_read_format_rar_encryption_data.rar.uu \
+	libarchive/test/test_read_format_rar_encryption_header.rar.uu \
+	libarchive/test/test_read_format_rar_encryption_partially.rar.uu \
+	libarchive/test/test_read_format_rar_filter.rar.uu \
+	libarchive/test/test_read_format_rar_invalid1.rar.uu \
+	libarchive/test/test_read_format_rar_multi_lzss_blocks.rar.uu \
+	libarchive/test/test_read_format_rar_multivolume.part0001.rar.uu \
+	libarchive/test/test_read_format_rar_multivolume.part0002.rar.uu \
+	libarchive/test/test_read_format_rar_multivolume.part0003.rar.uu \
+	libarchive/test/test_read_format_rar_multivolume.part0004.rar.uu \
+	libarchive/test/test_read_format_rar_noeof.rar.uu \
+	libarchive/test/test_read_format_rar_ppmd_lzss_conversion.rar.uu \
+	libarchive/test/test_read_format_rar_ppmd_use_after_free.rar.uu \
+	libarchive/test/test_read_format_rar_ppmd_use_after_free2.rar.uu \
+	libarchive/test/test_read_format_rar_sfx.exe.uu \
+	libarchive/test/test_read_format_rar_subblock.rar.uu \
+	libarchive/test/test_read_format_rar_unicode.rar.uu \
+	libarchive/test/test_read_format_rar_windows.rar.uu \
+	libarchive/test/test_read_format_rar5_arm.rar.uu \
+	libarchive/test/test_read_format_rar5_blake2.rar.uu \
+	libarchive/test/test_read_format_rar5_compressed.rar.uu \
+	libarchive/test/test_read_format_rar5_different_window_size.rar.uu \
+	libarchive/test/test_read_format_rar5_different_solid_window_size.rar.uu \
+	libarchive/test/test_read_format_rar5_distance_overflow.rar.uu \
+	libarchive/test/test_read_format_rar5_extra_field_version.rar.uu \
+	libarchive/test/test_read_format_rar5_fileattr.rar.uu \
+	libarchive/test/test_read_format_rar5_hardlink.rar.uu \
+	libarchive/test/test_read_format_rar5_invalid_dict_reference.rar.uu \
+	libarchive/test/test_read_format_rar5_leftshift1.rar.uu \
+	libarchive/test/test_read_format_rar5_leftshift2.rar.uu \
+	libarchive/test/test_read_format_rar5_multiarchive.part01.rar.uu \
+	libarchive/test/test_read_format_rar5_multiarchive.part02.rar.uu \
+	libarchive/test/test_read_format_rar5_multiarchive.part03.rar.uu \
+	libarchive/test/test_read_format_rar5_multiarchive.part04.rar.uu \
+	libarchive/test/test_read_format_rar5_multiarchive.part05.rar.uu \
+	libarchive/test/test_read_format_rar5_multiarchive.part06.rar.uu \
+	libarchive/test/test_read_format_rar5_multiarchive.part07.rar.uu \
+	libarchive/test/test_read_format_rar5_multiarchive.part08.rar.uu \
+	libarchive/test/test_read_format_rar5_multiarchive_solid.part01.rar.uu \
+	libarchive/test/test_read_format_rar5_multiarchive_solid.part02.rar.uu \
+	libarchive/test/test_read_format_rar5_multiarchive_solid.part03.rar.uu \
+	libarchive/test/test_read_format_rar5_multiarchive_solid.part04.rar.uu \
+	libarchive/test/test_read_format_rar5_multiple_files.rar.uu \
+	libarchive/test/test_read_format_rar5_multiple_files_solid.rar.uu \
+	libarchive/test/test_read_format_rar5_nonempty_dir_stream.rar.uu \
+	libarchive/test/test_read_format_rar5_owner.rar.uu \
+	libarchive/test/test_read_format_rar5_readtables_overflow.rar.uu \
+	libarchive/test/test_read_format_rar5_sfx.exe.uu \
+	libarchive/test/test_read_format_rar5_solid.rar.uu \
+	libarchive/test/test_read_format_rar5_stored.rar.uu \
+	libarchive/test/test_read_format_rar5_stored_manyfiles.rar.uu \
+	libarchive/test/test_read_format_rar5_symlink.rar.uu \
+	libarchive/test/test_read_format_rar5_truncated_huff.rar.uu \
+	libarchive/test/test_read_format_rar5_win32.rar.uu \
+	libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu \
+	libarchive/test/test_read_format_rar5_different_winsize_on_merge.rar.uu \
+	libarchive/test/test_read_format_rar5_block_size_is_too_small.rar.uu \
+	libarchive/test/test_read_format_rar5_decode_number_out_of_bounds_read.rar.uu \
+	libarchive/test/test_read_format_raw.bufr.uu \
+	libarchive/test/test_read_format_raw.data.gz.uu \
+	libarchive/test/test_read_format_raw.data.Z.uu \
+	libarchive/test/test_read_format_raw.data.uu \
+	libarchive/test/test_read_format_tar_concatenated.tar.uu \
+	libarchive/test/test_read_format_tar_empty_filename.tar.uu \
+	libarchive/test/test_read_format_tar_empty_with_gnulabel.tar.uu \
+	libarchive/test/test_read_format_tar_empty_pax.tar.Z.uu \
+	libarchive/test/test_read_format_tar_filename_koi8r.tar.Z.uu \
+	libarchive/test/test_read_format_ustar_filename_cp866.tar.Z.uu \
+	libarchive/test/test_read_format_ustar_filename_eucjp.tar.Z.uu \
+	libarchive/test/test_read_format_ustar_filename_koi8r.tar.Z.uu \
+	libarchive/test/test_read_format_warc.warc.uu \
+	libarchive/test/test_read_format_zip.zip.uu \
+	libarchive/test/test_read_format_zip_7075_utf8_paths.zip.uu \
+	libarchive/test/test_read_format_zip_7z_deflate.zip.uu \
+	libarchive/test/test_read_format_zip_7z_lzma.zip.uu \
+	libarchive/test/test_read_format_zip_bz2_hang.zip.uu \
+	libarchive/test/test_read_format_zip_bzip2.zipx.uu \
+	libarchive/test/test_read_format_zip_bzip2_multi.zipx.uu \
+	libarchive/test/test_read_format_zip_comment_stored_1.zip.uu \
+	libarchive/test/test_read_format_zip_comment_stored_2.zip.uu \
+	libarchive/test/test_read_format_zip_encryption_data.zip.uu \
+	libarchive/test/test_read_format_zip_encryption_header.zip.uu \
+	libarchive/test/test_read_format_zip_encryption_partially.zip.uu \
+	libarchive/test/test_read_format_zip_extra_padding.zip.uu \
+	libarchive/test/test_read_format_zip_filename_cp866.zip.uu \
+	libarchive/test/test_read_format_zip_filename_cp932.zip.uu \
+	libarchive/test/test_read_format_zip_filename_koi8r.zip.uu \
+	libarchive/test/test_read_format_zip_filename_utf8_jp.zip.uu \
+	libarchive/test/test_read_format_zip_filename_utf8_ru.zip.uu \
+	libarchive/test/test_read_format_zip_filename_utf8_ru2.zip.uu \
+	libarchive/test/test_read_format_zip_high_compression.zip.uu \
+	libarchive/test/test_read_format_zip_length_at_end.zip.uu \
+	libarchive/test/test_read_format_zip_lzma.zipx.uu \
+	libarchive/test/test_read_format_zip_lzma_alone_leak.zipx.uu \
+	libarchive/test/test_read_format_zip_lzma_multi.zipx.uu \
+	libarchive/test/test_read_format_zip_lzma_stream_end.zipx.uu \
+	libarchive/test/test_read_format_zip_jar.jar.uu \
+	libarchive/test/test_read_format_zip_mac_metadata.zip.uu \
+	libarchive/test/test_read_format_zip_malformed1.zip.uu \
+	libarchive/test/test_read_format_zip_msdos.zip.uu \
+	libarchive/test/test_read_format_zip_nested.zip.uu \
+	libarchive/test/test_read_format_zip_nofiletype.zip.uu \
+	libarchive/test/test_read_format_zip_padded1.zip.uu \
+	libarchive/test/test_read_format_zip_padded2.zip.uu \
+	libarchive/test/test_read_format_zip_padded3.zip.uu \
+	libarchive/test/test_read_format_zip_ppmd8.zipx.uu \
+	libarchive/test/test_read_format_zip_ppmd8_crash_1.zipx.uu \
+	libarchive/test/test_read_format_zip_ppmd8_crash_2.zipx.uu \
+	libarchive/test/test_read_format_zip_ppmd8_multi.zipx.uu \
+	libarchive/test/test_read_format_zip_sfx.uu \
+	libarchive/test/test_read_format_zip_symlink.zip.uu \
+	libarchive/test/test_read_format_zip_traditional_encryption_data.zip.uu \
+	libarchive/test/test_read_format_zip_ux.zip.uu \
+	libarchive/test/test_read_format_zip_winzip_aes128.zip.uu \
+	libarchive/test/test_read_format_zip_winzip_aes256.zip.uu \
+	libarchive/test/test_read_format_zip_winzip_aes256_large.zip.uu \
+	libarchive/test/test_read_format_zip_winzip_aes256_stored.zip.uu \
+	libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.zip.uu \
+	libarchive/test/test_read_format_zip_xz_multi.zipx.uu \
+	libarchive/test/test_read_format_zip_zip64a.zip.uu \
+	libarchive/test/test_read_format_zip_zip64b.zip.uu \
+	libarchive/test/test_read_large_splitted_rar_aa.uu \
+	libarchive/test/test_read_large_splitted_rar_ab.uu \
+	libarchive/test/test_read_large_splitted_rar_ac.uu \
+	libarchive/test/test_read_large_splitted_rar_ad.uu \
+	libarchive/test/test_read_large_splitted_rar_ae.uu \
+	libarchive/test/test_read_pax_xattr_rht_security_selinux.tar.uu \
+	libarchive/test/test_read_pax_xattr_schily.tar.uu \
+	libarchive/test/test_read_splitted_rar_aa.uu \
+	libarchive/test/test_read_splitted_rar_ab.uu \
+	libarchive/test/test_read_splitted_rar_ac.uu \
+	libarchive/test/test_read_splitted_rar_ad.uu \
+	libarchive/test/test_read_too_many_filters.gz.uu \
+	libarchive/test/test_splitted_rar_seek_support_aa.uu \
+	libarchive/test/test_splitted_rar_seek_support_ab.uu \
+	libarchive/test/test_splitted_rar_seek_support_ac.uu \
+	libarchive/test/test_write_disk_appledouble.cpio.gz.uu \
+	libarchive/test/test_write_disk_hfs_compression.tgz.uu \
+	libarchive/test/test_write_disk_mac_metadata.tar.gz.uu \
+	libarchive/test/test_write_disk_no_hfs_compression.tgz.uu \
+	libarchive/test/CMakeLists.txt \
+	libarchive/test/README
+
+#
+# Common code for libarchive frontends (cpio, tar)
+#
+libarchive_fe_la_SOURCES= \
+	libarchive_fe/err.c \
+	libarchive_fe/err.h \
+	libarchive_fe/lafe_platform.h \
+	libarchive_fe/line_reader.c \
+	libarchive_fe/line_reader.h \
+	libarchive_fe/passphrase.c \
+	libarchive_fe/passphrase.h
+
+libarchive_fe_la_CPPFLAGS= -I$(top_srcdir)/libarchive
+#
+#
+# bsdtar source, docs, etc.
+#
+#
+
+bsdtar_SOURCES= \
+		tar/bsdtar.c \
+		tar/bsdtar.h \
+		tar/bsdtar_platform.h \
+		tar/cmdline.c \
+		tar/creation_set.c \
+		tar/read.c \
+		tar/subst.c \
+		tar/util.c \
+		tar/write.c
+
+if INC_WINDOWS_FILES
+bsdtar_SOURCES+= \
+		tar/bsdtar_windows.h \
+		tar/bsdtar_windows.c
+endif
+
+bsdtar_DEPENDENCIES= libarchive.la libarchive_fe.la
+
+if STATIC_BSDTAR
+bsdtar_ldstatic= -static
+bsdtar_ccstatic= -DLIBARCHIVE_STATIC
+else
+bsdtar_ldstatic=
+bsdtar_ccstatic=
+endif
+
+bsdtar_LDADD= libarchive.la libarchive_fe.la $(LTLIBICONV)
+bsdtar_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdtar_ccstatic) $(PLATFORMCPPFLAGS)
+bsdtar_LDFLAGS= $(bsdtar_ldstatic) $(GC_SECTIONS)
+
+bsdtar_EXTRA_DIST= \
+	tar/bsdtar.1 \
+	tar/bsdtar_windows.h \
+	tar/bsdtar_windows.c \
+	tar/CMakeLists.txt \
+	tar/config_freebsd.h
+
+
+if BUILD_BSDTAR
+bsdtar_man_MANS= tar/bsdtar.1
+bsdtar_programs= bsdtar
+else
+bsdtar_man_MANS=
+bsdtar_programs=
+endif
+
+#
+# bsdtar_test
+#
+
+bsdtar_test_SOURCES= \
+	$(test_utils_SOURCES) \
+	tar/test/test.h \
+	tar/test/test_0.c \
+	tar/test/test_basic.c \
+	tar/test/test_copy.c \
+	tar/test/test_empty_mtree.c \
+	tar/test/test_extract_tar_Z.c \
+	tar/test/test_extract_tar_bz2.c \
+	tar/test/test_extract_tar_grz.c \
+	tar/test/test_extract_tar_gz.c \
+	tar/test/test_extract_tar_lrz.c \
+	tar/test/test_extract_tar_lz.c \
+	tar/test/test_extract_tar_lz4.c \
+	tar/test/test_extract_tar_lzma.c \
+	tar/test/test_extract_tar_lzo.c \
+	tar/test/test_extract_tar_xz.c \
+	tar/test/test_extract_tar_zstd.c \
+	tar/test/test_format_newc.c \
+	tar/test/test_help.c \
+	tar/test/test_leading_slash.c \
+	tar/test/test_missing_file.c \
+	tar/test/test_option_C_mtree.c \
+	tar/test/test_option_C_upper.c \
+	tar/test/test_option_H_upper.c \
+	tar/test/test_option_L_upper.c \
+	tar/test/test_option_O_upper.c \
+	tar/test/test_option_T_upper.c \
+	tar/test/test_option_U_upper.c \
+	tar/test/test_option_X_upper.c \
+	tar/test/test_option_acls.c \
+	tar/test/test_option_a.c \
+	tar/test/test_option_b.c \
+	tar/test/test_option_b64encode.c \
+	tar/test/test_option_exclude.c \
+	tar/test/test_option_exclude_vcs.c \
+	tar/test/test_option_fflags.c \
+	tar/test/test_option_gid_gname.c \
+	tar/test/test_option_grzip.c \
+	tar/test/test_option_ignore_zeros.c \
+	tar/test/test_option_j.c \
+	tar/test/test_option_k.c \
+	tar/test/test_option_keep_newer_files.c \
+	tar/test/test_option_lrzip.c \
+	tar/test/test_option_lz4.c \
+	tar/test/test_option_lzma.c \
+	tar/test/test_option_lzop.c \
+	tar/test/test_option_n.c \
+	tar/test/test_option_newer_than.c \
+	tar/test/test_option_nodump.c \
+	tar/test/test_option_older_than.c \
+	tar/test/test_option_passphrase.c \
+	tar/test/test_option_q.c \
+	tar/test/test_option_r.c \
+	tar/test/test_option_s.c \
+	tar/test/test_option_safe_writes.c \
+	tar/test/test_option_uid_uname.c \
+	tar/test/test_option_uuencode.c \
+	tar/test/test_option_xattrs.c \
+	tar/test/test_option_xz.c \
+	tar/test/test_option_z.c \
+	tar/test/test_option_zstd.c \
+	tar/test/test_patterns.c \
+	tar/test/test_print_longpath.c \
+	tar/test/test_stdio.c \
+	tar/test/test_strip_components.c \
+	tar/test/test_symlink_dir.c \
+	tar/test/test_version.c \
+	tar/test/test_windows.c
+
+bsdtar_test_CPPFLAGS=\
+	-I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \
+	-I$(top_srcdir)/test_utils \
+	-I$(top_srcdir)/tar -I$(top_srcdir)/tar/test \
+	-I$(top_builddir)/tar/test \
+	$(PLATFORMCPPFLAGS)
+
+tar/test/list.h: Makefile
+	$(MKDIR_P) tar/test
+	cat $(top_srcdir)/tar/test/test_*.c | grep '^DEFINE_TEST' > tar/test/list.h
+
+if BUILD_BSDTAR
+bsdtar_test_programs= bsdtar_test
+bsdtar_TESTS_ENVIRONMENT= BSDTAR=`cd $(top_builddir);/bin/pwd`/bsdtar$(EXEEXT) BSDTAR_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/tar/test
+else
+bsdtar_test_programs=
+bsdtar_TESTS_ENVIRONMENT=
+endif
+
+bsdtar_test_EXTRA_DIST= \
+	tar/test/list.h \
+	tar/test/test_extract.tar.Z.uu \
+	tar/test/test_extract.tar.bz2.uu \
+	tar/test/test_extract.tar.grz.uu \
+	tar/test/test_extract.tar.gz.uu \
+	tar/test/test_extract.tar.lrz.uu \
+	tar/test/test_extract.tar.lz.uu \
+	tar/test/test_extract.tar.lz4.uu \
+	tar/test/test_extract.tar.zst.uu \
+	tar/test/test_extract.tar.lzma.uu \
+	tar/test/test_extract.tar.lzo.uu \
+	tar/test/test_extract.tar.xz.uu \
+	tar/test/test_leading_slash.tar.uu \
+	tar/test/test_option_keep_newer_files.tar.Z.uu \
+	tar/test/test_option_passphrase.zip.uu \
+	tar/test/test_option_s.tar.Z.uu \
+	tar/test/test_patterns_2.tar.uu \
+	tar/test/test_patterns_3.tar.uu \
+	tar/test/test_patterns_4.tar.uu \
+	tar/test/test_print_longpath.tar.Z.uu \
+	tar/test/CMakeLists.txt
+
+
+#
+#
+# bsdcpio source, docs, etc.
+#
+#
+
+bsdcpio_SOURCES= \
+		cpio/cmdline.c \
+		cpio/cpio.c \
+		cpio/cpio.h \
+		cpio/cpio_platform.h
+
+if INC_WINDOWS_FILES
+bsdcpio_SOURCES+= \
+		cpio/cpio_windows.h \
+		cpio/cpio_windows.c
+endif
+
+bsdcpio_DEPENDENCIES = libarchive.la libarchive_fe.la
+
+
+if STATIC_BSDCPIO
+bsdcpio_ldstatic= -static
+bsdcpio_ccstatic= -DLIBARCHIVE_STATIC
+else
+bsdcpio_ldstatic=
+bsdcpio_ccstatic=
+endif
+
+bsdcpio_LDADD= libarchive_fe.la libarchive.la $(LTLIBICONV)
+bsdcpio_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdcpio_ccstatic) $(PLATFORMCPPFLAGS)
+bsdcpio_LDFLAGS= $(bsdcpio_ldstatic) $(GC_SECTIONS)
+
+bsdcpio_EXTRA_DIST= \
+	cpio/bsdcpio.1 \
+	cpio/cpio_windows.h \
+	cpio/cpio_windows.c \
+	cpio/CMakeLists.txt \
+	cpio/config_freebsd.h
+
+
+if BUILD_BSDCPIO
+# Manpages to install
+bsdcpio_man_MANS= cpio/bsdcpio.1
+bsdcpio_programs= bsdcpio
+else
+bsdcpio_man_MANS=
+bsdcpio_programs=
+endif
+
+#
+# bsdcpio_test
+#
+
+bsdcpio_test_SOURCES= \
+	$(test_utils_SOURCES) \
+	cpio/cmdline.c \
+	cpio/test/test.h \
+	cpio/test/test_0.c \
+	cpio/test/test_basic.c \
+	cpio/test/test_cmdline.c \
+	cpio/test/test_extract_cpio_Z.c \
+	cpio/test/test_extract_cpio_bz2.c \
+	cpio/test/test_extract_cpio_grz.c \
+	cpio/test/test_extract_cpio_gz.c \
+	cpio/test/test_extract_cpio_lrz.c \
+	cpio/test/test_extract_cpio_lz.c \
+	cpio/test/test_extract_cpio_lz4.c \
+	cpio/test/test_extract_cpio_lzma.c \
+	cpio/test/test_extract_cpio_lzo.c \
+	cpio/test/test_extract_cpio_xz.c \
+	cpio/test/test_extract_cpio_zstd.c \
+	cpio/test/test_format_newc.c \
+	cpio/test/test_gcpio_compat.c \
+	cpio/test/test_missing_file.c \
+	cpio/test/test_option_0.c \
+	cpio/test/test_option_B_upper.c \
+	cpio/test/test_option_C_upper.c \
+	cpio/test/test_option_J_upper.c \
+	cpio/test/test_option_L_upper.c \
+	cpio/test/test_option_Z_upper.c \
+	cpio/test/test_option_a.c \
+	cpio/test/test_option_b64encode.c \
+	cpio/test/test_option_c.c \
+	cpio/test/test_option_d.c \
+	cpio/test/test_option_f.c \
+	cpio/test/test_option_grzip.c \
+	cpio/test/test_option_help.c \
+	cpio/test/test_option_l.c \
+	cpio/test/test_option_lrzip.c \
+	cpio/test/test_option_lz4.c \
+	cpio/test/test_option_lzma.c \
+	cpio/test/test_option_lzop.c \
+	cpio/test/test_option_m.c \
+	cpio/test/test_option_passphrase.c \
+	cpio/test/test_option_t.c \
+	cpio/test/test_option_u.c \
+	cpio/test/test_option_uuencode.c \
+	cpio/test/test_option_version.c \
+	cpio/test/test_option_xz.c \
+	cpio/test/test_option_y.c \
+	cpio/test/test_option_z.c \
+	cpio/test/test_option_zstd.c \
+	cpio/test/test_owner_parse.c \
+	cpio/test/test_passthrough_dotdot.c \
+	cpio/test/test_passthrough_reverse.c
+
+bsdcpio_test_CPPFLAGS= \
+	-I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \
+	-I$(top_srcdir)/test_utils \
+	-I$(top_srcdir)/cpio -I$(top_srcdir)/cpio/test \
+	-I$(top_builddir)/cpio/test \
+	$(PLATFORMCPPFLAGS)
+bsdcpio_test_LDADD=libarchive_fe.la
+
+cpio/test/list.h: Makefile
+	$(MKDIR_P) cpio/test
+	cat $(top_srcdir)/cpio/test/test_*.c | grep '^DEFINE_TEST' > cpio/test/list.h
+
+if BUILD_BSDCPIO
+bsdcpio_test_programs= bsdcpio_test
+bsdcpio_TESTS_ENVIRONMENT= BSDCPIO=`cd $(top_builddir);/bin/pwd`/bsdcpio$(EXEEXT) BSDCPIO_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/cpio/test
+else
+bsdcpio_test_programs=
+bsdcpio_TESTS_ENVIRONMENT=
+endif
+
+bsdcpio_test_EXTRA_DIST= \
+	cpio/test/list.h \
+	cpio/test/test_extract.cpio.Z.uu \
+	cpio/test/test_extract.cpio.bz2.uu \
+	cpio/test/test_extract.cpio.grz.uu \
+	cpio/test/test_extract.cpio.gz.uu \
+	cpio/test/test_extract.cpio.lrz.uu \
+	cpio/test/test_extract.cpio.lz.uu \
+	cpio/test/test_extract.cpio.lz4.uu \
+	cpio/test/test_extract.cpio.zst.uu \
+	cpio/test/test_extract.cpio.lzma.uu \
+	cpio/test/test_extract.cpio.lzo.uu \
+	cpio/test/test_extract.cpio.xz.uu \
+	cpio/test/test_gcpio_compat_ref.bin.uu \
+	cpio/test/test_gcpio_compat_ref.crc.uu \
+	cpio/test/test_gcpio_compat_ref.newc.uu \
+	cpio/test/test_gcpio_compat_ref.ustar.uu \
+	cpio/test/test_gcpio_compat_ref_nosym.bin.uu \
+	cpio/test/test_gcpio_compat_ref_nosym.crc.uu \
+	cpio/test/test_gcpio_compat_ref_nosym.newc.uu \
+	cpio/test/test_gcpio_compat_ref_nosym.ustar.uu \
+	cpio/test/test_option_f.cpio.uu \
+	cpio/test/test_option_m.cpio.uu \
+	cpio/test/test_option_passphrase.zip.uu \
+	cpio/test/test_option_t.cpio.uu \
+	cpio/test/test_option_t.stdout.uu \
+	cpio/test/test_option_tv.stdout.uu \
+	cpio/test/CMakeLists.txt
+
+#
+#
+# bsdcat source, docs, etc.
+#
+#
+
+bsdcat_SOURCES= \
+		cat/bsdcat.c \
+		cat/bsdcat.h \
+		cat/bsdcat_platform.h \
+		cat/cmdline.c
+
+if INC_WINDOWS_FILES
+bsdcat_SOURCES+=
+endif
+
+bsdcat_DEPENDENCIES = libarchive.la libarchive_fe.la
+
+
+if STATIC_BSDCAT
+bsdcat_ldstatic= -static
+bsdcat_ccstatic= -DLIBARCHIVE_STATIC
+else
+bsdcat_ldstatic=
+bsdcat_ccstatic=
+endif
+
+bsdcat_LDADD= libarchive_fe.la libarchive.la $(LTLIBICONV)
+bsdcat_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdcat_ccstatic) $(PLATFORMCPPFLAGS)
+bsdcat_LDFLAGS= $(bsdcat_ldstatic) $(GC_SECTIONS)
+
+bsdcat_EXTRA_DIST= \
+	cat/bsdcat.1 \
+	cat/CMakeLists.txt
+
+
+if BUILD_BSDCAT
+# Manpages to install
+bsdcat_man_MANS= cat/bsdcat.1
+bsdcat_programs= bsdcat
+else
+bsdcat_man_MANS=
+bsdcat_programs=
+endif
+
+#
+# bsdcat_test
+#
+
+bsdcat_test_SOURCES= \
+	$(test_utils_SOURCES) \
+	cat/test/test.h \
+	cat/test/test_0.c \
+	cat/test/test_empty_gz.c \
+	cat/test/test_empty_lz4.c \
+	cat/test/test_empty_xz.c \
+	cat/test/test_empty_zstd.c \
+	cat/test/test_error.c \
+	cat/test/test_error_mixed.c \
+	cat/test/test_expand_Z.c \
+	cat/test/test_expand_bz2.c \
+	cat/test/test_expand_gz.c \
+	cat/test/test_expand_lz4.c \
+	cat/test/test_expand_mixed.c \
+	cat/test/test_expand_plain.c \
+	cat/test/test_expand_xz.c \
+	cat/test/test_expand_zstd.c \
+	cat/test/test_help.c \
+	cat/test/test_stdin.c \
+	cat/test/test_version.c
+
+bsdcat_test_CPPFLAGS= \
+	-I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \
+	-I$(top_srcdir)/test_utils \
+	-I$(top_srcdir)/cat -I$(top_srcdir)/cat/test \
+	-I$(top_builddir)/cat/test \
+	$(PLATFORMCPPFLAGS)
+bsdcat_test_LDADD=libarchive_fe.la
+
+cat/test/list.h: Makefile
+	cat $(top_srcdir)/cat/test/test_*.c | grep '^DEFINE_TEST' > cat/test/list.h
+
+if BUILD_BSDCAT
+bsdcat_test_programs= bsdcat_test
+bsdcat_TESTS_ENVIRONMENT= BSDCAT=`cd $(top_builddir);/bin/pwd`/bsdcat$(EXEEXT) BSDCAT_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/cat/test
+else
+bsdcat_test_programs=
+bsdcat_TESTS_ENVIRONMENT=
+endif
+
+bsdcat_test_EXTRA_DIST= \
+	cat/test/list.h \
+	cat/test/test_empty.gz.uu \
+	cat/test/test_empty.lz4.uu \
+	cat/test/test_empty.zst.uu \
+	cat/test/test_empty.xz.uu \
+	cat/test/test_expand.Z.uu \
+	cat/test/test_expand.bz2.uu \
+	cat/test/test_expand.gz.uu \
+	cat/test/test_expand.lz4.uu \
+	cat/test/test_expand.zst.uu \
+	cat/test/test_expand.plain.uu \
+	cat/test/test_expand.xz.uu \
+	cat/test/CMakeLists.txt

+ 741 - 0
core.mod/libarchive/NEWS

@@ -0,0 +1,741 @@
+Aug 22, 2021: libarchive 3.5.2 released
+
+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 <sigh>.
+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.

+ 227 - 0
core.mod/libarchive/README.md

@@ -0,0 +1,227 @@
+# Welcome to libarchive!
+
+The libarchive project develops a portable, efficient C library that
+can read and write streaming archives in a variety of formats.  It
+also includes implementations of the common `tar`, `cpio`, and `zcat`
+command-line tools that use the libarchive library.
+
+## Questions?  Issues?
+
+* http://www.libarchive.org is the home for ongoing
+  libarchive development, including documentation,
+  and links to the libarchive mailing lists.
+* To report an issue, use the issue tracker at
+  https://github.com/libarchive/libarchive/issues
+* To submit an enhancement to libarchive, please
+  submit a pull request via GitHub: https://github.com/libarchive/libarchive/pulls
+
+## Contents of the Distribution
+
+This distribution bundle includes the following major components:
+
+* **libarchive**: a library for reading and writing streaming archives
+* **tar**: the 'bsdtar' program is a full-featured 'tar' implementation built on libarchive
+* **cpio**: the 'bsdcpio' program is a different interface to essentially the same functionality
+* **cat**: the 'bsdcat' program is a simple replacement tool for zcat, bzcat, xzcat, and such
+* **examples**: Some small example programs that you may find useful.
+* **examples/minitar**: a compact sample demonstrating use of libarchive.
+* **contrib**:  Various items sent to me by third parties; please contact the authors with any questions.
+
+The top-level directory contains the following information files:
+
+* **NEWS** - highlights of recent changes
+* **COPYING** - what you can do with this
+* **INSTALL** - installation instructions
+* **README** - this file
+* **CMakeLists.txt** - input for "cmake" build tool, see INSTALL
+* **configure** - configuration script, see INSTALL for details.  If your copy of the source lacks a `configure` script, you can try to construct it by running the script in `build/autogen.sh` (or use `cmake`).
+
+The following files in the top-level directory are used by the 'configure' script:
+* `Makefile.am`, `aclocal.m4`, `configure.ac` - used to build this distribution, only needed by maintainers
+* `Makefile.in`, `config.h.in` - templates used by configure script
+
+## Documentation
+
+In addition to the informational articles and documentation
+in the online [libarchive Wiki](https://github.com/libarchive/libarchive/wiki),
+the distribution also includes a number of manual pages:
+
+ * bsdtar.1 explains the use of the bsdtar program
+ * bsdcpio.1 explains the use of the bsdcpio program
+ * bsdcat.1 explains the use of the bsdcat program
+ * libarchive.3 gives an overview of the library as a whole
+ * archive_read.3, archive_write.3, archive_write_disk.3, and
+   archive_read_disk.3 provide detailed calling sequences for the read
+   and write APIs
+ * archive_entry.3 details the "struct archive_entry" utility class
+ * archive_internals.3 provides some insight into libarchive's
+   internal structure and operation.
+ * libarchive-formats.5 documents the file formats supported by the library
+ * cpio.5, mtree.5, and tar.5 provide detailed information about these
+   popular archive formats, including hard-to-find details about
+   modern cpio and tar variants.
+
+The manual pages above are provided in the 'doc' directory in
+a number of different formats.
+
+You should also read the copious comments in `archive.h` and the
+source code for the sample programs for more details.  Please let us
+know about any errors or omissions you find.
+
+## Supported Formats
+
+Currently, the library automatically detects and reads the following formats:
+  * Old V7 tar archives
+  * POSIX ustar
+  * GNU tar format (including GNU long filenames, long link names, and sparse files)
+  * Solaris 9 extended tar format (including ACLs)
+  * POSIX pax interchange format
+  * POSIX octet-oriented cpio
+  * SVR4 ASCII cpio
+  * Binary cpio (big-endian or little-endian)
+  * PWB binary cpio
+  * ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
+  * ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives)
+  * ZIPX archives (with support for bzip2, ppmd8, lzma and xz compressed entries)
+  * GNU and BSD 'ar' archives
+  * 'mtree' format
+  * 7-Zip archives
+  * Microsoft CAB format
+  * LHA and LZH archives
+  * RAR and RAR 5.0 archives (with some limitations due to RAR's proprietary status)
+  * XAR archives
+
+The library also detects and handles any of the following before evaluating the archive:
+  * uuencoded files
+  * files with RPM wrapper
+  * gzip compression
+  * bzip2 compression
+  * compress/LZW compression
+  * lzma, lzip, and xz compression
+  * lz4 compression
+  * lzop compression
+  * zstandard compression
+
+The library can create archives in any of the following formats:
+  * POSIX ustar
+  * POSIX pax interchange format
+  * "restricted" pax format, which will create ustar archives except for
+    entries that require pax extensions (for long filenames, ACLs, etc).
+  * Old GNU tar format
+  * Old V7 tar format
+  * POSIX octet-oriented cpio
+  * SVR4 "newc" cpio
+  * Binary cpio (little-endian)
+  * PWB binary cpio
+  * shar archives
+  * ZIP archives (with uncompressed or "deflate" compressed entries)
+  * GNU and BSD 'ar' archives
+  * 'mtree' format
+  * ISO9660 format
+  * 7-Zip archives
+  * XAR archives
+
+When creating archives, the result can be filtered with any of the following:
+  * uuencode
+  * gzip compression
+  * bzip2 compression
+  * compress/LZW compression
+  * lzma, lzip, and xz compression
+  * lz4 compression
+  * lzop compression
+  * zstandard compression
+
+## Notes about the Library Design
+
+The following notes address many of the most common
+questions we are asked about libarchive:
+
+* This is a heavily stream-oriented system.  That means that
+  it is optimized to read or write the archive in a single
+  pass from beginning to end.  For example, this allows
+  libarchive to process archives too large to store on disk
+  by processing them on-the-fly as they are read from or
+  written to a network or tape drive.  This also makes
+  libarchive useful for tools that need to produce
+  archives on-the-fly (such as webservers that provide
+  archived contents of a users account).
+
+* In-place modification and random access to the contents
+  of an archive are not directly supported.  For some formats,
+  this is not an issue: For example, tar.gz archives are not
+  designed for random access.  In some other cases, libarchive
+  can re-open an archive and scan it from the beginning quickly
+  enough to provide the needed abilities even without true
+  random access.  Of course, some applications do require true
+  random access; those applications should consider alternatives
+  to libarchive.
+
+* The library is designed to be extended with new compression and
+  archive formats.  The only requirement is that the format be
+  readable or writable as a stream and that each archive entry be
+  independent.  There are articles on the libarchive Wiki explaining
+  how to extend libarchive.
+
+* On read, compression and format are always detected automatically.
+
+* The same API is used for all formats; it should be very
+  easy for software using libarchive to transparently handle
+  any of libarchive's archiving formats.
+
+* Libarchive's automatic support for decompression can be used
+  without archiving by explicitly selecting the "raw" and "empty"
+  formats.
+
+* I've attempted to minimize static link pollution.  If you don't
+  explicitly invoke a particular feature (such as support for a
+  particular compression or format), it won't get pulled in to
+  statically-linked programs.  In particular, if you don't explicitly
+  enable a particular compression or decompression support, you won't
+  need to link against the corresponding compression or decompression
+  libraries.  This also reduces the size of statically-linked
+  binaries in environments where that matters.
+
+* The library is generally _thread safe_ depending on the platform:
+  it does not define any global variables of its own.  However, some
+  platforms do not provide fully thread-safe versions of key C library
+  functions.  On those platforms, libarchive will use the non-thread-safe
+  functions.  Patches to improve this are of great interest to us.
+
+* In particular, libarchive's modules to read or write a directory
+  tree do use `chdir()` to optimize the directory traversals.  This
+  can cause problems for programs that expect to do disk access from
+  multiple threads.  Of course, those modules are completely
+  optional and you can use the rest of libarchive without them.
+
+* The library is _not_ thread aware, however.  It does no locking
+  or thread management of any kind.  If you create a libarchive
+  object and need to access it from multiple threads, you will
+  need to provide your own locking.
+
+* On read, the library accepts whatever blocks you hand it.
+  Your read callback is free to pass the library a byte at a time
+  or mmap the entire archive and give it to the library at once.
+  On write, the library always produces correctly-blocked output.
+
+* The object-style approach allows you to have multiple archive streams
+  open at once.  bsdtar uses this in its "@archive" extension.
+
+* The archive itself is read/written using callback functions.
+  You can read an archive directly from an in-memory buffer or
+  write it to a socket, if you wish.  There are some utility
+  functions to provide easy-to-use "open file," etc, capabilities.
+
+* The read/write APIs are designed to allow individual entries
+  to be read or written to any data source:  You can create
+  a block of data in memory and add it to a tar archive without
+  first writing a temporary file.  You can also read an entry from
+  an archive and write the data directly to a socket.  If you want
+  to read/write entries to disk, there are convenience functions to
+  make this especially easy.
+
+* Note: The "pax interchange format" is a POSIX standard extended tar
+  format that should be used when the older _ustar_ format is not
+  appropriate.  It has many advantages over other tar formats
+  (including the legacy GNU tar format) and is widely supported by
+  current tar implementations.
+

+ 35 - 0
core.mod/libarchive/build/README.txt

@@ -0,0 +1,35 @@
+Notes on making a new release of libarchive
+===========================================
+
+The following serves as a guide for libarchive developers on the general
+process to be followed when making a new release of libarchive.
+
+* Update build/version with the version number of the release to be made.
+* If the library's ABI has changed, the library's soname major version *MUST*
+  be updated. Update configure.ac and CMakeLists.txt appropriately.
+  - For configure.ac, the variable ARCHIVE_INTERFACE needs to be updated.
+  - For CMakeLists.txt, the variable INTERFACE_VERSION needs to be updated.
+* Update the entries in the NEWS file accordingly.
+* Run `build/makerelease.sh` from the top source directory. Running this script
+  will do the following.
+  - Removes all Makefile.am development build specific CFLAGS from
+    Makefile.am.
+  - Update configure scripts and header files with the appropriate version
+    number from build/version.
+  - Rebuild the documentation directory.
+  - Runs a full cmake build and test.
+  - Runs a full autotools build and test.
+  - Builds the .tar.gz and .zip distribution files.
+* Commit all changed files into git.
+  - This should be build/version, NEWS, and the files edited by running
+    build/makerelease.sh.
+* Tag the release appropriately. The tag should also have an appropriate
+  message.
+  - The git command is as follows:
+    $ git tag -m "Libarchive <version>" v<version>
+    Replace <version> with the version to be released.
+* Copy all the generated wiki files and commit them into the libarchive.wiki
+  repository. Overwrite any preexisting files with the same name (these files
+  are always autogenerated from the libarchive release after every release).
+* Update the libarchive.org website accordingly.
+* Make an announcement to the libarchive-announce mailing list.

+ 67 - 0
core.mod/libarchive/build/autoconf/ax_append_compile_flags.m4

@@ -0,0 +1,67 @@
+# ===========================================================================
+#  http://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+#   For every FLAG1, FLAG2 it is checked whether the compiler works with the
+#   flag.  If it does, the flag is added FLAGS-VARIABLE
+#
+#   If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
+#   CFLAGS) is used.  During the check the flag is always added to the
+#   current language's flags.
+#
+#   If EXTRA-FLAGS is defined, it is added to the current language's default
+#   flags (e.g. CFLAGS) when the check is done.  The check is thus made with
+#   the flags: "CFLAGS EXTRA-FLAGS FLAG".  This can for example be used to
+#   force the compiler to issue an error when a bad flag is given.
+#
+#   INPUT gives an alternative input source to AC_COMPILE_IFELSE.
+#
+#   NOTE: This macro depends on the AX_APPEND_FLAG and
+#   AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with
+#   AX_APPEND_LINK_FLAGS.
+#
+# LICENSE
+#
+#   Copyright (c) 2011 Maarten Bosmans <[email protected]>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 5
+
+AC_DEFUN([AX_APPEND_COMPILE_FLAGS],
+[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG])
+AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
+for flag in $1; do
+  AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4])
+done
+])dnl AX_APPEND_COMPILE_FLAGS

+ 71 - 0
core.mod/libarchive/build/autoconf/ax_append_flag.m4

@@ -0,0 +1,71 @@
+# ===========================================================================
+#      http://www.gnu.org/software/autoconf-archive/ax_append_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
+#
+# DESCRIPTION
+#
+#   FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
+#   added in between.
+#
+#   If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
+#   CFLAGS) is used.  FLAGS-VARIABLE is not changed if it already contains
+#   FLAG.  If FLAGS-VARIABLE is unset in the shell, it is set to exactly
+#   FLAG.
+#
+#   NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Guido U. Draheim <[email protected]>
+#   Copyright (c) 2011 Maarten Bosmans <[email protected]>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 6
+
+AC_DEFUN([AX_APPEND_FLAG],
+[dnl
+AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
+AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
+AS_VAR_SET_IF(FLAGS,[
+  AS_CASE([" AS_VAR_GET(FLAGS) "],
+    [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
+    [
+     AS_VAR_APPEND(FLAGS,[" $1"])
+     AC_RUN_LOG([: FLAGS="$FLAGS"])
+    ])
+  ],
+  [
+  AS_VAR_SET(FLAGS,[$1])
+  AC_RUN_LOG([: FLAGS="$FLAGS"])
+  ])
+AS_VAR_POPDEF([FLAGS])dnl
+])dnl AX_APPEND_FLAG

+ 74 - 0
core.mod/libarchive/build/autoconf/ax_check_compile_flag.m4

@@ -0,0 +1,74 @@
+# ===========================================================================
+#   http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT])
+#
+# DESCRIPTION
+#
+#   Check whether the given FLAG works with the current language's compiler
+#   or gives an error.  (Warnings, however, are ignored)
+#
+#   ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
+#   success/failure.
+#
+#   If EXTRA-FLAGS is defined, it is added to the current language's default
+#   flags (e.g. CFLAGS) when the check is done.  The check is thus made with
+#   the flags: "CFLAGS EXTRA-FLAGS FLAG".  This can for example be used to
+#   force the compiler to issue an error when a bad flag is given.
+#
+#   INPUT gives an alternative input source to AC_COMPILE_IFELSE.
+#
+#   NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
+#   macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Guido U. Draheim <[email protected]>
+#   Copyright (c) 2011 Maarten Bosmans <[email protected]>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 4
+
+AC_DEFUN([AX_CHECK_COMPILE_FLAG],
+[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF
+AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
+AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
+  ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
+  _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
+  AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
+    [AS_VAR_SET(CACHEVAR,[yes])],
+    [AS_VAR_SET(CACHEVAR,[no])])
+  _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
+AS_VAR_IF(CACHEVAR,yes,
+  [m4_default([$2], :)],
+  [m4_default([$3], :)])
+AS_VAR_POPDEF([CACHEVAR])dnl
+])dnl AX_CHECK_COMPILE_FLAGS

+ 37 - 0
core.mod/libarchive/build/autoconf/ax_require_defined.m4

@@ -0,0 +1,37 @@
+# ===========================================================================
+#    http://www.gnu.org/software/autoconf-archive/ax_require_defined.html
+# ===========================================================================
+#
+# SYNOPSIS
+#
+#   AX_REQUIRE_DEFINED(MACRO)
+#
+# DESCRIPTION
+#
+#   AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
+#   been defined and thus are available for use.  This avoids random issues
+#   where a macro isn't expanded.  Instead the configure script emits a
+#   non-fatal:
+#
+#     ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
+#
+#   It's like AC_REQUIRE except it doesn't expand the required macro.
+#
+#   Here's an example:
+#
+#     AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
+#
+# LICENSE
+#
+#   Copyright (c) 2014 Mike Frysinger <[email protected]>
+#
+#   Copying and distribution of this file, with or without modification, are
+#   permitted in any medium without royalty provided the copyright notice
+#   and this notice are preserved. This file is offered as-is, without any
+#   warranty.
+
+#serial 1
+
+AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
+  m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
+])dnl AX_REQUIRE_DEFINED

+ 51 - 0
core.mod/libarchive/build/autoconf/check_stdcall_func.m4

@@ -0,0 +1,51 @@
+# AC_LANG_STDCALL_FUNC_LINK_TRY(FUNCTION, SIGNATURE)
+# -------------------------------
+# Produce a source which links correctly iff the FUNCTION exists.
+AC_DEFUN([AC_LANG_STDCALL_FUNC_LINK_TRY],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+# AC_CHECK_STDCALL_FUNC(FUNCTION, SIGNATURE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
+# -----------------------------------------------------------------
+AC_DEFUN([AC_CHECK_STDCALL_FUNC],
+[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl
+AC_CACHE_CHECK([for $1], ac_var,
+[AC_LINK_IFELSE([AC_LANG_STDCALL_FUNC_LINK_TRY([$1],[$2])],
+                [AS_VAR_SET(ac_var, yes)],
+                [AS_VAR_SET(ac_var, no)])])
+AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl
+AS_VAR_POPDEF([ac_var])dnl
+])# AC_CHECK_FUNC
+
+# AC_LANG_STDCALL_FUNC_LINK_TRY(C)(FUNCTION, SIGNATURE)
+# ----------------------------------
+# Don't include <ctype.h> because on OSF/1 3.0 it includes
+# <sys/types.h> which includes <sys/select.h> which contains a
+# prototype for select.  Similarly for bzero.
+m4_define([AC_LANG_STDCALL_FUNC_LINK_TRY(C)],
+[AC_LANG_PROGRAM(
+[/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char __stdcall $1 ( $2 ) below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char __stdcall $1 ( $2 );
+char (*f) ( $2 );
+],
+[/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$1) || defined (__stub___$1)
+choke me
+#else
+f = $1;
+#endif
+])])
+
+# AC_LANG_STDCALL_FUNC_LINK_TRY(C++)(FUNCTION)
+# ------------------------------------
+m4_copy([AC_LANG_STDCALL_FUNC_LINK_TRY(C)], [AC_LANG_STDCALL_FUNC_LINK_TRY(C++)])
+

+ 696 - 0
core.mod/libarchive/build/autoconf/config.rpath

@@ -0,0 +1,696 @@
+#! /bin/sh
+#
+# NOTE: This file was brought from
+#       http://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/config.rpath
+#       You should sometimes check if the file is updated and bring it to
+#       our trunk and copy this note to the top of that file.
+#
+# Output a system dependent set of variables, describing how to set the
+# run time search path of shared libraries in an executable.
+#
+#   Copyright 1996-2011 Free Software Foundation, Inc.
+#   Taken from GNU libtool, 2001
+#   Originally by Gordon Matzigkeit <[email protected]>, 1996
+#
+#   This file is free software; the Free Software Foundation gives
+#   unlimited permission to copy and/or distribute it, with or without
+#   modifications, as long as this notice is preserved.
+#
+# The first argument passed to this file is the canonical host specification,
+#    CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or
+#    CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
+# should be set by the caller.
+#
+# The set of defined variables is at the end of this script.
+
+# Known limitations:
+# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
+#   than 256 bytes, otherwise the compiler driver will dump core. The only
+#   known workaround is to choose shorter directory names for the build
+#   directory and/or the installation directory.
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+shrext=.so
+
+host="$1"
+host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+# Code taken from libtool.m4's _LT_CC_BASENAME.
+
+for cc_temp in $CC""; do
+  case $cc_temp in
+    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+    \-*) ;;
+    *) break;;
+  esac
+done
+cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
+
+# Code taken from libtool.m4's _LT_COMPILER_PIC.
+
+wl=
+if test "$GCC" = yes; then
+  wl='-Wl,'
+else
+  case "$host_os" in
+    aix*)
+      wl='-Wl,'
+      ;;
+    mingw* | cygwin* | msys* | pw32* | os2* | cegcc*)
+      ;;
+    hpux9* | hpux10* | hpux11*)
+      wl='-Wl,'
+      ;;
+    irix5* | irix6* | nonstopux*)
+      wl='-Wl,'
+      ;;
+    linux* | k*bsd*-gnu | kopensolaris*-gnu)
+      case $cc_basename in
+        ecc*)
+          wl='-Wl,'
+          ;;
+        icc* | ifort*)
+          wl='-Wl,'
+          ;;
+        lf95*)
+          wl='-Wl,'
+          ;;
+        nagfor*)
+          wl='-Wl,-Wl,,'
+          ;;
+        pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+          wl='-Wl,'
+          ;;
+        ccc*)
+          wl='-Wl,'
+          ;;
+        xl* | bgxl* | bgf* | mpixl*)
+          wl='-Wl,'
+          ;;
+        como)
+          wl='-lopt='
+          ;;
+        *)
+          case `$CC -V 2>&1 | sed 5q` in
+            *Sun\ F* | *Sun*Fortran*)
+              wl=
+              ;;
+            *Sun\ C*)
+              wl='-Wl,'
+              ;;
+          esac
+          ;;
+      esac
+      ;;
+    newsos6)
+      ;;
+    *nto* | *qnx*)
+      ;;
+    osf3* | osf4* | osf5*)
+      wl='-Wl,'
+      ;;
+    rdos*)
+      ;;
+    solaris*)
+      case $cc_basename in
+        f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+          wl='-Qoption ld '
+          ;;
+        *)
+          wl='-Wl,'
+          ;;
+      esac
+      ;;
+    sunos4*)
+      wl='-Qoption ld '
+      ;;
+    sysv4 | sysv4.2uw2* | sysv4.3*)
+      wl='-Wl,'
+      ;;
+    sysv4*MP*)
+      ;;
+    sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+      wl='-Wl,'
+      ;;
+    unicos*)
+      wl='-Wl,'
+      ;;
+    uts4*)
+      ;;
+  esac
+fi
+
+# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
+
+hardcode_libdir_flag_spec=
+hardcode_libdir_separator=
+hardcode_direct=no
+hardcode_minus_L=no
+
+case "$host_os" in
+  cygwin* | msys* | mingw* | pw32* | cegcc*)
+    # FIXME: the MSVC++ port hasn't been tested in a loooong time
+    # When not using gcc, we currently assume that we are using
+    # Microsoft Visual C++.
+    if test "$GCC" != yes; then
+      with_gnu_ld=no
+    fi
+    ;;
+  interix*)
+    # we just hope/assume this is gcc and not c89 (= MSVC++)
+    with_gnu_ld=yes
+    ;;
+  openbsd*)
+    with_gnu_ld=no
+    ;;
+esac
+
+ld_shlibs=yes
+if test "$with_gnu_ld" = yes; then
+  # Set some defaults for GNU ld with shared library support. These
+  # are reset later if shared libraries are not supported. Putting them
+  # here allows them to be overridden if necessary.
+  # Unlike libtool, we use -rpath here, not --rpath, since the documented
+  # option of GNU ld is called -rpath, not --rpath.
+  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+  case "$host_os" in
+    aix[3-9]*)
+      # On AIX/PPC, the GNU linker is very broken
+      if test "$host_cpu" != ia64; then
+        ld_shlibs=no
+      fi
+      ;;
+    amigaos*)
+      case "$host_cpu" in
+        powerpc)
+          ;;
+        m68k)
+          hardcode_libdir_flag_spec='-L$libdir'
+          hardcode_minus_L=yes
+          ;;
+      esac
+      ;;
+    beos*)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    cygwin* | msys* | mingw* | pw32* | cegcc*)
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec='-L$libdir'
+      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    haiku*)
+      ;;
+    interix[3-9]*)
+      hardcode_direct=no
+      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+      ;;
+    gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    netbsd*)
+      ;;
+    solaris*)
+      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+        ld_shlibs=no
+      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+      case `$LD -v 2>&1` in
+        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+          ld_shlibs=no
+          ;;
+        *)
+          if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+            hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+          else
+            ld_shlibs=no
+          fi
+          ;;
+      esac
+      ;;
+    sunos4*)
+      hardcode_direct=yes
+      ;;
+    *)
+      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+  esac
+  if test "$ld_shlibs" = no; then
+    hardcode_libdir_flag_spec=
+  fi
+else
+  case "$host_os" in
+    aix3*)
+      # Note: this linker hardcodes the directories in LIBPATH if there
+      # are no directories specified by -L.
+      hardcode_minus_L=yes
+      if test "$GCC" = yes; then
+        # Neither direct hardcoding nor static linking is supported with a
+        # broken collect2.
+        hardcode_direct=unsupported
+      fi
+      ;;
+    aix[4-9]*)
+      if test "$host_cpu" = ia64; then
+        # On IA64, the linker does run time linking by default, so we don't
+        # have to do anything special.
+        aix_use_runtimelinking=no
+      else
+        aix_use_runtimelinking=no
+        # Test if we are trying to use run time linking or normal
+        # AIX style linking. If -brtl is somewhere in LDFLAGS, we
+        # need to do runtime linking.
+        case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
+          for ld_flag in $LDFLAGS; do
+            if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+              aix_use_runtimelinking=yes
+              break
+            fi
+          done
+          ;;
+        esac
+      fi
+      hardcode_direct=yes
+      hardcode_libdir_separator=':'
+      if test "$GCC" = yes; then
+        case $host_os in aix4.[012]|aix4.[012].*)
+          collect2name=`${CC} -print-prog-name=collect2`
+          if test -f "$collect2name" && \
+            strings "$collect2name" | grep resolve_lib_name >/dev/null
+          then
+            # We have reworked collect2
+            :
+          else
+            # We have old collect2
+            hardcode_direct=unsupported
+            hardcode_minus_L=yes
+            hardcode_libdir_flag_spec='-L$libdir'
+            hardcode_libdir_separator=
+          fi
+          ;;
+        esac
+      fi
+      # Begin _LT_AC_SYS_LIBPATH_AIX.
+      echo 'int main () { return 0; }' > conftest.c
+      ${CC} ${LDFLAGS} conftest.c -o conftest
+      aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      if test -z "$aix_libpath"; then
+        aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
+}'`
+      fi
+      if test -z "$aix_libpath"; then
+        aix_libpath="/usr/lib:/lib"
+      fi
+      rm -f conftest.c conftest
+      # End _LT_AC_SYS_LIBPATH_AIX.
+      if test "$aix_use_runtimelinking" = yes; then
+        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+      else
+        if test "$host_cpu" = ia64; then
+          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+        else
+          hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+        fi
+      fi
+      ;;
+    amigaos*)
+      case "$host_cpu" in
+        powerpc)
+          ;;
+        m68k)
+          hardcode_libdir_flag_spec='-L$libdir'
+          hardcode_minus_L=yes
+          ;;
+      esac
+      ;;
+    bsdi[45]*)
+      ;;
+    cygwin* | msys* | mingw* | pw32* | cegcc*)
+      # When not using gcc, we currently assume that we are using
+      # Microsoft Visual C++.
+      # hardcode_libdir_flag_spec is actually meaningless, as there is
+      # no search path for DLLs.
+      hardcode_libdir_flag_spec=' '
+      libext=lib
+      ;;
+    darwin* | rhapsody*)
+      hardcode_direct=no
+      if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then
+        :
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    dgux*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    freebsd2.2*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    freebsd2*)
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    freebsd* | dragonfly*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    hpux9*)
+      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+      hardcode_libdir_separator=:
+      hardcode_direct=yes
+      # hardcode_minus_L: Not really in the search PATH,
+      # but as the default location of the library.
+      hardcode_minus_L=yes
+      ;;
+    hpux10*)
+      if test "$with_gnu_ld" = no; then
+        hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator=:
+        hardcode_direct=yes
+        # hardcode_minus_L: Not really in the search PATH,
+        # but as the default location of the library.
+        hardcode_minus_L=yes
+      fi
+      ;;
+    hpux11*)
+      if test "$with_gnu_ld" = no; then
+        hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+        hardcode_libdir_separator=:
+        case $host_cpu in
+          hppa*64*|ia64*)
+            hardcode_direct=no
+            ;;
+          *)
+            hardcode_direct=yes
+            # hardcode_minus_L: Not really in the search PATH,
+            # but as the default location of the library.
+            hardcode_minus_L=yes
+            ;;
+        esac
+      fi
+      ;;
+    irix5* | irix6* | nonstopux*)
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    netbsd*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      hardcode_direct=yes
+      ;;
+    newsos6)
+      hardcode_direct=yes
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    *nto* | *qnx*)
+      ;;
+    openbsd*)
+      if test -f /usr/libexec/ld.so; then
+        hardcode_direct=yes
+        if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+          hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+        else
+          case "$host_os" in
+            openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+              hardcode_libdir_flag_spec='-R$libdir'
+              ;;
+            *)
+              hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+              ;;
+          esac
+        fi
+      else
+        ld_shlibs=no
+      fi
+      ;;
+    os2*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_minus_L=yes
+      ;;
+    osf3*)
+      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      hardcode_libdir_separator=:
+      ;;
+    osf4* | osf5*)
+      if test "$GCC" = yes; then
+        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+      else
+        # Both cc and cxx compiler support -rpath directly
+        hardcode_libdir_flag_spec='-rpath $libdir'
+      fi
+      hardcode_libdir_separator=:
+      ;;
+    solaris*)
+      hardcode_libdir_flag_spec='-R$libdir'
+      ;;
+    sunos4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      hardcode_direct=yes
+      hardcode_minus_L=yes
+      ;;
+    sysv4)
+      case $host_vendor in
+        sni)
+          hardcode_direct=yes # is this really true???
+          ;;
+        siemens)
+          hardcode_direct=no
+          ;;
+        motorola)
+          hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+          ;;
+      esac
+      ;;
+    sysv4.3*)
+      ;;
+    sysv4*MP*)
+      if test -d /usr/nec; then
+        ld_shlibs=yes
+      fi
+      ;;
+    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+      ;;
+    sysv5* | sco3.2v5* | sco5v6*)
+      hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+      hardcode_libdir_separator=':'
+      ;;
+    uts4*)
+      hardcode_libdir_flag_spec='-L$libdir'
+      ;;
+    *)
+      ld_shlibs=no
+      ;;
+  esac
+fi
+
+# Check dynamic linker characteristics
+# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
+# Unlike libtool.m4, here we don't care about _all_ names of the library, but
+# only about the one the linker finds when passed -lNAME. This is the last
+# element of library_names_spec in libtool.m4, or possibly two of them if the
+# linker has special search rules.
+library_names_spec=      # the last element of library_names_spec in libtool.m4
+libname_spec='lib$name'
+case "$host_os" in
+  aix3*)
+    library_names_spec='$libname.a'
+    ;;
+  aix[4-9]*)
+    library_names_spec='$libname$shrext'
+    ;;
+  amigaos*)
+    case "$host_cpu" in
+      powerpc*)
+        library_names_spec='$libname$shrext' ;;
+      m68k)
+        library_names_spec='$libname.a' ;;
+    esac
+    ;;
+  beos*)
+    library_names_spec='$libname$shrext'
+    ;;
+  bsdi[45]*)
+    library_names_spec='$libname$shrext'
+    ;;
+  cygwin* | msys* | mingw* | pw32* | cegcc*)
+    shrext=.dll
+    library_names_spec='$libname.dll.a $libname.lib'
+    ;;
+  darwin* | rhapsody*)
+    shrext=.dylib
+    library_names_spec='$libname$shrext'
+    ;;
+  dgux*)
+    library_names_spec='$libname$shrext'
+    ;;
+  freebsd* | dragonfly*)
+    case "$host_os" in
+      freebsd[123]*)
+        library_names_spec='$libname$shrext$versuffix' ;;
+      *)
+        library_names_spec='$libname$shrext' ;;
+    esac
+    ;;
+  gnu*)
+    library_names_spec='$libname$shrext'
+    ;;
+  haiku*)
+    library_names_spec='$libname$shrext'
+    ;;
+  hpux9* | hpux10* | hpux11*)
+    case $host_cpu in
+      ia64*)
+        shrext=.so
+        ;;
+      hppa*64*)
+        shrext=.sl
+        ;;
+      *)
+        shrext=.sl
+        ;;
+    esac
+    library_names_spec='$libname$shrext'
+    ;;
+  interix[3-9]*)
+    library_names_spec='$libname$shrext'
+    ;;
+  irix5* | irix6* | nonstopux*)
+    library_names_spec='$libname$shrext'
+    case "$host_os" in
+      irix5* | nonstopux*)
+        libsuff= shlibsuff=
+        ;;
+      *)
+        case $LD in
+          *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
+          *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
+          *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
+          *) libsuff= shlibsuff= ;;
+        esac
+        ;;
+    esac
+    ;;
+  linux*oldld* | linux*aout* | linux*coff*)
+    ;;
+  linux* | k*bsd*-gnu | kopensolaris*-gnu)
+    library_names_spec='$libname$shrext'
+    ;;
+  knetbsd*-gnu)
+    library_names_spec='$libname$shrext'
+    ;;
+  netbsd*)
+    library_names_spec='$libname$shrext'
+    ;;
+  newsos6)
+    library_names_spec='$libname$shrext'
+    ;;
+  *nto* | *qnx*)
+    library_names_spec='$libname$shrext'
+    ;;
+  openbsd*)
+    library_names_spec='$libname$shrext$versuffix'
+    ;;
+  os2*)
+    libname_spec='$name'
+    shrext=.dll
+    library_names_spec='$libname.a'
+    ;;
+  osf3* | osf4* | osf5*)
+    library_names_spec='$libname$shrext'
+    ;;
+  rdos*)
+    ;;
+  solaris*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sunos4*)
+    library_names_spec='$libname$shrext$versuffix'
+    ;;
+  sysv4 | sysv4.3*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sysv4*MP*)
+    library_names_spec='$libname$shrext'
+    ;;
+  sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+    library_names_spec='$libname$shrext'
+    ;;
+  tpf*)
+    library_names_spec='$libname$shrext'
+    ;;
+  uts4*)
+    library_names_spec='$libname$shrext'
+    ;;
+esac
+
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
+shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
+escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
+
+LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
+
+# How to pass a linker flag through the compiler.
+wl="$escaped_wl"
+
+# Static library suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally "so").
+shlibext="$shlibext"
+
+# Format of library name prefix.
+libname_spec="$escaped_libname_spec"
+
+# Library names that the linker finds when passed -lNAME.
+library_names_spec="$escaped_library_names_spec"
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator="$hardcode_libdir_separator"
+
+# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct="$hardcode_direct"
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L="$hardcode_minus_L"
+
+EOF

+ 271 - 0
core.mod/libarchive/build/autoconf/iconv.m4

@@ -0,0 +1,271 @@
+# iconv.m4 serial 19 (gettext-0.18.2)
+dnl Copyright (C) 2000-2002, 2007-2014 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
+[
+  dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+
+  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+  dnl accordingly.
+  AC_LIB_LINKFLAGS_BODY([iconv])
+])
+
+AC_DEFUN([AM_ICONV_LINK],
+[
+  dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
+  dnl those with the standalone portable GNU libiconv installed).
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
+  dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
+  dnl accordingly.
+  AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
+
+  dnl Add $INCICONV to CPPFLAGS before performing the following checks,
+  dnl because if the user has installed libiconv and not disabled its use
+  dnl via --without-libiconv-prefix, he wants to use it. The first
+  dnl AC_LINK_IFELSE will then fail, the second AC_LINK_IFELSE will succeed.
+  am_save_CPPFLAGS="$CPPFLAGS"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
+
+  AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
+    am_cv_func_iconv="no, consider installing GNU libiconv"
+    am_cv_lib_iconv=no
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM(
+         [[
+#include <stdlib.h>
+#include <iconv.h>
+         ]],
+         [[iconv_t cd = iconv_open("","");
+           iconv(cd,NULL,NULL,NULL,NULL);
+           iconv_close(cd);]])],
+      [am_cv_func_iconv=yes])
+    if test "$am_cv_func_iconv" != yes; then
+      am_save_LIBS="$LIBS"
+      LIBS="$LIBS $LIBICONV"
+      AC_LINK_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[
+#include <stdlib.h>
+#include <iconv.h>
+           ]],
+           [[iconv_t cd = iconv_open("","");
+             iconv(cd,NULL,NULL,NULL,NULL);
+             iconv_close(cd);]])],
+        [am_cv_lib_iconv=yes]
+        [am_cv_func_iconv=yes])
+      LIBS="$am_save_LIBS"
+    fi
+  ])
+  if test "$am_cv_func_iconv" = yes; then
+    AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
+      dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11,
+      dnl Solaris 10.
+      am_save_LIBS="$LIBS"
+      if test $am_cv_lib_iconv = yes; then
+        LIBS="$LIBS $LIBICONV"
+      fi
+      am_cv_func_iconv_works=no
+      for ac_iconv_const in '' 'const'; do
+        AC_RUN_IFELSE(
+          [AC_LANG_PROGRAM(
+             [[
+#include <iconv.h>
+#include <string.h>
+
+#ifndef ICONV_CONST
+# define ICONV_CONST $ac_iconv_const
+#endif
+             ]],
+             [[int result = 0;
+  /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
+     returns.  */
+  {
+    iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
+    if (cd_utf8_to_88591 != (iconv_t)(-1))
+      {
+        static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */
+        char buf[10];
+        ICONV_CONST char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_utf8_to_88591,
+                            &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          result |= 1;
+        iconv_close (cd_utf8_to_88591);
+      }
+  }
+  /* Test against Solaris 10 bug: Failures are not distinguishable from
+     successful returns.  */
+  {
+    iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
+    if (cd_ascii_to_88591 != (iconv_t)(-1))
+      {
+        static ICONV_CONST char input[] = "\263";
+        char buf[10];
+        ICONV_CONST char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_ascii_to_88591,
+                            &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res == 0)
+          result |= 2;
+        iconv_close (cd_ascii_to_88591);
+      }
+  }
+  /* Test against AIX 6.1..7.1 bug: Buffer overrun.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static ICONV_CONST char input[] = "\304";
+        static char buf[2] = { (char)0xDE, (char)0xAD };
+        ICONV_CONST char *inptr = input;
+        size_t inbytesleft = 1;
+        char *outptr = buf;
+        size_t outbytesleft = 1;
+        size_t res = iconv (cd_88591_to_utf8,
+                            &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD)
+          result |= 4;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
+#if 0 /* This bug could be worked around by the caller.  */
+  /* Test against HP-UX 11.11 bug: Positive return value instead of 0.  */
+  {
+    iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
+    if (cd_88591_to_utf8 != (iconv_t)(-1))
+      {
+        static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
+        char buf[50];
+        ICONV_CONST char *inptr = input;
+        size_t inbytesleft = strlen (input);
+        char *outptr = buf;
+        size_t outbytesleft = sizeof (buf);
+        size_t res = iconv (cd_88591_to_utf8,
+                            &inptr, &inbytesleft,
+                            &outptr, &outbytesleft);
+        if ((int)res > 0)
+          result |= 8;
+        iconv_close (cd_88591_to_utf8);
+      }
+  }
+#endif
+  /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
+     provided.  */
+  if (/* Try standardized names.  */
+      iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
+      /* Try IRIX, OSF/1 names.  */
+      && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
+      /* Try AIX names.  */
+      && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
+      /* Try HP-UX names.  */
+      && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
+    result |= 16;
+  return result;
+]])],
+          [am_cv_func_iconv_works=yes], ,
+          [case "$host_os" in
+             aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
+             *)            am_cv_func_iconv_works="guessing yes" ;;
+           esac])
+        test "$am_cv_func_iconv_works" = no || break
+      done
+      LIBS="$am_save_LIBS"
+    ])
+    case "$am_cv_func_iconv_works" in
+      *no) am_func_iconv=no am_cv_lib_iconv=no ;;
+      *)   am_func_iconv=yes ;;
+    esac
+  else
+    am_func_iconv=no am_cv_lib_iconv=no
+  fi
+  if test "$am_func_iconv" = yes; then
+    AC_DEFINE([HAVE_ICONV], [1],
+      [Define if you have the iconv() function and it works.])
+  fi
+  if test "$am_cv_lib_iconv" = yes; then
+    AC_MSG_CHECKING([how to link with libiconv])
+    AC_MSG_RESULT([$LIBICONV])
+  else
+    dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
+    dnl either.
+    CPPFLAGS="$am_save_CPPFLAGS"
+    LIBICONV=
+    LTLIBICONV=
+  fi
+  AC_SUBST([LIBICONV])
+  AC_SUBST([LTLIBICONV])
+])
+
+dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
+dnl avoid warnings like
+dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
+dnl This is tricky because of the way 'aclocal' is implemented:
+dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
+dnl   Otherwise aclocal's initial scan pass would miss the macro definition.
+dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
+dnl   Otherwise aclocal would emit many "Use of uninitialized value $1"
+dnl   warnings.
+m4_define([gl_iconv_AC_DEFUN],
+  m4_version_prereq([2.64],
+    [[AC_DEFUN_ONCE(
+        [$1], [$2])]],
+    [m4_ifdef([gl_00GNULIB],
+       [[AC_DEFUN_ONCE(
+           [$1], [$2])]],
+       [[AC_DEFUN(
+           [$1], [$2])]])]))
+gl_iconv_AC_DEFUN([AM_ICONV],
+[
+  AM_ICONV_LINK
+  if test "$am_cv_func_iconv" = yes; then
+    AC_MSG_CHECKING([for iconv declaration])
+    AC_CACHE_VAL([am_cv_proto_iconv], [
+      AC_COMPILE_IFELSE(
+        [AC_LANG_PROGRAM(
+           [[
+#include <stdlib.h>
+#include <iconv.h>
+extern
+#ifdef __cplusplus
+"C"
+#endif
+#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
+size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
+#else
+size_t iconv();
+#endif
+           ]],
+           [[]])],
+        [am_cv_proto_iconv_arg1=""],
+        [am_cv_proto_iconv_arg1="const"])
+      am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
+    am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
+    AC_MSG_RESULT([
+         $am_cv_proto_iconv])
+    AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
+      [Define as const if the declaration of iconv() needs const.])
+    dnl Also substitute ICONV_CONST in the gnulib generated <iconv.h>.
+    m4_ifdef([gl_ICONV_H_DEFAULTS],
+      [AC_REQUIRE([gl_ICONV_H_DEFAULTS])
+       if test -n "$am_cv_proto_iconv_arg1"; then
+         ICONV_CONST="const"
+       fi
+      ])
+  fi
+])

+ 20 - 0
core.mod/libarchive/build/autoconf/la_uid_t.m4

@@ -0,0 +1,20 @@
+# la_TYPE_UID_T
+# -------------
+AC_DEFUN([la_TYPE_UID_T],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_CACHE_CHECK(for uid_t in sys/types.h, la_cv_type_uid_t,
+[AC_EGREP_HEADER(uid_t, sys/types.h,
+  la_cv_type_uid_t=yes, la_cv_type_uid_t=no)])
+if test $la_cv_type_uid_t = no; then
+  case $host in
+    *mingw*) def_uid_t=short ;;
+    *) def_uid_t=int ;;
+  esac
+  AC_DEFINE_UNQUOTED(uid_t, [$def_uid_t],
+	[Define to match typeof st_uid field of struct stat if <sys/types.h> doesn't define.])
+  AC_DEFINE_UNQUOTED(gid_t, [$def_uid_t],
+	[Define to match typeof st_gid field of struct stat if <sys/types.h> doesn't define.])
+fi
+])
+AU_ALIAS([AC_TYPE_UID_T], [la_TYPE_UID_T])
+

+ 109 - 0
core.mod/libarchive/build/autoconf/lib-ld.m4

@@ -0,0 +1,109 @@
+# lib-ld.m4 serial 5 (gettext-0.18.2)
+dnl Copyright (C) 1996-2003, 2009-2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Subroutines of libtool.m4,
+dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
+dnl with libtool.m4.
+
+dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
+AC_DEFUN([AC_LIB_PROG_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
+[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+  acl_cv_prog_gnu_ld=yes ;;
+*)
+  acl_cv_prog_gnu_ld=no ;;
+esac])
+with_gnu_ld=$acl_cv_prog_gnu_ld
+])
+
+dnl From libtool-1.4. Sets the variable LD.
+AC_DEFUN([AC_LIB_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+[  --with-gnu-ld           assume the C compiler uses GNU ld [default=no]],
+test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# Prepare PATH_SEPARATOR.
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
+  # contains only /bin. Note that ksh looks also at the FPATH variable,
+  # so we have to set that as well for the test.
+  PATH_SEPARATOR=:
+  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
+           || PATH_SEPARATOR=';'
+       }
+fi
+ac_prog=ld
+if test "$GCC" = yes; then
+  # Check if gcc -print-prog-name=ld gives a path.
+  AC_MSG_CHECKING([for ld used by GCC])
+  case $host in
+  *-*-mingw*)
+    # gcc leaves a trailing carriage return which upsets mingw
+    ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
+  *)
+    ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
+  esac
+  case $ac_prog in
+    # Accept absolute paths.
+    [[\\/]* | [A-Za-z]:[\\/]*)]
+      [re_direlt='/[^/][^/]*/\.\./']
+      # Canonicalize the path of ld
+      ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
+      while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+        ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
+      done
+      test -z "$LD" && LD="$ac_prog"
+      ;;
+  "")
+    # If it fails, then pretend we aren't using GCC.
+    ac_prog=ld
+    ;;
+  *)
+    # If it is relative, then search for the first ld in PATH.
+    with_gnu_ld=unknown
+    ;;
+  esac
+elif test "$with_gnu_ld" = yes; then
+  AC_MSG_CHECKING([for GNU ld])
+else
+  AC_MSG_CHECKING([for non-GNU ld])
+fi
+AC_CACHE_VAL([acl_cv_path_LD],
+[if test -z "$LD"; then
+  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+      acl_cv_path_LD="$ac_dir/$ac_prog"
+      # Check to see if the program is GNU ld.  I'd rather use --version,
+      # but apparently some GNU ld's only accept -v.
+      # Break only if it was the GNU/non-GNU ld that we prefer.
+      case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
+      *GNU* | *'with BFD'*)
+        test "$with_gnu_ld" != no && break ;;
+      *)
+        test "$with_gnu_ld" != yes && break ;;
+      esac
+    fi
+  done
+  IFS="$ac_save_ifs"
+else
+  acl_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$acl_cv_path_LD"
+if test -n "$LD"; then
+  AC_MSG_RESULT([$LD])
+else
+  AC_MSG_RESULT([no])
+fi
+test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
+AC_LIB_PROG_LD_GNU
+])

+ 777 - 0
core.mod/libarchive/build/autoconf/lib-link.m4

@@ -0,0 +1,777 @@
+# lib-link.m4 serial 26 (gettext-0.18.2)
+dnl Copyright (C) 2001-2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+AC_PREREQ([2.54])
+
+dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
+dnl augments the CPPFLAGS variable.
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_LINKFLAGS],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+  pushdef([Name],[m4_translit([$1],[./+-], [____])])
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
+    AC_LIB_LINKFLAGS_BODY([$1], [$2])
+    ac_cv_lib[]Name[]_libs="$LIB[]NAME"
+    ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
+    ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
+    ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
+  ])
+  LIB[]NAME="$ac_cv_lib[]Name[]_libs"
+  LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
+  INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
+  LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+  AC_SUBST([LIB]NAME)
+  AC_SUBST([LTLIB]NAME)
+  AC_SUBST([LIB]NAME[_PREFIX])
+  dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
+  dnl results of this search when this library appears as a dependency.
+  HAVE_LIB[]NAME=yes
+  popdef([NAME])
+  popdef([Name])
+])
+
+dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
+dnl searches for libname and the libraries corresponding to explicit and
+dnl implicit dependencies, together with the specified include files and
+dnl the ability to compile and link the specified testcode. The missing-message
+dnl defaults to 'no' and may contain additional hints for the user.
+dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
+dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
+dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
+dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
+dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
+dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  AC_REQUIRE([AC_LIB_RPATH])
+  pushdef([Name],[m4_translit([$1],[./+-], [____])])
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+
+  dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
+  dnl accordingly.
+  AC_LIB_LINKFLAGS_BODY([$1], [$2])
+
+  dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
+  dnl because if the user has installed lib[]Name and not disabled its use
+  dnl via --without-lib[]Name-prefix, he wants to use it.
+  ac_save_CPPFLAGS="$CPPFLAGS"
+  AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
+
+  AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
+    ac_save_LIBS="$LIBS"
+    dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
+    dnl because these -l options might require -L options that are present in
+    dnl LIBS. -l options benefit only from the -L options listed before it.
+    dnl Otherwise, add it to the front of LIBS, because it may be a static
+    dnl library that depends on another static library that is present in LIBS.
+    dnl Static libraries benefit only from the static libraries listed after
+    dnl it.
+    case " $LIB[]NAME" in
+      *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
+      *)       LIBS="$LIB[]NAME $LIBS" ;;
+    esac
+    AC_LINK_IFELSE(
+      [AC_LANG_PROGRAM([[$3]], [[$4]])],
+      [ac_cv_lib[]Name=yes],
+      [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
+    LIBS="$ac_save_LIBS"
+  ])
+  if test "$ac_cv_lib[]Name" = yes; then
+    HAVE_LIB[]NAME=yes
+    AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
+    AC_MSG_CHECKING([how to link with lib[]$1])
+    AC_MSG_RESULT([$LIB[]NAME])
+  else
+    HAVE_LIB[]NAME=no
+    dnl If $LIB[]NAME didn't lead to a usable library, we don't need
+    dnl $INC[]NAME either.
+    CPPFLAGS="$ac_save_CPPFLAGS"
+    LIB[]NAME=
+    LTLIB[]NAME=
+    LIB[]NAME[]_PREFIX=
+  fi
+  AC_SUBST([HAVE_LIB]NAME)
+  AC_SUBST([LIB]NAME)
+  AC_SUBST([LTLIB]NAME)
+  AC_SUBST([LIB]NAME[_PREFIX])
+  popdef([NAME])
+  popdef([Name])
+])
+
+dnl Determine the platform dependent parameters needed to use rpath:
+dnl   acl_libext,
+dnl   acl_shlibext,
+dnl   acl_libname_spec,
+dnl   acl_library_names_spec,
+dnl   acl_hardcode_libdir_flag_spec,
+dnl   acl_hardcode_libdir_separator,
+dnl   acl_hardcode_direct,
+dnl   acl_hardcode_minus_L.
+AC_DEFUN([AC_LIB_RPATH],
+[
+  dnl Tell automake >= 1.10 to complain if config.rpath is missing.
+  m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
+  AC_REQUIRE([AC_PROG_CC])                dnl we use $CC, $GCC, $LDFLAGS
+  AC_REQUIRE([AC_LIB_PROG_LD])            dnl we use $LD, $with_gnu_ld
+  AC_REQUIRE([AC_CANONICAL_HOST])         dnl we use $host
+  AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
+  AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
+    CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
+    ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
+    . ./conftest.sh
+    rm -f ./conftest.sh
+    acl_cv_rpath=done
+  ])
+  wl="$acl_cv_wl"
+  acl_libext="$acl_cv_libext"
+  acl_shlibext="$acl_cv_shlibext"
+  acl_libname_spec="$acl_cv_libname_spec"
+  acl_library_names_spec="$acl_cv_library_names_spec"
+  acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
+  acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
+  acl_hardcode_direct="$acl_cv_hardcode_direct"
+  acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
+  dnl Determine whether the user wants rpath handling at all.
+  AC_ARG_ENABLE([rpath],
+    [  --disable-rpath         do not hardcode runtime library paths],
+    :, enable_rpath=yes)
+])
+
+dnl AC_LIB_FROMPACKAGE(name, package)
+dnl declares that libname comes from the given package. The configure file
+dnl will then not have a --with-libname-prefix option but a
+dnl --with-package-prefix option. Several libraries can come from the same
+dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
+dnl macro call that searches for libname.
+AC_DEFUN([AC_LIB_FROMPACKAGE],
+[
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  define([acl_frompackage_]NAME, [$2])
+  popdef([NAME])
+  pushdef([PACK],[$2])
+  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
+                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  define([acl_libsinpackage_]PACKUP,
+    m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1])
+  popdef([PACKUP])
+  popdef([PACK])
+])
+
+dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
+dnl the libraries corresponding to explicit and implicit dependencies.
+dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
+dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
+dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
+AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
+[
+  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+  pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-],
+                                   [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
+  pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-],
+                                     [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])])
+  pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
+  dnl Autoconf >= 2.61 supports dots in --with options.
+  pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)])
+  dnl By default, look in $includedir and $libdir.
+  use_additional=yes
+  AC_LIB_WITH_FINAL_PREFIX([
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+  ])
+  AC_ARG_WITH(P_A_C_K[-prefix],
+[[  --with-]]P_A_C_K[[-prefix[=DIR]  search for ]PACKLIBS[ in DIR/include and DIR/lib
+  --without-]]P_A_C_K[[-prefix     don't search for ]PACKLIBS[ in includedir and libdir]],
+[
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+        AC_LIB_WITH_FINAL_PREFIX([
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+        ])
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/$acl_libdirstem"
+        if test "$acl_libdirstem2" != "$acl_libdirstem" \
+           && ! test -d "$withval/$acl_libdirstem"; then
+          additional_libdir="$withval/$acl_libdirstem2"
+        fi
+      fi
+    fi
+])
+  dnl Search the library and its dependencies in $additional_libdir and
+  dnl $LDFLAGS. Using breadth-first-seach.
+  LIB[]NAME=
+  LTLIB[]NAME=
+  INC[]NAME=
+  LIB[]NAME[]_PREFIX=
+  dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
+  dnl computed. So it has to be reset here.
+  HAVE_LIB[]NAME=
+  rpathdirs=
+  ltrpathdirs=
+  names_already_handled=
+  names_next_round='$1 $2'
+  while test -n "$names_next_round"; do
+    names_this_round="$names_next_round"
+    names_next_round=
+    for name in $names_this_round; do
+      already_handled=
+      for n in $names_already_handled; do
+        if test "$n" = "$name"; then
+          already_handled=yes
+          break
+        fi
+      done
+      if test -z "$already_handled"; then
+        names_already_handled="$names_already_handled $name"
+        dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
+        dnl or AC_LIB_HAVE_LINKFLAGS call.
+        uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'`
+        eval value=\"\$HAVE_LIB$uppername\"
+        if test -n "$value"; then
+          if test "$value" = yes; then
+            eval value=\"\$LIB$uppername\"
+            test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
+            eval value=\"\$LTLIB$uppername\"
+            test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
+          else
+            dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
+            dnl that this library doesn't exist. So just drop it.
+            :
+          fi
+        else
+          dnl Search the library lib$name in $additional_libdir and $LDFLAGS
+          dnl and the already constructed $LIBNAME/$LTLIBNAME.
+          found_dir=
+          found_la=
+          found_so=
+          found_a=
+          eval libname=\"$acl_libname_spec\"    # typically: libname=lib$name
+          if test -n "$acl_shlibext"; then
+            shrext=".$acl_shlibext"             # typically: shrext=.so
+          else
+            shrext=
+          fi
+          if test $use_additional = yes; then
+            dir="$additional_libdir"
+            dnl The same code as in the loop below:
+            dnl First look for a shared library.
+            if test -n "$acl_shlibext"; then
+              if test -f "$dir/$libname$shrext"; then
+                found_dir="$dir"
+                found_so="$dir/$libname$shrext"
+              else
+                if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                  ver=`(cd "$dir" && \
+                        for f in "$libname$shrext".*; do echo "$f"; done \
+                        | sed -e "s,^$libname$shrext\\\\.,," \
+                        | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                        | sed 1q ) 2>/dev/null`
+                  if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+                    found_dir="$dir"
+                    found_so="$dir/$libname$shrext.$ver"
+                  fi
+                else
+                  eval library_names=\"$acl_library_names_spec\"
+                  for f in $library_names; do
+                    if test -f "$dir/$f"; then
+                      found_dir="$dir"
+                      found_so="$dir/$f"
+                      break
+                    fi
+                  done
+                fi
+              fi
+            fi
+            dnl Then look for a static library.
+            if test "X$found_dir" = "X"; then
+              if test -f "$dir/$libname.$acl_libext"; then
+                found_dir="$dir"
+                found_a="$dir/$libname.$acl_libext"
+              fi
+            fi
+            if test "X$found_dir" != "X"; then
+              if test -f "$dir/$libname.la"; then
+                found_la="$dir/$libname.la"
+              fi
+            fi
+          fi
+          if test "X$found_dir" = "X"; then
+            for x in $LDFLAGS $LTLIB[]NAME; do
+              AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+              case "$x" in
+                -L*)
+                  dir=`echo "X$x" | sed -e 's/^X-L//'`
+                  dnl First look for a shared library.
+                  if test -n "$acl_shlibext"; then
+                    if test -f "$dir/$libname$shrext"; then
+                      found_dir="$dir"
+                      found_so="$dir/$libname$shrext"
+                    else
+                      if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
+                        ver=`(cd "$dir" && \
+                              for f in "$libname$shrext".*; do echo "$f"; done \
+                              | sed -e "s,^$libname$shrext\\\\.,," \
+                              | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
+                              | sed 1q ) 2>/dev/null`
+                        if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
+                          found_dir="$dir"
+                          found_so="$dir/$libname$shrext.$ver"
+                        fi
+                      else
+                        eval library_names=\"$acl_library_names_spec\"
+                        for f in $library_names; do
+                          if test -f "$dir/$f"; then
+                            found_dir="$dir"
+                            found_so="$dir/$f"
+                            break
+                          fi
+                        done
+                      fi
+                    fi
+                  fi
+                  dnl Then look for a static library.
+                  if test "X$found_dir" = "X"; then
+                    if test -f "$dir/$libname.$acl_libext"; then
+                      found_dir="$dir"
+                      found_a="$dir/$libname.$acl_libext"
+                    fi
+                  fi
+                  if test "X$found_dir" != "X"; then
+                    if test -f "$dir/$libname.la"; then
+                      found_la="$dir/$libname.la"
+                    fi
+                  fi
+                  ;;
+              esac
+              if test "X$found_dir" != "X"; then
+                break
+              fi
+            done
+          fi
+          if test "X$found_dir" != "X"; then
+            dnl Found the library.
+            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
+            if test "X$found_so" != "X"; then
+              dnl Linking with a shared library. We attempt to hardcode its
+              dnl directory into the executable's runpath, unless it's the
+              dnl standard /usr/lib.
+              if test "$enable_rpath" = no \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem" \
+                 || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
+                dnl No hardcoding is needed.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+              else
+                dnl Use an explicit option to hardcode DIR into the resulting
+                dnl binary.
+                dnl Potentially add DIR to ltrpathdirs.
+                dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+                haveit=
+                for x in $ltrpathdirs; do
+                  if test "X$x" = "X$found_dir"; then
+                    haveit=yes
+                    break
+                  fi
+                done
+                if test -z "$haveit"; then
+                  ltrpathdirs="$ltrpathdirs $found_dir"
+                fi
+                dnl The hardcoding into $LIBNAME is system dependent.
+                if test "$acl_hardcode_direct" = yes; then
+                  dnl Using DIR/libNAME.so during linking hardcodes DIR into the
+                  dnl resulting binary.
+                  LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                else
+                  if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+                    dnl Use an explicit option to hardcode DIR into the resulting
+                    dnl binary.
+                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                    dnl Potentially add DIR to rpathdirs.
+                    dnl The rpathdirs will be appended to $LIBNAME at the end.
+                    haveit=
+                    for x in $rpathdirs; do
+                      if test "X$x" = "X$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      rpathdirs="$rpathdirs $found_dir"
+                    fi
+                  else
+                    dnl Rely on "-L$found_dir".
+                    dnl But don't add it if it's already contained in the LDFLAGS
+                    dnl or the already constructed $LIBNAME
+                    haveit=
+                    for x in $LDFLAGS $LIB[]NAME; do
+                      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                      if test "X$x" = "X-L$found_dir"; then
+                        haveit=yes
+                        break
+                      fi
+                    done
+                    if test -z "$haveit"; then
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
+                    fi
+                    if test "$acl_hardcode_minus_L" != no; then
+                      dnl FIXME: Not sure whether we should use
+                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+                      dnl here.
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
+                    else
+                      dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
+                      dnl here, because this doesn't fit in flags passed to the
+                      dnl compiler. So give up. No hardcoding. This affects only
+                      dnl very old systems.
+                      dnl FIXME: Not sure whether we should use
+                      dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
+                      dnl here.
+                      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+                    fi
+                  fi
+                fi
+              fi
+            else
+              if test "X$found_a" != "X"; then
+                dnl Linking with a static library.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
+              else
+                dnl We shouldn't come here, but anyway it's good to have a
+                dnl fallback.
+                LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
+              fi
+            fi
+            dnl Assume the include files are nearby.
+            additional_includedir=
+            case "$found_dir" in
+              */$acl_libdirstem | */$acl_libdirstem/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
+                if test "$name" = '$1'; then
+                  LIB[]NAME[]_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+              */$acl_libdirstem2 | */$acl_libdirstem2/)
+                basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
+                if test "$name" = '$1'; then
+                  LIB[]NAME[]_PREFIX="$basedir"
+                fi
+                additional_includedir="$basedir/include"
+                ;;
+            esac
+            if test "X$additional_includedir" != "X"; then
+              dnl Potentially add $additional_includedir to $INCNAME.
+              dnl But don't add it
+              dnl   1. if it's the standard /usr/include,
+              dnl   2. if it's /usr/local/include and we are using GCC on Linux,
+              dnl   3. if it's already present in $CPPFLAGS or the already
+              dnl      constructed $INCNAME,
+              dnl   4. if it doesn't exist as a directory.
+              if test "X$additional_includedir" != "X/usr/include"; then
+                haveit=
+                if test "X$additional_includedir" = "X/usr/local/include"; then
+                  if test -n "$GCC"; then
+                    case $host_os in
+                      linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                    esac
+                  fi
+                fi
+                if test -z "$haveit"; then
+                  for x in $CPPFLAGS $INC[]NAME; do
+                    AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                    if test "X$x" = "X-I$additional_includedir"; then
+                      haveit=yes
+                      break
+                    fi
+                  done
+                  if test -z "$haveit"; then
+                    if test -d "$additional_includedir"; then
+                      dnl Really add $additional_includedir to $INCNAME.
+                      INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
+                    fi
+                  fi
+                fi
+              fi
+            fi
+            dnl Look for dependencies.
+            if test -n "$found_la"; then
+              dnl Read the .la file. It defines the variables
+              dnl dlname, library_names, old_library, dependency_libs, current,
+              dnl age, revision, installed, dlopen, dlpreopen, libdir.
+              save_libdir="$libdir"
+              case "$found_la" in
+                */* | *\\*) . "$found_la" ;;
+                *) . "./$found_la" ;;
+              esac
+              libdir="$save_libdir"
+              dnl We use only dependency_libs.
+              for dep in $dependency_libs; do
+                case "$dep" in
+                  -L*)
+                    additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
+                    dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
+                    dnl But don't add it
+                    dnl   1. if it's the standard /usr/lib,
+                    dnl   2. if it's /usr/local/lib and we are using GCC on Linux,
+                    dnl   3. if it's already present in $LDFLAGS or the already
+                    dnl      constructed $LIBNAME,
+                    dnl   4. if it doesn't exist as a directory.
+                    if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
+                       && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
+                      haveit=
+                      if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
+                         || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
+                        if test -n "$GCC"; then
+                          case $host_os in
+                            linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+                          esac
+                        fi
+                      fi
+                      if test -z "$haveit"; then
+                        haveit=
+                        for x in $LDFLAGS $LIB[]NAME; do
+                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                            dnl Really add $additional_libdir to $LIBNAME.
+                            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
+                          fi
+                        fi
+                        haveit=
+                        for x in $LDFLAGS $LTLIB[]NAME; do
+                          AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+                          if test "X$x" = "X-L$additional_libdir"; then
+                            haveit=yes
+                            break
+                          fi
+                        done
+                        if test -z "$haveit"; then
+                          if test -d "$additional_libdir"; then
+                            dnl Really add $additional_libdir to $LTLIBNAME.
+                            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
+                          fi
+                        fi
+                      fi
+                    fi
+                    ;;
+                  -R*)
+                    dir=`echo "X$dep" | sed -e 's/^X-R//'`
+                    if test "$enable_rpath" != no; then
+                      dnl Potentially add DIR to rpathdirs.
+                      dnl The rpathdirs will be appended to $LIBNAME at the end.
+                      haveit=
+                      for x in $rpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        rpathdirs="$rpathdirs $dir"
+                      fi
+                      dnl Potentially add DIR to ltrpathdirs.
+                      dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
+                      haveit=
+                      for x in $ltrpathdirs; do
+                        if test "X$x" = "X$dir"; then
+                          haveit=yes
+                          break
+                        fi
+                      done
+                      if test -z "$haveit"; then
+                        ltrpathdirs="$ltrpathdirs $dir"
+                      fi
+                    fi
+                    ;;
+                  -l*)
+                    dnl Handle this in the next round.
+                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
+                    ;;
+                  *.la)
+                    dnl Handle this in the next round. Throw away the .la's
+                    dnl directory; it is already contained in a preceding -L
+                    dnl option.
+                    names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
+                    ;;
+                  *)
+                    dnl Most likely an immediate library name.
+                    LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
+                    LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
+                    ;;
+                esac
+              done
+            fi
+          else
+            dnl Didn't find the library; assume it is in the system directories
+            dnl known to the linker and runtime loader. (All the system
+            dnl directories known to the linker should also be known to the
+            dnl runtime loader, otherwise the system is severely misconfigured.)
+            LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
+            LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
+          fi
+        fi
+      fi
+    done
+  done
+  if test "X$rpathdirs" != "X"; then
+    if test -n "$acl_hardcode_libdir_separator"; then
+      dnl Weird platform: only the last -rpath option counts, the user must
+      dnl pass all path elements in one option. We can arrange that for a
+      dnl single library, but not when more than one $LIBNAMEs are used.
+      alldirs=
+      for found_dir in $rpathdirs; do
+        alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
+      done
+      dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
+      acl_save_libdir="$libdir"
+      libdir="$alldirs"
+      eval flag=\"$acl_hardcode_libdir_flag_spec\"
+      libdir="$acl_save_libdir"
+      LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+    else
+      dnl The -rpath options are cumulative.
+      for found_dir in $rpathdirs; do
+        acl_save_libdir="$libdir"
+        libdir="$found_dir"
+        eval flag=\"$acl_hardcode_libdir_flag_spec\"
+        libdir="$acl_save_libdir"
+        LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
+      done
+    fi
+  fi
+  if test "X$ltrpathdirs" != "X"; then
+    dnl When using libtool, the option that works for both libraries and
+    dnl executables is -R. The -R options are cumulative.
+    for found_dir in $ltrpathdirs; do
+      LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
+    done
+  fi
+  popdef([P_A_C_K])
+  popdef([PACKLIBS])
+  popdef([PACKUP])
+  popdef([PACK])
+  popdef([NAME])
+])
+
+dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
+dnl unless already present in VAR.
+dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
+dnl contains two or three consecutive elements that belong together.
+AC_DEFUN([AC_LIB_APPENDTOVAR],
+[
+  for element in [$2]; do
+    haveit=
+    for x in $[$1]; do
+      AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      [$1]="${[$1]}${[$1]:+ }$element"
+    fi
+  done
+])
+
+dnl For those cases where a variable contains several -L and -l options
+dnl referring to unknown libraries and directories, this macro determines the
+dnl necessary additional linker options for the runtime path.
+dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
+dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
+dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
+dnl otherwise linking without libtool is assumed.
+AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
+[
+  AC_REQUIRE([AC_LIB_RPATH])
+  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+  $1=
+  if test "$enable_rpath" != no; then
+    if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
+      dnl Use an explicit option to hardcode directories into the resulting
+      dnl binary.
+      rpathdirs=
+      next=
+      for opt in $2; do
+        if test -n "$next"; then
+          dir="$next"
+          dnl No need to hardcode the standard /usr/lib.
+          if test "X$dir" != "X/usr/$acl_libdirstem" \
+             && test "X$dir" != "X/usr/$acl_libdirstem2"; then
+            rpathdirs="$rpathdirs $dir"
+          fi
+          next=
+        else
+          case $opt in
+            -L) next=yes ;;
+            -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
+                 dnl No need to hardcode the standard /usr/lib.
+                 if test "X$dir" != "X/usr/$acl_libdirstem" \
+                    && test "X$dir" != "X/usr/$acl_libdirstem2"; then
+                   rpathdirs="$rpathdirs $dir"
+                 fi
+                 next= ;;
+            *) next= ;;
+          esac
+        fi
+      done
+      if test "X$rpathdirs" != "X"; then
+        if test -n ""$3""; then
+          dnl libtool is used for linking. Use -R options.
+          for dir in $rpathdirs; do
+            $1="${$1}${$1:+ }-R$dir"
+          done
+        else
+          dnl The linker is used for linking directly.
+          if test -n "$acl_hardcode_libdir_separator"; then
+            dnl Weird platform: only the last -rpath option counts, the user
+            dnl must pass all path elements in one option.
+            alldirs=
+            for dir in $rpathdirs; do
+              alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
+            done
+            acl_save_libdir="$libdir"
+            libdir="$alldirs"
+            eval flag=\"$acl_hardcode_libdir_flag_spec\"
+            libdir="$acl_save_libdir"
+            $1="$flag"
+          else
+            dnl The -rpath options are cumulative.
+            for dir in $rpathdirs; do
+              acl_save_libdir="$libdir"
+              libdir="$dir"
+              eval flag=\"$acl_hardcode_libdir_flag_spec\"
+              libdir="$acl_save_libdir"
+              $1="${$1}${$1:+ }$flag"
+            done
+          fi
+        fi
+      fi
+    fi
+  fi
+  AC_SUBST([$1])
+])

+ 224 - 0
core.mod/libarchive/build/autoconf/lib-prefix.m4

@@ -0,0 +1,224 @@
+# lib-prefix.m4 serial 7 (gettext-0.18)
+dnl Copyright (C) 2001-2005, 2008-2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl From Bruno Haible.
+
+dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
+dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
+dnl require excessive bracketing.
+ifdef([AC_HELP_STRING],
+[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
+[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
+
+dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
+dnl to access previously installed libraries. The basic assumption is that
+dnl a user will want packages to use other packages he previously installed
+dnl with the same --prefix option.
+dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
+dnl libraries, but is otherwise very convenient.
+AC_DEFUN([AC_LIB_PREFIX],
+[
+  AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
+  AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
+  dnl By default, look in $includedir and $libdir.
+  use_additional=yes
+  AC_LIB_WITH_FINAL_PREFIX([
+    eval additional_includedir=\"$includedir\"
+    eval additional_libdir=\"$libdir\"
+  ])
+  AC_LIB_ARG_WITH([lib-prefix],
+[  --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
+  --without-lib-prefix    don't search for libraries in includedir and libdir],
+[
+    if test "X$withval" = "Xno"; then
+      use_additional=no
+    else
+      if test "X$withval" = "X"; then
+        AC_LIB_WITH_FINAL_PREFIX([
+          eval additional_includedir=\"$includedir\"
+          eval additional_libdir=\"$libdir\"
+        ])
+      else
+        additional_includedir="$withval/include"
+        additional_libdir="$withval/$acl_libdirstem"
+      fi
+    fi
+])
+  if test $use_additional = yes; then
+    dnl Potentially add $additional_includedir to $CPPFLAGS.
+    dnl But don't add it
+    dnl   1. if it's the standard /usr/include,
+    dnl   2. if it's already present in $CPPFLAGS,
+    dnl   3. if it's /usr/local/include and we are using GCC on Linux,
+    dnl   4. if it doesn't exist as a directory.
+    if test "X$additional_includedir" != "X/usr/include"; then
+      haveit=
+      for x in $CPPFLAGS; do
+        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+        if test "X$x" = "X-I$additional_includedir"; then
+          haveit=yes
+          break
+        fi
+      done
+      if test -z "$haveit"; then
+        if test "X$additional_includedir" = "X/usr/local/include"; then
+          if test -n "$GCC"; then
+            case $host_os in
+              linux* | gnu* | k*bsd*-gnu) haveit=yes;;
+            esac
+          fi
+        fi
+        if test -z "$haveit"; then
+          if test -d "$additional_includedir"; then
+            dnl Really add $additional_includedir to $CPPFLAGS.
+            CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
+          fi
+        fi
+      fi
+    fi
+    dnl Potentially add $additional_libdir to $LDFLAGS.
+    dnl But don't add it
+    dnl   1. if it's the standard /usr/lib,
+    dnl   2. if it's already present in $LDFLAGS,
+    dnl   3. if it's /usr/local/lib and we are using GCC on Linux,
+    dnl   4. if it doesn't exist as a directory.
+    if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
+      haveit=
+      for x in $LDFLAGS; do
+        AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
+        if test "X$x" = "X-L$additional_libdir"; then
+          haveit=yes
+          break
+        fi
+      done
+      if test -z "$haveit"; then
+        if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
+          if test -n "$GCC"; then
+            case $host_os in
+              linux*) haveit=yes;;
+            esac
+          fi
+        fi
+        if test -z "$haveit"; then
+          if test -d "$additional_libdir"; then
+            dnl Really add $additional_libdir to $LDFLAGS.
+            LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
+          fi
+        fi
+      fi
+    fi
+  fi
+])
+
+dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
+dnl acl_final_exec_prefix, containing the values to which $prefix and
+dnl $exec_prefix will expand at the end of the configure script.
+AC_DEFUN([AC_LIB_PREPARE_PREFIX],
+[
+  dnl Unfortunately, prefix and exec_prefix get only finally determined
+  dnl at the end of configure.
+  if test "X$prefix" = "XNONE"; then
+    acl_final_prefix="$ac_default_prefix"
+  else
+    acl_final_prefix="$prefix"
+  fi
+  if test "X$exec_prefix" = "XNONE"; then
+    acl_final_exec_prefix='${prefix}'
+  else
+    acl_final_exec_prefix="$exec_prefix"
+  fi
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
+  prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
+dnl variables prefix and exec_prefix bound to the values they will have
+dnl at the end of the configure script.
+AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
+[
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  $1
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+])
+
+dnl AC_LIB_PREPARE_MULTILIB creates
+dnl - a variable acl_libdirstem, containing the basename of the libdir, either
+dnl   "lib" or "lib64" or "lib/64",
+dnl - a variable acl_libdirstem2, as a secondary possible value for
+dnl   acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
+dnl   "lib/amd64".
+AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
+[
+  dnl There is no formal standard regarding lib and lib64.
+  dnl On glibc systems, the current practice is that on a system supporting
+  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+  dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
+  dnl the compiler's default mode by looking at the compiler's library search
+  dnl path. If at least one of its elements ends in /lib64 or points to a
+  dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
+  dnl Otherwise we use the default, namely "lib".
+  dnl On Solaris systems, the current practice is that on a system supporting
+  dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
+  dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
+  dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
+  AC_REQUIRE([AC_CANONICAL_HOST])
+  acl_libdirstem=lib
+  acl_libdirstem2=
+  case "$host_os" in
+    solaris*)
+      dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
+      dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
+      dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
+      dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
+      dnl symlink is missing, so we set acl_libdirstem2 too.
+      AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
+        [AC_EGREP_CPP([sixtyfour bits], [
+#ifdef _LP64
+sixtyfour bits
+#endif
+           ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
+        ])
+      if test $gl_cv_solaris_64bit = yes; then
+        acl_libdirstem=lib/64
+        case "$host_cpu" in
+          sparc*)        acl_libdirstem2=lib/sparcv9 ;;
+          i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
+        esac
+      fi
+      ;;
+    *)
+      searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
+      if test -n "$searchpath"; then
+        acl_save_IFS="${IFS= 	}"; IFS=":"
+        for searchdir in $searchpath; do
+          if test -d "$searchdir"; then
+            case "$searchdir" in
+              */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
+              */../ | */.. )
+                # Better ignore directories of this form. They are misleading.
+                ;;
+              *) searchdir=`cd "$searchdir" && pwd`
+                 case "$searchdir" in
+                   */lib64 ) acl_libdirstem=lib64 ;;
+                 esac ;;
+            esac
+          fi
+        done
+        IFS="$acl_save_IFS"
+      fi
+      ;;
+  esac
+  test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
+])

+ 115 - 0
core.mod/libarchive/build/autoconf/m4_ax_compile_check_sizeof.m4

@@ -0,0 +1,115 @@
+# ============================================================================
+#  https://www.gnu.org/software/autoconf-archive/ax_compile_check_sizeof.html
+# ============================================================================
+#
+# SYNOPSIS
+#
+#   AX_COMPILE_CHECK_SIZEOF(TYPE [, HEADERS [, EXTRA_SIZES...]])
+#
+# DESCRIPTION
+#
+#   This macro checks for the size of TYPE using compile checks, not run
+#   checks. You can supply extra HEADERS to look into. the check will cycle
+#   through 1 2 4 8 16 and any EXTRA_SIZES the user supplies. If a match is
+#   found, it will #define SIZEOF_`TYPE' to that value. Otherwise it will
+#   emit a configure time error indicating the size of the type could not be
+#   determined.
+#
+#   The trick is that C will not allow duplicate case labels. While this is
+#   valid C code:
+#
+#     switch (0) case 0: case 1:;
+#
+#   The following is not:
+#
+#     switch (0) case 0: case 0:;
+#
+#   Thus, the AC_COMPILE_IFELSE will fail if the currently tried size does
+#   not match.
+#
+#   Here is an example skeleton configure.in script, demonstrating the
+#   macro's usage:
+#
+#     AC_PROG_CC
+#     AC_CHECK_HEADERS(stddef.h unistd.h)
+#     AC_TYPE_SIZE_T
+#     AC_CHECK_TYPE(ssize_t, int)
+#
+#     headers='#ifdef HAVE_STDDEF_H
+#     #include <stddef.h>
+#     #endif
+#     #ifdef HAVE_UNISTD_H
+#     #include <unistd.h>
+#     #endif
+#     '
+#
+#     AX_COMPILE_CHECK_SIZEOF(char)
+#     AX_COMPILE_CHECK_SIZEOF(short)
+#     AX_COMPILE_CHECK_SIZEOF(int)
+#     AX_COMPILE_CHECK_SIZEOF(long)
+#     AX_COMPILE_CHECK_SIZEOF(unsigned char *)
+#     AX_COMPILE_CHECK_SIZEOF(void *)
+#     AX_COMPILE_CHECK_SIZEOF(size_t, $headers)
+#     AX_COMPILE_CHECK_SIZEOF(ssize_t, $headers)
+#     AX_COMPILE_CHECK_SIZEOF(ptrdiff_t, $headers)
+#     AX_COMPILE_CHECK_SIZEOF(off_t, $headers)
+#
+# LICENSE
+#
+#   Copyright (c) 2008 Kaveh Ghazi <[email protected]>
+#   Copyright (c) 2017 Reini Urban <[email protected]>
+#
+#   This program is free software: you can redistribute it and/or modify it
+#   under the terms of the GNU General Public License as published by the
+#   Free Software Foundation, either version 3 of the License, or (at your
+#   option) any later version.
+#
+#   This program is distributed in the hope that it will be useful, but
+#   WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
+#   Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License along
+#   with this program. If not, see <https://www.gnu.org/licenses/>.
+#
+#   As a special exception, the respective Autoconf Macro's copyright owner
+#   gives unlimited permission to copy, distribute and modify the configure
+#   scripts that are the output of Autoconf when processing the Macro. You
+#   need not follow the terms of the GNU General Public License when using
+#   or distributing such scripts, even though portions of the text of the
+#   Macro appear in them. The GNU General Public License (GPL) does govern
+#   all other use of the material that constitutes the Autoconf Macro.
+#
+#   This special exception to the GPL applies to versions of the Autoconf
+#   Macro released by the Autoconf Archive. When you make and distribute a
+#   modified version of the Autoconf Macro, you may extend this special
+#   exception to the GPL to apply to your modified version as well.
+
+#serial 8
+
+AU_ALIAS([AC_COMPILE_CHECK_SIZEOF], [AX_COMPILE_CHECK_SIZEOF])
+AC_DEFUN([AX_COMPILE_CHECK_SIZEOF],
+[changequote(<<, >>)dnl
+dnl The name to #define.
+define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl
+dnl The cache variable name.
+define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl
+changequote([, ])dnl
+AC_MSG_CHECKING(size of $1)
+AC_CACHE_VAL(AC_CV_NAME,
+[for ac_size in 4 8 1 2 16 $3 ; do # List sizes in rough order of prevalence.
+  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <sys/types.h>
+$2
+]], [[switch (0) case 0: case (sizeof ($1) == $ac_size):;]])], [AC_CV_NAME=$ac_size])
+  if test x$AC_CV_NAME != x ; then break; fi
+done
+])
+if test x$AC_CV_NAME = x ; then
+  AC_MSG_ERROR([cannot determine a size for $1])
+fi
+AC_MSG_RESULT($AC_CV_NAME)
+AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in type $1])
+undefine([AC_TYPE_NAME])dnl
+undefine([AC_CV_NAME])dnl
+])

+ 68 - 0
core.mod/libarchive/build/autogen.sh

@@ -0,0 +1,68 @@
+#!/bin/sh
+
+PATH=/usr/local/gnu-autotools/bin/:$PATH
+export PATH
+
+# Start from one level above the build directory
+if [ -f version ]; then
+    cd ..
+fi
+
+if [ \! -f build/version ]; then
+    echo "Can't find source directory"
+    exit 1
+fi
+
+# BSD make's "OBJDIR" support freaks out the automake-generated
+# Makefile.  Effectively disable it.
+export MAKEOBJDIRPREFIX=/junk
+
+# Start from the build directory, where the version file is located
+if [ -f build/version ]; then
+    cd build
+fi
+
+if [ \! -f version ]; then
+    echo "Can't find version file"
+    exit 1
+fi
+
+# Update the build number in the 'version' file.
+# Separate number from additional alpha/beta/etc marker
+MARKER=`cat version | sed 's/[0-9.]//g'`
+# Bump the number
+VN=`cat version | sed 's/[^0-9.]//g'`
+# Build out the string.
+VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER"
+
+cd ..
+
+# Clean up the source dir as much as we can.
+/bin/sh build/clean.sh
+
+# Substitute the versions into Libarchive's archive.h and archive_entry.h
+perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive.h
+perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive_entry.h
+perl -p -i -e "s/^(#define\tARCHIVE_VERSION_ONLY_STRING).*/\$1 \"$VS\"/" libarchive/archive.h
+# Substitute versions into configure.ac as well
+perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_S\]),.*\)/$1,['"$VS"'])/' configure.ac
+perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_N\]),.*\)/$1,['"$VN"'])/' configure.ac
+
+# Remove developer CFLAGS if a release build is being made
+if [ -n "${MAKE_LIBARCHIVE_RELEASE}" ]; then
+  perl -p -i -e "s/^(DEV_CFLAGS.*)/# \$1/" Makefile.am
+  perl -p -i -e 's/CMAKE_BUILD_TYPE "[A-Za-z]*"/CMAKE_BUILD_TYPE "Release"/' CMakeLists.txt
+fi
+
+set -xe
+aclocal -I build/autoconf
+
+# Note: --automake flag needed only for libtoolize from
+# libtool 1.5.x; in libtool 2.2.x it is a synonym for --quiet
+case `uname` in
+Darwin) glibtoolize --automake -c;;
+*) libtoolize --automake -c;;
+esac
+autoconf
+autoheader
+automake -a -c

+ 36 - 0
core.mod/libarchive/build/bump-version.sh

@@ -0,0 +1,36 @@
+#!/bin/sh +v
+
+# Start from the build directory, where the version file is located
+if [ -f build/version ]; then
+    cd build
+fi
+
+if [ \! -f version ]; then
+    echo "Can't find version file"
+    exit 1
+fi
+
+# Update the build number in the 'version' file.
+# Separate number from additional alpha/beta/etc marker
+MARKER=`cat version | sed 's/[0-9.]//g'`
+# Bump the number
+VN=`cat version | sed 's/[^0-9.]//g'`
+# Reassemble and write back out
+VN=$(($VN + 1))
+rm -f version.old
+mv version version.old
+chmod +w version.old
+echo $VN$MARKER > version
+VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER"
+cd ..
+
+ANNOUNCE=`date +"%b %d, %Y:"`" libarchive $VS released"
+
+echo $ANNOUNCE
+
+# Add a version notice to NEWS
+mv NEWS NEWS.bak
+chmod +w NEWS.bak
+echo $ANNOUNCE >> NEWS
+echo >> NEWS
+cat NEWS.bak >> NEWS

+ 172 - 0
core.mod/libarchive/build/ci/build.sh

@@ -0,0 +1,172 @@
+#!/bin/sh
+#
+# Automated build and test of libarchive on CI systems
+#
+# Variables that can be passed via environment:
+# BS=			# build system (autotools or cmake)
+# CRYPTO=		# cryptography provider (openssl, nettle or mbedtls)
+# BUILDDIR=		# build directory
+# SRCDIR=		# source directory
+# CONFIGURE_ARGS=	# configure arguments
+# CMAKE_ARGS=		# cmake arguments
+# MAKE_ARGS=		# make arguments
+# DEBUG=		# set -g -fsanitize=address flags
+
+ACTIONS=
+if [ -n "${BUILD_SYSTEM}" ]; then
+	BS="${BUILD_SYSTEM}"
+fi
+
+BS="${BS:-autotools}"
+MAKE="${MAKE:-make}"
+CMAKE="${CMAKE:-cmake}"
+CURDIR=`pwd`
+SRCDIR="${SRCDIR:-`pwd`}"
+RET=0
+
+usage () {
+	echo "Usage: $0 [-b autotools|cmake] [-a autogen|configure|build|test|install|distcheck ] [ -a ... ] [ -d builddir ] [-c openssl|nettle|mbedtls] [-s srcdir ]"
+}
+inputerror () {
+	echo $1
+	usage
+	exit 1
+}
+while getopts a:b:c:d:s: opt; do
+	case ${opt} in
+		a)
+			case "${OPTARG}" in
+				autogen) ;;
+				configure) ;;
+				build) ;;
+				test) ;;
+				install) ;;
+				distcheck) ;;
+				artifact) ;;
+				*) inputerror "Invalid action (-a)" ;;
+			esac
+			ACTIONS="${ACTIONS} ${OPTARG}"
+		;;
+		b) BS="${OPTARG}"
+			case "${BS}" in
+				autotools) ;;
+				cmake) ;;
+				*) inputerror "Invalid build system (-b)" ;;
+			esac
+		;;
+		c) CRYPTO="${OPTARG}"
+			case "${CRYPTO}" in
+				mbedtls) ;;
+				openssl) ;;
+				nettle) ;;
+				*) inputerror "Invalid crypto provider (-c)" ;;
+			esac
+		;;
+		d)
+			BUILDDIR="${OPTARG}"
+		;;
+		s)
+			SRCDIR="${OPTARG}"
+			if [ ! -f "${SRCDIR}/build/version" ]; then
+				inputerror "Missing file: ${SRCDIR}/build/version"
+			fi
+		;;
+	esac
+done
+case "${CRYPTO}" in
+	mbedtls)
+		CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_OPENSSL=OFF -DENABLE_MBEDTLS=ON"
+		CONFIGURE_ARGS="${CONFIGURE_ARGS} --without-openssl --with-mbedtls"
+	;;
+	nettle)
+		CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_OPENSSL=OFF -DENABLE_NETTLE=ON"
+		CONFIGURE_ARGS="${CONFIGURE_ARGS} --without-openssl --with-nettle"
+	;;
+esac
+if [ -z "${MAKE_ARGS}" ]; then
+	if [ "${BS}" = "autotools" ]; then
+		MAKE_ARGS="V=1"
+	elif [ "${BS}" = "cmake" ]; then
+		MAKE_ARGS="VERBOSE=1"
+	fi
+fi
+if [ -n "${DEBUG}" ]; then
+	if [ -n "${CFLAGS}" ]; then
+		export CFLAGS="${CFLAGS} -g -fsanitize=address"
+	else
+		export CFLAGS="-g -fsanitize=address"
+	fi
+	if [ "${BS}" = "cmake" ]; then
+		CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_C_CFLAGS=-g -fsanitize=address"
+	fi
+fi
+if [ -z "${ACTIONS}" ]; then
+	ACTIONS="autogen configure build test install"
+fi
+if [ -z "${BS}" ]; then
+	inputerror "Missing build system (-b) parameter"
+fi
+if [ -z "${BUILDDIR}" ]; then
+	BUILDDIR="${CURDIR}/build_ci/${BS}"
+fi
+mkdir -p "${BUILDDIR}"
+for action in ${ACTIONS}; do
+	cd "${BUILDDIR}"
+	case "${action}" in
+		autogen)
+			case "${BS}" in
+				autotools)
+					cd "${SRCDIR}"
+					sh build/autogen.sh
+					RET="$?"
+				;;
+			esac
+		;;
+		configure)
+			case "${BS}" in
+				autotools) "${SRCDIR}/configure" ${CONFIGURE_ARGS} ;;
+				cmake) ${CMAKE} ${CMAKE_ARGS} "${SRCDIR}" ;;
+			esac
+			RET="$?"
+		;;
+		build)
+			${MAKE} ${MAKE_ARGS}
+			RET="$?"
+		;;
+		test)
+			case "${BS}" in
+				autotools)
+					${MAKE} ${MAKE_ARGS} check LOG_DRIVER="${SRCDIR}/build/ci/test_driver"
+					;;
+				cmake)
+					${MAKE} ${MAKE_ARGS} test
+					;;
+			esac
+			RET="$?"
+			find ${TMPDIR:-/tmp} -path '*_test.*' -name '*.log' -print -exec cat {} \;
+		;;
+		install)
+			${MAKE} ${MAKE_ARGS} install DESTDIR="${BUILDDIR}/destdir"
+			RET="$?"
+			cd "${BUILDDIR}/destdir" && ls -lR .
+		;;
+		distcheck)
+			${MAKE} ${MAKE_ARGS} distcheck || (
+				RET="$?"
+				find . -name 'test-suite.log' -print -exec cat {} \;
+				find ${TMPDIR:-/tmp} -path '*_test.*' -name '*.log' -print -exec cat {} \;
+				exit "${RET}"
+			)
+			RET="$?"
+		;;
+		artifact)
+			tar -c -J -C "${BUILDDIR}/destdir" -f "${CURDIR}/libarchive.tar.xz" usr
+			ls -l "${CURDIR}/libarchive.tar.xz"
+		;;
+	esac
+	if [ "${RET}" != "0" ]; then
+		exit "${RET}"
+	fi
+	cd "${CURDIR}"
+done
+exit "${RET}"

+ 4 - 0
core.mod/libarchive/build/ci/cirrus_ci/Dockerfile.cygwin

@@ -0,0 +1,4 @@
+FROM cirrusci/windowsservercore:2019
+
+RUN choco install -y --no-progress cygwin
+RUN C:\tools\cygwin\cygwinsetup.exe -q -P make,autoconf,automake,cmake,gcc-core,binutils,libtool,pkg-config,bison,sharutils,zlib-devel,libbz2-devel,liblzma-devel,liblz4-devel,libiconv-devel,libxml2-devel,libzstd-devel,libssl-devel

+ 3 - 0
core.mod/libarchive/build/ci/cirrus_ci/Dockerfile.fc31

@@ -0,0 +1,3 @@
+FROM fedora:31
+
+RUN dnf -y install make cmake gcc gcc-c++ kernel-devel automake libtool bison sharutils pkgconf libacl-devel libasan librichacl-devel bzip2-devel zlib-devel xz-devel lz4-devel libzstd-devel openssl-devel nettle-devel mbedtls-devel

+ 3 - 0
core.mod/libarchive/build/ci/cirrus_ci/Dockerfile.fc31.distcheck

@@ -0,0 +1,3 @@
+FROM fedora:31
+
+RUN dnf -y install make cmake gcc gcc-c++ kernel-devel automake libtool bison sharutils pkgconf libacl-devel libasan librichacl-devel bzip2-devel zlib-devel xz-devel lz4-devel libzstd-devel openssl-devel groff ghostscript xz zip

+ 8 - 0
core.mod/libarchive/build/ci/cirrus_ci/Dockerfile.mingw

@@ -0,0 +1,8 @@
+FROM cirrusci/windowsservercore:2019
+
+RUN choco install -y --no-progress --installargs 'ADD_CMAKE_TO_PATH=User' cmake
+RUN choco install -y --no-progress mingw
+RUN curl -o zlib-1.2.11.tar.gz https://www.zlib.net/zlib-1.2.11.tar.gz
+RUN tar -x -f zlib-1.2.11.tar.gz
+RUN cd zlib-1.2.11 && cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="Release" . && mingw32-make && mingw32-make install
+RUN del /f /q /s zlib-1.2.11 zlib-1.2.11.tar.gz

+ 9 - 0
core.mod/libarchive/build/ci/cirrus_ci/Dockerfile.msvc

@@ -0,0 +1,9 @@
+FROM cirrusci/windowsservercore:2019
+
+RUN choco install -y --no-progress --installargs 'ADD_CMAKE_TO_PATH=User' cmake
+RUN choco install -y --no-progress visualstudio2017community
+RUN choco install -y --no-progress visualstudio2017-workload-vctools
+RUN curl -o zlib-1.2.11.tar.gz https://www.zlib.net/zlib-1.2.11.tar.gz
+RUN tar -x -f zlib-1.2.11.tar.gz
+RUN cd zlib-1.2.11 && cmake -G "Visual Studio 15 2017" . && cmake --build . --target ALL_BUILD --config Release && cmake --build . --target INSTALL --config Release
+RUN del /f /q /s zlib-1.2.11 zlib-1.2.11.tar.gz

+ 12 - 0
core.mod/libarchive/build/ci/cirrus_ci/Dockerfile.windows

@@ -0,0 +1,12 @@
+FROM cirrusci/windowsservercore:2019
+
+RUN choco install -y --no-progress mingw
+RUN choco install -y --no-progress --installargs 'ADD_CMAKE_TO_PATH=User' cmake
+RUN choco install -y --no-progress visualstudio2017community
+RUN choco install -y --no-progress visualstudio2017-workload-vctools
+RUN curl -o zlib-1.2.11.tar.gz https://www.zlib.net/zlib-1.2.11.tar.gz
+RUN tar -x -f zlib-1.2.11.tar.gz
+RUN cd zlib-1.2.11 && cmake -G "Visual Studio 15 2017" . && cmake --build . --target ALL_BUILD --config Release && cmake --build . --target INSTALL --config Release
+RUN del /f /q /s zlib-1.2.11 zlib-1.2.11.tar.gz
+RUN choco install -y --no-progress cygwin
+RUN C:\tools\cygwin\cygwinsetup.exe -q -P make,autoconf,automake,cmake,gcc-core,binutils,libtool,pkg-config,bison,sharutils,zlib-devel,libbz2-devel,liblzma-devel,liblz4-devel,libiconv-devel,libxml2-devel,libzstd-devel,libssl-devel

+ 122 - 0
core.mod/libarchive/build/ci/cirrus_ci/ci.cmd

@@ -0,0 +1,122 @@
+@ECHO OFF
+SET ZLIB_VERSION=1.2.11
+IF NOT "%BE%"=="cygwin-gcc"  (
+  IF NOT "%BE%"=="mingw-gcc" (
+    IF NOT "%BE%"=="msvc" (
+      ECHO Environment variable BE must be cygwin-gcc, mingw-gcc or msvc
+      EXIT /b 1
+    )
+  )
+)
+
+IF "%1%"=="prepare" (
+  IF "%BE%"=="cygwin-gcc" (
+    @ECHO ON
+    choco install -y --no-progress cygwin || EXIT /b 1
+    C:\tools\cygwin\cygwinsetup.exe -q -P make,autoconf,automake,cmake,gcc-core,binutils,libtool,pkg-config,bison,sharutils,zlib-devel,libbz2-devel,liblzma-devel,liblz4-devel,libiconv-devel,libxml2-devel,libzstd-devel,libssl-devel || EXIT /b 1
+    @EXIT /b 0
+  ) ELSE IF "%BE%"=="mingw-gcc" (
+    @ECHO ON
+    choco install -y --no-progress mingw || EXIT /b 1
+    choco install -y --no-progress --installargs 'ADD_CMAKE_TO_PATH=System' cmake || EXIT /b 1
+    @EXIT /b 0
+  ) ELSE IF "%BE%"=="msvc" (
+    @ECHO ON
+    choco install -y --no-progress visualstudio2017community || EXIT /b 1
+    choco install -y --no-progress visualstudio2017-workload-vctools || EXIT /b 1
+    choco install -y --no-progress --installargs 'ADD_CMAKE_TO_PATH=System' cmake || EXIT /b 1
+  )
+) ELSE IF "%1"=="deplibs" (
+  IF "%BE%"=="cygwin-gcc" (
+    ECHO Skipping on this platform
+    EXIT /b 0
+  )
+  IF NOT EXIST build_ci\libs (
+    MKDIR build_ci\libs
+  )
+  CD build_ci\libs
+  IF NOT EXIST zlib-%ZLIB_VERSION%.tar.gz (
+    curl -o zlib-%ZLIB_VERSION%.tar.gz https://www.zlib.net/zlib-%ZLIB_VERSION%.tar.gz
+  )
+  IF NOT EXIST zlib-%ZLIB_VERSION% (
+    tar -x -z -f zlib-%ZLIB_VERSION%.tar.gz
+  )
+  SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
+  CD zlib-%ZLIB_VERSION%
+  IF "%BE%"=="mingw-gcc" (
+    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 15 2017" . || 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
+  )
+) ELSE IF "%1%"=="configure" (
+  IF "%BE%"=="cygwin-gcc" (
+    SET BS=cmake
+    SET CONFIGURE_ARGS=-DENABLE_ACL=OFF
+    C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%'; ./build/ci/build.sh -a configure" || EXIT /b 1
+  ) ELSE IF "%BE%"=="mingw-gcc" (
+    SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
+    MKDIR build_ci\cmake
+    CD build_ci\cmake
+    cmake -G "MinGW Makefiles" ..\.. || EXIT /b 1
+  ) ELSE IF "%BE%"=="msvc" (
+    SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
+    MKDIR build_ci\cmake
+    CD build_ci\cmake
+    cmake -G "Visual Studio 15 2017" -D CMAKE_BUILD_TYPE="Release" ..\.. || EXIT /b 1
+  )
+) ELSE IF "%1%"=="build" (
+  IF "%BE%"=="cygwin-gcc" (
+    SET BS=cmake
+    C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%'; ./build/ci/build.sh -a build"
+  ) ELSE IF "%BE%"=="mingw-gcc" (
+    SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
+    CD build_ci\cmake
+    mingw32-make || EXIT /b 1
+  ) ELSE IF "%BE%"=="msvc" (
+    SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
+    CD build_ci\cmake
+    cmake --build . --target ALL_BUILD --config Release
+  )
+) ELSE IF "%1%"=="test" (
+  IF "%BE%"=="cygwin-gcc" (
+    ECHO "Skipping tests on this platform"
+    EXIT /b 0
+    REM SET BS=cmake
+    REM SET SKIP_TEST_SPARSE=1
+    REM C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%'; ./build/ci/build.sh -a test"
+  ) ELSE IF "%BE%"=="mingw-gcc" (
+    SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
+    COPY "C:\Program Files (x86)\zlib\bin\libzlib.dll" build_ci\cmake\bin\
+    CD build_ci\cmake
+    SET SKIP_TEST_SPARSE=1
+    mingw32-make test
+  ) ELSE IF "%BE%"=="msvc" (
+    SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
+    ECHO "Skipping tests on this platform"
+    EXIT /b 0
+    REM CD build_ci\cmake
+    REM cmake --build . --target RUN_TESTS --config Release
+  )
+) ELSE IF "%1%"=="install" (
+  IF "%BE%"=="cygwin-gcc" (
+    SET BS=cmake
+    C:\tools\cygwin\bin\bash.exe --login -c "cd '%cd%'; ./build/ci/build.sh -a install"
+  ) ELSE IF "%BE%"=="mingw-gcc" (
+    SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
+    CD build_ci\cmake
+    mingw32-make install DESTDIR=%cd%\destdir
+  ) ELSE IF "%BE%"=="msvc" (
+    SET PATH=%PATH%;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
+    cmake --build . --target INSTALL --config Release
+  )
+) ELSE (
+  ECHO "Usage: %0% prepare|deplibs|configure|build|test|install"
+  @EXIT /b 0
+)
+@EXIT /b 0

+ 58 - 0
core.mod/libarchive/build/ci/cirrus_ci/ci.sh

@@ -0,0 +1,58 @@
+#!/bin/sh
+UNAME=`uname`
+if [ "$1" = "prepare" ]
+then
+	if [ "${UNAME}" = "FreeBSD" ]
+	then
+		set -x -e
+		env ASSUME_ALWAYS_YES=yes pkg bootstrap -f
+		sed -i.bak -e 's,pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly,pkg+http://pkg.FreeBSD.org/\${ABI}/latest,' /etc/pkg/FreeBSD.conf
+		pkg update
+		mount -u -o acls /
+		mkdir /tmp_acl_nfsv4
+		MD=`mdconfig -a -t swap -s 128M`
+		newfs /dev/$MD
+		tunefs -N enable /dev/$MD
+		mount /dev/$MD /tmp_acl_nfsv4
+		chmod 1777 /tmp_acl_nfsv4
+		pkg install -y autoconf automake cmake libiconv libtool pkgconf expat libxml2 liblz4 zstd
+	elif [ "${UNAME}" = "Darwin" ]
+	then
+		set -x -e
+		brew update > /dev/null
+		for pkg in autoconf automake libtool pkg-config cmake xz lz4 zstd
+		do
+			brew list $pkg > /dev/null && brew upgrade $pkg || brew install $pkg
+		done
+	elif [ "${UNAME}" = "Linux" ]
+	then
+		if [ -f "/etc/debian_version" ]
+		then
+			apt-get -y update
+			apt-get -y install build-essential locales automake libtool bison sharutils pkgconf libacl1-dev libbz2-dev zlib1g-dev liblzma-dev liblz4-dev libzstd-dev libssl-dev lrzip cmake
+		elif [ -f "/etc/fedora-release" ]
+		then
+			dnf -y install make cmake gcc gcc-c++ kernel-devel automake libtool bison sharutils pkgconf libacl-devel librichacl-devel bzip2-devel zlib-devel xz-devel lz4-devel libzstd-devel openssl-devel
+		fi
+	fi
+elif [ "$1" = "test" ]
+then
+	if [ "${UNAME}" = "FreeBSD" ]
+	then
+		set -e
+		echo "Additional NFSv4 ACL tests"
+		CURDIR=`pwd`
+		if [ "${BS}" = "cmake" ]
+		then
+			BIN_SUBDIR="bin"
+		else
+			BIN_SUBDIR=.
+		fi
+		BUILDDIR="${CURDIR}/build_ci/${BS}"
+		cd "$BUILDDIR"
+		TMPDIR=/tmp_acl_nfsv4 ${BIN_SUBDIR}/libarchive_test -r "${CURDIR}/libarchive/test" -v test_acl_platform_nfs4
+	fi
+else
+	echo "Usage $0 prepare | test_nfsv4_acls"
+	exit 1
+fi

+ 132 - 0
core.mod/libarchive/build/ci/github_actions/ci.cmd

@@ -0,0 +1,132 @@
+@ECHO OFF
+SET ZLIB_VERSION=1.2.11
+SET BZIP2_VERSION=b7a672291188a6469f71dd13ad14f2f9a7344fc8
+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/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

+ 25 - 0
core.mod/libarchive/build/ci/github_actions/macos.sh

@@ -0,0 +1,25 @@
+#!/bin/sh
+if [ "$1" = "prepare" ]
+then
+	set -x
+	brew uninstall [email protected] > /dev/null
+	brew uninstall [email protected] > /dev/null
+	brew untap local/openssl > /dev/null
+	brew untap local/python2 > /dev/null
+	brew update > /dev/null
+	brew upgrade > /dev/null
+	set -x -e
+	for pkg in \
+		autoconf \
+		automake \
+		libtool \
+		pkg-config \
+		cmake \
+		xz \
+		lz4 \
+		zstd \
+		openssl
+	do
+		brew list $pkg > /dev/null && brew upgrade $pkg || brew install $pkg
+	done
+fi

+ 148 - 0
core.mod/libarchive/build/ci/test_driver

@@ -0,0 +1,148 @@
+#! /bin/sh
+# test-driver - basic testsuite driver script.
+
+scriptversion=2013-07-13.22; # UTC
+
+# Copyright (C) 2011-2014 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# This file is maintained in Automake, please report
+# bugs to <[email protected]> or send patches to
+# <[email protected]>.
+
+# Make unconditional expansion of undefined variables an error.  This
+# helps a lot in preventing typo-related bugs.
+set -u
+
+usage_error ()
+{
+  echo "$0: $*" >&2
+  print_usage >&2
+  exit 2
+}
+
+print_usage ()
+{
+  cat <<END
+Usage:
+  test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
+              [--expect-failure={yes|no}] [--color-tests={yes|no}]
+              [--enable-hard-errors={yes|no}] [--]
+              TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
+The '--test-name', '--log-file' and '--trs-file' options are mandatory.
+END
+}
+
+test_name= # Used for reporting.
+log_file=  # Where to save the output of the test script.
+trs_file=  # Where to save the metadata of the test run.
+expect_failure=no
+color_tests=no
+enable_hard_errors=yes
+while test $# -gt 0; do
+  case $1 in
+  --help) print_usage; exit $?;;
+  --version) echo "test-driver $scriptversion"; exit $?;;
+  --test-name) test_name=$2; shift;;
+  --log-file) log_file=$2; shift;;
+  --trs-file) trs_file=$2; shift;;
+  --color-tests) color_tests=$2; shift;;
+  --expect-failure) expect_failure=$2; shift;;
+  --enable-hard-errors) enable_hard_errors=$2; shift;;
+  --) shift; break;;
+  -*) usage_error "invalid option: '$1'";;
+   *) break;;
+  esac
+  shift
+done
+
+missing_opts=
+test x"$test_name" = x && missing_opts="$missing_opts --test-name"
+test x"$log_file"  = x && missing_opts="$missing_opts --log-file"
+test x"$trs_file"  = x && missing_opts="$missing_opts --trs-file"
+if test x"$missing_opts" != x; then
+  usage_error "the following mandatory options are missing:$missing_opts"
+fi
+
+if test $# -eq 0; then
+  usage_error "missing argument"
+fi
+
+if test $color_tests = yes; then
+  # Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
+  red='' # Red.
+  grn='' # Green.
+  lgn='' # Light green.
+  blu='' # Blue.
+  mgn='' # Magenta.
+  std=''     # No color.
+else
+  red= grn= lgn= blu= mgn= std=
+fi
+
+do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
+trap "st=129; $do_exit" 1
+trap "st=130; $do_exit" 2
+trap "st=141; $do_exit" 13
+trap "st=143; $do_exit" 15
+
+# Test script is run here.
+( "$@"; echo "$?" > $log_file.s ) | tee $log_file 2>&1
+estatus=`cat $log_file.s`
+
+if test $enable_hard_errors = no && test $estatus -eq 99; then
+  tweaked_estatus=1
+else
+  tweaked_estatus=$estatus
+fi
+
+case $tweaked_estatus:$expect_failure in
+  0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
+  0:*)   col=$grn res=PASS  recheck=no  gcopy=no;;
+  77:*)  col=$blu res=SKIP  recheck=no  gcopy=yes;;
+  99:*)  col=$mgn res=ERROR recheck=yes gcopy=yes;;
+  *:yes) col=$lgn res=XFAIL recheck=no  gcopy=yes;;
+  *:*)   col=$red res=FAIL  recheck=yes gcopy=yes;;
+esac
+
+# Report the test outcome and exit status in the logs, so that one can
+# know whether the test passed or failed simply by looking at the '.log'
+# file, without the need of also peaking into the corresponding '.trs'
+# file (automake bug#11814).
+echo "$res $test_name (exit status: $estatus)" >>$log_file
+
+# Report outcome to console.
+echo "${col}${res}${std}: $test_name"
+
+# Register the test result, and other relevant metadata.
+echo ":test-result: $res" > $trs_file
+echo ":global-test-result: $res" >> $trs_file
+echo ":recheck: $recheck" >> $trs_file
+echo ":copy-in-global-log: $gcopy" >> $trs_file
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:

+ 33 - 0
core.mod/libarchive/build/ci/travis_ci.sh

@@ -0,0 +1,33 @@
+#!/bin/sh
+set -e
+UNAME=`uname`
+CURDIR=`pwd`
+SRCDIR="${SRCDIR:-`pwd`}"
+if [ -z "${BUILDDIR}" ]; then
+        BUILDDIR="${CURDIR}/build_ci/${BS}"
+fi
+mkdir -p "${BUILDDIR}"
+cd "${BUILDDIR}"
+case "$UNAME" in
+	MSYS*)
+	if [ "${BS}" = "msbuild" ]; then
+		set -x
+		cmake -G "Visual Studio 15 2017" -D CMAKE_BUILD_TYPE="Release" "${SRCDIR}"
+		cmake --build . --target ALL_BUILD
+		# Until fixed, we don't run tests on Windows (lots of fails + timeout)
+		#export SKIP_TEST_FUZZ=1
+		#cmake --build . --target RUN_TESTS
+		set +x
+	elif [ "${BS}" = "mingw" ]; then
+		set -x
+		cmake -G "MSYS Makefiles" -D CMAKE_C_COMPILER="${CC}" -D CMAKE_MAKE_PROGRAM="mingw32-make" -D CMAKE_BUILD_TYPE="Release" "${SRCDIR}"
+		mingw32-make
+		#export SKIP_TEST_FUZZ=1
+		#mingw32-make test
+		set +x
+	else
+		echo "Unknown or unspecified build type: ${BS}"
+		exit 1
+	fi
+	;;
+esac

+ 99 - 0
core.mod/libarchive/build/clean.sh

@@ -0,0 +1,99 @@
+#!/bin/sh
+
+#
+# Attempt to remove as many generated files as we can.
+# Ideally, a well-used development sandbox would look like
+# a pristine checkout after running this script.
+#
+
+if [ \! -f build/version ]; then
+    echo 'Must run the clean script from the top-level dir of the libarchive distribution' 1>&2
+    exit 1
+fi
+
+# If we're on BSD, blow away the build dir under /usr/obj
+rm -rf /usr/obj`pwd`
+
+#
+# Try to clean up a bit more...
+#
+
+find . -name '*.So' | xargs rm -f
+find . -name '*.a' | xargs rm -f
+find . -name '*.la' | xargs rm -f
+find . -name '*.lo' | xargs rm -f
+find . -name '*.o' | xargs rm -f
+find . -name '*.orig' | xargs rm -f
+find . -name '*.po' | xargs rm -f
+find . -name '*.rej' | xargs rm -f
+find . -name '*~' | xargs rm -f
+find . -name '.depend' | xargs rm -f
+find . -name '.deps' | xargs rm -rf
+find . -name '.dirstamp' | xargs rm -f
+find . -name '.libs' | xargs rm -rf
+find . -name 'CMakeFiles' | xargs rm -rf
+find . -name 'cmake_install.cmake' | xargs rm -f
+find . -name 'CTestTestfile.cmake' | xargs rm -f
+
+rm -rf Testing
+rm -rf autom4te.cache
+rm -rf bin
+rm -rf cmake.tmp
+rm -rf libarchive/Testing
+
+rm -f CMakeCache.txt
+rm -f DartConfiguration.tcl
+rm -f Makefile
+rm -f Makefile.in
+rm -f aclocal.m4
+rm -f bsdcpio
+rm -f bsdcpio_test
+rm -f bsdtar
+rm -f bsdtar_test
+rm -f build/autoconf/compile
+rm -f build/autoconf/config.guess
+rm -f build/autoconf/config.sub
+rm -f build/autoconf/depcomp
+rm -f build/autoconf/install-sh
+rm -f build/autoconf/libtool.m4
+rm -f build/autoconf/ltmain.sh
+rm -f build/autoconf/ltoptions.m4
+rm -f build/autoconf/ltsugar.m4
+rm -f build/autoconf/ltversion.m4
+rm -f build/autoconf/lt~obsolete.m4
+rm -f build/autoconf/missing
+rm -f build/autoconf/test-driver
+rm -f build/pkgconfig/libarchive.pc
+rm -f build/version.old
+rm -f cat/test/list.h
+rm -f config.h
+rm -f config.h.in
+rm -f config.log
+rm -f config.status
+rm -f configure
+rm -f cpio/*.1.gz
+rm -f cpio/Makefile
+rm -f cpio/bsdcpio
+rm -f cpio/test/Makefile
+rm -f cpio/test/bsdcpio_test
+rm -f cpio/test/list.h
+rm -f doc/html/*
+rm -f doc/man/*
+rm -f doc/pdf/*
+rm -f doc/text/*
+rm -f doc/wiki/*
+rm -f libarchive/*.[35].gz
+rm -f libarchive/Makefile
+rm -f libarchive/libarchive.so*
+rm -f libarchive/test/Makefile
+rm -f libarchive/test/libarchive_test
+rm -f libarchive/test/list.h
+rm -f libarchive_test
+rm -f libtool
+rm -f stamp-h1
+rm -f tar/*.1.gz
+rm -f tar/Makefile
+rm -f tar/bsdtar
+rm -f tar/test/Makefile
+rm -f tar/test/bsdtar_test
+rm -f tar/test/list.h

+ 14 - 0
core.mod/libarchive/build/cmake/CheckFileOffsetBits.c

@@ -0,0 +1,14 @@
+#include <sys/types.h>
+
+#define KB ((off_t)1024)
+#define MB ((off_t)1024 * KB)
+#define GB ((off_t)1024 * MB)
+#define TB ((off_t)1024 * GB)
+int t2[(((64 * GB -1) % 671088649) == 268434537)
+       && (((TB - (64 * GB -1) + 255) % 1792151290) == 305159546)? 1: -1];
+
+int main()
+{
+  ;
+  return 0;
+}

+ 44 - 0
core.mod/libarchive/build/cmake/CheckFileOffsetBits.cmake

@@ -0,0 +1,44 @@
+# - Check if _FILE_OFFSET_BITS macro needed for large files
+# CHECK_FILE_OFFSET_BITS ()
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+#  CMAKE_REQUIRED_FLAGS = string of compile command line flags
+#  CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+#  CMAKE_REQUIRED_INCLUDES = list of include directories
+# Copyright (c) 2009, Michihiro NAKAJIMA
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+#INCLUDE(CheckCXXSourceCompiles)
+
+GET_FILENAME_COMPONENT(_selfdir_CheckFileOffsetBits
+	 "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+MACRO (CHECK_FILE_OFFSET_BITS)
+  IF(NOT DEFINED _FILE_OFFSET_BITS)
+    MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files")
+    TRY_COMPILE(__WITHOUT_FILE_OFFSET_BITS_64
+      ${CMAKE_CURRENT_BINARY_DIR}
+      ${_selfdir_CheckFileOffsetBits}/CheckFileOffsetBits.c
+      COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS})
+    IF(NOT __WITHOUT_FILE_OFFSET_BITS_64)
+      TRY_COMPILE(__WITH_FILE_OFFSET_BITS_64
+        ${CMAKE_CURRENT_BINARY_DIR}
+        ${_selfdir_CheckFileOffsetBits}/CheckFileOffsetBits.c
+        COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=64)
+    ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64)
+
+    IF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
+      SET(_FILE_OFFSET_BITS 64 CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files")
+      MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files - needed")
+    ELSE(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
+      SET(_FILE_OFFSET_BITS "" CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files")
+      MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files - not needed")
+    ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64)
+  ENDIF(NOT DEFINED _FILE_OFFSET_BITS)
+
+ENDMACRO (CHECK_FILE_OFFSET_BITS)
+

+ 49 - 0
core.mod/libarchive/build/cmake/CheckFuncs.cmake

@@ -0,0 +1,49 @@
+# Check if the system has the specified function; treat glibc "stub"
+# functions as nonexistent:
+# CHECK_FUNCTION_EXISTS_GLIBC (FUNCTION FUNCVAR)
+#
+#  FUNCTION - the function(s) where the prototype should be declared
+#  FUNCVAR - variable to define if the function does exist
+#
+# In particular, this understands the glibc convention of
+# defining macros __stub_XXXX or __stub___XXXX if the function
+# does appear in the library but is merely a stub that does nothing.
+# By detecting this case, we can select alternate behavior on
+# platforms that don't support this functionality.
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+#  CMAKE_REQUIRED_FLAGS = string of compile command line flags
+#  CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+#  CMAKE_REQUIRED_INCLUDES = list of include directories
+# Copyright (c) 2009, Michihiro NAKAJIMA
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+INCLUDE(CheckFunctionExists)
+GET_FILENAME_COMPONENT(_selfdir_CheckFunctionExistsGlibc
+	 "${CMAKE_CURRENT_LIST_FILE}" PATH)
+
+MACRO (CHECK_FUNCTION_EXISTS_GLIBC _FUNC _FUNCVAR)
+   IF(NOT DEFINED ${_FUNCVAR})
+     SET(CHECK_STUB_FUNC_1 "__stub_${_FUNC}")
+     SET(CHECK_STUB_FUNC_2 "__stub___${_FUNC}")
+     CONFIGURE_FILE( ${_selfdir_CheckFunctionExistsGlibc}/CheckFuncs_stub.c.in
+       ${CMAKE_CURRENT_BINARY_DIR}/cmake.tmp/CheckFuncs_stub.c IMMEDIATE)
+     TRY_COMPILE(__stub
+       ${CMAKE_CURRENT_BINARY_DIR}
+       ${CMAKE_CURRENT_BINARY_DIR}/cmake.tmp/CheckFuncs_stub.c
+       COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
+       CMAKE_FLAGS
+       -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS}
+       "${CHECK_INCLUDE_FILE_C_INCLUDE_DIRS}")
+     IF (__stub)
+       SET("${_FUNCVAR}" "" CACHE INTERNAL "Have function ${_FUNC}")
+     ELSE (__stub)
+       CHECK_FUNCTION_EXISTS("${_FUNC}" "${_FUNCVAR}")
+     ENDIF (__stub)
+  ENDIF(NOT DEFINED ${_FUNCVAR})
+ENDMACRO (CHECK_FUNCTION_EXISTS_GLIBC)
+

+ 16 - 0
core.mod/libarchive/build/cmake/CheckFuncs_stub.c.in

@@ -0,0 +1,16 @@
+#ifdef __STDC__
+#include <limits.h>
+#else
+#include <assert.h>
+#endif
+
+int
+main()
+{
+#if defined ${CHECK_STUB_FUNC_1} || defined ${CHECK_STUB_FUNC_2}
+  return 0;
+#else
+this system have stub
+  return 0;
+#endif
+}

+ 32 - 0
core.mod/libarchive/build/cmake/CheckHeaderDirent.cmake

@@ -0,0 +1,32 @@
+# - Check if the system has the specified type
+# CHECK_HEADER_DIRENT (HEADER1 HEARDER2 ...)
+#
+#  HEADER - the header(s) where the prototype should be declared
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+#  CMAKE_REQUIRED_FLAGS = string of compile command line flags
+#  CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+#  CMAKE_REQUIRED_INCLUDES = list of include directories
+# Copyright (c) 2009, Michihiro NAKAJIMA
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+INCLUDE(CheckTypeExists)
+
+MACRO (CHECK_HEADER_DIRENT)
+  CHECK_TYPE_EXISTS("DIR *" dirent.h     HAVE_DIRENT_H)
+  IF(NOT HAVE_DIRENT_H)
+    CHECK_TYPE_EXISTS("DIR *" sys/ndir.h  HAVE_SYS_NDIR_H)
+    IF(NOT HAVE_SYS_NDIR_H)
+      CHECK_TYPE_EXISTS("DIR *" ndir.h      HAVE_NDIR_H)
+      IF(NOT HAVE_NDIR_H)
+        CHECK_TYPE_EXISTS("DIR *" sys/dir.h   HAVE_SYS_DIR_H)
+      ENDIF(NOT HAVE_NDIR_H)
+    ENDIF(NOT HAVE_SYS_NDIR_H)
+  ENDIF(NOT HAVE_DIRENT_H)
+ENDMACRO (CHECK_HEADER_DIRENT)
+

+ 42 - 0
core.mod/libarchive/build/cmake/CheckTypeExists.cmake

@@ -0,0 +1,42 @@
+# - Check if the system has the specified type
+# CHECK_TYPE_EXISTS (TYPE HEADER VARIABLE)
+#
+#  TYPE - the name of the type or struct or class you are interested in
+#  HEADER - the header(s) where the prototype should be declared
+#  VARIABLE - variable to store the result
+#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+#  CMAKE_REQUIRED_FLAGS = string of compile command line flags
+#  CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+#  CMAKE_REQUIRED_INCLUDES = list of include directories
+# Copyright (c) 2009, Michihiro NAKAJIMA
+# Copyright (c) 2006, Alexander Neundorf, <[email protected]>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+INCLUDE(CheckCSourceCompiles)
+
+MACRO (CHECK_TYPE_EXISTS _TYPE _HEADER _RESULT)
+   SET(_INCLUDE_FILES)
+   FOREACH (it ${_HEADER})
+      SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n")
+   ENDFOREACH (it)
+
+   SET(_CHECK_TYPE_EXISTS_SOURCE_CODE "
+${_INCLUDE_FILES}
+int main()
+{
+   static ${_TYPE} tmp;
+   if (sizeof(tmp))
+      return 0;
+  return 0;
+}
+")
+   CHECK_C_SOURCE_COMPILES("${_CHECK_TYPE_EXISTS_SOURCE_CODE}" ${_RESULT})
+
+ENDMACRO (CHECK_TYPE_EXISTS)
+

+ 33 - 0
core.mod/libarchive/build/cmake/CreatePkgConfigFile.cmake

@@ -0,0 +1,33 @@
+# - Generate a libarchive.pc like autotools for pkg-config
+#
+
+# Set the required variables (we use the same input file as autotools)
+SET(prefix ${CMAKE_INSTALL_PREFIX})
+SET(exec_prefix \${prefix})
+SET(libdir \${exec_prefix}/lib)
+SET(includedir \${prefix}/include)
+# Now, this is not particularly pretty, nor is it terribly accurate...
+# Loop over all our additional libs
+FOREACH(mylib ${ADDITIONAL_LIBS})
+	# Extract the filename from the absolute path
+	GET_FILENAME_COMPONENT(mylib_name ${mylib} NAME_WE)
+	# Strip the lib prefix
+	STRING(REGEX REPLACE "^lib" "" mylib_name ${mylib_name})
+	# Append it to our LIBS string
+	SET(LIBS "${LIBS} -l${mylib_name}")
+ENDFOREACH()
+# libxml2 is easier, since it's already using pkg-config
+FOREACH(mylib ${PC_LIBXML_STATIC_LDFLAGS})
+	SET(LIBS "${LIBS} ${mylib}")
+ENDFOREACH()
+# FIXME: The order of the libraries doesn't take dependencies into account,
+#	 thus there's a good chance it'll make some binutils versions unhappy...
+#	 This only affects Libs.private (looked up for static builds) though.
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/pkgconfig/libarchive.pc.in
+		${CMAKE_CURRENT_BINARY_DIR}/build/pkgconfig/libarchive.pc
+		@ONLY)
+# And install it, of course ;).
+IF(ENABLE_INSTALL)
+  INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/build/pkgconfig/libarchive.pc
+          DESTINATION "lib/pkgconfig")
+ENDIF()

+ 22 - 0
core.mod/libarchive/build/cmake/FindLibGCC.cmake

@@ -0,0 +1,22 @@
+# - Find libgcc
+# Find the libgcc library.
+#
+#  LIBGCC_LIBRARIES      - List of libraries when using libgcc
+#  LIBGCC_FOUND          - True if libgcc found.
+
+IF (LIBGCC_LIBRARY)
+  # Already in cache, be silent
+  SET(LIBGCC_FIND_QUIETLY TRUE)
+ENDIF (LIBGCC_LIBRARY)
+
+FIND_LIBRARY(LIBGCC_LIBRARY NAMES gcc libgcc)
+
+# handle the QUIETLY and REQUIRED arguments and set LIBGCC_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGCC DEFAULT_MSG LIBGCC_LIBRARY)
+
+IF(LIBGCC_FOUND)
+  SET(LIBGCC_LIBRARIES ${LIBGCC_LIBRARY})
+  SET(HAVE_LIBGCC 1)
+ENDIF(LIBGCC_FOUND)

+ 13 - 0
core.mod/libarchive/build/cmake/FindMbedTLS.cmake

@@ -0,0 +1,13 @@
+find_path(MBEDTLS_INCLUDE_DIRS mbedtls/ssl.h)
+
+find_library(MBEDTLS_LIBRARY mbedtls)
+find_library(MBEDX509_LIBRARY mbedx509)
+find_library(MBEDCRYPTO_LIBRARY mbedcrypto)
+
+set(MBEDTLS_LIBRARIES "${MBEDTLS_LIBRARY}" "${MBEDX509_LIBRARY}" "${MBEDCRYPTO_LIBRARY}")
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(MBEDTLS DEFAULT_MSG
+    MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
+
+mark_as_advanced(MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)

+ 23 - 0
core.mod/libarchive/build/cmake/FindNettle.cmake

@@ -0,0 +1,23 @@
+# - Find Nettle
+# Find the Nettle include directory and library
+#
+#  NETTLE_INCLUDE_DIR    - where to find <nettle/sha.h>, etc.
+#  NETTLE_LIBRARIES      - List of libraries when using libnettle.
+#  NETTLE_FOUND          - True if libnettle found.
+
+IF (NETTLE_INCLUDE_DIR)
+  # Already in cache, be silent
+  SET(NETTLE_FIND_QUIETLY TRUE)
+ENDIF (NETTLE_INCLUDE_DIR)
+
+FIND_PATH(NETTLE_INCLUDE_DIR nettle/md5.h nettle/ripemd160.h nettle/sha.h)
+FIND_LIBRARY(NETTLE_LIBRARY NAMES nettle libnettle)
+
+# handle the QUIETLY and REQUIRED arguments and set NETTLE_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETTLE DEFAULT_MSG NETTLE_LIBRARY NETTLE_INCLUDE_DIR)
+
+IF(NETTLE_FOUND)
+  SET(NETTLE_LIBRARIES ${NETTLE_LIBRARY})
+ENDIF(NETTLE_FOUND)

+ 34 - 0
core.mod/libarchive/build/cmake/FindPCREPOSIX.cmake

@@ -0,0 +1,34 @@
+# - Find pcreposix
+# Find the native PCRE and PCREPOSIX include and libraries
+#
+#  PCRE_INCLUDE_DIR    - where to find pcreposix.h, etc.
+#  PCREPOSIX_LIBRARIES - List of libraries when using libpcreposix.
+#  PCRE_LIBRARIES      - List of libraries when using libpcre.
+#  PCREPOSIX_FOUND     - True if libpcreposix found.
+#  PCRE_FOUND          - True if libpcre found.
+
+IF (PCRE_INCLUDE_DIR)
+  # Already in cache, be silent
+  SET(PCRE_FIND_QUIETLY TRUE)
+ENDIF (PCRE_INCLUDE_DIR)
+
+FIND_PATH(PCRE_INCLUDE_DIR pcreposix.h)
+FIND_LIBRARY(PCREPOSIX_LIBRARY NAMES pcreposix libpcreposix)
+FIND_LIBRARY(PCRE_LIBRARY NAMES pcre libpcre)
+
+# handle the QUIETLY and REQUIRED arguments and set PCREPOSIX_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCREPOSIX DEFAULT_MSG PCREPOSIX_LIBRARY PCRE_INCLUDE_DIR)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY)
+
+IF(PCREPOSIX_FOUND)
+  SET(PCREPOSIX_LIBRARIES ${PCREPOSIX_LIBRARY})
+  SET(HAVE_LIBPCREPOSIX 1)
+  SET(HAVE_PCREPOSIX_H 1)
+ENDIF(PCREPOSIX_FOUND)
+
+IF(PCRE_FOUND)
+  SET(PCRE_LIBRARIES ${PCRE_LIBRARY})
+  SET(HAVE_LIBPCRE 1)
+ENDIF(PCRE_FOUND)

+ 68 - 0
core.mod/libarchive/build/cmake/LibarchiveCodeCoverage.cmake

@@ -0,0 +1,68 @@
+#################################################################
+# Adds a build target called "coverage" for code coverage.
+#
+# This compiles the code using special GCC flags, run the tests,
+# and then generates a nice HTML output. This new "coverage" make
+# target will only be available if you build using GCC in Debug
+# mode. If any of the required programs (lcov and genhtml) were
+# not found, a FATAL_ERROR message is printed.
+#
+# If not already done, this code will set ENABLE_TEST to ON.
+#
+# To build the code coverage and open it in your browser do this:
+#
+#    mkdir debug
+#    cd debug
+#    cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON ..
+#    make -j4
+#    make coverage
+#    xdg-open coverage/index.html
+#################################################################
+
+# Find programs we need 
+FIND_PROGRAM(LCOV_EXECUTABLE lcov DOC "Full path to lcov executable")
+FIND_PROGRAM(GENHTML_EXECUTABLE genhtml DOC "Full path to genhtml executable")
+MARK_AS_ADVANCED(LCOV_EXECUTABLE GENHTML_EXECUTABLE)
+
+# Check, compiler, build types and programs are available
+IF(NOT CMAKE_COMPILER_IS_GNUCC)
+MESSAGE(FATAL_ERROR "Coverage can only be built on GCC")
+ELSEIF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
+MESSAGE(FATAL_ERROR "Coverage can only be built in Debug mode")
+ELSEIF(NOT LCOV_EXECUTABLE)
+MESSAGE(FATAL_ERROR "lcov executable not found")
+ELSEIF(NOT GENHTML_EXECUTABLE)
+MESSAGE(FATAL_ERROR "genhtml executable not found")
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCC)
+
+# Enable testing if not already done
+SET(ENABLE_TEST ON)
+
+#################################################################
+# Set special compiler and linker flags for test coverage
+#################################################################
+# 0. Enable debug: -g
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
+# 1. Disable optimizations: -O0
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0")
+# 2. Enable all kind of warnings:
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W")
+# 3. Enable special coverage flag (HINT: --coverage is a synonym for -fprofile-arcs -ftest-coverage)
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage")
+SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage")
+SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage")
+#################################################################
+
+ADD_CUSTOM_TARGET(coverage
+COMMAND ${CMAKE_COMMAND} -E echo "Beginning test coverage. Output is written to coverage.log."
+COMMAND ${CMAKE_COMMAND} -E echo "COVERAGE-STEP-1/5: Reset all execution counts to zero"
+COMMAND ${LCOV_EXECUTABLE} --directory . --zerocounters > coverage.log 2>&1
+COMMAND ${CMAKE_COMMAND} -E echo "COVERAGE-STEP-2/5: Run testrunner"
+COMMAND ${CMAKE_CTEST_COMMAND} >> coverage.log 2>&1
+COMMAND ${CMAKE_COMMAND} -E echo "COVERAGE-STEP-3/5: Collect coverage data"
+COMMAND ${LCOV_EXECUTABLE} --capture --directory . --output-file "./coverage.info" >> coverage.log 2>&1
+COMMAND ${CMAKE_COMMAND} -E echo "COVERAGE-STEP-4/5: Generate HTML from coverage data"
+COMMAND ${GENHTML_EXECUTABLE} "coverage.info" --title="libarchive-${LIBARCHIVE_VERSION_STRING}" --show-details --legend --output-directory "./coverage"  >> coverage.log 2>&1
+COMMAND ${CMAKE_COMMAND} -E echo "COVERAGE-STEP-5/5: Open test coverage HTML output in browser: xdg-open ./coverage/index.html"
+COMMENT "Runs testrunner and generates coverage output (formats: .info and .html)")
+

+ 1349 - 0
core.mod/libarchive/build/cmake/config.h.in

@@ -0,0 +1,1349 @@
+/* config.h.  Generated from build/cmake/config.h.in by cmake configure */
+#define __LIBARCHIVE_CONFIG_H_INCLUDED 1
+
+/*
+ * Ensure we have C99-style int64_t, etc, all defined.
+ */
+
+/* First, we need to know if the system has already defined them. */
+#cmakedefine HAVE_INT16_T
+#cmakedefine HAVE_INT32_T
+#cmakedefine HAVE_INT64_T
+#cmakedefine HAVE_INTMAX_T
+
+#cmakedefine HAVE_UINT8_T
+#cmakedefine HAVE_UINT16_T
+#cmakedefine HAVE_UINT32_T
+#cmakedefine HAVE_UINT64_T
+#cmakedefine HAVE_UINTMAX_T
+
+/* We might have the types we want under other spellings. */
+#cmakedefine HAVE___INT64
+#cmakedefine HAVE_U_INT64_T
+#cmakedefine HAVE_UNSIGNED___INT64
+
+/* The sizes of various standard integer types. */
+@SIZEOF_SHORT_CODE@
+@SIZEOF_INT_CODE@
+@SIZEOF_LONG_CODE@
+@SIZEOF_LONG_LONG_CODE@
+@SIZEOF_UNSIGNED_SHORT_CODE@
+@SIZEOF_UNSIGNED_CODE@
+@SIZEOF_UNSIGNED_LONG_CODE@
+@SIZEOF_UNSIGNED_LONG_LONG_CODE@
+
+/*
+ * If we lack int64_t, define it to the first of __int64, int, long, and long long
+ * that exists and is the right size.
+ */
+#if !defined(HAVE_INT64_T) && defined(HAVE___INT64)
+typedef __int64 int64_t;
+#define HAVE_INT64_T
+#endif
+
+#if !defined(HAVE_INT64_T) && SIZEOF_INT == 8
+typedef int int64_t;
+#define HAVE_INT64_T
+#endif
+
+#if !defined(HAVE_INT64_T) && SIZEOF_LONG == 8
+typedef long int64_t;
+#define HAVE_INT64_T
+#endif
+
+#if !defined(HAVE_INT64_T) && SIZEOF_LONG_LONG == 8
+typedef long long int64_t;
+#define HAVE_INT64_T
+#endif
+
+#if !defined(HAVE_INT64_T)
+#error No 64-bit integer type was found.
+#endif
+
+/*
+ * Similarly for int32_t
+ */
+#if !defined(HAVE_INT32_T) && SIZEOF_INT == 4
+typedef int int32_t;
+#define HAVE_INT32_T
+#endif
+
+#if !defined(HAVE_INT32_T) && SIZEOF_LONG == 4
+typedef long int32_t;
+#define HAVE_INT32_T
+#endif
+
+#if !defined(HAVE_INT32_T)
+#error No 32-bit integer type was found.
+#endif
+
+/*
+ * Similarly for int16_t
+ */
+#if !defined(HAVE_INT16_T) && SIZEOF_INT == 2
+typedef int int16_t;
+#define HAVE_INT16_T
+#endif
+
+#if !defined(HAVE_INT16_T) && SIZEOF_SHORT == 2
+typedef short int16_t;
+#define HAVE_INT16_T
+#endif
+
+#if !defined(HAVE_INT16_T)
+#error No 16-bit integer type was found.
+#endif
+
+/*
+ * Similarly for uint64_t
+ */
+#if !defined(HAVE_UINT64_T) && defined(HAVE_UNSIGNED___INT64)
+typedef unsigned __int64 uint64_t;
+#define HAVE_UINT64_T
+#endif
+
+#if !defined(HAVE_UINT64_T) && SIZEOF_UNSIGNED == 8
+typedef unsigned uint64_t;
+#define HAVE_UINT64_T
+#endif
+
+#if !defined(HAVE_UINT64_T) && SIZEOF_UNSIGNED_LONG == 8
+typedef unsigned long uint64_t;
+#define HAVE_UINT64_T
+#endif
+
+#if !defined(HAVE_UINT64_T) && SIZEOF_UNSIGNED_LONG_LONG == 8
+typedef unsigned long long uint64_t;
+#define HAVE_UINT64_T
+#endif
+
+#if !defined(HAVE_UINT64_T)
+#error No 64-bit unsigned integer type was found.
+#endif
+
+
+/*
+ * Similarly for uint32_t
+ */
+#if !defined(HAVE_UINT32_T) && SIZEOF_UNSIGNED == 4
+typedef unsigned uint32_t;
+#define HAVE_UINT32_T
+#endif
+
+#if !defined(HAVE_UINT32_T) && SIZEOF_UNSIGNED_LONG == 4
+typedef unsigned long uint32_t;
+#define HAVE_UINT32_T
+#endif
+
+#if !defined(HAVE_UINT32_T)
+#error No 32-bit unsigned integer type was found.
+#endif
+
+/*
+ * Similarly for uint16_t
+ */
+#if !defined(HAVE_UINT16_T) && SIZEOF_UNSIGNED == 2
+typedef unsigned uint16_t;
+#define HAVE_UINT16_T
+#endif
+
+#if !defined(HAVE_UINT16_T) && SIZEOF_UNSIGNED_SHORT == 2
+typedef unsigned short uint16_t;
+#define HAVE_UINT16_T
+#endif
+
+#if !defined(HAVE_UINT16_T)
+#error No 16-bit unsigned integer type was found.
+#endif
+
+/*
+ * Similarly for uint8_t
+ */
+#if !defined(HAVE_UINT8_T)
+typedef unsigned char uint8_t;
+#define HAVE_UINT8_T
+#endif
+
+#if !defined(HAVE_UINT16_T)
+#error No 8-bit unsigned integer type was found.
+#endif
+
+/* Define intmax_t and uintmax_t if they are not already defined. */
+#if !defined(HAVE_INTMAX_T)
+typedef int64_t intmax_t;
+#endif
+
+#if !defined(HAVE_UINTMAX_T)
+typedef uint64_t uintmax_t;
+#endif
+
+/* Define ZLIB_WINAPI if zlib was built on Visual Studio. */
+#cmakedefine ZLIB_WINAPI 1
+
+/* Darwin ACL support */
+#cmakedefine ARCHIVE_ACL_DARWIN 1
+
+/* FreeBSD ACL support */
+#cmakedefine ARCHIVE_ACL_FREEBSD 1
+
+/* FreeBSD NFSv4 ACL support */
+#cmakedefine ARCHIVE_ACL_FREEBSD_NFS4 1
+
+/* Linux POSIX.1e ACL support via libacl */
+#cmakedefine ARCHIVE_ACL_LIBACL 1
+
+/* Linux NFSv4 ACL support via librichacl */
+#cmakedefine ARCHIVE_ACL_LIBRICHACL 1
+
+/* Solaris ACL support */
+#cmakedefine ARCHIVE_ACL_SUNOS 1
+
+/* Solaris NFSv4 ACL support */
+#cmakedefine ARCHIVE_ACL_SUNOS_NFS4 1
+
+/* MD5 via ARCHIVE_CRYPTO_MD5_LIBC supported. */
+#cmakedefine ARCHIVE_CRYPTO_MD5_LIBC 1
+
+/* MD5 via ARCHIVE_CRYPTO_MD5_LIBSYSTEM supported. */
+#cmakedefine ARCHIVE_CRYPTO_MD5_LIBSYSTEM 1
+
+/* MD5 via ARCHIVE_CRYPTO_MD5_NETTLE supported. */
+#cmakedefine ARCHIVE_CRYPTO_MD5_NETTLE 1
+
+/* MD5 via ARCHIVE_CRYPTO_MD5_OPENSSL supported. */
+#cmakedefine ARCHIVE_CRYPTO_MD5_OPENSSL 1
+
+/* MD5 via ARCHIVE_CRYPTO_MD5_WIN supported. */
+#cmakedefine ARCHIVE_CRYPTO_MD5_WIN 1
+
+/* RMD160 via ARCHIVE_CRYPTO_RMD160_LIBC supported. */
+#cmakedefine ARCHIVE_CRYPTO_RMD160_LIBC 1
+
+/* RMD160 via ARCHIVE_CRYPTO_RMD160_NETTLE supported. */
+#cmakedefine ARCHIVE_CRYPTO_RMD160_NETTLE 1
+
+/* RMD160 via ARCHIVE_CRYPTO_RMD160_OPENSSL supported. */
+#cmakedefine ARCHIVE_CRYPTO_RMD160_OPENSSL 1
+
+/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBC supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA1_LIBC 1
+
+/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBSYSTEM supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA1_LIBSYSTEM 1
+
+/* SHA1 via ARCHIVE_CRYPTO_SHA1_NETTLE supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA1_NETTLE 1
+
+/* SHA1 via ARCHIVE_CRYPTO_SHA1_OPENSSL supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA1_OPENSSL 1
+
+/* SHA1 via ARCHIVE_CRYPTO_SHA1_WIN supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA1_WIN 1
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA256_LIBC 1
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC2 supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA256_LIBC2 1
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC3 supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA256_LIBC3 1
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBSYSTEM supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA256_LIBSYSTEM 1
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_NETTLE supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA256_NETTLE 1
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_OPENSSL supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA256_OPENSSL 1
+
+/* SHA256 via ARCHIVE_CRYPTO_SHA256_WIN supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA256_WIN 1
+
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA384_LIBC 1
+
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC2 supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA384_LIBC2 1
+
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC3 supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA384_LIBC3 1
+
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBSYSTEM supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA384_LIBSYSTEM 1
+
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_NETTLE supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA384_NETTLE 1
+
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_OPENSSL supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA384_OPENSSL 1
+
+/* SHA384 via ARCHIVE_CRYPTO_SHA384_WIN supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA384_WIN 1
+
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA512_LIBC 1
+
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC2 supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA512_LIBC2 1
+
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC3 supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA512_LIBC3 1
+
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBSYSTEM supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA512_LIBSYSTEM 1
+
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_NETTLE supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA512_NETTLE 1
+
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_OPENSSL supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA512_OPENSSL 1
+
+/* SHA512 via ARCHIVE_CRYPTO_SHA512_WIN supported. */
+#cmakedefine ARCHIVE_CRYPTO_SHA512_WIN 1
+
+/* AIX xattr support */
+#cmakedefine ARCHIVE_XATTR_AIX 1
+
+/* Darwin xattr support */
+#cmakedefine ARCHIVE_XATTR_DARWIN 1
+
+/* FreeBSD xattr support */
+#cmakedefine ARCHIVE_XATTR_FREEBSD 1
+
+/* Linux xattr support */
+#cmakedefine ARCHIVE_XATTR_LINUX 1
+
+/* Version number of bsdcpio */
+#cmakedefine BSDCPIO_VERSION_STRING "${BSDCPIO_VERSION_STRING}"
+
+/* Version number of bsdtar */
+#cmakedefine BSDTAR_VERSION_STRING "${BSDTAR_VERSION_STRING}"
+
+/* Version number of bsdcat */
+#cmakedefine BSDCAT_VERSION_STRING "${BSDCAT_VERSION_STRING}"
+
+/* Define to 1 if you have the `acl_create_entry' function. */
+#cmakedefine HAVE_ACL_CREATE_ENTRY 1
+
+/* Define to 1 if you have the `acl_get_fd_np' function. */
+#cmakedefine HAVE_ACL_GET_FD_NP 1
+
+/* Define to 1 if you have the `acl_get_link' function. */
+#cmakedefine HAVE_ACL_GET_LINK 1
+
+/* Define to 1 if you have the `acl_get_link_np' function. */
+#cmakedefine HAVE_ACL_GET_LINK_NP 1
+
+/* Define to 1 if you have the `acl_get_perm' function. */
+#cmakedefine HAVE_ACL_GET_PERM 1
+
+/* Define to 1 if you have the `acl_get_perm_np' function. */
+#cmakedefine HAVE_ACL_GET_PERM_NP 1
+
+/* Define to 1 if you have the `acl_init' function. */
+#cmakedefine HAVE_ACL_INIT 1
+
+/* Define to 1 if you have the <acl/libacl.h> header file. */
+#cmakedefine HAVE_ACL_LIBACL_H 1
+
+/* Define to 1 if the system has the type `acl_permset_t'. */
+#cmakedefine HAVE_ACL_PERMSET_T 1
+
+/* Define to 1 if you have the `acl_set_fd' function. */
+#cmakedefine HAVE_ACL_SET_FD 1
+
+/* Define to 1 if you have the `acl_set_fd_np' function. */
+#cmakedefine HAVE_ACL_SET_FD_NP 1
+
+/* Define to 1 if you have the `acl_set_file' function. */
+#cmakedefine HAVE_ACL_SET_FILE 1
+
+/* Define to 1 if you have the `arc4random_buf' function. */
+#cmakedefine HAVE_ARC4RANDOM_BUF 1
+
+/* Define to 1 if you have the <attr/xattr.h> header file. */
+#cmakedefine HAVE_ATTR_XATTR_H 1
+
+/* Define to 1 if you have the <Bcrypt.h> header file. */
+#cmakedefine HAVE_BCRYPT_H 1
+
+/* Define to 1 if you have the <bsdxml.h> header file. */
+#cmakedefine HAVE_BSDXML_H 1
+
+/* Define to 1 if you have the <bzlib.h> header file. */
+#cmakedefine HAVE_BZLIB_H 1
+
+/* Define to 1 if you have the `chflags' function. */
+#cmakedefine HAVE_CHFLAGS 1
+
+/* Define to 1 if you have the `chown' function. */
+#cmakedefine HAVE_CHOWN 1
+
+/* Define to 1 if you have the `chroot' function. */
+#cmakedefine HAVE_CHROOT 1
+
+/* Define to 1 if you have the <copyfile.h> header file. */
+#cmakedefine HAVE_COPYFILE_H 1
+
+/* Define to 1 if you have the `ctime_r' function. */
+#cmakedefine HAVE_CTIME_R 1
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#cmakedefine HAVE_CTYPE_H 1
+
+/* Define to 1 if you have the `cygwin_conv_path' function. */
+#cmakedefine HAVE_CYGWIN_CONV_PATH 1
+
+/* Define to 1 if you have the declaration of `ACE_GETACL', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_ACE_GETACL 1
+
+/* Define to 1 if you have the declaration of `ACE_GETACLCNT', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_ACE_GETACLCNT 1
+
+/* Define to 1 if you have the declaration of `ACE_SETACL', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_ACE_SETACL 1
+
+/* Define to 1 if you have the declaration of `ACL_SYNCHRONIZE', and to 0 if
+   you don't. */
+#cmakedefine HAVE_DECL_ACL_SYNCHRONIZE 1
+
+/* Define to 1 if you have the declaration of `ACL_TYPE_EXTENDED', and to 0 if
+   you don't. */
+#cmakedefine HAVE_DECL_ACL_TYPE_EXTENDED 1
+
+/* Define to 1 if you have the declaration of `ACL_TYPE_NFS4', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_ACL_TYPE_NFS4 1
+
+/* Define to 1 if you have the declaration of `ACL_USER', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_ACL_USER 1
+
+/* Define to 1 if you have the declaration of `INT32_MAX', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_INT32_MAX 1
+
+/* Define to 1 if you have the declaration of `INT32_MIN', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_INT32_MIN 1
+
+/* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_INT64_MAX 1
+
+/* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_INT64_MIN 1
+
+/* Define to 1 if you have the declaration of `INTMAX_MAX', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_INTMAX_MAX 1
+
+/* Define to 1 if you have the declaration of `INTMAX_MIN', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_INTMAX_MIN 1
+
+/* Define to 1 if you have the declaration of `SETACL', and to 0 if you don't.
+   */
+#cmakedefine HAVE_DECL_SETACL 1
+
+/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_SIZE_MAX 1
+
+/* Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_SSIZE_MAX 1
+
+/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_STRERROR_R 1
+
+/* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_UINT32_MAX 1
+
+/* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_UINT64_MAX 1
+
+/* Define to 1 if you have the declaration of `UINTMAX_MAX', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_UINTMAX_MAX 1
+
+/* Define to 1 if you have the declaration of `XATTR_NOFOLLOW', and to 0 if
+   you don't. */
+#cmakedefine HAVE_DECL_XATTR_NOFOLLOW 1
+
+/* Define to 1 if you have the <direct.h> header file. */
+#cmakedefine HAVE_DIRECT_H 1
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+   */
+#cmakedefine HAVE_DIRENT_H 1
+
+/* Define to 1 if you have the `dirfd' function. */
+#cmakedefine HAVE_DIRFD 1
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#cmakedefine HAVE_DLFCN_H 1
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#cmakedefine HAVE_DOPRNT 1
+
+/* Define to 1 if nl_langinfo supports D_MD_ORDER */
+#cmakedefine HAVE_D_MD_ORDER 1
+
+/* A possible errno value for invalid file format errors */
+#cmakedefine HAVE_EFTYPE 1
+
+/* A possible errno value for invalid file format errors */
+#cmakedefine HAVE_EILSEQ 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#cmakedefine HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the <expat.h> header file. */
+#cmakedefine HAVE_EXPAT_H 1
+
+/* Define to 1 if you have the <ext2fs/ext2_fs.h> header file. */
+#cmakedefine HAVE_EXT2FS_EXT2_FS_H 1
+
+/* Define to 1 if you have the `extattr_get_file' function. */
+#cmakedefine HAVE_EXTATTR_GET_FILE 1
+
+/* Define to 1 if you have the `extattr_list_file' function. */
+#cmakedefine HAVE_EXTATTR_LIST_FILE 1
+
+/* Define to 1 if you have the `extattr_set_fd' function. */
+#cmakedefine HAVE_EXTATTR_SET_FD 1
+
+/* Define to 1 if you have the `extattr_set_file' function. */
+#cmakedefine HAVE_EXTATTR_SET_FILE 1
+
+/* Define to 1 if EXTATTR_NAMESPACE_USER is defined in sys/extattr.h. */
+#cmakedefine HAVE_DECL_EXTATTR_NAMESPACE_USER 1
+
+/* Define to 1 if you have the declaration of `GETACL', and to 0 if you don't.
+   */
+#cmakedefine HAVE_DECL_GETACL 1
+
+/* Define to 1 if you have the declaration of `GETACLCNT', and to 0 if you
+   don't. */
+#cmakedefine HAVE_DECL_GETACLCNT 1
+
+/* Define to 1 if you have the `fchdir' function. */
+#cmakedefine HAVE_FCHDIR 1
+
+/* Define to 1 if you have the `fchflags' function. */
+#cmakedefine HAVE_FCHFLAGS 1
+
+/* Define to 1 if you have the `fchmod' function. */
+#cmakedefine HAVE_FCHMOD 1
+
+/* Define to 1 if you have the `fchown' function. */
+#cmakedefine HAVE_FCHOWN 1
+
+/* Define to 1 if you have the `fcntl' function. */
+#cmakedefine HAVE_FCNTL 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#cmakedefine HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `fdopendir' function. */
+#cmakedefine HAVE_FDOPENDIR 1
+
+/* Define to 1 if you have the `fgetea' function. */
+#cmakedefine HAVE_FGETEA 1
+
+/* Define to 1 if you have the `fgetxattr' function. */
+#cmakedefine HAVE_FGETXATTR 1
+
+/* Define to 1 if you have the `flistea' function. */
+#cmakedefine HAVE_FLISTEA 1
+
+/* Define to 1 if you have the `flistxattr' function. */
+#cmakedefine HAVE_FLISTXATTR 1
+
+/* Define to 1 if you have the `fork' function. */
+#cmakedefine HAVE_FORK 1
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#cmakedefine HAVE_FSEEKO 1
+
+/* Define to 1 if you have the `fsetea' function. */
+#cmakedefine HAVE_FSETEA 1
+
+/* Define to 1 if you have the `fsetxattr' function. */
+#cmakedefine HAVE_FSETXATTR 1
+
+/* Define to 1 if you have the `fstat' function. */
+#cmakedefine HAVE_FSTAT 1
+
+/* Define to 1 if you have the `fstatat' function. */
+#cmakedefine HAVE_FSTATAT 1
+
+/* Define to 1 if you have the `fstatfs' function. */
+#cmakedefine HAVE_FSTATFS 1
+
+/* Define to 1 if you have the `fstatvfs' function. */
+#cmakedefine HAVE_FSTATVFS 1
+
+/* Define to 1 if you have the `ftruncate' function. */
+#cmakedefine HAVE_FTRUNCATE 1
+
+/* Define to 1 if you have the `futimens' function. */
+#cmakedefine HAVE_FUTIMENS 1
+
+/* Define to 1 if you have the `futimes' function. */
+#cmakedefine HAVE_FUTIMES 1
+
+/* Define to 1 if you have the `futimesat' function. */
+#cmakedefine HAVE_FUTIMESAT 1
+
+/* Define to 1 if you have the `getea' function. */
+#cmakedefine HAVE_GETEA 1
+
+/* Define to 1 if you have the `geteuid' function. */
+#cmakedefine HAVE_GETEUID 1
+
+/* Define to 1 if you have the `getgrgid_r' function. */
+#cmakedefine HAVE_GETGRGID_R 1
+
+/* Define to 1 if you have the `getgrnam_r' function. */
+#cmakedefine HAVE_GETGRNAM_R 1
+
+/* Define to 1 if you have the `getpid' function. */
+#cmakedefine HAVE_GETPID 1
+
+/* Define to 1 if you have the `getpwnam_r' function. */
+#cmakedefine HAVE_GETPWNAM_R 1
+
+/* Define to 1 if you have the `getpwuid_r' function. */
+#cmakedefine HAVE_GETPWUID_R 1
+
+/* Define to 1 if you have the `getvfsbyname' function. */
+#cmakedefine HAVE_GETVFSBYNAME 1
+
+/* Define to 1 if you have the `getxattr' function. */
+#cmakedefine HAVE_GETXATTR 1
+
+/* Define to 1 if you have the `gmtime_r' function. */
+#cmakedefine HAVE_GMTIME_R 1
+
+/* Define to 1 if you have the <grp.h> header file. */
+#cmakedefine HAVE_GRP_H 1
+
+/* Define to 1 if you have the `iconv' function. */
+#cmakedefine HAVE_ICONV 1
+
+/* Define to 1 if you have the <iconv.h> header file. */
+#cmakedefine HAVE_ICONV_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <io.h> header file. */
+#cmakedefine HAVE_IO_H 1
+
+/* Define to 1 if you have the <langinfo.h> header file. */
+#cmakedefine HAVE_LANGINFO_H 1
+
+/* Define to 1 if you have the `lchflags' function. */
+#cmakedefine HAVE_LCHFLAGS 1
+
+/* Define to 1 if you have the `lchmod' function. */
+#cmakedefine HAVE_LCHMOD 1
+
+/* Define to 1 if you have the `lchown' function. */
+#cmakedefine HAVE_LCHOWN 1
+
+/* Define to 1 if you have the `lgetea' function. */
+#cmakedefine HAVE_LGETEA 1
+
+/* Define to 1 if you have the `lgetxattr' function. */
+#cmakedefine HAVE_LGETXATTR 1
+
+/* Define to 1 if you have the `acl' library (-lacl). */
+#cmakedefine HAVE_LIBACL 1
+
+/* Define to 1 if you have the `attr' library (-lattr). */
+#cmakedefine HAVE_LIBATTR 1
+
+/* Define to 1 if you have the `bsdxml' library (-lbsdxml). */
+#cmakedefine HAVE_LIBBSDXML 1
+
+/* Define to 1 if you have the `bz2' library (-lbz2). */
+#cmakedefine HAVE_LIBBZ2 1
+
+/* Define to 1 if you have the `b2' library (-lb2). */
+#cmakedefine HAVE_LIBB2 1
+
+/* Define to 1 if you have the <blake2.h> header file. */
+#cmakedefine HAVE_BLAKE2_H 1
+
+/* Define to 1 if you have the `charset' library (-lcharset). */
+#cmakedefine HAVE_LIBCHARSET 1
+
+/* Define to 1 if you have the `crypto' library (-lcrypto). */
+#cmakedefine HAVE_LIBCRYPTO 1
+
+/* Define to 1 if you have the `expat' library (-lexpat). */
+#cmakedefine HAVE_LIBEXPAT 1
+
+/* Define to 1 if you have the `gcc' library (-lgcc). */
+#cmakedefine HAVE_LIBGCC 1
+
+/* Define to 1 if you have the `lz4' library (-llz4). */
+#cmakedefine HAVE_LIBLZ4 1
+
+/* Define to 1 if you have the `lzma' library (-llzma). */
+#cmakedefine HAVE_LIBLZMA 1
+
+/* Define to 1 if you have the `lzmadec' library (-llzmadec). */
+#cmakedefine HAVE_LIBLZMADEC 1
+
+/* Define to 1 if you have the `lzo2' library (-llzo2). */
+#cmakedefine HAVE_LIBLZO2 1
+
+/* Define to 1 if you have the `mbedcrypto' library (-lmbedcrypto). */
+#cmakedefine HAVE_LIBMBEDCRYPTO 1
+
+/* Define to 1 if you have the `nettle' library (-lnettle). */
+#cmakedefine HAVE_LIBNETTLE 1
+
+/* Define to 1 if you have the `pcre' library (-lpcre). */
+#cmakedefine HAVE_LIBPCRE 1
+
+/* Define to 1 if you have the `pcreposix' library (-lpcreposix). */
+#cmakedefine HAVE_LIBPCREPOSIX 1
+
+/* Define to 1 if you have the `xml2' library (-lxml2). */
+#cmakedefine HAVE_LIBXML2 1
+
+/* Define to 1 if you have the <libxml/xmlreader.h> header file. */
+#cmakedefine HAVE_LIBXML_XMLREADER_H 1
+
+/* Define to 1 if you have the <libxml/xmlwriter.h> header file. */
+#cmakedefine HAVE_LIBXML_XMLWRITER_H 1
+
+/* Define to 1 if you have the `z' library (-lz). */
+#cmakedefine HAVE_LIBZ 1
+
+/* Define to 1 if you have the `zstd' library (-lzstd). */
+#cmakedefine HAVE_LIBZSTD 1
+
+/* Define to 1 if you have the `zstd' library (-lzstd) with compression
+   support. */
+#cmakedefine HAVE_LIBZSTD_COMPRESSOR 1
+
+/* Define to 1 if you have the <limits.h> header file. */
+#cmakedefine HAVE_LIMITS_H 1
+
+/* Define to 1 if you have the `link' function. */
+#cmakedefine HAVE_LINK 1
+
+/* Define to 1 if you have the `linkat' function. */
+#cmakedefine HAVE_LINKAT 1
+
+/* Define to 1 if you have the <linux/fiemap.h> header file. */
+#cmakedefine HAVE_LINUX_FIEMAP_H 1
+
+/* Define to 1 if you have the <linux/fs.h> header file. */
+#cmakedefine HAVE_LINUX_FS_H 1
+
+/* Define to 1 if you have the <linux/magic.h> header file. */
+#cmakedefine HAVE_LINUX_MAGIC_H 1
+
+/* Define to 1 if you have the <linux/types.h> header file. */
+#cmakedefine HAVE_LINUX_TYPES_H 1
+
+/* Define to 1 if you have the `listea' function. */
+#cmakedefine HAVE_LISTEA 1
+
+/* Define to 1 if you have the `listxattr' function. */
+#cmakedefine HAVE_LISTXATTR 1
+
+/* Define to 1 if you have the `llistea' function. */
+#cmakedefine HAVE_LLISTEA 1
+
+/* Define to 1 if you have the `llistxattr' function. */
+#cmakedefine HAVE_LLISTXATTR 1
+
+/* Define to 1 if you have the <localcharset.h> header file. */
+#cmakedefine HAVE_LOCALCHARSET_H 1
+
+/* Define to 1 if you have the `locale_charset' function. */
+#cmakedefine HAVE_LOCALE_CHARSET 1
+
+/* Define to 1 if you have the <locale.h> header file. */
+#cmakedefine HAVE_LOCALE_H 1
+
+/* Define to 1 if you have the `localtime_r' function. */
+#cmakedefine HAVE_LOCALTIME_R 1
+
+/* Define to 1 if the system has the type `long long int'. */
+#cmakedefine HAVE_LONG_LONG_INT 1
+
+/* Define to 1 if you have the `lsetea' function. */
+#cmakedefine HAVE_LSETEA 1
+
+/* Define to 1 if you have the `lsetxattr' function. */
+#cmakedefine HAVE_LSETXATTR 1
+
+/* Define to 1 if you have the `lstat' function. */
+#cmakedefine HAVE_LSTAT 1
+
+/* Define to 1 if `lstat' has the bug that it succeeds when given the
+   zero-length file name argument. */
+#cmakedefine HAVE_LSTAT_EMPTY_STRING_BUG 1
+
+/* Define to 1 if you have the `lutimes' function. */
+#cmakedefine HAVE_LUTIMES 1
+
+/* Define to 1 if you have the <lz4hc.h> header file. */
+#cmakedefine HAVE_LZ4HC_H 1
+
+/* Define to 1 if you have the <lz4.h> header file. */
+#cmakedefine HAVE_LZ4_H 1
+
+/* Define to 1 if you have the <lzmadec.h> header file. */
+#cmakedefine HAVE_LZMADEC_H 1
+
+/* Define to 1 if you have the <lzma.h> header file. */
+#cmakedefine HAVE_LZMA_H 1
+
+/* Define to 1 if you have a working `lzma_stream_encoder_mt' function. */
+#cmakedefine HAVE_LZMA_STREAM_ENCODER_MT 1
+
+/* Define to 1 if you have the <lzo/lzo1x.h> header file. */
+#cmakedefine HAVE_LZO_LZO1X_H 1
+
+/* Define to 1 if you have the <lzo/lzoconf.h> header file. */
+#cmakedefine HAVE_LZO_LZOCONF_H 1
+
+/* Define to 1 if you have the `mbrtowc' function. */
+#cmakedefine HAVE_MBRTOWC 1
+
+/* Define to 1 if you have the <membership.h> header file. */
+#cmakedefine HAVE_MEMBERSHIP_H 1
+
+/* Define to 1 if you have the `memmove' function. */
+#cmakedefine HAVE_MEMMOVE 1
+
+/* Define to 1 if you have the <memory.h> header file. */
+#cmakedefine HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the `mkdir' function. */
+#cmakedefine HAVE_MKDIR 1
+
+/* Define to 1 if you have the `mkfifo' function. */
+#cmakedefine HAVE_MKFIFO 1
+
+/* Define to 1 if you have the `mknod' function. */
+#cmakedefine HAVE_MKNOD 1
+
+/* Define to 1 if you have the `mkstemp' function. */
+#cmakedefine HAVE_MKSTEMP 1
+
+/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
+#cmakedefine HAVE_NDIR_H 1
+
+/* Define to 1 if you have the <nettle/aes.h> header file. */
+#cmakedefine HAVE_NETTLE_AES_H 1
+
+/* Define to 1 if you have the <nettle/hmac.h> header file. */
+#cmakedefine HAVE_NETTLE_HMAC_H 1
+
+/* Define to 1 if you have the <nettle/md5.h> header file. */
+#cmakedefine HAVE_NETTLE_MD5_H 1
+
+/* Define to 1 if you have the <nettle/pbkdf2.h> header file. */
+#cmakedefine HAVE_NETTLE_PBKDF2_H 1
+
+/* Define to 1 if you have the <nettle/ripemd160.h> header file. */
+#cmakedefine HAVE_NETTLE_RIPEMD160_H 1
+
+/* Define to 1 if you have the <nettle/sha.h> header file. */
+#cmakedefine HAVE_NETTLE_SHA_H 1
+
+/* Define to 1 if you have the `nl_langinfo' function. */
+#cmakedefine HAVE_NL_LANGINFO 1
+
+/* Define to 1 if you have the `openat' function. */
+#cmakedefine HAVE_OPENAT 1
+
+/* Define to 1 if you have the <paths.h> header file. */
+#cmakedefine HAVE_PATHS_H 1
+
+/* Define to 1 if you have the <pcreposix.h> header file. */
+#cmakedefine HAVE_PCREPOSIX_H 1
+
+/* Define to 1 if you have the `pipe' function. */
+#cmakedefine HAVE_PIPE 1
+
+/* Define to 1 if you have the `PKCS5_PBKDF2_HMAC_SHA1' function. */
+#cmakedefine HAVE_PKCS5_PBKDF2_HMAC_SHA1 1
+
+/* Define to 1 if you have the `poll' function. */
+#cmakedefine HAVE_POLL 1
+
+/* Define to 1 if you have the <poll.h> header file. */
+#cmakedefine HAVE_POLL_H 1
+
+/* Define to 1 if you have the `posix_spawnp' function. */
+#cmakedefine HAVE_POSIX_SPAWNP 1
+
+/* Define to 1 if you have the <process.h> header file. */
+#cmakedefine HAVE_PROCESS_H 1
+
+/* Define to 1 if you have the <pthread.h> header file. */
+#cmakedefine HAVE_PTHREAD_H 1
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#cmakedefine HAVE_PWD_H 1
+
+/* Define to 1 if you have the `readdir_r' function. */
+#cmakedefine HAVE_READDIR_R 1
+
+/* Define to 1 if you have the `readlink' function. */
+#cmakedefine HAVE_READLINK 1
+
+/* Define to 1 if you have the `readlinkat' function. */
+#cmakedefine HAVE_READLINKAT 1
+
+/* Define to 1 if you have the `readpassphrase' function. */
+#cmakedefine HAVE_READPASSPHRASE 1
+
+/* Define to 1 if you have the <readpassphrase.h> header file. */
+#cmakedefine HAVE_READPASSPHRASE_H 1
+
+/* Define to 1 if you have the <regex.h> header file. */
+#cmakedefine HAVE_REGEX_H 1
+
+/* Define to 1 if you have the `select' function. */
+#cmakedefine HAVE_SELECT 1
+
+/* Define to 1 if you have the `setenv' function. */
+#cmakedefine HAVE_SETENV 1
+
+/* Define to 1 if you have the `setlocale' function. */
+#cmakedefine HAVE_SETLOCALE 1
+
+/* Define to 1 if you have the `sigaction' function. */
+#cmakedefine HAVE_SIGACTION 1
+
+/* Define to 1 if you have the <signal.h> header file. */
+#cmakedefine HAVE_SIGNAL_H 1
+
+/* Define to 1 if you have the <spawn.h> header file. */
+#cmakedefine HAVE_SPAWN_H 1
+
+/* Define to 1 if you have the `statfs' function. */
+#cmakedefine HAVE_STATFS 1
+
+/* Define to 1 if you have the `statvfs' function. */
+#cmakedefine HAVE_STATVFS 1
+
+/* Define to 1 if `stat' has the bug that it succeeds when given the
+   zero-length file name argument. */
+#cmakedefine HAVE_STAT_EMPTY_STRING_BUG 1
+
+/* Define to 1 if you have the <stdarg.h> header file. */
+#cmakedefine HAVE_STDARG_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#cmakedefine HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#cmakedefine HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strchr' function. */
+#cmakedefine HAVE_STRCHR 1
+
+/* Define to 1 if you have the `strnlen' function. */
+#cmakedefine HAVE_STRNLEN 1
+
+/* Define to 1 if you have the `strdup' function. */
+#cmakedefine HAVE_STRDUP 1
+
+/* Define to 1 if you have the `strerror' function. */
+#cmakedefine HAVE_STRERROR 1
+
+/* Define to 1 if you have the `strerror_r' function. */
+#cmakedefine HAVE_STRERROR_R 1
+
+/* Define to 1 if you have the `strftime' function. */
+#cmakedefine HAVE_STRFTIME 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#cmakedefine HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#cmakedefine HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strrchr' function. */
+#cmakedefine HAVE_STRRCHR 1
+
+/* Define to 1 if `f_namemax' is a member of `struct statfs'. */
+#cmakedefine HAVE_STRUCT_STATFS_F_NAMEMAX 1
+
+/* Define to 1 if `f_iosize' is a member of `struct statvfs'. */
+#cmakedefine HAVE_STRUCT_STATVFS_F_IOSIZE 1
+
+/* Define to 1 if `st_birthtime' is a member of `struct stat'. */
+#cmakedefine HAVE_STRUCT_STAT_ST_BIRTHTIME 1
+
+/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */
+#cmakedefine HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1
+
+/* Define to 1 if `st_blksize' is a member of `struct stat'. */
+#cmakedefine HAVE_STRUCT_STAT_ST_BLKSIZE 1
+
+/* Define to 1 if `st_flags' is a member of `struct stat'. */
+#cmakedefine HAVE_STRUCT_STAT_ST_FLAGS 1
+
+/* Define to 1 if `st_mtimespec.tv_nsec' is a member of `struct stat'. */
+#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1
+
+/* Define to 1 if `st_mtime_n' is a member of `struct stat'. */
+#cmakedefine HAVE_STRUCT_STAT_ST_MTIME_N 1
+
+/* Define to 1 if `st_mtime_usec' is a member of `struct stat'. */
+#cmakedefine HAVE_STRUCT_STAT_ST_MTIME_USEC 1
+
+/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */
+#cmakedefine HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
+
+/* Define to 1 if `st_umtime' is a member of `struct stat'. */
+#cmakedefine HAVE_STRUCT_STAT_ST_UMTIME 1
+
+/* Define to 1 if `tm_gmtoff' is a member of `struct tm'. */
+#cmakedefine HAVE_STRUCT_TM_TM_GMTOFF 1
+
+/* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */
+#cmakedefine HAVE_STRUCT_TM___TM_GMTOFF 1
+
+/* Define to 1 if you have `struct vfsconf'. */
+#cmakedefine HAVE_STRUCT_VFSCONF 1
+
+/* Define to 1 if you have `struct xvfsconf'. */
+#cmakedefine HAVE_STRUCT_XVFSCONF 1
+
+/* Define to 1 if you have the `symlink' function. */
+#cmakedefine HAVE_SYMLINK 1
+
+/* Define to 1 if you have the <sys/acl.h> header file. */
+#cmakedefine HAVE_SYS_ACL_H 1
+
+/* Define to 1 if you have the <sys/cdefs.h> header file. */
+#cmakedefine HAVE_SYS_CDEFS_H 1
+
+/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
+   */
+#cmakedefine HAVE_SYS_DIR_H 1
+
+/* Define to 1 if you have the <sys/ea.h> header file. */
+#cmakedefine HAVE_SYS_EA_H 1
+
+/* Define to 1 if you have the <sys/extattr.h> header file. */
+#cmakedefine HAVE_SYS_EXTATTR_H 1
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#cmakedefine HAVE_SYS_IOCTL_H 1
+
+/* Define to 1 if you have the <sys/mkdev.h> header file. */
+#cmakedefine HAVE_SYS_MKDEV_H 1
+
+/* Define to 1 if you have the <sys/mount.h> header file. */
+#cmakedefine HAVE_SYS_MOUNT_H 1
+
+/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
+   */
+#cmakedefine HAVE_SYS_NDIR_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#cmakedefine HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/poll.h> header file. */
+#cmakedefine HAVE_SYS_POLL_H 1
+
+/* Define to 1 if you have the <sys/richacl.h> header file. */
+#cmakedefine HAVE_SYS_RICHACL_H 1
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#cmakedefine HAVE_SYS_SELECT_H 1
+
+/* Define to 1 if you have the <sys/statfs.h> header file. */
+#cmakedefine HAVE_SYS_STATFS_H 1
+
+/* Define to 1 if you have the <sys/statvfs.h> header file. */
+#cmakedefine HAVE_SYS_STATVFS_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#cmakedefine HAVE_SYS_STAT_H 1
+
+
+/* Define to 1 if you have the <sys/sysmacros.h> header file. */
+#cmakedefine HAVE_SYS_SYSMACROS_H 1
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#cmakedefine HAVE_SYS_TIME_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <sys/utime.h> header file. */
+#cmakedefine HAVE_SYS_UTIME_H 1
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#cmakedefine HAVE_SYS_UTSNAME_H 1
+
+/* Define to 1 if you have the <sys/vfs.h> header file. */
+#cmakedefine HAVE_SYS_VFS_H 1
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#cmakedefine HAVE_SYS_WAIT_H 1
+
+/* Define to 1 if you have the <sys/xattr.h> header file. */
+#cmakedefine HAVE_SYS_XATTR_H 1
+
+/* Define to 1 if you have the `timegm' function. */
+#cmakedefine HAVE_TIMEGM 1
+
+/* Define to 1 if you have the <time.h> header file. */
+#cmakedefine HAVE_TIME_H 1
+
+/* Define to 1 if you have the `tzset' function. */
+#cmakedefine HAVE_TZSET 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#cmakedefine HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `unlinkat' function. */
+#cmakedefine HAVE_UNLINKAT 1
+
+/* Define to 1 if you have the `unsetenv' function. */
+#cmakedefine HAVE_UNSETENV 1
+
+/* Define to 1 if the system has the type `unsigned long long'. */
+#cmakedefine HAVE_UNSIGNED_LONG_LONG 1
+
+/* Define to 1 if the system has the type `unsigned long long int'. */
+#cmakedefine HAVE_UNSIGNED_LONG_LONG_INT 1
+
+/* Define to 1 if you have the `utime' function. */
+#cmakedefine HAVE_UTIME 1
+
+/* Define to 1 if you have the `utimensat' function. */
+#cmakedefine HAVE_UTIMENSAT 1
+
+/* Define to 1 if you have the `utimes' function. */
+#cmakedefine HAVE_UTIMES 1
+
+/* Define to 1 if you have the <utime.h> header file. */
+#cmakedefine HAVE_UTIME_H 1
+
+/* Define to 1 if you have the `vfork' function. */
+#cmakedefine HAVE_VFORK 1
+
+/* Define to 1 if you have the `vprintf' function. */
+#cmakedefine HAVE_VPRINTF 1
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#cmakedefine HAVE_WCHAR_H 1
+
+/* Define to 1 if the system has the type `wchar_t'. */
+#cmakedefine HAVE_WCHAR_T 1
+
+/* Define to 1 if you have the `wcrtomb' function. */
+#cmakedefine HAVE_WCRTOMB 1
+
+/* Define to 1 if you have the `wcscmp' function. */
+#cmakedefine HAVE_WCSCMP 1
+
+/* Define to 1 if you have the `wcscpy' function. */
+#cmakedefine HAVE_WCSCPY 1
+
+/* Define to 1 if you have the `wcslen' function. */
+#cmakedefine HAVE_WCSLEN 1
+
+/* Define to 1 if you have the `wctomb' function. */
+#cmakedefine HAVE_WCTOMB 1
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#cmakedefine HAVE_WCTYPE_H 1
+
+/* Define to 1 if you have the <wincrypt.h> header file. */
+#cmakedefine HAVE_WINCRYPT_H 1
+
+/* Define to 1 if you have the <windows.h> header file. */
+#cmakedefine HAVE_WINDOWS_H 1
+
+/* Define to 1 if you have the <winioctl.h> header file. */
+#cmakedefine HAVE_WINIOCTL_H 1
+
+/* Define to 1 if you have _CrtSetReportMode in <crtdbg.h>  */
+#cmakedefine HAVE__CrtSetReportMode 1
+
+/* Define to 1 if you have the `wmemcmp' function. */
+#cmakedefine HAVE_WMEMCMP 1
+
+/* Define to 1 if you have the `wmemcpy' function. */
+#cmakedefine HAVE_WMEMCPY 1
+
+/* Define to 1 if you have the `wmemmove' function. */
+#cmakedefine HAVE_WMEMMOVE 1
+
+/* Define to 1 if you have a working EXT2_IOC_GETFLAGS */
+#cmakedefine HAVE_WORKING_EXT2_IOC_GETFLAGS 1
+
+/* Define to 1 if you have a working FS_IOC_GETFLAGS */
+#cmakedefine HAVE_WORKING_FS_IOC_GETFLAGS 1
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#cmakedefine HAVE_ZLIB_H 1
+
+/* Define to 1 if you have the <zstd.h> header file. */
+#cmakedefine HAVE_ZSTD_H 1
+
+/* Define to 1 if you have the `_ctime64_s' function. */
+#cmakedefine HAVE__CTIME64_S 1
+
+/* Define to 1 if you have the `_fseeki64' function. */
+#cmakedefine HAVE__FSEEKI64 1
+
+/* Define to 1 if you have the `_get_timezone' function. */
+#cmakedefine HAVE__GET_TIMEZONE 1
+
+/* Define to 1 if you have the `_gmtime64_s' function. */
+#cmakedefine HAVE__GMTIME64_S 1
+
+/* Define to 1 if you have the `_localtime64_s' function. */
+#cmakedefine HAVE__LOCALTIME64_S 1
+
+/* Define to 1 if you have the `_mkgmtime64' function. */
+#cmakedefine HAVE__MKGMTIME64 1
+
+/* Define as const if the declaration of iconv() needs const. */
+#define ICONV_CONST ${ICONV_CONST}
+
+/* Version number of libarchive as a single integer */
+#cmakedefine LIBARCHIVE_VERSION_NUMBER "${LIBARCHIVE_VERSION_NUMBER}"
+
+/* Version number of libarchive */
+#cmakedefine LIBARCHIVE_VERSION_STRING "${LIBARCHIVE_VERSION_STRING}"
+
+/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
+   slash. */
+#cmakedefine LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+
+/* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>.
+   */
+#cmakedefine MAJOR_IN_MKDEV 1
+
+/* Define to 1 if `major', `minor', and `makedev' are declared in
+   <sysmacros.h>. */
+#cmakedefine MAJOR_IN_SYSMACROS 1
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+#cmakedefine NO_MINUS_C_MINUS_O 1
+
+/* The size of `wchar_t', as computed by sizeof. */
+#cmakedefine SIZEOF_WCHAR_T ${SIZEOF_WCHAR_T}
+
+/* Define to 1 if strerror_r returns char *. */
+#cmakedefine STRERROR_R_CHAR_P 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#cmakedefine TIME_WITH_SYS_TIME 1
+
+/*
+ * Some platform requires a macro to use extension functions.
+ */
+#cmakedefine SAFE_TO_DEFINE_EXTENSIONS 1
+#ifdef SAFE_TO_DEFINE_EXTENSIONS
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+#endif /* SAFE_TO_DEFINE_EXTENSIONS */
+
+/* Version number of package */
+#cmakedefine VERSION "${VERSION}"
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#cmakedefine _FILE_OFFSET_BITS ${_FILE_OFFSET_BITS}
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+#cmakedefine _LARGEFILE_SOURCE 1
+
+/* Define for large files, on AIX-style hosts. */
+#cmakedefine _LARGE_FILES ${_LARGE_FILES}
+
+/* Define to control Windows SDK version */
+#ifndef NTDDI_VERSION
+#cmakedefine NTDDI_VERSION ${NTDDI_VERSION}
+#endif // NTDDI_VERSION
+
+#ifndef _WIN32_WINNT
+#cmakedefine _WIN32_WINNT ${_WIN32_WINNT}
+#endif // _WIN32_WINNT
+
+#ifndef WINVER
+#cmakedefine WINVER ${WINVER}
+#endif // WINVER
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#cmakedefine const ${const}
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#cmakedefine gid_t ${gid_t}
+
+/* Define to `unsigned long' if <sys/types.h> does not define. */
+#cmakedefine id_t ${id_t}
+
+/* Define to `int' if <sys/types.h> does not define. */
+#cmakedefine mode_t ${mode_t}
+
+/* Define to `long long' if <sys/types.h> does not define. */
+#cmakedefine off_t ${off_t}
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#cmakedefine pid_t ${pid_t}
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#cmakedefine size_t ${size_t}
+
+/* Define to `int' if <sys/types.h> does not define. */
+#cmakedefine ssize_t ${ssize_t}
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#cmakedefine uid_t ${uid_t}
+
+/* Define to `int' if <sys/types.h> does not define. */
+#cmakedefine intptr_t ${intptr_t}
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#cmakedefine uintptr_t ${uintptr_t}

+ 58 - 0
core.mod/libarchive/build/makerelease.sh

@@ -0,0 +1,58 @@
+#!/bin/sh
+
+#
+# This script exists primarily to document some of the
+# steps needed when building an "official libarchive distribution".
+# Feel free to hack it up as necessary to adjust to the peculiarities
+# of a particular build environment.
+#
+
+PATH=/usr/local/gnu-autotools/bin/:$PATH
+export PATH
+
+# Start from one level above the build directory
+if [ -f version ]; then
+    cd ..
+fi
+
+if [ \! -f build/version ]; then
+    echo "Can't find source directory"
+    exit 1
+fi
+
+# BSD make's "OBJDIR" support freaks out the automake-generated
+# Makefile.  Effectively disable it.
+export MAKEOBJDIRPREFIX=/junk
+
+set -ex
+
+#
+# Scrub the local tree before running the build tests below.
+#
+/bin/sh build/clean.sh
+
+#
+# Verify the CMake-generated build
+#
+mkdir -p _cmtest
+cd _cmtest
+cmake ..
+make
+make test
+cd ..
+rm -rf _cmtest
+# TODO: Build distribution using cmake
+
+#
+# Construct and verify the autoconf build system
+#
+export MAKE_LIBARCHIVE_RELEASE="1"
+/bin/sh build/autogen.sh
+
+# Get the newest config.guess/config.sub from savannah.gnu.org
+curl 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' > build/autoconf/config.guess
+curl 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' > build/autoconf/config.sub
+
+./configure
+make distcheck
+make dist-zip

+ 12 - 0
core.mod/libarchive/build/pkgconfig/libarchive.pc.in

@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libarchive
+Description: library that can create and read several streaming archive formats
+Version: @VERSION@
+Cflags: -I${includedir}
+Cflags.private: -DLIBARCHIVE_STATIC
+Libs: -L${libdir} -larchive
+Libs.private: @LIBS@

+ 13 - 0
core.mod/libarchive/build/release/Dockerfile

@@ -0,0 +1,13 @@
+FROM ubuntu:20.04
+ENV DEBIAN_FRONTEND=noninteractive
+RUN ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
+RUN apt-get update && apt-get install -y build-essential autoconf automake libtool pkg-config cmake zlib1g-dev libssl-dev libacl1-dev libbz2-dev liblzma-dev liblz4-dev libzstd-dev lzop groff ghostscript bsdmainutils zip
+ADD . $HOME/libarchive/
+ADD "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" $HOME/libarchive/build/autoconf/config.guess
+ADD "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" $HOME/libarchive/build/autoconf/config.sub
+WORKDIR $HOME/libarchive
+RUN /bin/sh build/clean.sh
+RUN /bin/sh build/autogen.sh
+ENV SKIP_OPEN_FD_ERR_TEST=1 SKIP_TEST_SPARSE=1
+RUN ./configure
+RUN make V=1 distcheck

+ 8 - 0
core.mod/libarchive/build/release/release.sh

@@ -0,0 +1,8 @@
+#!/bin/sh
+ID=$(docker build -q -f build/release/Dockerfile .)
+if [ -z "$ID" ]; then
+	echo "Failed to build docker image"
+	exit 1
+else
+	docker run $ID sh -c "tar -c -f - libarchive-*" | tar -x -f -
+fi

+ 455 - 0
core.mod/libarchive/build/utils/gen_archive_string_composition_h.sh

@@ -0,0 +1,455 @@
+#!/bin/sh
+#
+# This needs http://unicode.org/Public/6.0.0/ucd/UnicodeData.txt
+#
+inputfile="$1"	# Expect UnicodeData.txt
+outfile=archive_string_composition.h
+pickout=/tmp/mk_unicode_composition_tbl$$.awk
+pickout2=/tmp/mk_unicode_composition_tbl2$$.awk
+#nfdtmp=/tmp/mk_unicode_decomposition_tmp$$.txt
+nfdtmp="nfdtmpx"
+#################################################################################
+#
+# Append the file header of "archive_string_composition.h"
+#
+#################################################################################
+append_copyright()
+{
+cat > ${outfile} <<CR_END
+/*-
+ * Copyright (c) 2011-2012 libarchive Project
+ * 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\$
+ *
+ */
+
+/*
+ * ATTENTION!
+ *  This file is generated by build/utils/gen_archive_string_composition_h.sh
+ *  from http://unicode.org/Public/6.0.0/ucd/UnicodeData.txt
+ *
+ *  See also http://unicode.org/report/tr15/
+ */
+
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
+
+#ifndef ARCHIVE_STRING_COMPOSITION_H_INCLUDED
+#define ARCHIVE_STRING_COMPOSITION_H_INCLUDED
+
+struct unicode_composition_table {
+	uint32_t cp1;
+	uint32_t cp2;
+	uint32_t nfc;
+};
+
+CR_END
+}
+#################################################################################
+#
+# awk script
+#
+#################################################################################
+cat > ${pickout} <<AWK_END
+#
+BEGIN {
+  FS = ";"
+  min = "";
+  max = "";
+  cmd="sort | awk -F ' ' '{printf \"\\\\t{ 0x%s , 0x%s , 0x%s },\\\\n\",\$1,\$2,\$3}'"
+  nfdtbl="${nfdtmp}"
+  print "static const struct unicode_composition_table u_composition_table[] = {"
+}
+END {
+  close(cmd)
+  print "};"
+  print ""
+  #
+  # Output Canonical Combining Class tables used for translating NFD to NFC.
+  #
+  printf "#define CANONICAL_CLASS_MIN\\t0x%s\\n", min
+  printf "#define CANONICAL_CLASS_MAX\\t0x%s\\n", max
+  print ""
+  printf "#define IS_DECOMPOSABLE_BLOCK(uc)\\t\\\\\n"
+  printf "\\t(((uc)>>8) <= 0x%X && u_decomposable_blocks[(uc)>>8])\\n", highnum
+  printf "static const char u_decomposable_blocks[0x%X+1] = {\\n\\t", highnum
+  #
+  # Output blockmap
+  for (i = 0; i <= highnum; i++) {
+    if (i != 0 && i % 32 == 0)
+      printf "\\n\\t"
+    # Additionally Hangul[11XX(17), AC00(172) - D7FF(215)] is decomposable.
+    if (blockmap[i] || i == 17 || (i >= 172 && i <= 215))
+        printf "1,"
+    else
+        printf "0,"
+  }
+  printf "\\n};\\n\\n"
+  #
+  # Output a macro to get a canonical combining class.
+  #
+  print "/* Get Canonical Combining Class(CCC). */"
+  printf "#define CCC(uc)\\t\\\\\n"
+  printf "\\t(((uc) > 0x%s)?0:\\\\\\n", max
+  printf "\\tccc_val[ccc_val_index[ccc_index[(uc)>>8]][((uc)>>4)&0x0F]][(uc)&0x0F])\\n"
+  print ""
+  #
+  # Output a canonical combining class value table.
+  #
+  midcnt = 0
+  printf "/* The table of the value of Canonical Cimbining Class */\\n"
+  print "static const unsigned char ccc_val[][16] = {"
+  print " /* idx=0: XXXX0 - XXXXF */"
+  print " { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },"
+  for (h = 0; h <= highnum; h++) {
+    if (!blockmap[h])
+      continue;
+    for (m = 0; m < 16; m++) {
+      if (!xx_blockmap[h, m])
+        continue;
+      midcnt++
+      printf " /* idx=%d: %03X%1X0 - %03X%1XF */\\n {", midcnt, h, m, h, m
+      for (l = 0; l < 15; l++) {
+        printf "%d, ", xxx_blockmap[h, m, l]
+      }
+      printf "%d },\n", xxx_blockmap[h, m, 15]
+    }
+  }
+  printf "};\n"
+  #
+  # Output the index table of the canonical combining class value table.
+  #
+  cnt = 0
+  midcnt = 0
+  printf "\\n/* The index table to ccc_val[*][16] */\\n"
+  print "static const unsigned char ccc_val_index[][16] = {"
+  print " /* idx=0: XXX00 - XXXFF */"
+  print " { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },"
+  for (h = 0; h <= highnum; h++) {
+    if (!blockmap[h])
+      continue;
+    cnt++
+    printf " /* idx=%d: %03X00 - %03XFF */\\n {", cnt, h, h
+    for (m = 0; m < 16; m++) {
+      if (m != 0)
+          printf ","
+      if (xx_blockmap[h, m]) {
+          midcnt++
+          printf "%2d", midcnt
+      } else
+          printf " 0"
+    }
+    printf " },\\n"
+  }
+  printf "};\\n"
+  #
+  # Output the index table to the index table of the canonical combining
+  # class value table.
+  #
+  printf "\\n/* The index table to ccc_val_index[*][16] */\\n"
+  printf "static const unsigned char ccc_index[] = {\\n ", h
+  cnt = 0
+  for (h = 0; h <= highnum; h++) {
+    if (h != 0 && h % 24 == 0)
+      printf "\\n "
+    if (blockmap[h]) {
+      cnt++;
+      printf "%2d,", cnt
+    } else
+      printf " 0,"
+  }
+  print "};"
+  print ""
+}
+#
+#
+function hextoi(hex)
+{
+  dec = 0
+  for (i=0; i < length(hex); i++) {
+    x = substr(hex, i+1, 1)
+    if (x ~/[0-9]/)
+	dec = dec * 16 + x;
+    else if (x == "A")
+	dec = dec * 16 + 10;
+    else if (x == "B")
+	dec = dec * 16 + 11;
+    else if (x == "C")
+	dec = dec * 16 + 12;
+    else if (x == "D")
+	dec = dec * 16 + 13;
+    else if (x == "E")
+	dec = dec * 16 + 14;
+    else if (x == "F")
+	dec = dec * 16 + 15;
+  }
+  return dec
+}
+#
+# Collect Canonical Combining Class values.
+#
+\$4 ~/^[0-9A-F]+$/ {
+  if (\$4 !~/^0$/) {
+    if (min == "") {
+      min = \$1
+    }
+    max = \$1
+    high = substr(\$1, 1, length(\$1) -2)
+    highnum = hextoi(high)
+    mid = substr(\$1, length(\$1) -1, 1)
+    midnum = hextoi(mid)
+    low = substr(\$1, length(\$1), 1)
+    lownum = hextoi(low)
+    blockmap[highnum] = 1
+    xx_blockmap[highnum, midnum] = 1
+    xxx_blockmap[highnum, midnum, lownum] = \$4
+  }
+}
+#
+# Following code points are not decomposed in MAC OS.
+#   U+2000  - U+2FFF
+#   U+F900  - U+FAFF
+#   U+2F800 - U+2FAFF
+#
+#\$1 ~/^2[0-9A-F][0-9A-F][0-9A-F]\$/ {
+#        next
+#}
+#\$1 ~/^F[9A][0-9A-F][0-9A-F]\$/ {
+#        next
+#}
+#\$1 ~/^2F[89A][0-9A-F][0-9A-F]\$/ {
+#        next
+#}
+#
+# Exclusion code points specified by  
+# http://unicode.org/Public/6.0.0/ucd/CompositionExclusions.txt
+##
+# 1. Script Specifics
+##
+\$1 ~/^095[89ABCDEF]\$/ {
+    next
+}
+\$1 ~/^09D[CDF]\$/ {
+    next
+}
+\$1 ~/^0A3[36]\$/ {
+    next
+}
+\$1 ~/^0A5[9ABE]\$/ {
+    next
+}
+\$1 ~/^0B5[CD]\$/ {
+    next
+}
+\$1 ~/^0F4[3D]\$/ {
+    next
+}
+\$1 ~/^0F5[27C]\$/ {
+    next
+}
+\$1 ~/^0F69\$/ {
+    next
+}
+\$1 ~/^0F7[68]\$/ {
+    next
+}
+\$1 ~/^0F9[3D]\$/ {
+    next
+}
+\$1 ~/^0FA[27C]\$/ {
+    next
+}
+\$1 ~/^0FB9\$/ {
+    next
+}
+\$1 ~/^FB1[DF]\$/ {
+    next
+}
+\$1 ~/^FB2[ABCDEF]\$/ {
+    next
+}
+\$1 ~/^FB3[012345689ABCE]\$/ {
+    next
+}
+\$1 ~/^FB4[01346789ABCDE]\$/ {
+    next
+}
+##
+# 2. Post Composition Version precomposed characters
+##
+\$1 ~/^2ADC\$/ {
+    next
+}
+\$1 ~/^1D15[EF]\$/ {
+    next
+}
+\$1 ~/^1D16[01234]\$/ {
+    next
+}
+\$1 ~/^1D1B[BCDEF]\$/ {
+    next
+}
+\$1 ~/^1D1C0\$/ {
+    next
+}
+##
+# 3. Singleton Decompositions
+##
+\$1 ~/^034[01]\$/ {
+    next
+}
+\$1 ~/^037[4E]\$/ {
+    next
+}
+\$1 ~/^0387\$/ {
+    next
+}
+\$1 ~/^1F7[13579BD]\$/ {
+    next
+}
+\$1 ~/^1FB[BE]\$/ {
+    next
+}
+\$1 ~/^1FC[9B]\$/ {
+    next
+}
+\$1 ~/^1FD[3B]\$/ {
+    next
+}
+\$1 ~/^1FE[3BEF]\$/ {
+    next
+}
+\$1 ~/^1FF[9BD]\$/ {
+    next
+}
+\$1 ~/^200[01]\$/ {
+    next
+}
+\$1 ~/^212[6AB]\$/ {
+    next
+}
+\$1 ~/^232[9A]\$/ {
+    next
+}
+\$1 ~/^F9[0-9A-F][0-9A-F]\$/ {
+    next
+}
+\$1 ~/^FA0[0-9A-D]\$/ {
+    next
+}
+\$1 ~/^FA1[025-9A-E]\$/ {
+    next
+}
+\$1 ~/^FA2[0256A-D]\$/ {
+    next
+}
+\$1 ~/^FA[3-5][0-9A-F]\$/ {
+    next
+}
+\$1 ~/^FA6[0-9A-D]\$/ {
+    next
+}
+\$1 ~/^FA[7-9A-C][0-9A-F]\$/ {
+    next
+}
+\$1 ~/^FAD[0-9]\$/ {
+    next
+}
+\$1 ~/^2F[89][0-9A-F][0-9A-F]\$/ {
+    next
+}
+\$1 ~/^2FA0[0-9A-F]\$/ {
+    next
+}
+\$1 ~/^2FA1[0-9A-D]\$/ {
+    next
+}
+##
+# 4. Non-Starter Decompositions
+##
+\$1 ~/^0344\$/ {
+    next
+}
+\$1 ~/^0F7[35]\$/ {
+    next
+}
+\$1 ~/^0F81\$/ {
+    next
+}
+#
+# Output combinations for NFD ==> NFC.
+#
+\$6 ~/^[0-9A-F]+ [0-9A-F]+\$/ {
+    split(\$6, cp, " ")
+    if (length(\$1) == 4)
+        print "0"cp[1], "0"cp[2], "0"\$1 | cmd
+    else
+        print cp[1], cp[2], \$1 | cmd
+    # NFC ==> NFD table.
+    if (length(\$1) == 4)
+        print "0"\$1, "0"cp[1], "0"cp[2] >>nfdtbl
+    else
+        print \$1, cp[1], cp[2] >>nfdtbl
+}
+AWK_END
+#################################################################################
+# awk script
+#
+#################################################################################
+cat > ${pickout2} <<AWK_END
+#
+BEGIN {
+  FS = " "
+  print "struct unicode_decomposition_table {"
+  print "\tuint32_t nfc;"
+  print "\tuint32_t cp1;"
+  print "\tuint32_t cp2;"
+  print "};"
+  print ""
+  print "static const struct unicode_decomposition_table u_decomposition_table[] = {"
+}
+END {
+  print "};"
+  print ""
+}
+{
+printf "\t{ 0x%s , 0x%s , 0x%s },\n", \$1, \$2, \$3;
+}
+AWK_END
+#################################################################################
+#
+# Run awk a script.
+#
+#################################################################################
+append_copyright
+awk -f ${pickout} ${inputfile} >> ${outfile}
+awk -f ${pickout2} ${nfdtmp} >> ${outfile}
+echo "#endif /* ARCHIVE_STRING_COMPOSITION_H_INCLUDED */" >> ${outfile}
+echo "" >> ${outfile}
+#
+# Remove awk the script.
+rm ${pickout}
+rm ${pickout2}
+rm ${nfdtmp}

+ 1 - 0
core.mod/libarchive/build/version

@@ -0,0 +1 @@
+3005003dev

+ 37 - 0
core.mod/libarchive/cat/CMakeLists.txt

@@ -0,0 +1,37 @@
+############################################
+#
+# How to build bsdcat
+#
+############################################
+IF(ENABLE_CAT)
+
+  SET(bsdcat_SOURCES
+    bsdcat.c
+    bsdcat.h
+    bsdcat_platform.h
+    cmdline.c
+    ../libarchive_fe/err.c
+    ../libarchive_fe/err.h
+    ../libarchive_fe/lafe_platform.h
+  )
+  INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe)
+
+  # bsdcat documentation
+  SET(bsdcat_MANS bsdcat.1)
+
+  # How to build bsdcat
+  ADD_EXECUTABLE(bsdcat ${bsdcat_SOURCES})
+  IF(ENABLE_CAT_SHARED)
+    TARGET_LINK_LIBRARIES(bsdcat archive ${ADDITIONAL_LIBS})
+  ELSE(ENABLE_CAT_SHARED)
+    TARGET_LINK_LIBRARIES(bsdcat archive_static ${ADDITIONAL_LIBS})
+    SET_TARGET_PROPERTIES(bsdcat PROPERTIES COMPILE_DEFINITIONS
+    				 LIBARCHIVE_STATIC)
+  ENDIF(ENABLE_CAT_SHARED)
+
+  # Installation rules
+  INSTALL(TARGETS bsdcat RUNTIME DESTINATION bin)
+  INSTALL_MAN(${bsdcat_MANS})
+ENDIF(ENABLE_CAT)
+
+add_subdirectory(test)

+ 61 - 0
core.mod/libarchive/cat/bsdcat.1

@@ -0,0 +1,61 @@
+.\" Copyright (c) 2011-2014, Mike Kazantsev
+.\" 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 AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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$
+.\"
+.Dd March 1, 2014
+.Dt BSDCAT 1
+.Os
+.Sh NAME
+.Nm bsdcat
+.Nd expand files to standard output
+.Sh SYNOPSIS
+.Nm
+.Op options
+.Op files
+.Sh DESCRIPTION
+.Nm
+expands files to standard output.
+.Sh OPTIONS
+.Nm
+typically takes a filename as an argument or reads standard input when used in a
+pipe.
+In both cases decompressed data it written to standard output.
+.Sh EXAMPLES
+To decompress a file:
+.Pp
+.Dl bsdcat example.txt.gz > example.txt
+.Pp
+To decompress standard input in a pipe:
+.Pp
+.Dl cat example.txt.gz | bsdcat > example.txt
+.Pp
+Both examples achieve the same results - a decompressed file by redirecting
+output.
+.Sh SEE ALSO
+.Xr bzcat 1 ,
+.Xr uncompress 1 ,
+.Xr xzcat 1 ,
+.Xr zcat 1 ,
+.Xr libarchive-formats 5

+ 156 - 0
core.mod/libarchive/cat/bsdcat.c

@@ -0,0 +1,156 @@
+/*-
+ * Copyright (c) 2011-2014, Mike Kazantsev
+ * 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.
+ */
+
+#include "bsdcat_platform.h"
+__FBSDID("$FreeBSD$");
+
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "bsdcat.h"
+#include "err.h"
+
+#define	BYTES_PER_BLOCK	(20*512)
+
+static struct archive *a;
+static struct archive_entry *ae;
+static const char *bsdcat_current_path;
+static int exit_status = 0;
+
+
+void
+usage(FILE *stream, int eval)
+{
+	const char *p;
+	p = lafe_getprogname();
+	fprintf(stream,
+	    "Usage: %s [-h] [--help] [--version] [--] [filenames...]\n", p);
+	exit(eval);
+}
+
+static void
+version(void)
+{
+	printf("bsdcat %s - %s \n",
+	    BSDCAT_VERSION_STRING,
+	    archive_version_details());
+	exit(0);
+}
+
+void
+bsdcat_next(void)
+{
+	if (a != NULL) {
+		if (archive_read_close(a) != ARCHIVE_OK)
+			bsdcat_print_error();
+		archive_read_free(a);
+	}
+
+	a = archive_read_new();
+	archive_read_support_filter_all(a);
+	archive_read_support_format_empty(a);
+	archive_read_support_format_raw(a);
+}
+
+void
+bsdcat_print_error(void)
+{
+	lafe_warnc(0, "%s: %s",
+	    bsdcat_current_path, archive_error_string(a));
+	exit_status = 1;
+}
+
+void
+bsdcat_read_to_stdout(const char* filename)
+{
+	int r;
+
+	if (archive_read_open_filename(a, filename, BYTES_PER_BLOCK)
+	    != ARCHIVE_OK)
+		bsdcat_print_error();
+	else if (r = archive_read_next_header(a, &ae),
+		 r != ARCHIVE_OK && r != ARCHIVE_EOF)
+		bsdcat_print_error();
+	else if (r == ARCHIVE_EOF)
+		/* for empty payloads don't try and read data */
+		;
+	else if (archive_read_data_into_fd(a, 1) != ARCHIVE_OK)
+		bsdcat_print_error();
+	if (archive_read_close(a) != ARCHIVE_OK)
+		bsdcat_print_error();
+	archive_read_free(a);
+	a = NULL;
+}
+
+int
+main(int argc, char **argv)
+{
+	struct bsdcat *bsdcat, bsdcat_storage;
+	int c;
+
+	bsdcat = &bsdcat_storage;
+	memset(bsdcat, 0, sizeof(*bsdcat));
+
+	lafe_setprogname(*argv, "bsdcat");
+
+	bsdcat->argv = argv;
+	bsdcat->argc = argc;
+
+	while ((c = bsdcat_getopt(bsdcat)) != -1) {
+		switch (c) {
+		case 'h':
+			usage(stdout, 0);
+			break;
+		case OPTION_VERSION:
+			version();
+			break;
+		default:
+			usage(stderr, 1);
+		}
+	}
+
+	bsdcat_next();
+	if (*bsdcat->argv == NULL) {
+		bsdcat_current_path = "<stdin>";
+		bsdcat_read_to_stdout(NULL);
+	} else {
+		while (*bsdcat->argv) {
+			bsdcat_current_path = *bsdcat->argv++;
+			bsdcat_read_to_stdout(bsdcat_current_path);
+			bsdcat_next();
+		}
+		archive_read_free(a); /* Help valgrind & friends */
+	}
+
+	exit(exit_status);
+}

+ 61 - 0
core.mod/libarchive/cat/bsdcat.h

@@ -0,0 +1,61 @@
+/*-
+ * Copyright (c) 2014, Mike Kazantsev
+ * 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.
+ */
+
+#ifndef BSDCAT_H_INCLUDED
+#define BSDCAT_H_INCLUDED
+
+#if defined(PLATFORM_CONFIG_H)
+/* Use hand-built config.h in environments that need it. */
+#include PLATFORM_CONFIG_H
+#else
+/* Not having a config.h of some sort is a serious problem. */
+#include "config.h"
+#endif
+
+#include <archive.h>
+#include <archive_entry.h>
+
+struct bsdcat {
+	/* Option parser state */
+	int		  getopt_state;
+	char		 *getopt_word;
+
+	/* Miscellaneous state information */
+	int		  argc;
+	char		**argv;
+	const char	 *argument;
+};
+
+enum {
+	OPTION_VERSION
+};
+
+int bsdcat_getopt(struct bsdcat *);
+void usage(FILE *stream, int eval);
+void bsdcat_next(void);
+void bsdcat_print_error(void);
+void bsdcat_read_to_stdout(const char* filename);
+
+#endif

+ 75 - 0
core.mod/libarchive/cat/bsdcat_platform.h

@@ -0,0 +1,75 @@
+/*-
+ * 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: src/usr.bin/tar/bsdtar_platform.h,v 1.26 2008/12/06 07:37:14 kientzle Exp $
+ */
+
+/*
+ * This header is the first thing included in any of the bsdtar
+ * source files.  As far as possible, platform-specific issues should
+ * be dealt with here and not within individual source files.
+ */
+
+#ifndef BSDCAT_PLATFORM_H_INCLUDED
+#define	BSDCAT_PLATFORM_H_INCLUDED
+
+#if defined(PLATFORM_CONFIG_H)
+/* Use hand-built config.h in environments that need it. */
+#include PLATFORM_CONFIG_H
+#else
+/* Not having a config.h of some sort is a serious problem. */
+#include "config.h"
+#endif
+
+/* Get a real definition for __FBSDID if we can */
+#if HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+
+/* If not, define it so as to avoid dangling semicolons. */
+#ifndef __FBSDID
+#define	__FBSDID(a)     struct _undefined_hack
+#endif
+
+#ifdef HAVE_LIBARCHIVE
+/* If we're using the platform libarchive, include system headers. */
+#include <archive.h>
+#include <archive_entry.h>
+#else
+/* Otherwise, include user headers. */
+#include "archive.h"
+#include "archive_entry.h"
+#endif
+
+/* How to mark functions that don't return. */
+/* This facilitates use of some newer static code analysis tools. */
+#undef __LA_DEAD
+#if defined(__GNUC__) && (__GNUC__ > 2 || \
+			  (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
+#define	__LA_DEAD	__attribute__((__noreturn__))
+#else
+#define	__LA_DEAD
+#endif
+
+#endif /* !BSDCAT_PLATFORM_H_INCLUDED */

+ 283 - 0
core.mod/libarchive/cat/cmdline.c

@@ -0,0 +1,283 @@
+/*-
+ * Copyright (c) 2003-2008 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.
+ */
+
+/*
+ * Command line parser for tar.
+ */
+
+#include "bsdcat_platform.h"
+__FBSDID("$FreeBSD$");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "bsdcat.h"
+#include "err.h"
+
+/*
+ * Short options for tar.  Please keep this sorted.
+ */
+static const char *short_options = "h";
+
+/*
+ * Long options for tar.  Please keep this list sorted.
+ *
+ * The symbolic names for options that lack a short equivalent are
+ * defined in bsdcat.h.  Also note that so far I've found no need
+ * to support optional arguments to long options.  That would be
+ * a small change to the code below.
+ */
+
+static const struct bsdcat_option {
+	const char *name;
+	int required;      /* 1 if this option requires an argument. */
+	int equivalent;    /* Equivalent short option. */
+} tar_longopts[] = {
+	{ "help",                 0, 'h' },
+	{ "version",              0, OPTION_VERSION },
+	{ NULL, 0, 0 }
+};
+
+/*
+ * This getopt implementation has two key features that common
+ * getopt_long() implementations lack.  Apart from those, it's a
+ * straightforward option parser, considerably simplified by not
+ * needing to support the wealth of exotic getopt_long() features.  It
+ * has, of course, been shamelessly tailored for bsdcat.  (If you're
+ * looking for a generic getopt_long() implementation for your
+ * project, I recommend Gregory Pietsch's public domain getopt_long()
+ * implementation.)  The two additional features are:
+ *
+ * Old-style tar arguments: The original tar implementation treated
+ * the first argument word as a list of single-character option
+ * letters.  All arguments follow as separate words.  For example,
+ *    tar xbf 32 /dev/tape
+ * Here, the "xbf" is three option letters, "32" is the argument for
+ * "b" and "/dev/tape" is the argument for "f".  We support this usage
+ * if the first command-line argument does not begin with '-'.  We
+ * also allow regular short and long options to follow, e.g.,
+ *    tar xbf 32 /dev/tape -P --format=pax
+ *
+ * -W long options: There's an obscure GNU convention (only rarely
+ * supported even there) that allows "-W option=argument" as an
+ * alternative way to support long options.  This was supported in
+ * early bsdcat as a way to access long options on platforms that did
+ * not support getopt_long() and is preserved here for backwards
+ * compatibility.  (Of course, if I'd started with a custom
+ * command-line parser from the beginning, I would have had normal
+ * long option support on every platform so that hack wouldn't have
+ * been necessary.  Oh, well.  Some mistakes you just have to live
+ * with.)
+ *
+ * TODO: We should be able to use this to pull files and intermingled
+ * options (such as -C) from the command line in write mode.  That
+ * will require a little rethinking of the argument handling in
+ * bsdcat.c.
+ *
+ * TODO: If we want to support arbitrary command-line options from -T
+ * input (as GNU tar does), we may need to extend this to handle option
+ * words from sources other than argv/argc.  I'm not really sure if I
+ * like that feature of GNU tar, so it's certainly not a priority.
+ */
+
+int
+bsdcat_getopt(struct bsdcat *bsdcat)
+{
+	enum { state_start = 0, state_old_tar, state_next_word,
+	       state_short, state_long };
+
+	const struct bsdcat_option *popt, *match = NULL, *match2 = NULL;
+	const char *p, *long_prefix = "--";
+	size_t optlength;
+	int opt = '?';
+	int required = 0;
+
+	bsdcat->argument = NULL;
+
+	/* First time through, initialize everything. */
+	if (bsdcat->getopt_state == state_start) {
+		/* Skip program name. */
+		++bsdcat->argv;
+		--bsdcat->argc;
+		if (*bsdcat->argv == NULL)
+			return (-1);
+		/* Decide between "new style" and "old style" arguments. */
+		bsdcat->getopt_state = state_next_word;
+	}
+
+	/*
+	 * We're ready to look at the next word in argv.
+	 */
+	if (bsdcat->getopt_state == state_next_word) {
+		/* No more arguments, so no more options. */
+		if (bsdcat->argv[0] == NULL)
+			return (-1);
+		/* Doesn't start with '-', so no more options. */
+		if (bsdcat->argv[0][0] != '-')
+			return (-1);
+		/* "--" marks end of options; consume it and return. */
+		if (strcmp(bsdcat->argv[0], "--") == 0) {
+			++bsdcat->argv;
+			--bsdcat->argc;
+			return (-1);
+		}
+		/* Get next word for parsing. */
+		bsdcat->getopt_word = *bsdcat->argv++;
+		--bsdcat->argc;
+		if (bsdcat->getopt_word[1] == '-') {
+			/* Set up long option parser. */
+			bsdcat->getopt_state = state_long;
+			bsdcat->getopt_word += 2; /* Skip leading '--' */
+		} else {
+			/* Set up short option parser. */
+			bsdcat->getopt_state = state_short;
+			++bsdcat->getopt_word;  /* Skip leading '-' */
+		}
+	}
+
+	/*
+	 * We're parsing a group of POSIX-style single-character options.
+	 */
+	if (bsdcat->getopt_state == state_short) {
+		/* Peel next option off of a group of short options. */
+		opt = *bsdcat->getopt_word++;
+		if (opt == '\0') {
+			/* End of this group; recurse to get next option. */
+			bsdcat->getopt_state = state_next_word;
+			return bsdcat_getopt(bsdcat);
+		}
+
+		/* Does this option take an argument? */
+		p = strchr(short_options, opt);
+		if (p == NULL)
+			return ('?');
+		if (p[1] == ':')
+			required = 1;
+
+		/* If it takes an argument, parse that. */
+		if (required) {
+			/* If arg is run-in, bsdcat->getopt_word already points to it. */
+			if (bsdcat->getopt_word[0] == '\0') {
+				/* Otherwise, pick up the next word. */
+				bsdcat->getopt_word = *bsdcat->argv;
+				if (bsdcat->getopt_word == NULL) {
+					lafe_warnc(0,
+					    "Option -%c requires an argument",
+					    opt);
+					return ('?');
+				}
+				++bsdcat->argv;
+				--bsdcat->argc;
+			}
+			if (opt == 'W') {
+				bsdcat->getopt_state = state_long;
+				long_prefix = "-W "; /* For clearer errors. */
+			} else {
+				bsdcat->getopt_state = state_next_word;
+				bsdcat->argument = bsdcat->getopt_word;
+			}
+		}
+	}
+
+	/* We're reading a long option, including -W long=arg convention. */
+	if (bsdcat->getopt_state == state_long) {
+		/* After this long option, we'll be starting a new word. */
+		bsdcat->getopt_state = state_next_word;
+
+		/* Option name ends at '=' if there is one. */
+		p = strchr(bsdcat->getopt_word, '=');
+		if (p != NULL) {
+			optlength = (size_t)(p - bsdcat->getopt_word);
+			bsdcat->argument = (char *)(uintptr_t)(p + 1);
+		} else {
+			optlength = strlen(bsdcat->getopt_word);
+		}
+
+		/* Search the table for an unambiguous match. */
+		for (popt = tar_longopts; popt->name != NULL; popt++) {
+			/* Short-circuit if first chars don't match. */
+			if (popt->name[0] != bsdcat->getopt_word[0])
+				continue;
+			/* If option is a prefix of name in table, record it.*/
+			if (strncmp(bsdcat->getopt_word, popt->name, optlength) == 0) {
+				match2 = match; /* Record up to two matches. */
+				match = popt;
+				/* If it's an exact match, we're done. */
+				if (strlen(popt->name) == optlength) {
+					match2 = NULL; /* Forget the others. */
+					break;
+				}
+			}
+		}
+
+		/* Fail if there wasn't a unique match. */
+		if (match == NULL) {
+			lafe_warnc(0,
+			    "Option %s%s is not supported",
+			    long_prefix, bsdcat->getopt_word);
+			return ('?');
+		}
+		if (match2 != NULL) {
+			lafe_warnc(0,
+			    "Ambiguous option %s%s (matches --%s and --%s)",
+			    long_prefix, bsdcat->getopt_word, match->name, match2->name);
+			return ('?');
+		}
+
+		/* We've found a unique match; does it need an argument? */
+		if (match->required) {
+			/* Argument required: get next word if necessary. */
+			if (bsdcat->argument == NULL) {
+				bsdcat->argument = *bsdcat->argv;
+				if (bsdcat->argument == NULL) {
+					lafe_warnc(0,
+					    "Option %s%s requires an argument",
+					    long_prefix, match->name);
+					return ('?');
+				}
+				++bsdcat->argv;
+				--bsdcat->argc;
+			}
+		} else {
+			/* Argument forbidden: fail if there is one. */
+			if (bsdcat->argument != NULL) {
+				lafe_warnc(0,
+				    "Option %s%s does not allow an argument",
+				    long_prefix, match->name);
+				return ('?');
+			}
+		}
+		return (match->equivalent);
+	}
+
+	return (opt);
+}

+ 80 - 0
core.mod/libarchive/cat/test/CMakeLists.txt

@@ -0,0 +1,80 @@
+############################################
+#
+# How to build bsdtar_test
+#
+############################################
+IF(ENABLE_CAT AND ENABLE_TEST)
+  SET(bsdcat_test_SOURCES
+    ../../test_utils/test_utils.c
+    ../../test_utils/test_main.c
+    test.h
+    test_0.c
+    test_empty_gz.c
+    test_empty_lz4.c
+    test_empty_xz.c
+    test_empty_zstd.c
+    test_error.c
+    test_error_mixed.c
+    test_expand_Z.c
+    test_expand_bz2.c
+    test_expand_gz.c
+    test_expand_lz4.c
+    test_expand_mixed.c
+    test_expand_plain.c
+    test_expand_xz.c
+    test_expand_zstd.c
+    test_help.c
+    test_stdin.c
+    test_version.c
+  )
+
+  #
+  # Register target
+  #
+  ADD_EXECUTABLE(bsdcat_test ${bsdcat_test_SOURCES})
+  IF(ENABLE_ACL)
+    SET(TEST_ACL_LIBS "")
+    IF(HAVE_LIBACL)
+      LIST(APPEND TEST_ACL_LIBS ${ACL_LIBRARY})
+    ENDIF(HAVE_LIBACL)
+    IF(HAVE_LIBRICHACL)
+      LIST(APPEND TEST_ACL_LIBS ${RICHACL_LIBRARY})
+    ENDIF(HAVE_LIBRICHACL)
+    TARGET_LINK_LIBRARIES(bsdcat_test ${TEST_ACL_LIBS})
+  ENDIF(ENABLE_ACL)
+  SET_PROPERTY(TARGET bsdcat_test PROPERTY COMPILE_DEFINITIONS LIST_H)
+
+  #
+  # Generate list.h by grepping DEFINE_TEST() lines out of the C sources.
+  #
+  GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/list.h
+    ${CMAKE_CURRENT_LIST_FILE} ${bsdcat_test_SOURCES})
+  SET_PROPERTY(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES
+    ${CMAKE_CURRENT_BINARY_DIR})
+
+  # list.h has a line DEFINE_TEST(testname) for every
+  # test.  We can use that to define the tests for cmake by
+  # defining a DEFINE_TEST macro and reading list.h in.
+  MACRO (DEFINE_TEST _testname)
+    ADD_TEST(
+      NAME bsdcat_${_testname}
+      COMMAND bsdcat_test -vv
+                          -p $<TARGET_FILE:bsdcat>
+                          -r ${CMAKE_CURRENT_SOURCE_DIR}
+                          ${_testname})
+  ENDMACRO (DEFINE_TEST _testname)
+
+  INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h)
+  INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
+  INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/test_utils)
+  INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/cat/test)
+
+  # Experimental new test handling
+  ADD_CUSTOM_TARGET(run_bsdcat_test
+	COMMAND	bsdcat_test -p $<TARGET_FILE:bsdcat>
+			    -r ${CMAKE_CURRENT_SOURCE_DIR}
+			    -vv)
+  ADD_DEPENDENCIES(run_bsdcat_test bsdcat)
+  ADD_DEPENDENCIES(run_all_tests run_bsdcat_test)
+
+ENDIF(ENABLE_CAT AND ENABLE_TEST)

+ 40 - 0
core.mod/libarchive/cat/test/test.h

@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2003-2006 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$
+ */
+
+/* Every test program should #include "test.h" as the first thing. */
+
+#define KNOWNREF       "test_expand.Z.uu"
+#define ENVBASE "BSDCAT"  /* Prefix for environment variables. */
+#define	PROGRAM "bsdcat"  /* Name of program being tested. */
+#define PROGRAM_ALIAS "cat" /* Generic alias for program */
+#undef	LIBRARY		  /* Not testing a library. */
+#undef	EXTRA_DUMP	  /* How to dump extra data */
+#undef	EXTRA_ERRNO	  /* How to dump errno */
+/* How to generate extra version info. */
+#define	EXTRA_VERSION    (systemf("%s --version", testprog) ? "" : "")
+
+#include "test_common.h"

+ 67 - 0
core.mod/libarchive/cat/test/test_0.c

@@ -0,0 +1,67 @@
+/*-
+ * 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.
+ */
+#include "test.h"
+
+/*
+ * This first test does basic sanity checks on the environment.  For
+ * most of these, we just exit on failure.
+ */
+#if !defined(_WIN32) || defined(__CYGWIN__)
+#define DEV_NULL "/dev/null"
+#else
+#define DEV_NULL "NUL"
+#endif
+
+DEFINE_TEST(test_0)
+{
+	struct stat st;
+
+	failure("File %s does not exist?!", testprog);
+	if (!assertEqualInt(0, stat(testprogfile, &st))) {
+		fprintf(stderr,
+		    "\nFile %s does not exist; aborting test.\n\n",
+		    testprog);
+		exit(1);
+	}
+
+	failure("%s is not executable?!", testprog);
+	if (!assert((st.st_mode & 0111) != 0)) {
+		fprintf(stderr,
+		    "\nFile %s not executable; aborting test.\n\n",
+		    testprog);
+		exit(1);
+	}
+
+	/*
+	 * Try to successfully run the program; this requires that
+	 * we know some option that will succeed.
+	 */
+	if (0 != systemf("%s --version >" DEV_NULL, testprog)) {
+		failure("Unable to successfully run: %s --version\n", testprog);
+		assert(0);
+	}
+
+	/* TODO: Ensure that our reference files are available. */
+}

+ 4 - 0
core.mod/libarchive/cat/test/test_empty.gz.uu

@@ -0,0 +1,4 @@
+begin 644 test_empty.gz
+?'XL(""\MZE,``W1E<W1?96UP='D``P``````````````
+`
+end

+ 4 - 0
core.mod/libarchive/cat/test/test_empty.lz4.uu

@@ -0,0 +1,4 @@
+begin 644 test_empty.lz4
+/!")-&&1PN0`````%7<P"
+`
+end

+ 4 - 0
core.mod/libarchive/cat/test/test_empty.xz.uu

@@ -0,0 +1,4 @@
+begin 644 test_empty.xz
+@_3=Z6%H```3FUK1&`````!S?1"$?MO-]`0`````$65H`
+`
+end

+ 4 - 0
core.mod/libarchive/cat/test/test_empty.zst.uu

@@ -0,0 +1,4 @@
+begin 644 test_empty.zst
+-*+4O_010`0``F>G840``
+`
+end

+ 41 - 0
core.mod/libarchive/cat/test/test_empty_gz.c

@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2014 Sebastian Freundt
+ * 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.
+ */
+#include "test.h"
+
+DEFINE_TEST(test_empty_gz)
+{
+	const char *reffile = "test_empty.gz";
+	int f;
+
+	extract_reference_file(reffile);
+	f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
+	if (f == 0 || canGzip()) {
+		assertEqualInt(0, f);
+		assertEmptyFile("test.out");
+		assertEmptyFile("test.err");
+	} else {
+		skipping("It seems gzip is not supported on this platform");
+	}
+}

+ 41 - 0
core.mod/libarchive/cat/test/test_empty_lz4.c

@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2014 Sebastian Freundt
+ * 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.
+ */
+#include "test.h"
+
+DEFINE_TEST(test_empty_lz4)
+{
+	const char *reffile = "test_empty.lz4";
+	int f;
+
+	extract_reference_file(reffile);
+	f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
+	if (f == 0 || canLz4()) {
+		assertEqualInt(0, f);
+		assertEmptyFile("test.out");
+		assertEmptyFile("test.err");
+	} else {
+		skipping("It seems lz4 is not supported on this platform");
+	}
+}

+ 41 - 0
core.mod/libarchive/cat/test/test_empty_xz.c

@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2014 Sebastian Freundt
+ * 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.
+ */
+#include "test.h"
+
+DEFINE_TEST(test_empty_xz)
+{
+	const char *reffile = "test_empty.xz";
+	int f;
+
+	extract_reference_file(reffile);
+	f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
+	if (f == 0 || canXz()) {
+		assertEqualInt(0, f);
+		assertEmptyFile("test.out");
+		assertEmptyFile("test.err");
+	} else {
+		skipping("It seems xz is not supported on this platform");
+	}
+}

+ 41 - 0
core.mod/libarchive/cat/test/test_empty_zstd.c

@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2017 Sean Purcell
+ * 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.
+ */
+#include "test.h"
+
+DEFINE_TEST(test_empty_zstd)
+{
+	const char *reffile = "test_empty.zst";
+	int f;
+
+	extract_reference_file(reffile);
+	f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
+	if (f == 0 || canZstd()) {
+		assertEqualInt(0, f);
+		assertEmptyFile("test.out");
+		assertEmptyFile("test.err");
+	} else {
+		skipping("It seems zstd is not supported on this platform");
+	}
+}

+ 36 - 0
core.mod/libarchive/cat/test/test_error.c

@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 2014 Mike Kazantsev
+ * 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.
+ */
+#include "test.h"
+
+DEFINE_TEST(test_error)
+{
+	const char *reffile = "test_expand.error";
+
+	assertFileNotExists(reffile);
+	assert(0 != systemf("%s %s >test.out 2>test.err", testprog, reffile));
+
+	assertEmptyFile("test.out");
+	assertNonEmptyFile("test.err");
+}

+ 43 - 0
core.mod/libarchive/cat/test/test_error_mixed.c

@@ -0,0 +1,43 @@
+/*-
+ * Copyright (c) 2014 Mike Kazantsev
+ * 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.
+ */
+#include "test.h"
+
+DEFINE_TEST(test_error_mixed)
+{
+	const char *reffile1 = "test_expand.plain";
+	const char *reffile2 = "test_expand.error";
+	const char *reffile3 = "test_expand.Z";
+
+	assertFileNotExists(reffile2);
+	extract_reference_file(reffile1);
+	extract_reference_file(reffile3);
+	assert(0 != systemf("%s %s %s %s >test.out 2>test.err",
+	    testprog, reffile1, reffile2, reffile3));
+
+	assertTextFileContents(
+	    "contents of test_expand.plain.\n"
+	    "contents of test_expand.Z.\n", "test.out");
+	assertNonEmptyFile("test.err");
+}

+ 3 - 0
core.mod/libarchive/cat/test/test_expand.Z.uu

@@ -0,0 +1,3 @@
+begin 664 test_expand.Z
+@'YV08]ZXH5-FX!P0;\R`(#B'SI<R>."$<4/&A187"@`
+end

+ 5 - 0
core.mod/libarchive/cat/test/test_expand.bz2.uu

@@ -0,0 +1,5 @@
+begin 664 test_expand.bz2
+M0EIH.3%!62936=[T@^L   [__N000(!!(#!@\P+(, !@4 1 @$" (0   80$
+M(!D0 "  5%)D::#( #0]0 9J%1Z@>H :!B:&33(!"X";"%C@I$+32H/(0MXG
+J,EA1G51 WG-"6JV7JKA;/&]$X 6MNH 8'N@3[\XCA_%W)%.%"0WO2#ZP
+end

+ 4 - 0
core.mod/libarchive/cat/test/test_expand.gz.uu

@@ -0,0 +1,4 @@
+begin 664 test_expand.gz
+M'XL("-UD1%,``V%S9`!+SL\K2<TK*5;(3U,H22TNB4^M*$C,2]%+K]+C`@`Z
+'PQU''```````
+end

+ 5 - 0
core.mod/libarchive/cat/test/test_expand.lz4.uu

@@ -0,0 +1,5 @@
+begin 644 test_expand.lz4
+M!")-&&1PN1T``(!C;VYT96YT<R!O9B!T97-T7V5X<&%N9"YL>C0N"@`````Y
+#!E9+
+`
+end

+ 3 - 0
core.mod/libarchive/cat/test/test_expand.plain.uu

@@ -0,0 +1,3 @@
+begin 664 test_expand.plain
+?8V]N=&5N=',@;V8@=&5S=%]E>'!A;F0N<&QA:6XN"@
+end

+ 4 - 0
core.mod/libarchive/cat/test/test_expand.xz.uu

@@ -0,0 +1,4 @@
+begin 664 test_expand.xz
+M_3=Z6%H   3FUK1& @ A 18   !T+^6C 0 ;8V]N=&5N=',@;V8@=&5S=%]E
+G>'!A;F0N>'HN"@!S;^LVAO^3[  !-!R3&JV/'[;S?0$     !%E:
+end

+ 4 - 0
core.mod/libarchive/cat/test/test_expand.zst.uu

@@ -0,0 +1,4 @@
+begin 644 test_expand.zst
+J*+4O_010Z0``8V]N=&5N=',@;V8@=&5S=%]E>'!A;F0N>G-T+@J;23#F
+`
+end

+ 36 - 0
core.mod/libarchive/cat/test/test_expand_Z.c

@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 2014 Mike Kazantsev
+ * 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.
+ */
+#include "test.h"
+
+DEFINE_TEST(test_expand_Z)
+{
+	const char *reffile = "test_expand.Z";
+
+	extract_reference_file(reffile);
+	assertEqualInt(0, systemf("%s %s >test.out 2>test.err", testprog, reffile));
+
+	assertTextFileContents("contents of test_expand.Z.\n", "test.out");
+	assertEmptyFile("test.err");
+}

+ 42 - 0
core.mod/libarchive/cat/test/test_expand_bz2.c

@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2014 Mike Kazantsev
+ * Copyright (c) 2012 Michihiro NAKAJIMA
+ * 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.
+ */
+#include "test.h"
+
+DEFINE_TEST(test_expand_bz2)
+{
+	const char *reffile = "test_expand.bz2";
+	int f;
+
+	extract_reference_file(reffile);
+	f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
+	if (f == 0 || canBzip2()) {
+		assertEqualInt(0, f);
+		assertTextFileContents("contents of test_expand.bz2.\n", "test.out");
+		assertEmptyFile("test.err");
+	} else {
+		skipping("It seems bzip2 is not supported on this platform");
+	}
+}

+ 42 - 0
core.mod/libarchive/cat/test/test_expand_gz.c

@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2014 Mike Kazantsev
+ * Copyright (c) 2012 Michihiro NAKAJIMA
+ * 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.
+ */
+#include "test.h"
+
+DEFINE_TEST(test_expand_gz)
+{
+	const char *reffile = "test_expand.gz";
+	int f;
+
+	extract_reference_file(reffile);
+	f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
+	if (f == 0 || canGzip()) {
+		assertEqualInt(0, f);
+		assertTextFileContents("contents of test_expand.gz.\n", "test.out");
+		assertEmptyFile("test.err");
+	} else {
+		skipping("It seems gzip is not supported on this platform");
+	}
+}

+ 42 - 0
core.mod/libarchive/cat/test/test_expand_lz4.c

@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2014 Mike Kazantsev
+ * Copyright (c) 2012, 2014 Michihiro NAKAJIMA
+ * 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.
+ */
+#include "test.h"
+
+DEFINE_TEST(test_expand_lz4)
+{
+	const char *reffile = "test_expand.lz4";
+	int f;
+
+	extract_reference_file(reffile);
+	f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
+	if (f == 0 || canLz4()) {
+		assertEqualInt(0, f);
+		assertTextFileContents("contents of test_expand.lz4.\n", "test.out");
+		assertEmptyFile("test.err");
+	} else {
+		skipping("It seems lz4 is not supported on this platform");
+	}
+}

+ 41 - 0
core.mod/libarchive/cat/test/test_expand_mixed.c

@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2014 Mike Kazantsev
+ * 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.
+ */
+#include "test.h"
+
+DEFINE_TEST(test_expand_mixed)
+{
+	const char *reffile1 = "test_expand.Z";
+	const char *reffile2 = "test_expand.plain";
+
+	extract_reference_file(reffile1);
+	extract_reference_file(reffile2);
+	assertEqualInt(0, systemf("%s %s %s >test.out 2>test.err",
+	    testprog, reffile1, reffile2));
+
+	assertTextFileContents(
+	    "contents of test_expand.Z.\n"
+	    "contents of test_expand.plain.\n", "test.out");
+	assertEmptyFile("test.err");
+}

+ 36 - 0
core.mod/libarchive/cat/test/test_expand_plain.c

@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 2014 Mike Kazantsev
+ * 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.
+ */
+#include "test.h"
+
+DEFINE_TEST(test_expand_plain)
+{
+	const char *reffile = "test_expand.plain";
+
+	extract_reference_file(reffile);
+	assertEqualInt(0, systemf("%s %s >test.out 2>test.err", testprog, reffile));
+
+	assertTextFileContents("contents of test_expand.plain.\n", "test.out");
+	assertEmptyFile("test.err");
+}

+ 42 - 0
core.mod/libarchive/cat/test/test_expand_xz.c

@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2014 Mike Kazantsev
+ * Copyright (c) 2012 Michihiro NAKAJIMA
+ * 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.
+ */
+#include "test.h"
+
+DEFINE_TEST(test_expand_xz)
+{
+	const char *reffile = "test_expand.xz";
+	int f;
+
+	extract_reference_file(reffile);
+	f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
+	if (f == 0 || canXz()) {
+		assertEqualInt(0, f);
+		assertTextFileContents("contents of test_expand.xz.\n", "test.out");
+		assertEmptyFile("test.err");
+	} else {
+		skipping("It seems xz is not supported on this platform");
+	}
+}

+ 41 - 0
core.mod/libarchive/cat/test/test_expand_zstd.c

@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2017 Sean Purcell
+ * 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.
+ */
+#include "test.h"
+
+DEFINE_TEST(test_expand_zstd)
+{
+	const char *reffile = "test_expand.zst";
+	int f;
+
+	extract_reference_file(reffile);
+	f = systemf("%s %s >test.out 2>test.err", testprog, reffile);
+	if (f == 0 || canZstd()) {
+		assertEqualInt(0, f);
+		assertTextFileContents("contents of test_expand.zst.\n", "test.out");
+		assertEmptyFile("test.err");
+	} else {
+		skipping("It seems zstd is not supported on this platform");
+	}
+}

+ 75 - 0
core.mod/libarchive/cat/test/test_help.c

@@ -0,0 +1,75 @@
+/*-
+ * 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.
+ */
+#include "test.h"
+
+/*
+ * Test that "--help", "-h", and "-W help" options all work and
+ * generate reasonable output.
+ */
+
+static int
+in_first_line(const char *p, const char *substring)
+{
+	size_t l = strlen(substring);
+
+	while (*p != '\0' && *p != '\n') {
+		if (memcmp(p, substring, l) == 0)
+			return (1);
+		++p;
+	}
+	return (0);
+}
+
+DEFINE_TEST(test_help)
+{
+	int r;
+	char *p;
+	size_t plen;
+
+	/* Exercise --help option. */
+	r = systemf("%s --help >help.stdout 2>help.stderr", testprog);
+	assertEqualInt(r, 0);
+	failure("--help should generate nothing to stderr.");
+	assertEmptyFile("help.stderr");
+	/* Help message should start with name of program. */
+	p = slurpfile(&plen, "help.stdout");
+	failure("Help output should be long enough.");
+	assert(plen >= 6);
+	failure("First line of help output should contain 'bsdcat': %s", p);
+	assert(in_first_line(p, "bsdcat"));
+	/*
+	 * TODO: Extend this check to further verify that --help output
+	 * looks approximately right.
+	 */
+	free(p);
+
+	/* -h option should generate the same output. */
+	r = systemf("%s -h >h.stdout 2>h.stderr", testprog);
+	assertEqualInt(r, 0);
+	failure("-h should generate nothing to stderr.");
+	assertEmptyFile("h.stderr");
+	failure("stdout should be same for -h and --help");
+	assertEqualFile("h.stdout", "help.stdout");
+}

+ 42 - 0
core.mod/libarchive/cat/test/test_stdin.c

@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2017 Sean Purcell
+ * 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.
+ */
+#include "test.h"
+
+#if !defined(_WIN32) || defined(__CYGWIN__)
+#define DEV_NULL "/dev/null"
+#else
+#define DEV_NULL "NUL"
+#endif
+
+DEFINE_TEST(test_stdin)
+{
+	int f;
+
+	f = systemf("%s <%s >test.out 2>test.err", testprog, DEV_NULL);
+	assertEqualInt(0, f);
+	assertEmptyFile("test.out");
+	assertEmptyFile("test.err");
+}
+

+ 34 - 0
core.mod/libarchive/cat/test/test_version.c

@@ -0,0 +1,34 @@
+/*-
+ * Copyright (c) 2003-2017 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.
+ */
+#include "test.h"
+
+/*
+ * Test that --version option works and generates reasonable output.
+ */
+
+DEFINE_TEST(test_version)
+{
+	assertVersion(testprog, "bsdcat");
+}

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно