summaryrefslogtreecommitdiff
path: root/archivers
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2010-02-20 03:54:07 +0000
committerjoerg <joerg@pkgsrc.org>2010-02-20 03:54:07 +0000
commit20970423a4335bb8c554454042499cc96b126ab7 (patch)
tree29ceb17217341be02a7f9dc77f012ce0e154d442 /archivers
parenta2ba3614751f1312459143069c0b61ff7608794c (diff)
downloadpkgsrc-20970423a4335bb8c554454042499cc96b126ab7.tar.gz
Merge again...
Diffstat (limited to 'archivers')
-rw-r--r--archivers/libarchive/files/COPYING60
-rw-r--r--archivers/libarchive/files/INSTALL30
-rw-r--r--archivers/libarchive/files/Makefile.am624
-rw-r--r--archivers/libarchive/files/Makefile.in6980
-rw-r--r--archivers/libarchive/files/NEWS525
-rw-r--r--archivers/libarchive/files/README137
-rw-r--r--archivers/libarchive/files/aclocal.m48850
-rw-r--r--archivers/libarchive/files/config.h.in747
-rwxr-xr-xarchivers/libarchive/files/configure27210
-rw-r--r--archivers/libarchive/files/configure.ac486
-rw-r--r--archivers/libarchive/files/contrib/README32
-rw-r--r--archivers/libarchive/files/contrib/libarchive.1aix53.spec187
-rw-r--r--archivers/libarchive/files/contrib/libarchive.spec174
-rw-r--r--archivers/libarchive/files/contrib/libarchive_autodetect-st_lib_archive.m4154
-rw-r--r--archivers/libarchive/files/contrib/psota-benchmark/results.txt122
-rw-r--r--archivers/libarchive/files/contrib/psota-benchmark/tcp.sh104
-rw-r--r--archivers/libarchive/files/cpio/bsdcpio.1405
-rw-r--r--archivers/libarchive/files/cpio/cmdline.c369
-rw-r--r--archivers/libarchive/files/cpio/cpio.c1267
-rw-r--r--archivers/libarchive/files/cpio/cpio.h109
-rw-r--r--archivers/libarchive/files/cpio/cpio_platform.h77
-rw-r--r--archivers/libarchive/files/cpio/test/list.h27
-rw-r--r--archivers/libarchive/files/cpio/test/main.c2124
-rw-r--r--archivers/libarchive/files/cpio/test/test.h286
-rw-r--r--archivers/libarchive/files/cpio/test/test_0.c67
-rw-r--r--archivers/libarchive/files/cpio/test/test_basic.c173
-rw-r--r--archivers/libarchive/files/cpio/test/test_format_newc.c294
-rw-r--r--archivers/libarchive/files/cpio/test/test_gcpio_compat.c108
-rw-r--r--archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.bin.uu16
-rw-r--r--archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.crc.uu27
-rw-r--r--archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.newc.uu27
-rw-r--r--archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.ustar.uu84
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_a.c154
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_c.c221
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_d.c64
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_f.c76
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_f.cpio.uu16
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_help.c84
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_m.c63
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_m.cpio.uu16
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_t.c95
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_t.cpio.uu16
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_t.stdout.uu5
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_tv.stdout.uu6
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_u.c81
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_version.c109
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_y.c57
-rw-r--r--archivers/libarchive/files/cpio/test/test_option_z.c56
-rw-r--r--archivers/libarchive/files/cpio/test/test_owner_parse.c121
-rw-r--r--archivers/libarchive/files/cpio/test/test_pathmatch.c243
-rw-r--r--archivers/libarchive/files/doc/man/Makefile46
-rw-r--r--archivers/libarchive/files/doc/man/archive_entry.3519
-rw-r--r--archivers/libarchive/files/doc/man/archive_read.3733
-rw-r--r--archivers/libarchive/files/doc/man/archive_util.3163
-rw-r--r--archivers/libarchive/files/doc/man/archive_write.3670
-rw-r--r--archivers/libarchive/files/doc/man/archive_write_disk.3386
-rw-r--r--archivers/libarchive/files/doc/man/bsdcpio.1446
-rw-r--r--archivers/libarchive/files/doc/man/bsdtar.11024
-rw-r--r--archivers/libarchive/files/doc/man/cpio.5329
-rw-r--r--archivers/libarchive/files/doc/man/libarchive-formats.5341
-rw-r--r--archivers/libarchive/files/doc/man/libarchive.3315
-rw-r--r--archivers/libarchive/files/doc/man/libarchive_internals.3361
-rw-r--r--archivers/libarchive/files/doc/man/mtree.5282
-rw-r--r--archivers/libarchive/files/doc/man/tar.5869
-rw-r--r--archivers/libarchive/files/doc/mdoc2man.awk391
-rw-r--r--archivers/libarchive/files/doc/text/Makefile46
-rwxr-xr-xarchivers/libarchive/files/doc/update.sh107
-rw-r--r--archivers/libarchive/files/examples/minitar/README12
-rw-r--r--archivers/libarchive/files/examples/minitar/minitar.c421
-rw-r--r--archivers/libarchive/files/examples/minitar/tree.c423
-rw-r--r--archivers/libarchive/files/examples/minitar/tree.h78
-rw-r--r--archivers/libarchive/files/examples/tarfilter.c113
-rw-r--r--archivers/libarchive/files/examples/untar.c262
-rw-r--r--archivers/libarchive/files/libarchive/archive.h741
-rw-r--r--archivers/libarchive/files/libarchive/archive_check_magic.c134
-rw-r--r--archivers/libarchive/files/libarchive/archive_endian.h162
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry.3433
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry.c2202
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry.h524
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry_copy_stat.c77
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry_link_resolver.c405
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry_private.h184
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry_stat.c118
-rw-r--r--archivers/libarchive/files/libarchive/archive_entry_strmode.c87
-rw-r--r--archivers/libarchive/files/libarchive/archive_platform.h165
-rw-r--r--archivers/libarchive/files/libarchive/archive_private.h124
-rw-r--r--archivers/libarchive/files/libarchive/archive_read.3714
-rw-r--r--archivers/libarchive/files/libarchive/archive_read.c1249
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_data_into_fd.c93
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_extract.c182
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_open_fd.c186
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_open_file.c165
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_open_filename.c268
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_open_memory.c156
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_private.h199
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_compression_all.c60
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_compression_bzip2.c353
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_compression_compress.c444
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_compression_gzip.c465
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_compression_none.c40
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_compression_program.c459
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_all.c43
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_ar.c584
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c777
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_empty.c93
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c2830
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c1304
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_tar.c2418
-rw-r--r--archivers/libarchive/files/libarchive/archive_read_support_format_zip.c903
-rw-r--r--archivers/libarchive/files/libarchive/archive_string.c453
-rw-r--r--archivers/libarchive/files/libarchive/archive_string.h148
-rw-r--r--archivers/libarchive/files/libarchive/archive_string_sprintf.c164
-rw-r--r--archivers/libarchive/files/libarchive/archive_util.3160
-rw-r--r--archivers/libarchive/files/libarchive/archive_util.c391
-rw-r--r--archivers/libarchive/files/libarchive/archive_virtual.c94
-rw-r--r--archivers/libarchive/files/libarchive/archive_windows.c1280
-rw-r--r--archivers/libarchive/files/libarchive/archive_windows.h422
-rw-r--r--archivers/libarchive/files/libarchive/archive_write.3629
-rw-r--r--archivers/libarchive/files/libarchive/archive_write.c466
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_disk.3375
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_disk.c2628
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_disk_private.h38
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_disk_set_standard_lookup.c242
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_open_fd.c141
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_open_file.c105
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_open_filename.c162
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_open_memory.c126
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_private.h122
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_compression_bzip2.c408
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_compression_compress.c492
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_compression_gzip.c477
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_compression_none.c257
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_compression_program.c347
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format.c72
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_ar.c550
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_by_name.c76
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_cpio.c344
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_cpio_newc.c295
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_pax.c1386
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_shar.c626
-rw-r--r--archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c587
-rw-r--r--archivers/libarchive/files/libarchive/config_freebsd.h154
-rw-r--r--archivers/libarchive/files/libarchive/cpio.5325
-rw-r--r--archivers/libarchive/files/libarchive/filter_fork.c161
-rw-r--r--archivers/libarchive/files/libarchive/filter_fork.h41
-rw-r--r--archivers/libarchive/files/libarchive/libarchive-formats.5355
-rw-r--r--archivers/libarchive/files/libarchive/libarchive.3331
-rw-r--r--archivers/libarchive/files/libarchive/libarchive_internals.3366
-rw-r--r--archivers/libarchive/files/libarchive/mtree.5269
-rw-r--r--archivers/libarchive/files/libarchive/tar.5831
-rw-r--r--archivers/libarchive/files/libarchive/test/list.h106
-rw-r--r--archivers/libarchive/files/libarchive/test/main.c2114
-rw-r--r--archivers/libarchive/files/libarchive/test/read_open_memory.c167
-rw-r--r--archivers/libarchive/files/libarchive/test/test.h302
-rw-r--r--archivers/libarchive/files/libarchive/test/test_acl_basic.c229
-rw-r--r--archivers/libarchive/files/libarchive/test/test_acl_pax.c517
-rw-r--r--archivers/libarchive/files/libarchive/test/test_archive_api_feature.c76
-rw-r--r--archivers/libarchive/files/libarchive/test/test_bad_fd.c41
-rw-r--r--archivers/libarchive/files/libarchive/test/test_compat_gtar.c119
-rw-r--r--archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink.c108
-rw-r--r--archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink_1.tar.uu39
-rw-r--r--archivers/libarchive/files/libarchive/test/test_compat_zip.c80
-rw-r--r--archivers/libarchive/files/libarchive/test/test_compat_zip_1.zip.uu15
-rw-r--r--archivers/libarchive/files/libarchive/test/test_empty_write.c120
-rw-r--r--archivers/libarchive/files/libarchive/test/test_entry.c891
-rw-r--r--archivers/libarchive/files/libarchive/test/test_entry_strmode.c71
-rw-r--r--archivers/libarchive/files/libarchive/test/test_link_resolver.c205
-rw-r--r--archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c333
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_compress_program.c84
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_data_large.c125
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_extract.c168
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_ar.c87
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin.c64
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin_Z.c61
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin_bz2.c58
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin_gz.c61
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_cpio_odc.c68
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_cpio_svr4_gzip.c61
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_cpio_svr4c_Z.c62
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_empty.c47
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_gtar_gz.c60
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse.c318
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu1370
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_iso_gz.c52
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c203
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_mtree.c143
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_pax_bz2.c66
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_tar.c480
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_tar_empty_filename.c66
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_tar_empty_filename.tar.uu39
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_tbz.c59
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_tgz.c60
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_tz.c61
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_zip.c92
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_format_zip.zip.uu14
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_large.c93
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_pax_truncated.c288
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_position.c94
-rw-r--r--archivers/libarchive/files/libarchive/test/test_read_truncated.c149
-rw-r--r--archivers/libarchive/files/libarchive/test/test_tar_filenames.c186
-rw-r--r--archivers/libarchive/files/libarchive/test/test_tar_large.c312
-rw-r--r--archivers/libarchive/files/libarchive/test/test_ustar_filenames.c191
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_compress.c102
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_compress_program.c118
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_disk.c332
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_disk_hardlink.c219
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_disk_perms.c457
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_disk_secure.c215
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_ar.c209
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_cpio.c194
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_cpio_empty.c75
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_cpio_newc.c214
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_cpio_odc.c241
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_shar_empty.c58
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_tar.c114
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_tar_empty.c92
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_format_tar_ustar.c347
-rw-r--r--archivers/libarchive/files/libarchive/test/test_write_open_memory.c76
-rw-r--r--archivers/libarchive/files/tar/bsdtar.1921
-rw-r--r--archivers/libarchive/files/tar/bsdtar.c734
-rw-r--r--archivers/libarchive/files/tar/bsdtar.h158
-rw-r--r--archivers/libarchive/files/tar/bsdtar_platform.h132
-rw-r--r--archivers/libarchive/files/tar/getdate.c1037
-rw-r--r--archivers/libarchive/files/tar/read.c437
-rw-r--r--archivers/libarchive/files/tar/subst.c289
-rw-r--r--archivers/libarchive/files/tar/test/main.c2226
-rw-r--r--archivers/libarchive/files/tar/test/test.h289
-rw-r--r--archivers/libarchive/files/tar/test/test_0.c67
-rw-r--r--archivers/libarchive/files/tar/test/test_basic.c115
-rw-r--r--archivers/libarchive/files/tar/test/test_copy.c372
-rw-r--r--archivers/libarchive/files/tar/test/test_getdate.c80
-rw-r--r--archivers/libarchive/files/tar/test/test_help.c84
-rw-r--r--archivers/libarchive/files/tar/test/test_patterns.c184
-rw-r--r--archivers/libarchive/files/tar/test/test_stdio.c125
-rw-r--r--archivers/libarchive/files/tar/test/test_version.c97
-rw-r--r--archivers/libarchive/files/tar/tree.c821
-rw-r--r--archivers/libarchive/files/tar/tree.h141
-rw-r--r--archivers/libarchive/files/tar/util.c559
-rw-r--r--archivers/libarchive/files/tar/write.c1134
239 files changed, 121879 insertions, 0 deletions
diff --git a/archivers/libarchive/files/COPYING b/archivers/libarchive/files/COPYING
new file mode 100644
index 00000000000..9dbf49dbf21
--- /dev/null
+++ b/archivers/libarchive/files/COPYING
@@ -0,0 +1,60 @@
+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_entry.c
+ libarchive/archive_read_support_compression_compress.c
+ libarchive/archive_write_set_compression_compress.c
+ libarchive/mtree.5
+ tar/matching.c
+
+* The following source files are in the public domain:
+ tar/getdate.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-2009 <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.
diff --git a/archivers/libarchive/files/INSTALL b/archivers/libarchive/files/INSTALL
new file mode 100644
index 00000000000..d91cc0691f4
--- /dev/null
+++ b/archivers/libarchive/files/INSTALL
@@ -0,0 +1,30 @@
+More complete build documentation is available on the libarchive
+Wiki: http://libarchive.googlecode.com/
+
+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 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.
+See the libarchive Wiki or the cmake site for further documentation. \ No newline at end of file
diff --git a/archivers/libarchive/files/Makefile.am b/archivers/libarchive/files/Makefile.am
new file mode 100644
index 00000000000..4f4a80dcfc7
--- /dev/null
+++ b/archivers/libarchive/files/Makefile.am
@@ -0,0 +1,624 @@
+## 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)
+man_MANS= $(libarchive_man_MANS) $(bsdtar_man_MANS) $(bsdcpio_man_MANS)
+BUILT_SOURCES= libarchive/test/list.h tar/test/list.h cpio/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)
+TESTS= libarchive_test $(bsdtar_test_programs) $(bsdcpio_test_programs)
+TESTS_ENVIRONMENT= $(libarchive_TESTS_ENVIRONMENT) $(bsdtar_TESTS_ENVIRONMENT) $(bsdcpio_TESTS_ENVIRONMENT)
+# Always build and test both bsdtar and bsdcpio as part of 'distcheck'
+DISTCHECK_CONFIGURE_FLAGS = --enable-bsdtar --enable-bsdcpio
+# Uncommenting this line can help diagnose some errors. This is ordinarily
+# enabled in the libarchive development branch but is disabled
+# for libarchive production releases.
+#AM_CFLAGS=-Wall -Werror
+PLATFORMCPPFLAGS = @PLATFORMCPPFLAGS@
+AM_CPPFLAGS=$(PLATFORMCPPFLAGS)
+
+#
+# What to include in the distribution
+#
+EXTRA_DIST= \
+ CMakeLists.txt \
+ build/autogen.sh \
+ build/bump-version.sh \
+ build/clean.sh \
+ build/cmake \
+ build/version \
+ build/windows \
+ contrib \
+ doc \
+ examples \
+ $(libarchive_EXTRA_DIST) \
+ $(libarchive_test_EXTRA_DIST) \
+ $(bsdtar_EXTRA_DIST) \
+ $(bsdtar_test_EXTRA_DIST) \
+ $(bsdcpio_EXTRA_DIST) \
+ $(bsdcpio_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
+
+# Verify cmake builds as part of the acceptance
+distcheck-hook:
+ mkdir $(distdir)/_build/cmtest
+ cd $(distdir)/_build/cmtest && cmake ../.. && make && make test
+ rm -rf $(distdir)/_build/cmtest
+
+#
+# Extra rules for cleanup
+#
+DISTCLEANFILES= \
+ libarchive/test/list.h \
+ tar/test/list.h \
+ cpio/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
+
+#
+# Libarchive headers, source, etc.
+#
+#
+
+include_HEADERS= libarchive/archive.h libarchive/archive_entry.h
+
+libarchive_la_SOURCES= \
+ libarchive/archive_check_magic.c \
+ 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_private.h \
+ libarchive/archive_entry_stat.c \
+ libarchive/archive_entry_strmode.c \
+ libarchive/archive_entry_xattr.c \
+ libarchive/archive_hash.h \
+ libarchive/archive_platform.h \
+ libarchive/archive_private.h \
+ libarchive/archive_read.c \
+ libarchive/archive_read_data_into_fd.c \
+ libarchive/archive_read_disk.c \
+ libarchive/archive_read_disk_entry_from_file.c \
+ libarchive/archive_read_disk_private.h \
+ libarchive/archive_read_disk_set_standard_lookup.c \
+ libarchive/archive_read_extract.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_support_compression_all.c \
+ libarchive/archive_read_support_compression_bzip2.c \
+ libarchive/archive_read_support_compression_compress.c \
+ libarchive/archive_read_support_compression_gzip.c \
+ libarchive/archive_read_support_compression_none.c \
+ libarchive/archive_read_support_compression_program.c \
+ libarchive/archive_read_support_compression_rpm.c \
+ libarchive/archive_read_support_compression_uu.c \
+ libarchive/archive_read_support_compression_xz.c \
+ libarchive/archive_read_support_format_all.c \
+ libarchive/archive_read_support_format_ar.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_mtree.c \
+ libarchive/archive_read_support_format_raw.c \
+ libarchive/archive_read_support_format_tar.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_sprintf.c \
+ libarchive/archive_util.c \
+ libarchive/archive_virtual.c \
+ libarchive/archive_write.c \
+ libarchive/archive_write_disk.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_set_compression_bzip2.c \
+ libarchive/archive_write_set_compression_compress.c \
+ libarchive/archive_write_set_compression_gzip.c \
+ libarchive/archive_write_set_compression_none.c \
+ libarchive/archive_write_set_compression_program.c \
+ libarchive/archive_write_set_compression_xz.c \
+ libarchive/archive_write_set_format.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_newc.c \
+ libarchive/archive_write_set_format_mtree.c \
+ libarchive/archive_write_set_format_pax.c \
+ libarchive/archive_write_set_format_shar.c \
+ libarchive/archive_write_set_format_ustar.c \
+ libarchive/archive_write_set_format_zip.c \
+ libarchive/config_freebsd.h \
+ libarchive/filter_fork.c \
+ libarchive/filter_fork.h
+
+if INC_WINDOWS_FILES
+libarchive_la_SOURCES+= \
+ libarchive/archive_entry_copy_bhfi.c \
+ libarchive/archive_windows.h \
+ libarchive/archive_windows.c \
+ libarchive/filter_fork_windows.c
+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)
+
+# Manpages to install
+libarchive_man_MANS= \
+ libarchive/archive_entry.3 \
+ libarchive/archive_read.3 \
+ libarchive/archive_read_disk.3 \
+ libarchive/archive_util.3 \
+ libarchive/archive_write.3 \
+ libarchive/archive_write_disk.3 \
+ libarchive/cpio.5 \
+ libarchive/libarchive.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/test/list.h \
+ 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
+
+#
+#
+# libarchive_test program
+#
+#
+libarchive_test_SOURCES= \
+ $(libarchive_la_SOURCES) \
+ libarchive/test/main.c \
+ libarchive/test/read_open_memory.c \
+ libarchive/test/test.h \
+ libarchive/test/test_acl_basic.c \
+ libarchive/test/test_acl_freebsd.c \
+ libarchive/test/test_acl_pax.c \
+ libarchive/test/test_archive_api_feature.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_lzma.c \
+ libarchive/test/test_compat_solaris_tar_acl.c \
+ libarchive/test/test_compat_tar_hardlink.c \
+ libarchive/test/test_compat_xz.c \
+ libarchive/test/test_compat_zip.c \
+ libarchive/test/test_empty_write.c \
+ libarchive/test/test_entry.c \
+ libarchive/test/test_extattr_freebsd.c \
+ libarchive/test/test_fuzz.c \
+ libarchive/test/test_entry_strmode.c \
+ libarchive/test/test_link_resolver.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_read_compress_program.c \
+ libarchive/test/test_read_data_large.c \
+ libarchive/test/test_read_disk.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_format_ar.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_lzma.c \
+ libarchive/test/test_read_format_cpio_bin_xz.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_gz.c \
+ libarchive/test/test_read_format_gtar_lzma.c \
+ libarchive/test/test_read_format_gtar_sparse.c \
+ libarchive/test/test_read_format_iso_gz.c \
+ libarchive/test/test_read_format_iso_multi_extent.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_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_mtree.c \
+ libarchive/test/test_read_format_pax_bz2.c \
+ libarchive/test/test_read_format_raw.c \
+ libarchive/test/test_read_format_tar.c \
+ libarchive/test/test_read_format_tar_empty_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_xar.c \
+ libarchive/test/test_read_format_zip.c \
+ libarchive/test/test_read_large.c \
+ libarchive/test/test_read_pax_truncated.c \
+ libarchive/test/test_read_position.c \
+ libarchive/test/test_read_truncated.c \
+ libarchive/test/test_read_uu.c \
+ libarchive/test/test_tar_filenames.c \
+ libarchive/test/test_tar_large.c \
+ libarchive/test/test_ustar_filenames.c \
+ libarchive/test/test_write_compress.c \
+ libarchive/test/test_write_compress_bzip2.c \
+ libarchive/test/test_write_compress_gzip.c \
+ libarchive/test/test_write_compress_lzma.c \
+ libarchive/test/test_write_compress_program.c \
+ libarchive/test/test_write_compress_xz.c \
+ libarchive/test/test_write_disk.c \
+ libarchive/test/test_write_disk_failures.c \
+ libarchive/test/test_write_disk_hardlink.c \
+ libarchive/test/test_write_disk_perms.c \
+ libarchive/test/test_write_disk_secure.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_format_ar.c \
+ libarchive/test/test_write_format_cpio.c \
+ libarchive/test/test_write_format_cpio_empty.c \
+ libarchive/test/test_write_format_cpio_odc.c \
+ libarchive/test/test_write_format_cpio_newc.c \
+ libarchive/test/test_write_format_mtree.c \
+ libarchive/test/test_write_format_pax.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_ustar.c \
+ libarchive/test/test_write_format_zip.c \
+ libarchive/test/test_write_format_zip_empty.c \
+ libarchive/test/test_write_format_zip_no_compression.c \
+ libarchive/test/test_write_open_memory.c
+
+libarchive_test_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_builddir)/libarchive/test -DLIBARCHIVE_STATIC $(PLATFORMCPPFLAGS)
+
+# 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
+ 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
+
+libarchive_test_EXTRA_DIST=\
+ 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_gzip_1.tgz.uu \
+ libarchive/test/test_compat_gzip_2.tgz.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_solaris_tar_acl.tar.uu \
+ libarchive/test/test_compat_tar_hardlink_1.tar.uu \
+ libarchive/test/test_compat_xz_1.txz.uu \
+ libarchive/test/test_compat_zip_1.zip.uu \
+ libarchive/test/test_fuzz_1.iso.Z.uu \
+ libarchive/test/test_pax_filename_encoding.tar.uu \
+ libarchive/test/test_read_format_ar.ar.uu \
+ libarchive/test/test_read_format_cpio_bin_be.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_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_iso.iso.Z.uu \
+ libarchive/test/test_read_format_iso_joliet.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_zisofs.iso.Z.uu \
+ libarchive/test/test_read_format_mtree.mtree.uu \
+ libarchive/test/test_read_format_raw.data.Z.uu \
+ libarchive/test/test_read_format_raw.data.uu \
+ libarchive/test/test_read_format_tar_empty_filename.tar.uu \
+ libarchive/test/test_read_format_zip.zip.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/matching.c \
+ libarchive_fe/matching.h \
+ libarchive_fe/pathmatch.c \
+ libarchive_fe/pathmatch.h
+
+#
+#
+# bsdtar source, docs, etc.
+#
+#
+
+bsdtar_SOURCES= \
+ tar/bsdtar.c \
+ tar/bsdtar.h \
+ tar/bsdtar_platform.h \
+ tar/cmdline.c \
+ tar/getdate.c \
+ tar/read.c \
+ tar/subst.c \
+ tar/tree.c \
+ tar/tree.h \
+ 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
+bsdtar_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdtar_ccstatic) $(PLATFORMCPPFLAGS)
+bsdtar_LDFLAGS= $(bsdtar_ldstatic)
+
+bsdtar_EXTRA_DIST= \
+ tar/bsdtar.1 \
+ tar/bsdtar_windows.h \
+ tar/bsdtar_windows.c \
+ tar/CMakeLists.txt \
+ tar/config_freebsd.h \
+ tar/test/list.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= \
+ tar/getdate.c \
+ tar/test/main.c \
+ 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_getdate.c \
+ tar/test/test_help.c \
+ tar/test/test_option_T_upper.c \
+ tar/test/test_option_q.c \
+ tar/test/test_option_r.c \
+ tar/test/test_option_s.c \
+ tar/test/test_patterns.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
+
+# For now, bsdtar_test uses Windows shims from tar/bsdtar_windows.*
+if INC_WINDOWS_FILES
+bsdtar_test_SOURCES+= \
+ tar/bsdtar_windows.h \
+ tar/bsdtar_windows.c
+endif
+
+bsdtar_test_CPPFLAGS=\
+ -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \
+ -I$(top_srcdir)/tar -I$(top_builddir)/tar/test \
+ $(PLATFORMCPPFLAGS)
+
+tar/test/list.h: Makefile
+ 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/test_patterns_2.tar.uu \
+ tar/test/test_patterns_3.tar.uu \
+ tar/test/test_patterns_4.tar.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
+bsdcpio_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdcpio_ccstatic) $(PLATFORMCPPFLAGS)
+bsdcpio_LDFLAGS= $(bsdcpio_ldstatic)
+
+bsdcpio_EXTRA_DIST= \
+ cpio/test/list.h \
+ 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= \
+ cpio/cmdline.c \
+ cpio/test/main.c \
+ cpio/test/test.h \
+ cpio/test/test_0.c \
+ cpio/test/test_basic.c \
+ cpio/test/test_cmdline.c \
+ cpio/test/test_format_newc.c \
+ cpio/test/test_gcpio_compat.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_c.c \
+ cpio/test/test_option_d.c \
+ cpio/test/test_option_f.c \
+ cpio/test/test_option_help.c \
+ cpio/test/test_option_l.c \
+ cpio/test/test_option_lzma.c \
+ cpio/test/test_option_m.c \
+ cpio/test/test_option_t.c \
+ cpio/test/test_option_u.c \
+ cpio/test/test_option_version.c \
+ cpio/test/test_option_y.c \
+ cpio/test/test_option_z.c \
+ cpio/test/test_owner_parse.c \
+ cpio/test/test_passthrough_dotdot.c \
+ cpio/test/test_passthrough_reverse.c \
+ cpio/test/test_pathmatch.c
+
+bsdcpio_test_CPPFLAGS= \
+ -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \
+ -I$(top_srcdir)/cpio -I$(top_builddir)/cpio/test \
+ $(PLATFORMCPPFLAGS)
+bsdcpio_test_LDADD=libarchive_fe.la
+
+cpio/test/list.h: Makefile
+ 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/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_option_f.cpio.uu \
+ cpio/test/test_option_m.cpio.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
diff --git a/archivers/libarchive/files/Makefile.in b/archivers/libarchive/files/Makefile.in
new file mode 100644
index 00000000000..01b5c9d0c2c
--- /dev/null
+++ b/archivers/libarchive/files/Makefile.in
@@ -0,0 +1,6980 @@
+# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This Makefile.in 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.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2)
+check_PROGRAMS = libarchive_test$(EXEEXT) $(am__EXEEXT_3) \
+ $(am__EXEEXT_4)
+TESTS = libarchive_test$(EXEEXT) $(am__EXEEXT_3) $(am__EXEEXT_4)
+@INC_WINDOWS_FILES_TRUE@am__append_1 = \
+@INC_WINDOWS_FILES_TRUE@ libarchive/archive_entry_copy_bhfi.c \
+@INC_WINDOWS_FILES_TRUE@ libarchive/archive_windows.h \
+@INC_WINDOWS_FILES_TRUE@ libarchive/archive_windows.c \
+@INC_WINDOWS_FILES_TRUE@ libarchive/filter_fork_windows.c
+
+@INC_WINDOWS_FILES_TRUE@am__append_2 = \
+@INC_WINDOWS_FILES_TRUE@ tar/bsdtar_windows.h \
+@INC_WINDOWS_FILES_TRUE@ tar/bsdtar_windows.c
+
+
+# For now, bsdtar_test uses Windows shims from tar/bsdtar_windows.*
+@INC_WINDOWS_FILES_TRUE@am__append_3 = \
+@INC_WINDOWS_FILES_TRUE@ tar/bsdtar_windows.h \
+@INC_WINDOWS_FILES_TRUE@ tar/bsdtar_windows.c
+
+@INC_WINDOWS_FILES_TRUE@am__append_4 = \
+@INC_WINDOWS_FILES_TRUE@ cpio/cpio_windows.h \
+@INC_WINDOWS_FILES_TRUE@ cpio/cpio_windows.c
+
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(include_HEADERS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in \
+ $(top_srcdir)/build/pkgconfig/libarchive.pc.in \
+ $(top_srcdir)/configure COPYING INSTALL NEWS \
+ build/autoconf/compile build/autoconf/config.guess \
+ build/autoconf/config.sub build/autoconf/depcomp \
+ build/autoconf/install-sh build/autoconf/ltmain.sh \
+ build/autoconf/missing
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = \
+ $(top_srcdir)/build/autoconf/check_stdcall_func.m4 \
+ $(top_srcdir)/build/autoconf/la_uid_t.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES = build/pkgconfig/libarchive.pc
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" \
+ "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" \
+ "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" \
+ "$(DESTDIR)$(includedir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
+LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES)
+libarchive_la_LIBADD =
+am__libarchive_la_SOURCES_DIST = libarchive/archive_check_magic.c \
+ 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_private.h \
+ libarchive/archive_entry_stat.c \
+ libarchive/archive_entry_strmode.c \
+ libarchive/archive_entry_xattr.c libarchive/archive_hash.h \
+ libarchive/archive_platform.h libarchive/archive_private.h \
+ libarchive/archive_read.c \
+ libarchive/archive_read_data_into_fd.c \
+ libarchive/archive_read_disk.c \
+ libarchive/archive_read_disk_entry_from_file.c \
+ libarchive/archive_read_disk_private.h \
+ libarchive/archive_read_disk_set_standard_lookup.c \
+ libarchive/archive_read_extract.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_support_compression_all.c \
+ libarchive/archive_read_support_compression_bzip2.c \
+ libarchive/archive_read_support_compression_compress.c \
+ libarchive/archive_read_support_compression_gzip.c \
+ libarchive/archive_read_support_compression_none.c \
+ libarchive/archive_read_support_compression_program.c \
+ libarchive/archive_read_support_compression_rpm.c \
+ libarchive/archive_read_support_compression_uu.c \
+ libarchive/archive_read_support_compression_xz.c \
+ libarchive/archive_read_support_format_all.c \
+ libarchive/archive_read_support_format_ar.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_mtree.c \
+ libarchive/archive_read_support_format_raw.c \
+ libarchive/archive_read_support_format_tar.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_sprintf.c libarchive/archive_util.c \
+ libarchive/archive_virtual.c libarchive/archive_write.c \
+ libarchive/archive_write_disk.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_set_compression_bzip2.c \
+ libarchive/archive_write_set_compression_compress.c \
+ libarchive/archive_write_set_compression_gzip.c \
+ libarchive/archive_write_set_compression_none.c \
+ libarchive/archive_write_set_compression_program.c \
+ libarchive/archive_write_set_compression_xz.c \
+ libarchive/archive_write_set_format.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_newc.c \
+ libarchive/archive_write_set_format_mtree.c \
+ libarchive/archive_write_set_format_pax.c \
+ libarchive/archive_write_set_format_shar.c \
+ libarchive/archive_write_set_format_ustar.c \
+ libarchive/archive_write_set_format_zip.c \
+ libarchive/config_freebsd.h libarchive/filter_fork.c \
+ libarchive/filter_fork.h libarchive/archive_entry_copy_bhfi.c \
+ libarchive/archive_windows.h libarchive/archive_windows.c \
+ libarchive/filter_fork_windows.c
+am__dirstamp = $(am__leading_dot)dirstamp
+@INC_WINDOWS_FILES_TRUE@am__objects_1 = \
+@INC_WINDOWS_FILES_TRUE@ libarchive/archive_entry_copy_bhfi.lo \
+@INC_WINDOWS_FILES_TRUE@ libarchive/archive_windows.lo \
+@INC_WINDOWS_FILES_TRUE@ libarchive/filter_fork_windows.lo
+am_libarchive_la_OBJECTS = libarchive/archive_check_magic.lo \
+ libarchive/archive_entry.lo \
+ libarchive/archive_entry_copy_stat.lo \
+ libarchive/archive_entry_link_resolver.lo \
+ libarchive/archive_entry_stat.lo \
+ libarchive/archive_entry_strmode.lo \
+ libarchive/archive_entry_xattr.lo libarchive/archive_read.lo \
+ libarchive/archive_read_data_into_fd.lo \
+ libarchive/archive_read_disk.lo \
+ libarchive/archive_read_disk_entry_from_file.lo \
+ libarchive/archive_read_disk_set_standard_lookup.lo \
+ libarchive/archive_read_extract.lo \
+ libarchive/archive_read_open_fd.lo \
+ libarchive/archive_read_open_file.lo \
+ libarchive/archive_read_open_filename.lo \
+ libarchive/archive_read_open_memory.lo \
+ libarchive/archive_read_support_compression_all.lo \
+ libarchive/archive_read_support_compression_bzip2.lo \
+ libarchive/archive_read_support_compression_compress.lo \
+ libarchive/archive_read_support_compression_gzip.lo \
+ libarchive/archive_read_support_compression_none.lo \
+ libarchive/archive_read_support_compression_program.lo \
+ libarchive/archive_read_support_compression_rpm.lo \
+ libarchive/archive_read_support_compression_uu.lo \
+ libarchive/archive_read_support_compression_xz.lo \
+ libarchive/archive_read_support_format_all.lo \
+ libarchive/archive_read_support_format_ar.lo \
+ libarchive/archive_read_support_format_cpio.lo \
+ libarchive/archive_read_support_format_empty.lo \
+ libarchive/archive_read_support_format_iso9660.lo \
+ libarchive/archive_read_support_format_mtree.lo \
+ libarchive/archive_read_support_format_raw.lo \
+ libarchive/archive_read_support_format_tar.lo \
+ libarchive/archive_read_support_format_xar.lo \
+ libarchive/archive_read_support_format_zip.lo \
+ libarchive/archive_string.lo \
+ libarchive/archive_string_sprintf.lo \
+ libarchive/archive_util.lo libarchive/archive_virtual.lo \
+ libarchive/archive_write.lo libarchive/archive_write_disk.lo \
+ libarchive/archive_write_disk_set_standard_lookup.lo \
+ libarchive/archive_write_open_fd.lo \
+ libarchive/archive_write_open_file.lo \
+ libarchive/archive_write_open_filename.lo \
+ libarchive/archive_write_open_memory.lo \
+ libarchive/archive_write_set_compression_bzip2.lo \
+ libarchive/archive_write_set_compression_compress.lo \
+ libarchive/archive_write_set_compression_gzip.lo \
+ libarchive/archive_write_set_compression_none.lo \
+ libarchive/archive_write_set_compression_program.lo \
+ libarchive/archive_write_set_compression_xz.lo \
+ libarchive/archive_write_set_format.lo \
+ libarchive/archive_write_set_format_ar.lo \
+ libarchive/archive_write_set_format_by_name.lo \
+ libarchive/archive_write_set_format_cpio.lo \
+ libarchive/archive_write_set_format_cpio_newc.lo \
+ libarchive/archive_write_set_format_mtree.lo \
+ libarchive/archive_write_set_format_pax.lo \
+ libarchive/archive_write_set_format_shar.lo \
+ libarchive/archive_write_set_format_ustar.lo \
+ libarchive/archive_write_set_format_zip.lo \
+ libarchive/filter_fork.lo $(am__objects_1)
+libarchive_la_OBJECTS = $(am_libarchive_la_OBJECTS)
+libarchive_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(libarchive_la_LDFLAGS) $(LDFLAGS) -o $@
+libarchive_fe_la_LIBADD =
+am_libarchive_fe_la_OBJECTS = libarchive_fe/err.lo \
+ libarchive_fe/line_reader.lo libarchive_fe/matching.lo \
+ libarchive_fe/pathmatch.lo
+libarchive_fe_la_OBJECTS = $(am_libarchive_fe_la_OBJECTS)
+@BUILD_BSDTAR_TRUE@am__EXEEXT_1 = bsdtar$(EXEEXT)
+@BUILD_BSDCPIO_TRUE@am__EXEEXT_2 = bsdcpio$(EXEEXT)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+@BUILD_BSDTAR_TRUE@am__EXEEXT_3 = bsdtar_test$(EXEEXT)
+@BUILD_BSDCPIO_TRUE@am__EXEEXT_4 = bsdcpio_test$(EXEEXT)
+PROGRAMS = $(bin_PROGRAMS)
+am__bsdcpio_SOURCES_DIST = cpio/cmdline.c cpio/cpio.c cpio/cpio.h \
+ cpio/cpio_platform.h cpio/cpio_windows.h cpio/cpio_windows.c
+@INC_WINDOWS_FILES_TRUE@am__objects_2 = \
+@INC_WINDOWS_FILES_TRUE@ cpio/bsdcpio-cpio_windows.$(OBJEXT)
+am_bsdcpio_OBJECTS = cpio/bsdcpio-cmdline.$(OBJEXT) \
+ cpio/bsdcpio-cpio.$(OBJEXT) $(am__objects_2)
+bsdcpio_OBJECTS = $(am_bsdcpio_OBJECTS)
+bsdcpio_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(bsdcpio_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am_bsdcpio_test_OBJECTS = cpio/bsdcpio_test-cmdline.$(OBJEXT) \
+ cpio/test/bsdcpio_test-main.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_0.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_basic.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_cmdline.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_format_newc.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_gcpio_compat.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_B_upper.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_C_upper.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_J_upper.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_L_upper.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_Z_upper.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_a.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_c.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_d.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_f.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_help.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_l.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_lzma.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_m.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_t.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_u.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_version.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_y.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_option_z.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_owner_parse.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_passthrough_dotdot.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_passthrough_reverse.$(OBJEXT) \
+ cpio/test/bsdcpio_test-test_pathmatch.$(OBJEXT)
+bsdcpio_test_OBJECTS = $(am_bsdcpio_test_OBJECTS)
+bsdcpio_test_DEPENDENCIES = libarchive_fe.la
+am__bsdtar_SOURCES_DIST = tar/bsdtar.c tar/bsdtar.h \
+ tar/bsdtar_platform.h tar/cmdline.c tar/getdate.c tar/read.c \
+ tar/subst.c tar/tree.c tar/tree.h tar/util.c tar/write.c \
+ tar/bsdtar_windows.h tar/bsdtar_windows.c
+@INC_WINDOWS_FILES_TRUE@am__objects_3 = \
+@INC_WINDOWS_FILES_TRUE@ tar/bsdtar-bsdtar_windows.$(OBJEXT)
+am_bsdtar_OBJECTS = tar/bsdtar-bsdtar.$(OBJEXT) \
+ tar/bsdtar-cmdline.$(OBJEXT) tar/bsdtar-getdate.$(OBJEXT) \
+ tar/bsdtar-read.$(OBJEXT) tar/bsdtar-subst.$(OBJEXT) \
+ tar/bsdtar-tree.$(OBJEXT) tar/bsdtar-util.$(OBJEXT) \
+ tar/bsdtar-write.$(OBJEXT) $(am__objects_3)
+bsdtar_OBJECTS = $(am_bsdtar_OBJECTS)
+bsdtar_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(bsdtar_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am__bsdtar_test_SOURCES_DIST = tar/getdate.c tar/test/main.c \
+ 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_getdate.c tar/test/test_help.c \
+ tar/test/test_option_T_upper.c tar/test/test_option_q.c \
+ tar/test/test_option_r.c tar/test/test_option_s.c \
+ tar/test/test_patterns.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 \
+ tar/bsdtar_windows.h tar/bsdtar_windows.c
+@INC_WINDOWS_FILES_TRUE@am__objects_4 = tar/bsdtar_test-bsdtar_windows.$(OBJEXT)
+am_bsdtar_test_OBJECTS = tar/bsdtar_test-getdate.$(OBJEXT) \
+ tar/test/bsdtar_test-main.$(OBJEXT) \
+ tar/test/bsdtar_test-test_0.$(OBJEXT) \
+ tar/test/bsdtar_test-test_basic.$(OBJEXT) \
+ tar/test/bsdtar_test-test_copy.$(OBJEXT) \
+ tar/test/bsdtar_test-test_empty_mtree.$(OBJEXT) \
+ tar/test/bsdtar_test-test_getdate.$(OBJEXT) \
+ tar/test/bsdtar_test-test_help.$(OBJEXT) \
+ tar/test/bsdtar_test-test_option_T_upper.$(OBJEXT) \
+ tar/test/bsdtar_test-test_option_q.$(OBJEXT) \
+ tar/test/bsdtar_test-test_option_r.$(OBJEXT) \
+ tar/test/bsdtar_test-test_option_s.$(OBJEXT) \
+ tar/test/bsdtar_test-test_patterns.$(OBJEXT) \
+ tar/test/bsdtar_test-test_stdio.$(OBJEXT) \
+ tar/test/bsdtar_test-test_strip_components.$(OBJEXT) \
+ tar/test/bsdtar_test-test_symlink_dir.$(OBJEXT) \
+ tar/test/bsdtar_test-test_version.$(OBJEXT) \
+ tar/test/bsdtar_test-test_windows.$(OBJEXT) $(am__objects_4)
+bsdtar_test_OBJECTS = $(am_bsdtar_test_OBJECTS)
+bsdtar_test_LDADD = $(LDADD)
+am__libarchive_test_SOURCES_DIST = libarchive/archive_check_magic.c \
+ 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_private.h \
+ libarchive/archive_entry_stat.c \
+ libarchive/archive_entry_strmode.c \
+ libarchive/archive_entry_xattr.c libarchive/archive_hash.h \
+ libarchive/archive_platform.h libarchive/archive_private.h \
+ libarchive/archive_read.c \
+ libarchive/archive_read_data_into_fd.c \
+ libarchive/archive_read_disk.c \
+ libarchive/archive_read_disk_entry_from_file.c \
+ libarchive/archive_read_disk_private.h \
+ libarchive/archive_read_disk_set_standard_lookup.c \
+ libarchive/archive_read_extract.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_support_compression_all.c \
+ libarchive/archive_read_support_compression_bzip2.c \
+ libarchive/archive_read_support_compression_compress.c \
+ libarchive/archive_read_support_compression_gzip.c \
+ libarchive/archive_read_support_compression_none.c \
+ libarchive/archive_read_support_compression_program.c \
+ libarchive/archive_read_support_compression_rpm.c \
+ libarchive/archive_read_support_compression_uu.c \
+ libarchive/archive_read_support_compression_xz.c \
+ libarchive/archive_read_support_format_all.c \
+ libarchive/archive_read_support_format_ar.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_mtree.c \
+ libarchive/archive_read_support_format_raw.c \
+ libarchive/archive_read_support_format_tar.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_sprintf.c libarchive/archive_util.c \
+ libarchive/archive_virtual.c libarchive/archive_write.c \
+ libarchive/archive_write_disk.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_set_compression_bzip2.c \
+ libarchive/archive_write_set_compression_compress.c \
+ libarchive/archive_write_set_compression_gzip.c \
+ libarchive/archive_write_set_compression_none.c \
+ libarchive/archive_write_set_compression_program.c \
+ libarchive/archive_write_set_compression_xz.c \
+ libarchive/archive_write_set_format.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_newc.c \
+ libarchive/archive_write_set_format_mtree.c \
+ libarchive/archive_write_set_format_pax.c \
+ libarchive/archive_write_set_format_shar.c \
+ libarchive/archive_write_set_format_ustar.c \
+ libarchive/archive_write_set_format_zip.c \
+ libarchive/config_freebsd.h libarchive/filter_fork.c \
+ libarchive/filter_fork.h libarchive/archive_entry_copy_bhfi.c \
+ libarchive/archive_windows.h libarchive/archive_windows.c \
+ libarchive/filter_fork_windows.c libarchive/test/main.c \
+ libarchive/test/read_open_memory.c libarchive/test/test.h \
+ libarchive/test/test_acl_basic.c \
+ libarchive/test/test_acl_freebsd.c \
+ libarchive/test/test_acl_pax.c \
+ libarchive/test/test_archive_api_feature.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_lzma.c \
+ libarchive/test/test_compat_solaris_tar_acl.c \
+ libarchive/test/test_compat_tar_hardlink.c \
+ libarchive/test/test_compat_xz.c \
+ libarchive/test/test_compat_zip.c \
+ libarchive/test/test_empty_write.c \
+ libarchive/test/test_entry.c \
+ libarchive/test/test_extattr_freebsd.c \
+ libarchive/test/test_fuzz.c \
+ libarchive/test/test_entry_strmode.c \
+ libarchive/test/test_link_resolver.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_read_compress_program.c \
+ libarchive/test/test_read_data_large.c \
+ libarchive/test/test_read_disk.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_format_ar.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_lzma.c \
+ libarchive/test/test_read_format_cpio_bin_xz.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_gz.c \
+ libarchive/test/test_read_format_gtar_lzma.c \
+ libarchive/test/test_read_format_gtar_sparse.c \
+ libarchive/test/test_read_format_iso_gz.c \
+ libarchive/test/test_read_format_iso_multi_extent.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_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_mtree.c \
+ libarchive/test/test_read_format_pax_bz2.c \
+ libarchive/test/test_read_format_raw.c \
+ libarchive/test/test_read_format_tar.c \
+ libarchive/test/test_read_format_tar_empty_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_xar.c \
+ libarchive/test/test_read_format_zip.c \
+ libarchive/test/test_read_large.c \
+ libarchive/test/test_read_pax_truncated.c \
+ libarchive/test/test_read_position.c \
+ libarchive/test/test_read_truncated.c \
+ libarchive/test/test_read_uu.c \
+ libarchive/test/test_tar_filenames.c \
+ libarchive/test/test_tar_large.c \
+ libarchive/test/test_ustar_filenames.c \
+ libarchive/test/test_write_compress.c \
+ libarchive/test/test_write_compress_bzip2.c \
+ libarchive/test/test_write_compress_gzip.c \
+ libarchive/test/test_write_compress_lzma.c \
+ libarchive/test/test_write_compress_program.c \
+ libarchive/test/test_write_compress_xz.c \
+ libarchive/test/test_write_disk.c \
+ libarchive/test/test_write_disk_failures.c \
+ libarchive/test/test_write_disk_hardlink.c \
+ libarchive/test/test_write_disk_perms.c \
+ libarchive/test/test_write_disk_secure.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_format_ar.c \
+ libarchive/test/test_write_format_cpio.c \
+ libarchive/test/test_write_format_cpio_empty.c \
+ libarchive/test/test_write_format_cpio_odc.c \
+ libarchive/test/test_write_format_cpio_newc.c \
+ libarchive/test/test_write_format_mtree.c \
+ libarchive/test/test_write_format_pax.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_ustar.c \
+ libarchive/test/test_write_format_zip.c \
+ libarchive/test/test_write_format_zip_empty.c \
+ libarchive/test/test_write_format_zip_no_compression.c \
+ libarchive/test/test_write_open_memory.c
+@INC_WINDOWS_FILES_TRUE@am__objects_5 = libarchive/libarchive_test-archive_entry_copy_bhfi.$(OBJEXT) \
+@INC_WINDOWS_FILES_TRUE@ libarchive/libarchive_test-archive_windows.$(OBJEXT) \
+@INC_WINDOWS_FILES_TRUE@ libarchive/libarchive_test-filter_fork_windows.$(OBJEXT)
+am__objects_6 = \
+ libarchive/libarchive_test-archive_check_magic.$(OBJEXT) \
+ libarchive/libarchive_test-archive_entry.$(OBJEXT) \
+ libarchive/libarchive_test-archive_entry_copy_stat.$(OBJEXT) \
+ libarchive/libarchive_test-archive_entry_link_resolver.$(OBJEXT) \
+ libarchive/libarchive_test-archive_entry_stat.$(OBJEXT) \
+ libarchive/libarchive_test-archive_entry_strmode.$(OBJEXT) \
+ libarchive/libarchive_test-archive_entry_xattr.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_data_into_fd.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_disk.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_disk_entry_from_file.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_disk_set_standard_lookup.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_extract.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_open_fd.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_open_file.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_open_filename.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_open_memory.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_compression_all.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_compression_bzip2.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_compression_compress.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_compression_gzip.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_compression_none.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_compression_program.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_compression_rpm.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_compression_uu.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_compression_xz.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_format_all.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_format_ar.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_format_cpio.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_format_empty.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_format_iso9660.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_format_mtree.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_format_raw.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_format_tar.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_format_xar.$(OBJEXT) \
+ libarchive/libarchive_test-archive_read_support_format_zip.$(OBJEXT) \
+ libarchive/libarchive_test-archive_string.$(OBJEXT) \
+ libarchive/libarchive_test-archive_string_sprintf.$(OBJEXT) \
+ libarchive/libarchive_test-archive_util.$(OBJEXT) \
+ libarchive/libarchive_test-archive_virtual.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_disk.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_disk_set_standard_lookup.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_open_fd.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_open_file.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_open_filename.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_open_memory.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_compression_bzip2.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_compression_compress.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_compression_gzip.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_compression_none.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_compression_program.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_compression_xz.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_format.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_format_ar.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_format_by_name.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_format_cpio.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_format_cpio_newc.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_format_mtree.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_format_pax.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_format_shar.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_format_ustar.$(OBJEXT) \
+ libarchive/libarchive_test-archive_write_set_format_zip.$(OBJEXT) \
+ libarchive/libarchive_test-filter_fork.$(OBJEXT) \
+ $(am__objects_5)
+am_libarchive_test_OBJECTS = $(am__objects_6) \
+ libarchive/test/libarchive_test-main.$(OBJEXT) \
+ libarchive/test/libarchive_test-read_open_memory.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_acl_basic.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_acl_freebsd.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_acl_pax.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_archive_api_feature.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_bad_fd.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_compat_bzip2.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_compat_cpio.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_compat_gtar.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_compat_gzip.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_compat_lzma.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_compat_solaris_tar_acl.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_compat_tar_hardlink.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_compat_xz.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_compat_zip.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_empty_write.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_entry.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_extattr_freebsd.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_fuzz.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_entry_strmode.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_link_resolver.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_open_fd.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_open_file.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_open_filename.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_pax_filename_encoding.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_compress_program.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_data_large.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_disk.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_disk_entry_from_file.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_extract.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_file_nonexistent.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_ar.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_cpio_bin.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_cpio_bin_Z.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_cpio_bin_be.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_cpio_bin_bz2.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_cpio_bin_gz.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_cpio_bin_lzma.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_cpio_bin_xz.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_cpio_odc.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_cpio_svr4c_Z.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_empty.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_gtar_gz.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_gtar_lzma.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_gtar_sparse.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_iso_gz.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_iso_multi_extent.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_isojoliet_bz2.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_isojoliet_long.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_isojoliet_rr.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_isorr_bz2.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_isorr_ce.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_isorr_new_bz2.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_isorr_rr_moved.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_isozisofs_bz2.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_mtree.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_pax_bz2.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_raw.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_tar.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_tar_empty_filename.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_tbz.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_tgz.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_tlz.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_txz.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_tz.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_xar.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_format_zip.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_large.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_pax_truncated.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_position.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_truncated.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_read_uu.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_tar_filenames.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_tar_large.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_ustar_filenames.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_compress.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_compress_bzip2.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_compress_gzip.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_compress_lzma.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_compress_program.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_compress_xz.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_disk.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_disk_failures.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_disk_hardlink.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_disk_perms.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_disk_secure.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_disk_sparse.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_disk_symlink.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_disk_times.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_ar.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_cpio.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_cpio_empty.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_cpio_odc.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_cpio_newc.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_mtree.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_pax.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_shar_empty.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_tar.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_tar_empty.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_tar_ustar.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_zip.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_zip_empty.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_format_zip_no_compression.$(OBJEXT) \
+ libarchive/test/libarchive_test-test_write_open_memory.$(OBJEXT)
+libarchive_test_OBJECTS = $(am_libarchive_test_OBJECTS)
+libarchive_test_LDADD = $(LDADD)
+DEFAULT_INCLUDES = -I.@am__isrc@
+depcomp = $(SHELL) $(top_srcdir)/build/autoconf/depcomp
+am__depfiles_maybe = depfiles
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libarchive_la_SOURCES) $(libarchive_fe_la_SOURCES) \
+ $(bsdcpio_SOURCES) $(bsdcpio_test_SOURCES) $(bsdtar_SOURCES) \
+ $(bsdtar_test_SOURCES) $(libarchive_test_SOURCES)
+DIST_SOURCES = $(am__libarchive_la_SOURCES_DIST) \
+ $(libarchive_fe_la_SOURCES) $(am__bsdcpio_SOURCES_DIST) \
+ $(bsdcpio_test_SOURCES) $(am__bsdtar_SOURCES_DIST) \
+ $(am__bsdtar_test_SOURCES_DIST) \
+ $(am__libarchive_test_SOURCES_DIST)
+man1dir = $(mandir)/man1
+man3dir = $(mandir)/man3
+man5dir = $(mandir)/man5
+NROFF = nroff
+MANS = $(man_MANS)
+pkgconfigDATA_INSTALL = $(INSTALL_DATA)
+DATA = $(pkgconfig_DATA)
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+HEADERS = $(include_HEADERS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+ARCHIVE_LIBTOOL_VERSION = @ARCHIVE_LIBTOOL_VERSION@
+AS = @AS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BSDCPIO_VERSION_STRING = @BSDCPIO_VERSION_STRING@
+BSDTAR_VERSION_STRING = @BSDTAR_VERSION_STRING@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBARCHIVE_VERSION_NUMBER = @LIBARCHIVE_VERSION_NUMBER@
+LIBARCHIVE_VERSION_STRING = @LIBARCHIVE_VERSION_STRING@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+NM = @NM@
+NMEDIT = @NMEDIT@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+# Uncommenting this line can help diagnose some errors. This is ordinarily
+# enabled in the libarchive development branch but is disabled
+# for libarchive production releases.
+#AM_CFLAGS=-Wall -Werror
+PLATFORMCPPFLAGS = @PLATFORMCPPFLAGS@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+XML2_CONFIG = @XML2_CONFIG@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AUTOMAKE_OPTIONS = foreign subdir-objects
+ACLOCAL_AMFLAGS = -I build/autoconf
+
+#
+# What to build and install
+#
+lib_LTLIBRARIES = libarchive.la
+noinst_LTLIBRARIES = libarchive_fe.la
+man_MANS = $(libarchive_man_MANS) $(bsdtar_man_MANS) $(bsdcpio_man_MANS)
+BUILT_SOURCES = libarchive/test/list.h tar/test/list.h cpio/test/list.h
+TESTS_ENVIRONMENT = $(libarchive_TESTS_ENVIRONMENT) $(bsdtar_TESTS_ENVIRONMENT) $(bsdcpio_TESTS_ENVIRONMENT)
+# Always build and test both bsdtar and bsdcpio as part of 'distcheck'
+DISTCHECK_CONFIGURE_FLAGS = --enable-bsdtar --enable-bsdcpio
+AM_CPPFLAGS = $(PLATFORMCPPFLAGS)
+
+#
+# What to include in the distribution
+#
+EXTRA_DIST = \
+ CMakeLists.txt \
+ build/autogen.sh \
+ build/bump-version.sh \
+ build/clean.sh \
+ build/cmake \
+ build/version \
+ build/windows \
+ contrib \
+ doc \
+ examples \
+ $(libarchive_EXTRA_DIST) \
+ $(libarchive_test_EXTRA_DIST) \
+ $(bsdtar_EXTRA_DIST) \
+ $(bsdtar_test_EXTRA_DIST) \
+ $(bsdcpio_EXTRA_DIST) \
+ $(bsdcpio_test_EXTRA_DIST)
+
+
+#
+# Extra rules for cleanup
+#
+DISTCLEANFILES = \
+ libarchive/test/list.h \
+ tar/test/list.h \
+ cpio/test/list.h
+
+
+#
+# Libarchive headers, source, etc.
+#
+#
+include_HEADERS = libarchive/archive.h libarchive/archive_entry.h
+libarchive_la_SOURCES = libarchive/archive_check_magic.c \
+ 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_private.h \
+ libarchive/archive_entry_stat.c \
+ libarchive/archive_entry_strmode.c \
+ libarchive/archive_entry_xattr.c libarchive/archive_hash.h \
+ libarchive/archive_platform.h libarchive/archive_private.h \
+ libarchive/archive_read.c \
+ libarchive/archive_read_data_into_fd.c \
+ libarchive/archive_read_disk.c \
+ libarchive/archive_read_disk_entry_from_file.c \
+ libarchive/archive_read_disk_private.h \
+ libarchive/archive_read_disk_set_standard_lookup.c \
+ libarchive/archive_read_extract.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_support_compression_all.c \
+ libarchive/archive_read_support_compression_bzip2.c \
+ libarchive/archive_read_support_compression_compress.c \
+ libarchive/archive_read_support_compression_gzip.c \
+ libarchive/archive_read_support_compression_none.c \
+ libarchive/archive_read_support_compression_program.c \
+ libarchive/archive_read_support_compression_rpm.c \
+ libarchive/archive_read_support_compression_uu.c \
+ libarchive/archive_read_support_compression_xz.c \
+ libarchive/archive_read_support_format_all.c \
+ libarchive/archive_read_support_format_ar.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_mtree.c \
+ libarchive/archive_read_support_format_raw.c \
+ libarchive/archive_read_support_format_tar.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_sprintf.c libarchive/archive_util.c \
+ libarchive/archive_virtual.c libarchive/archive_write.c \
+ libarchive/archive_write_disk.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_set_compression_bzip2.c \
+ libarchive/archive_write_set_compression_compress.c \
+ libarchive/archive_write_set_compression_gzip.c \
+ libarchive/archive_write_set_compression_none.c \
+ libarchive/archive_write_set_compression_program.c \
+ libarchive/archive_write_set_compression_xz.c \
+ libarchive/archive_write_set_format.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_newc.c \
+ libarchive/archive_write_set_format_mtree.c \
+ libarchive/archive_write_set_format_pax.c \
+ libarchive/archive_write_set_format_shar.c \
+ libarchive/archive_write_set_format_ustar.c \
+ libarchive/archive_write_set_format_zip.c \
+ libarchive/config_freebsd.h libarchive/filter_fork.c \
+ libarchive/filter_fork.h $(am__append_1)
+
+# -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)
+
+# Manpages to install
+libarchive_man_MANS = \
+ libarchive/archive_entry.3 \
+ libarchive/archive_read.3 \
+ libarchive/archive_read_disk.3 \
+ libarchive/archive_util.3 \
+ libarchive/archive_write.3 \
+ libarchive/archive_write_disk.3 \
+ libarchive/cpio.5 \
+ libarchive/libarchive.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/test/list.h \
+ 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
+
+#
+#
+# libarchive_test program
+#
+#
+libarchive_test_SOURCES = \
+ $(libarchive_la_SOURCES) \
+ libarchive/test/main.c \
+ libarchive/test/read_open_memory.c \
+ libarchive/test/test.h \
+ libarchive/test/test_acl_basic.c \
+ libarchive/test/test_acl_freebsd.c \
+ libarchive/test/test_acl_pax.c \
+ libarchive/test/test_archive_api_feature.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_lzma.c \
+ libarchive/test/test_compat_solaris_tar_acl.c \
+ libarchive/test/test_compat_tar_hardlink.c \
+ libarchive/test/test_compat_xz.c \
+ libarchive/test/test_compat_zip.c \
+ libarchive/test/test_empty_write.c \
+ libarchive/test/test_entry.c \
+ libarchive/test/test_extattr_freebsd.c \
+ libarchive/test/test_fuzz.c \
+ libarchive/test/test_entry_strmode.c \
+ libarchive/test/test_link_resolver.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_read_compress_program.c \
+ libarchive/test/test_read_data_large.c \
+ libarchive/test/test_read_disk.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_format_ar.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_lzma.c \
+ libarchive/test/test_read_format_cpio_bin_xz.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_gz.c \
+ libarchive/test/test_read_format_gtar_lzma.c \
+ libarchive/test/test_read_format_gtar_sparse.c \
+ libarchive/test/test_read_format_iso_gz.c \
+ libarchive/test/test_read_format_iso_multi_extent.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_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_mtree.c \
+ libarchive/test/test_read_format_pax_bz2.c \
+ libarchive/test/test_read_format_raw.c \
+ libarchive/test/test_read_format_tar.c \
+ libarchive/test/test_read_format_tar_empty_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_xar.c \
+ libarchive/test/test_read_format_zip.c \
+ libarchive/test/test_read_large.c \
+ libarchive/test/test_read_pax_truncated.c \
+ libarchive/test/test_read_position.c \
+ libarchive/test/test_read_truncated.c \
+ libarchive/test/test_read_uu.c \
+ libarchive/test/test_tar_filenames.c \
+ libarchive/test/test_tar_large.c \
+ libarchive/test/test_ustar_filenames.c \
+ libarchive/test/test_write_compress.c \
+ libarchive/test/test_write_compress_bzip2.c \
+ libarchive/test/test_write_compress_gzip.c \
+ libarchive/test/test_write_compress_lzma.c \
+ libarchive/test/test_write_compress_program.c \
+ libarchive/test/test_write_compress_xz.c \
+ libarchive/test/test_write_disk.c \
+ libarchive/test/test_write_disk_failures.c \
+ libarchive/test/test_write_disk_hardlink.c \
+ libarchive/test/test_write_disk_perms.c \
+ libarchive/test/test_write_disk_secure.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_format_ar.c \
+ libarchive/test/test_write_format_cpio.c \
+ libarchive/test/test_write_format_cpio_empty.c \
+ libarchive/test/test_write_format_cpio_odc.c \
+ libarchive/test/test_write_format_cpio_newc.c \
+ libarchive/test/test_write_format_mtree.c \
+ libarchive/test/test_write_format_pax.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_ustar.c \
+ libarchive/test/test_write_format_zip.c \
+ libarchive/test/test_write_format_zip_empty.c \
+ libarchive/test/test_write_format_zip_no_compression.c \
+ libarchive/test/test_write_open_memory.c
+
+libarchive_test_CPPFLAGS = -I$(top_srcdir)/libarchive -I$(top_builddir)/libarchive/test -DLIBARCHIVE_STATIC $(PLATFORMCPPFLAGS)
+libarchive_TESTS_ENVIRONMENT = LIBARCHIVE_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/libarchive/test
+libarchive_test_EXTRA_DIST = \
+ 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_gzip_1.tgz.uu \
+ libarchive/test/test_compat_gzip_2.tgz.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_solaris_tar_acl.tar.uu \
+ libarchive/test/test_compat_tar_hardlink_1.tar.uu \
+ libarchive/test/test_compat_xz_1.txz.uu \
+ libarchive/test/test_compat_zip_1.zip.uu \
+ libarchive/test/test_fuzz_1.iso.Z.uu \
+ libarchive/test/test_pax_filename_encoding.tar.uu \
+ libarchive/test/test_read_format_ar.ar.uu \
+ libarchive/test/test_read_format_cpio_bin_be.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_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_iso.iso.Z.uu \
+ libarchive/test/test_read_format_iso_joliet.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_zisofs.iso.Z.uu \
+ libarchive/test/test_read_format_mtree.mtree.uu \
+ libarchive/test/test_read_format_raw.data.Z.uu \
+ libarchive/test/test_read_format_raw.data.uu \
+ libarchive/test/test_read_format_tar_empty_filename.tar.uu \
+ libarchive/test/test_read_format_zip.zip.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/matching.c \
+ libarchive_fe/matching.h \
+ libarchive_fe/pathmatch.c \
+ libarchive_fe/pathmatch.h
+
+
+#
+#
+# bsdtar source, docs, etc.
+#
+#
+bsdtar_SOURCES = tar/bsdtar.c tar/bsdtar.h tar/bsdtar_platform.h \
+ tar/cmdline.c tar/getdate.c tar/read.c tar/subst.c tar/tree.c \
+ tar/tree.h tar/util.c tar/write.c $(am__append_2)
+bsdtar_DEPENDENCIES = libarchive.la libarchive_fe.la
+@STATIC_BSDTAR_FALSE@bsdtar_ldstatic =
+@STATIC_BSDTAR_TRUE@bsdtar_ldstatic = -static
+@STATIC_BSDTAR_FALSE@bsdtar_ccstatic =
+@STATIC_BSDTAR_TRUE@bsdtar_ccstatic = -DLIBARCHIVE_STATIC
+bsdtar_LDADD = libarchive.la libarchive_fe.la
+bsdtar_CPPFLAGS = -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdtar_ccstatic) $(PLATFORMCPPFLAGS)
+bsdtar_LDFLAGS = $(bsdtar_ldstatic)
+bsdtar_EXTRA_DIST = \
+ tar/bsdtar.1 \
+ tar/bsdtar_windows.h \
+ tar/bsdtar_windows.c \
+ tar/CMakeLists.txt \
+ tar/config_freebsd.h \
+ tar/test/list.h
+
+@BUILD_BSDTAR_FALSE@bsdtar_man_MANS =
+@BUILD_BSDTAR_TRUE@bsdtar_man_MANS = tar/bsdtar.1
+@BUILD_BSDTAR_FALSE@bsdtar_programs =
+@BUILD_BSDTAR_TRUE@bsdtar_programs = bsdtar
+
+#
+# bsdtar_test
+#
+bsdtar_test_SOURCES = tar/getdate.c tar/test/main.c 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_getdate.c \
+ tar/test/test_help.c tar/test/test_option_T_upper.c \
+ tar/test/test_option_q.c tar/test/test_option_r.c \
+ tar/test/test_option_s.c tar/test/test_patterns.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 $(am__append_3)
+bsdtar_test_CPPFLAGS = \
+ -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \
+ -I$(top_srcdir)/tar -I$(top_builddir)/tar/test \
+ $(PLATFORMCPPFLAGS)
+
+@BUILD_BSDTAR_FALSE@bsdtar_test_programs =
+@BUILD_BSDTAR_TRUE@bsdtar_test_programs = bsdtar_test
+@BUILD_BSDTAR_FALSE@bsdtar_TESTS_ENVIRONMENT =
+@BUILD_BSDTAR_TRUE@bsdtar_TESTS_ENVIRONMENT = BSDTAR=`cd $(top_builddir);/bin/pwd`/bsdtar$(EXEEXT) BSDTAR_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/tar/test
+bsdtar_test_EXTRA_DIST = \
+ tar/test/test_patterns_2.tar.uu \
+ tar/test/test_patterns_3.tar.uu \
+ tar/test/test_patterns_4.tar.uu \
+ tar/test/CMakeLists.txt
+
+
+#
+#
+# bsdcpio source, docs, etc.
+#
+#
+bsdcpio_SOURCES = cpio/cmdline.c cpio/cpio.c cpio/cpio.h \
+ cpio/cpio_platform.h $(am__append_4)
+bsdcpio_DEPENDENCIES = libarchive.la libarchive_fe.la
+@STATIC_BSDCPIO_FALSE@bsdcpio_ldstatic =
+@STATIC_BSDCPIO_TRUE@bsdcpio_ldstatic = -static
+@STATIC_BSDCPIO_FALSE@bsdcpio_ccstatic =
+@STATIC_BSDCPIO_TRUE@bsdcpio_ccstatic = -DLIBARCHIVE_STATIC
+bsdcpio_LDADD = libarchive_fe.la libarchive.la
+bsdcpio_CPPFLAGS = -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdcpio_ccstatic) $(PLATFORMCPPFLAGS)
+bsdcpio_LDFLAGS = $(bsdcpio_ldstatic)
+bsdcpio_EXTRA_DIST = \
+ cpio/test/list.h \
+ cpio/bsdcpio.1 \
+ cpio/cpio_windows.h \
+ cpio/cpio_windows.c \
+ cpio/CMakeLists.txt \
+ cpio/config_freebsd.h
+
+@BUILD_BSDCPIO_FALSE@bsdcpio_man_MANS =
+
+# Manpages to install
+@BUILD_BSDCPIO_TRUE@bsdcpio_man_MANS = cpio/bsdcpio.1
+@BUILD_BSDCPIO_FALSE@bsdcpio_programs =
+@BUILD_BSDCPIO_TRUE@bsdcpio_programs = bsdcpio
+
+#
+# bsdcpio_test
+#
+bsdcpio_test_SOURCES = \
+ cpio/cmdline.c \
+ cpio/test/main.c \
+ cpio/test/test.h \
+ cpio/test/test_0.c \
+ cpio/test/test_basic.c \
+ cpio/test/test_cmdline.c \
+ cpio/test/test_format_newc.c \
+ cpio/test/test_gcpio_compat.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_c.c \
+ cpio/test/test_option_d.c \
+ cpio/test/test_option_f.c \
+ cpio/test/test_option_help.c \
+ cpio/test/test_option_l.c \
+ cpio/test/test_option_lzma.c \
+ cpio/test/test_option_m.c \
+ cpio/test/test_option_t.c \
+ cpio/test/test_option_u.c \
+ cpio/test/test_option_version.c \
+ cpio/test/test_option_y.c \
+ cpio/test/test_option_z.c \
+ cpio/test/test_owner_parse.c \
+ cpio/test/test_passthrough_dotdot.c \
+ cpio/test/test_passthrough_reverse.c \
+ cpio/test/test_pathmatch.c
+
+bsdcpio_test_CPPFLAGS = \
+ -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \
+ -I$(top_srcdir)/cpio -I$(top_builddir)/cpio/test \
+ $(PLATFORMCPPFLAGS)
+
+bsdcpio_test_LDADD = libarchive_fe.la
+@BUILD_BSDCPIO_FALSE@bsdcpio_test_programs =
+@BUILD_BSDCPIO_TRUE@bsdcpio_test_programs = bsdcpio_test
+@BUILD_BSDCPIO_FALSE@bsdcpio_TESTS_ENVIRONMENT =
+@BUILD_BSDCPIO_TRUE@bsdcpio_TESTS_ENVIRONMENT = BSDCPIO=`cd $(top_builddir);/bin/pwd`/bsdcpio$(EXEEXT) BSDCPIO_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/cpio/test
+bsdcpio_test_EXTRA_DIST = \
+ 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_option_f.cpio.uu \
+ cpio/test/test_option_m.cpio.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
+
+all: $(BUILT_SOURCES) config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+am--refresh:
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
+ cd $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
+ else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ cd $(top_srcdir) && $(AUTOHEADER)
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+build/pkgconfig/libarchive.pc: $(top_builddir)/config.status $(top_srcdir)/build/pkgconfig/libarchive.pc.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
+install-libLTLIBRARIES: $(lib_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ if test -f $$p; then \
+ f=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ else :; fi; \
+ done
+
+uninstall-libLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p=$(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ done
+
+clean-libLTLIBRARIES:
+ -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libarchive/$(am__dirstamp):
+ @$(MKDIR_P) libarchive
+ @: > libarchive/$(am__dirstamp)
+libarchive/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) libarchive/$(DEPDIR)
+ @: > libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_check_magic.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_entry.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_entry_copy_stat.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_entry_link_resolver.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_entry_stat.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_entry_strmode.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_entry_xattr.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_data_into_fd.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_disk.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_disk_entry_from_file.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_disk_set_standard_lookup.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_extract.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_open_fd.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_open_file.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_open_filename.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_open_memory.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_compression_all.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_compression_bzip2.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_compression_compress.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_compression_gzip.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_compression_none.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_compression_program.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_compression_rpm.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_compression_uu.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_compression_xz.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_format_all.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_format_ar.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_format_cpio.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_format_empty.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_format_iso9660.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_format_mtree.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_format_raw.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_format_tar.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_format_xar.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_read_support_format_zip.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_string.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_string_sprintf.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_util.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_virtual.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_disk.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_disk_set_standard_lookup.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_open_fd.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_open_file.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_open_filename.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_open_memory.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_compression_bzip2.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_compression_compress.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_compression_gzip.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_compression_none.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_compression_program.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_compression_xz.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_format.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_format_ar.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_format_by_name.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_format_cpio.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_format_cpio_newc.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_format_mtree.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_format_pax.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_format_shar.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_format_ustar.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_write_set_format_zip.lo: \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/filter_fork.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_entry_copy_bhfi.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/archive_windows.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/filter_fork_windows.lo: libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive.la: $(libarchive_la_OBJECTS) $(libarchive_la_DEPENDENCIES)
+ $(libarchive_la_LINK) -rpath $(libdir) $(libarchive_la_OBJECTS) $(libarchive_la_LIBADD) $(LIBS)
+libarchive_fe/$(am__dirstamp):
+ @$(MKDIR_P) libarchive_fe
+ @: > libarchive_fe/$(am__dirstamp)
+libarchive_fe/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) libarchive_fe/$(DEPDIR)
+ @: > libarchive_fe/$(DEPDIR)/$(am__dirstamp)
+libarchive_fe/err.lo: libarchive_fe/$(am__dirstamp) \
+ libarchive_fe/$(DEPDIR)/$(am__dirstamp)
+libarchive_fe/line_reader.lo: libarchive_fe/$(am__dirstamp) \
+ libarchive_fe/$(DEPDIR)/$(am__dirstamp)
+libarchive_fe/matching.lo: libarchive_fe/$(am__dirstamp) \
+ libarchive_fe/$(DEPDIR)/$(am__dirstamp)
+libarchive_fe/pathmatch.lo: libarchive_fe/$(am__dirstamp) \
+ libarchive_fe/$(DEPDIR)/$(am__dirstamp)
+libarchive_fe.la: $(libarchive_fe_la_OBJECTS) $(libarchive_fe_la_DEPENDENCIES)
+ $(LINK) $(libarchive_fe_la_OBJECTS) $(libarchive_fe_la_LIBADD) $(LIBS)
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+cpio/$(am__dirstamp):
+ @$(MKDIR_P) cpio
+ @: > cpio/$(am__dirstamp)
+cpio/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) cpio/$(DEPDIR)
+ @: > cpio/$(DEPDIR)/$(am__dirstamp)
+cpio/bsdcpio-cmdline.$(OBJEXT): cpio/$(am__dirstamp) \
+ cpio/$(DEPDIR)/$(am__dirstamp)
+cpio/bsdcpio-cpio.$(OBJEXT): cpio/$(am__dirstamp) \
+ cpio/$(DEPDIR)/$(am__dirstamp)
+cpio/bsdcpio-cpio_windows.$(OBJEXT): cpio/$(am__dirstamp) \
+ cpio/$(DEPDIR)/$(am__dirstamp)
+bsdcpio$(EXEEXT): $(bsdcpio_OBJECTS) $(bsdcpio_DEPENDENCIES)
+ @rm -f bsdcpio$(EXEEXT)
+ $(bsdcpio_LINK) $(bsdcpio_OBJECTS) $(bsdcpio_LDADD) $(LIBS)
+cpio/bsdcpio_test-cmdline.$(OBJEXT): cpio/$(am__dirstamp) \
+ cpio/$(DEPDIR)/$(am__dirstamp)
+cpio/test/$(am__dirstamp):
+ @$(MKDIR_P) cpio/test
+ @: > cpio/test/$(am__dirstamp)
+cpio/test/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) cpio/test/$(DEPDIR)
+ @: > cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-main.$(OBJEXT): cpio/test/$(am__dirstamp) \
+ cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_0.$(OBJEXT): cpio/test/$(am__dirstamp) \
+ cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_basic.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_cmdline.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_format_newc.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_gcpio_compat.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_B_upper.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_C_upper.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_J_upper.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_L_upper.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_Z_upper.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_a.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_c.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_d.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_f.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_help.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_l.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_lzma.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_m.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_t.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_u.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_version.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_y.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_option_z.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_owner_parse.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_passthrough_dotdot.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_passthrough_reverse.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+cpio/test/bsdcpio_test-test_pathmatch.$(OBJEXT): \
+ cpio/test/$(am__dirstamp) cpio/test/$(DEPDIR)/$(am__dirstamp)
+bsdcpio_test$(EXEEXT): $(bsdcpio_test_OBJECTS) $(bsdcpio_test_DEPENDENCIES)
+ @rm -f bsdcpio_test$(EXEEXT)
+ $(LINK) $(bsdcpio_test_OBJECTS) $(bsdcpio_test_LDADD) $(LIBS)
+tar/$(am__dirstamp):
+ @$(MKDIR_P) tar
+ @: > tar/$(am__dirstamp)
+tar/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) tar/$(DEPDIR)
+ @: > tar/$(DEPDIR)/$(am__dirstamp)
+tar/bsdtar-bsdtar.$(OBJEXT): tar/$(am__dirstamp) \
+ tar/$(DEPDIR)/$(am__dirstamp)
+tar/bsdtar-cmdline.$(OBJEXT): tar/$(am__dirstamp) \
+ tar/$(DEPDIR)/$(am__dirstamp)
+tar/bsdtar-getdate.$(OBJEXT): tar/$(am__dirstamp) \
+ tar/$(DEPDIR)/$(am__dirstamp)
+tar/bsdtar-read.$(OBJEXT): tar/$(am__dirstamp) \
+ tar/$(DEPDIR)/$(am__dirstamp)
+tar/bsdtar-subst.$(OBJEXT): tar/$(am__dirstamp) \
+ tar/$(DEPDIR)/$(am__dirstamp)
+tar/bsdtar-tree.$(OBJEXT): tar/$(am__dirstamp) \
+ tar/$(DEPDIR)/$(am__dirstamp)
+tar/bsdtar-util.$(OBJEXT): tar/$(am__dirstamp) \
+ tar/$(DEPDIR)/$(am__dirstamp)
+tar/bsdtar-write.$(OBJEXT): tar/$(am__dirstamp) \
+ tar/$(DEPDIR)/$(am__dirstamp)
+tar/bsdtar-bsdtar_windows.$(OBJEXT): tar/$(am__dirstamp) \
+ tar/$(DEPDIR)/$(am__dirstamp)
+bsdtar$(EXEEXT): $(bsdtar_OBJECTS) $(bsdtar_DEPENDENCIES)
+ @rm -f bsdtar$(EXEEXT)
+ $(bsdtar_LINK) $(bsdtar_OBJECTS) $(bsdtar_LDADD) $(LIBS)
+tar/bsdtar_test-getdate.$(OBJEXT): tar/$(am__dirstamp) \
+ tar/$(DEPDIR)/$(am__dirstamp)
+tar/test/$(am__dirstamp):
+ @$(MKDIR_P) tar/test
+ @: > tar/test/$(am__dirstamp)
+tar/test/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) tar/test/$(DEPDIR)
+ @: > tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-main.$(OBJEXT): tar/test/$(am__dirstamp) \
+ tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_0.$(OBJEXT): tar/test/$(am__dirstamp) \
+ tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_basic.$(OBJEXT): tar/test/$(am__dirstamp) \
+ tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_copy.$(OBJEXT): tar/test/$(am__dirstamp) \
+ tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_empty_mtree.$(OBJEXT): \
+ tar/test/$(am__dirstamp) tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_getdate.$(OBJEXT): tar/test/$(am__dirstamp) \
+ tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_help.$(OBJEXT): tar/test/$(am__dirstamp) \
+ tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_option_T_upper.$(OBJEXT): \
+ tar/test/$(am__dirstamp) tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_option_q.$(OBJEXT): \
+ tar/test/$(am__dirstamp) tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_option_r.$(OBJEXT): \
+ tar/test/$(am__dirstamp) tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_option_s.$(OBJEXT): \
+ tar/test/$(am__dirstamp) tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_patterns.$(OBJEXT): \
+ tar/test/$(am__dirstamp) tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_stdio.$(OBJEXT): tar/test/$(am__dirstamp) \
+ tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_strip_components.$(OBJEXT): \
+ tar/test/$(am__dirstamp) tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_symlink_dir.$(OBJEXT): \
+ tar/test/$(am__dirstamp) tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_version.$(OBJEXT): tar/test/$(am__dirstamp) \
+ tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/test/bsdtar_test-test_windows.$(OBJEXT): tar/test/$(am__dirstamp) \
+ tar/test/$(DEPDIR)/$(am__dirstamp)
+tar/bsdtar_test-bsdtar_windows.$(OBJEXT): tar/$(am__dirstamp) \
+ tar/$(DEPDIR)/$(am__dirstamp)
+bsdtar_test$(EXEEXT): $(bsdtar_test_OBJECTS) $(bsdtar_test_DEPENDENCIES)
+ @rm -f bsdtar_test$(EXEEXT)
+ $(LINK) $(bsdtar_test_OBJECTS) $(bsdtar_test_LDADD) $(LIBS)
+libarchive/libarchive_test-archive_check_magic.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_entry.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_entry_copy_stat.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_entry_link_resolver.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_entry_stat.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_entry_strmode.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_entry_xattr.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_data_into_fd.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_disk.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_disk_entry_from_file.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_disk_set_standard_lookup.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_extract.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_open_fd.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_open_file.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_open_filename.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_open_memory.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_compression_all.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_compression_bzip2.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_compression_compress.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_compression_gzip.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_compression_none.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_compression_program.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_compression_rpm.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_compression_uu.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_compression_xz.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_format_all.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_format_ar.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_format_cpio.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_format_empty.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_format_iso9660.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_format_mtree.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_format_raw.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_format_tar.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_format_xar.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_read_support_format_zip.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_string.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_string_sprintf.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_util.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_virtual.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_disk.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_disk_set_standard_lookup.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_open_fd.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_open_file.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_open_filename.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_open_memory.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_compression_bzip2.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_compression_compress.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_compression_gzip.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_compression_none.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_compression_program.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_compression_xz.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_format.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_format_ar.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_format_by_name.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_format_cpio.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_format_cpio_newc.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_format_mtree.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_format_pax.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_format_shar.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_format_ustar.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_write_set_format_zip.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-filter_fork.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_entry_copy_bhfi.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-archive_windows.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/libarchive_test-filter_fork_windows.$(OBJEXT): \
+ libarchive/$(am__dirstamp) \
+ libarchive/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/$(am__dirstamp):
+ @$(MKDIR_P) libarchive/test
+ @: > libarchive/test/$(am__dirstamp)
+libarchive/test/$(DEPDIR)/$(am__dirstamp):
+ @$(MKDIR_P) libarchive/test/$(DEPDIR)
+ @: > libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-main.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-read_open_memory.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_acl_basic.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_acl_freebsd.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_acl_pax.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_archive_api_feature.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_bad_fd.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_compat_bzip2.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_compat_cpio.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_compat_gtar.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_compat_gzip.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_compat_lzma.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_compat_solaris_tar_acl.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_compat_tar_hardlink.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_compat_xz.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_compat_zip.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_empty_write.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_entry.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_extattr_freebsd.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_fuzz.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_entry_strmode.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_link_resolver.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_open_fd.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_open_file.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_open_filename.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_pax_filename_encoding.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_compress_program.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_data_large.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_disk.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_disk_entry_from_file.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_extract.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_file_nonexistent.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_ar.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_cpio_bin.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_cpio_bin_Z.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_cpio_bin_be.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_cpio_bin_bz2.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_cpio_bin_gz.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_cpio_bin_lzma.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_cpio_bin_xz.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_cpio_odc.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_cpio_svr4c_Z.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_empty.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_gtar_gz.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_gtar_lzma.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_gtar_sparse.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_iso_gz.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_iso_multi_extent.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_isojoliet_bz2.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_isojoliet_long.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_isojoliet_rr.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_isorr_bz2.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_isorr_ce.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_isorr_new_bz2.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_isorr_rr_moved.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_isozisofs_bz2.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_mtree.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_pax_bz2.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_raw.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_tar.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_tar_empty_filename.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_tbz.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_tgz.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_tlz.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_txz.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_tz.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_xar.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_format_zip.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_large.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_pax_truncated.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_position.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_truncated.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_read_uu.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_tar_filenames.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_tar_large.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_ustar_filenames.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_compress.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_compress_bzip2.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_compress_gzip.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_compress_lzma.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_compress_program.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_compress_xz.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_disk.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_disk_failures.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_disk_hardlink.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_disk_perms.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_disk_secure.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_disk_sparse.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_disk_symlink.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_disk_times.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_ar.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_cpio.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_cpio_empty.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_cpio_odc.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_cpio_newc.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_mtree.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_pax.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_shar_empty.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_tar.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_tar_empty.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_tar_ustar.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_zip.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_zip_empty.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_format_zip_no_compression.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive/test/libarchive_test-test_write_open_memory.$(OBJEXT): \
+ libarchive/test/$(am__dirstamp) \
+ libarchive/test/$(DEPDIR)/$(am__dirstamp)
+libarchive_test$(EXEEXT): $(libarchive_test_OBJECTS) $(libarchive_test_DEPENDENCIES)
+ @rm -f libarchive_test$(EXEEXT)
+ $(LINK) $(libarchive_test_OBJECTS) $(libarchive_test_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+ -rm -f cpio/bsdcpio-cmdline.$(OBJEXT)
+ -rm -f cpio/bsdcpio-cpio.$(OBJEXT)
+ -rm -f cpio/bsdcpio-cpio_windows.$(OBJEXT)
+ -rm -f cpio/bsdcpio_test-cmdline.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-main.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_0.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_basic.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_cmdline.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_format_newc.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_gcpio_compat.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_B_upper.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_C_upper.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_J_upper.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_L_upper.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_Z_upper.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_a.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_c.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_d.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_f.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_help.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_l.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_lzma.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_m.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_t.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_u.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_version.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_y.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_option_z.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_owner_parse.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_passthrough_dotdot.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_passthrough_reverse.$(OBJEXT)
+ -rm -f cpio/test/bsdcpio_test-test_pathmatch.$(OBJEXT)
+ -rm -f libarchive/archive_check_magic.$(OBJEXT)
+ -rm -f libarchive/archive_check_magic.lo
+ -rm -f libarchive/archive_entry.$(OBJEXT)
+ -rm -f libarchive/archive_entry.lo
+ -rm -f libarchive/archive_entry_copy_bhfi.$(OBJEXT)
+ -rm -f libarchive/archive_entry_copy_bhfi.lo
+ -rm -f libarchive/archive_entry_copy_stat.$(OBJEXT)
+ -rm -f libarchive/archive_entry_copy_stat.lo
+ -rm -f libarchive/archive_entry_link_resolver.$(OBJEXT)
+ -rm -f libarchive/archive_entry_link_resolver.lo
+ -rm -f libarchive/archive_entry_stat.$(OBJEXT)
+ -rm -f libarchive/archive_entry_stat.lo
+ -rm -f libarchive/archive_entry_strmode.$(OBJEXT)
+ -rm -f libarchive/archive_entry_strmode.lo
+ -rm -f libarchive/archive_entry_xattr.$(OBJEXT)
+ -rm -f libarchive/archive_entry_xattr.lo
+ -rm -f libarchive/archive_read.$(OBJEXT)
+ -rm -f libarchive/archive_read.lo
+ -rm -f libarchive/archive_read_data_into_fd.$(OBJEXT)
+ -rm -f libarchive/archive_read_data_into_fd.lo
+ -rm -f libarchive/archive_read_disk.$(OBJEXT)
+ -rm -f libarchive/archive_read_disk.lo
+ -rm -f libarchive/archive_read_disk_entry_from_file.$(OBJEXT)
+ -rm -f libarchive/archive_read_disk_entry_from_file.lo
+ -rm -f libarchive/archive_read_disk_set_standard_lookup.$(OBJEXT)
+ -rm -f libarchive/archive_read_disk_set_standard_lookup.lo
+ -rm -f libarchive/archive_read_extract.$(OBJEXT)
+ -rm -f libarchive/archive_read_extract.lo
+ -rm -f libarchive/archive_read_open_fd.$(OBJEXT)
+ -rm -f libarchive/archive_read_open_fd.lo
+ -rm -f libarchive/archive_read_open_file.$(OBJEXT)
+ -rm -f libarchive/archive_read_open_file.lo
+ -rm -f libarchive/archive_read_open_filename.$(OBJEXT)
+ -rm -f libarchive/archive_read_open_filename.lo
+ -rm -f libarchive/archive_read_open_memory.$(OBJEXT)
+ -rm -f libarchive/archive_read_open_memory.lo
+ -rm -f libarchive/archive_read_support_compression_all.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_compression_all.lo
+ -rm -f libarchive/archive_read_support_compression_bzip2.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_compression_bzip2.lo
+ -rm -f libarchive/archive_read_support_compression_compress.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_compression_compress.lo
+ -rm -f libarchive/archive_read_support_compression_gzip.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_compression_gzip.lo
+ -rm -f libarchive/archive_read_support_compression_none.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_compression_none.lo
+ -rm -f libarchive/archive_read_support_compression_program.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_compression_program.lo
+ -rm -f libarchive/archive_read_support_compression_rpm.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_compression_rpm.lo
+ -rm -f libarchive/archive_read_support_compression_uu.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_compression_uu.lo
+ -rm -f libarchive/archive_read_support_compression_xz.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_compression_xz.lo
+ -rm -f libarchive/archive_read_support_format_all.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_format_all.lo
+ -rm -f libarchive/archive_read_support_format_ar.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_format_ar.lo
+ -rm -f libarchive/archive_read_support_format_cpio.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_format_cpio.lo
+ -rm -f libarchive/archive_read_support_format_empty.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_format_empty.lo
+ -rm -f libarchive/archive_read_support_format_iso9660.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_format_iso9660.lo
+ -rm -f libarchive/archive_read_support_format_mtree.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_format_mtree.lo
+ -rm -f libarchive/archive_read_support_format_raw.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_format_raw.lo
+ -rm -f libarchive/archive_read_support_format_tar.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_format_tar.lo
+ -rm -f libarchive/archive_read_support_format_xar.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_format_xar.lo
+ -rm -f libarchive/archive_read_support_format_zip.$(OBJEXT)
+ -rm -f libarchive/archive_read_support_format_zip.lo
+ -rm -f libarchive/archive_string.$(OBJEXT)
+ -rm -f libarchive/archive_string.lo
+ -rm -f libarchive/archive_string_sprintf.$(OBJEXT)
+ -rm -f libarchive/archive_string_sprintf.lo
+ -rm -f libarchive/archive_util.$(OBJEXT)
+ -rm -f libarchive/archive_util.lo
+ -rm -f libarchive/archive_virtual.$(OBJEXT)
+ -rm -f libarchive/archive_virtual.lo
+ -rm -f libarchive/archive_windows.$(OBJEXT)
+ -rm -f libarchive/archive_windows.lo
+ -rm -f libarchive/archive_write.$(OBJEXT)
+ -rm -f libarchive/archive_write.lo
+ -rm -f libarchive/archive_write_disk.$(OBJEXT)
+ -rm -f libarchive/archive_write_disk.lo
+ -rm -f libarchive/archive_write_disk_set_standard_lookup.$(OBJEXT)
+ -rm -f libarchive/archive_write_disk_set_standard_lookup.lo
+ -rm -f libarchive/archive_write_open_fd.$(OBJEXT)
+ -rm -f libarchive/archive_write_open_fd.lo
+ -rm -f libarchive/archive_write_open_file.$(OBJEXT)
+ -rm -f libarchive/archive_write_open_file.lo
+ -rm -f libarchive/archive_write_open_filename.$(OBJEXT)
+ -rm -f libarchive/archive_write_open_filename.lo
+ -rm -f libarchive/archive_write_open_memory.$(OBJEXT)
+ -rm -f libarchive/archive_write_open_memory.lo
+ -rm -f libarchive/archive_write_set_compression_bzip2.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_compression_bzip2.lo
+ -rm -f libarchive/archive_write_set_compression_compress.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_compression_compress.lo
+ -rm -f libarchive/archive_write_set_compression_gzip.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_compression_gzip.lo
+ -rm -f libarchive/archive_write_set_compression_none.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_compression_none.lo
+ -rm -f libarchive/archive_write_set_compression_program.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_compression_program.lo
+ -rm -f libarchive/archive_write_set_compression_xz.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_compression_xz.lo
+ -rm -f libarchive/archive_write_set_format.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_format.lo
+ -rm -f libarchive/archive_write_set_format_ar.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_format_ar.lo
+ -rm -f libarchive/archive_write_set_format_by_name.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_format_by_name.lo
+ -rm -f libarchive/archive_write_set_format_cpio.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_format_cpio.lo
+ -rm -f libarchive/archive_write_set_format_cpio_newc.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_format_cpio_newc.lo
+ -rm -f libarchive/archive_write_set_format_mtree.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_format_mtree.lo
+ -rm -f libarchive/archive_write_set_format_pax.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_format_pax.lo
+ -rm -f libarchive/archive_write_set_format_shar.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_format_shar.lo
+ -rm -f libarchive/archive_write_set_format_ustar.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_format_ustar.lo
+ -rm -f libarchive/archive_write_set_format_zip.$(OBJEXT)
+ -rm -f libarchive/archive_write_set_format_zip.lo
+ -rm -f libarchive/filter_fork.$(OBJEXT)
+ -rm -f libarchive/filter_fork.lo
+ -rm -f libarchive/filter_fork_windows.$(OBJEXT)
+ -rm -f libarchive/filter_fork_windows.lo
+ -rm -f libarchive/libarchive_test-archive_check_magic.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_entry.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_entry_copy_bhfi.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_entry_copy_stat.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_entry_link_resolver.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_entry_stat.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_entry_strmode.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_entry_xattr.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_data_into_fd.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_disk.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_disk_entry_from_file.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_disk_set_standard_lookup.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_extract.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_open_fd.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_open_file.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_open_filename.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_open_memory.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_compression_all.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_compression_bzip2.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_compression_compress.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_compression_gzip.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_compression_none.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_compression_program.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_compression_rpm.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_compression_uu.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_compression_xz.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_format_all.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_format_ar.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_format_cpio.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_format_empty.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_format_iso9660.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_format_mtree.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_format_raw.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_format_tar.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_format_xar.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_read_support_format_zip.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_string.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_string_sprintf.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_util.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_virtual.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_windows.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_disk.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_disk_set_standard_lookup.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_open_fd.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_open_file.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_open_filename.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_open_memory.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_compression_bzip2.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_compression_compress.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_compression_gzip.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_compression_none.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_compression_program.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_compression_xz.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_format.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_format_ar.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_format_by_name.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_format_cpio.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_format_cpio_newc.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_format_mtree.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_format_pax.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_format_shar.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_format_ustar.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-archive_write_set_format_zip.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-filter_fork.$(OBJEXT)
+ -rm -f libarchive/libarchive_test-filter_fork_windows.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-main.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-read_open_memory.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_acl_basic.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_acl_freebsd.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_acl_pax.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_archive_api_feature.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_bad_fd.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_compat_bzip2.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_compat_cpio.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_compat_gtar.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_compat_gzip.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_compat_lzma.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_compat_solaris_tar_acl.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_compat_tar_hardlink.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_compat_xz.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_compat_zip.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_empty_write.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_entry.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_entry_strmode.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_extattr_freebsd.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_fuzz.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_link_resolver.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_open_fd.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_open_file.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_open_filename.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_pax_filename_encoding.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_compress_program.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_data_large.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_disk.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_disk_entry_from_file.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_extract.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_file_nonexistent.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_ar.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_cpio_bin.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_cpio_bin_Z.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_cpio_bin_be.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_cpio_bin_bz2.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_cpio_bin_gz.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_cpio_bin_lzma.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_cpio_bin_xz.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_cpio_odc.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_cpio_svr4c_Z.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_empty.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_gtar_gz.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_gtar_lzma.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_gtar_sparse.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_iso_gz.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_iso_multi_extent.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_isojoliet_bz2.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_isojoliet_long.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_isojoliet_rr.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_isorr_bz2.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_isorr_ce.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_isorr_new_bz2.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_isorr_rr_moved.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_isozisofs_bz2.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_mtree.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_pax_bz2.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_raw.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_tar.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_tar_empty_filename.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_tbz.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_tgz.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_tlz.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_txz.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_tz.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_xar.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_format_zip.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_large.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_pax_truncated.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_position.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_truncated.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_read_uu.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_tar_filenames.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_tar_large.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_ustar_filenames.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_compress.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_compress_bzip2.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_compress_gzip.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_compress_lzma.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_compress_program.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_compress_xz.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_disk.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_disk_failures.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_disk_hardlink.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_disk_perms.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_disk_secure.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_disk_sparse.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_disk_symlink.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_disk_times.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_ar.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_cpio.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_cpio_empty.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_cpio_newc.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_cpio_odc.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_mtree.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_pax.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_shar_empty.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_tar.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_tar_empty.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_tar_ustar.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_zip.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_zip_empty.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_format_zip_no_compression.$(OBJEXT)
+ -rm -f libarchive/test/libarchive_test-test_write_open_memory.$(OBJEXT)
+ -rm -f libarchive_fe/err.$(OBJEXT)
+ -rm -f libarchive_fe/err.lo
+ -rm -f libarchive_fe/line_reader.$(OBJEXT)
+ -rm -f libarchive_fe/line_reader.lo
+ -rm -f libarchive_fe/matching.$(OBJEXT)
+ -rm -f libarchive_fe/matching.lo
+ -rm -f libarchive_fe/pathmatch.$(OBJEXT)
+ -rm -f libarchive_fe/pathmatch.lo
+ -rm -f tar/bsdtar-bsdtar.$(OBJEXT)
+ -rm -f tar/bsdtar-bsdtar_windows.$(OBJEXT)
+ -rm -f tar/bsdtar-cmdline.$(OBJEXT)
+ -rm -f tar/bsdtar-getdate.$(OBJEXT)
+ -rm -f tar/bsdtar-read.$(OBJEXT)
+ -rm -f tar/bsdtar-subst.$(OBJEXT)
+ -rm -f tar/bsdtar-tree.$(OBJEXT)
+ -rm -f tar/bsdtar-util.$(OBJEXT)
+ -rm -f tar/bsdtar-write.$(OBJEXT)
+ -rm -f tar/bsdtar_test-bsdtar_windows.$(OBJEXT)
+ -rm -f tar/bsdtar_test-getdate.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-main.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_0.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_basic.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_copy.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_empty_mtree.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_getdate.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_help.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_option_T_upper.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_option_q.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_option_r.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_option_s.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_patterns.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_stdio.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_strip_components.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_symlink_dir.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_version.$(OBJEXT)
+ -rm -f tar/test/bsdtar_test-test_windows.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/$(DEPDIR)/bsdcpio-cmdline.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/$(DEPDIR)/bsdcpio-cpio.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/$(DEPDIR)/bsdcpio-cpio_windows.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/$(DEPDIR)/bsdcpio_test-cmdline.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_0.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_basic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_cmdline.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_format_newc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_gcpio_compat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_B_upper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_C_upper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_J_upper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_L_upper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_Z_upper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_a.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_c.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_d.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_f.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_help.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_l.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_lzma.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_m.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_t.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_u.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_version.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_y.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_option_z.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_owner_parse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_passthrough_dotdot.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_passthrough_reverse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@cpio/test/$(DEPDIR)/bsdcpio_test-test_pathmatch.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_check_magic.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_entry.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_entry_copy_bhfi.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_entry_copy_stat.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_entry_link_resolver.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_entry_stat.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_entry_strmode.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_entry_xattr.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_data_into_fd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_disk.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_disk_entry_from_file.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_disk_set_standard_lookup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_extract.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_open_fd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_open_file.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_open_filename.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_open_memory.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_compression_all.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_compression_bzip2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_compression_compress.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_compression_gzip.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_compression_none.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_compression_program.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_compression_rpm.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_compression_uu.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_compression_xz.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_format_all.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_format_ar.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_format_cpio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_format_empty.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_format_iso9660.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_format_mtree.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_format_raw.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_format_tar.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_format_xar.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_read_support_format_zip.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_string.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_string_sprintf.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_util.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_virtual.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_windows.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_disk.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_disk_set_standard_lookup.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_open_fd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_open_file.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_open_filename.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_open_memory.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_compression_bzip2.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_compression_compress.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_compression_gzip.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_compression_none.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_compression_program.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_compression_xz.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_ar.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_by_name.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_cpio.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_cpio_newc.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_mtree.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_pax.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_shar.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_ustar.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/archive_write_set_format_zip.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/filter_fork.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/filter_fork_windows.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_check_magic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_entry.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_bhfi.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_stat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_entry_link_resolver.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_entry_stat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_entry_strmode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_entry_xattr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_data_into_fd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_disk.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_disk_entry_from_file.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_disk_set_standard_lookup.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_extract.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_open_fd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_open_file.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_open_filename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_open_memory.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_all.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_bzip2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_compress.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_gzip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_none.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_program.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_rpm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_uu.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_xz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_all.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_ar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_cpio.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_empty.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_iso9660.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_mtree.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_raw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_tar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_xar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_zip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_string.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_string_sprintf.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_util.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_virtual.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_windows.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_disk.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_disk_set_standard_lookup.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_open_fd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_open_file.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_open_filename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_open_memory.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_bzip2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_compress.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_gzip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_none.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_program.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_xz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_ar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_by_name.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_cpio.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_cpio_newc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_mtree.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_pax.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_shar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_ustar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_zip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-filter_fork.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/$(DEPDIR)/libarchive_test-filter_fork_windows.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-read_open_memory.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_acl_basic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_acl_freebsd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_acl_pax.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_archive_api_feature.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_bad_fd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_compat_bzip2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_compat_cpio.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_compat_gtar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_compat_gzip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_compat_lzma.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_compat_solaris_tar_acl.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_compat_tar_hardlink.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_compat_xz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_compat_zip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_empty_write.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_entry.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_entry_strmode.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_extattr_freebsd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_fuzz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_link_resolver.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_open_fd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_open_file.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_open_filename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_pax_filename_encoding.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_compress_program.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_data_large.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_disk.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_disk_entry_from_file.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_extract.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_file_nonexistent.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_ar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_Z.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_be.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_bz2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_gz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_lzma.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_xz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_odc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_gzip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4c_Z.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_empty.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_gz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_lzma.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_sparse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_iso_gz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_iso_multi_extent.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_bz2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_long.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_rr.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_bz2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_ce.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_new_bz2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_rr_moved.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isozisofs_bz2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_pax_bz2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_raw.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tar_empty_filename.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tbz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tgz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tlz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_txz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_xar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_large.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_pax_truncated.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_position.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_truncated.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_read_uu.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_tar_filenames.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_tar_large.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_ustar_filenames.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_bzip2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_gzip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_lzma.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_program.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_xz.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_failures.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_hardlink.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_perms.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_sparse.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_symlink.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_times.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_ar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_empty.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_newc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_odc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_mtree.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_pax.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_shar_empty.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_empty.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_ustar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip_empty.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip_no_compression.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive/test/$(DEPDIR)/libarchive_test-test_write_open_memory.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive_fe/$(DEPDIR)/err.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive_fe/$(DEPDIR)/line_reader.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive_fe/$(DEPDIR)/matching.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@libarchive_fe/$(DEPDIR)/pathmatch.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/$(DEPDIR)/bsdtar-bsdtar.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/$(DEPDIR)/bsdtar-bsdtar_windows.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/$(DEPDIR)/bsdtar-cmdline.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/$(DEPDIR)/bsdtar-getdate.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/$(DEPDIR)/bsdtar-read.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/$(DEPDIR)/bsdtar-subst.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/$(DEPDIR)/bsdtar-tree.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/$(DEPDIR)/bsdtar-util.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/$(DEPDIR)/bsdtar-write.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/$(DEPDIR)/bsdtar_test-bsdtar_windows.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/$(DEPDIR)/bsdtar_test-getdate.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-main.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_0.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_basic.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_copy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_empty_mtree.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_getdate.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_help.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_option_T_upper.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_option_q.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_option_r.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_option_s.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_patterns.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_stdio.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_strip_components.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_symlink_dir.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_version.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@tar/test/$(DEPDIR)/bsdtar_test-test_windows.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ mv -f $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\
+@am__fastdepCC_TRUE@ mv -f $$depbase.Tpo $$depbase.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\
+@am__fastdepCC_TRUE@ mv -f $$depbase.Tpo $$depbase.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+cpio/bsdcpio-cmdline.o: cpio/cmdline.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-cmdline.o -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-cmdline.Tpo -c -o cpio/bsdcpio-cmdline.o `test -f 'cpio/cmdline.c' || echo '$(srcdir)/'`cpio/cmdline.c
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-cmdline.Tpo cpio/$(DEPDIR)/bsdcpio-cmdline.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/cmdline.c' object='cpio/bsdcpio-cmdline.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-cmdline.o `test -f 'cpio/cmdline.c' || echo '$(srcdir)/'`cpio/cmdline.c
+
+cpio/bsdcpio-cmdline.obj: cpio/cmdline.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-cmdline.obj -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-cmdline.Tpo -c -o cpio/bsdcpio-cmdline.obj `if test -f 'cpio/cmdline.c'; then $(CYGPATH_W) 'cpio/cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cpio/cmdline.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-cmdline.Tpo cpio/$(DEPDIR)/bsdcpio-cmdline.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/cmdline.c' object='cpio/bsdcpio-cmdline.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-cmdline.obj `if test -f 'cpio/cmdline.c'; then $(CYGPATH_W) 'cpio/cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cpio/cmdline.c'; fi`
+
+cpio/bsdcpio-cpio.o: cpio/cpio.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-cpio.o -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-cpio.Tpo -c -o cpio/bsdcpio-cpio.o `test -f 'cpio/cpio.c' || echo '$(srcdir)/'`cpio/cpio.c
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-cpio.Tpo cpio/$(DEPDIR)/bsdcpio-cpio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/cpio.c' object='cpio/bsdcpio-cpio.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-cpio.o `test -f 'cpio/cpio.c' || echo '$(srcdir)/'`cpio/cpio.c
+
+cpio/bsdcpio-cpio.obj: cpio/cpio.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-cpio.obj -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-cpio.Tpo -c -o cpio/bsdcpio-cpio.obj `if test -f 'cpio/cpio.c'; then $(CYGPATH_W) 'cpio/cpio.c'; else $(CYGPATH_W) '$(srcdir)/cpio/cpio.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-cpio.Tpo cpio/$(DEPDIR)/bsdcpio-cpio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/cpio.c' object='cpio/bsdcpio-cpio.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-cpio.obj `if test -f 'cpio/cpio.c'; then $(CYGPATH_W) 'cpio/cpio.c'; else $(CYGPATH_W) '$(srcdir)/cpio/cpio.c'; fi`
+
+cpio/bsdcpio-cpio_windows.o: cpio/cpio_windows.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-cpio_windows.o -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-cpio_windows.Tpo -c -o cpio/bsdcpio-cpio_windows.o `test -f 'cpio/cpio_windows.c' || echo '$(srcdir)/'`cpio/cpio_windows.c
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-cpio_windows.Tpo cpio/$(DEPDIR)/bsdcpio-cpio_windows.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/cpio_windows.c' object='cpio/bsdcpio-cpio_windows.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-cpio_windows.o `test -f 'cpio/cpio_windows.c' || echo '$(srcdir)/'`cpio/cpio_windows.c
+
+cpio/bsdcpio-cpio_windows.obj: cpio/cpio_windows.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio-cpio_windows.obj -MD -MP -MF cpio/$(DEPDIR)/bsdcpio-cpio_windows.Tpo -c -o cpio/bsdcpio-cpio_windows.obj `if test -f 'cpio/cpio_windows.c'; then $(CYGPATH_W) 'cpio/cpio_windows.c'; else $(CYGPATH_W) '$(srcdir)/cpio/cpio_windows.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio-cpio_windows.Tpo cpio/$(DEPDIR)/bsdcpio-cpio_windows.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/cpio_windows.c' object='cpio/bsdcpio-cpio_windows.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio-cpio_windows.obj `if test -f 'cpio/cpio_windows.c'; then $(CYGPATH_W) 'cpio/cpio_windows.c'; else $(CYGPATH_W) '$(srcdir)/cpio/cpio_windows.c'; fi`
+
+cpio/bsdcpio_test-cmdline.o: cpio/cmdline.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio_test-cmdline.o -MD -MP -MF cpio/$(DEPDIR)/bsdcpio_test-cmdline.Tpo -c -o cpio/bsdcpio_test-cmdline.o `test -f 'cpio/cmdline.c' || echo '$(srcdir)/'`cpio/cmdline.c
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio_test-cmdline.Tpo cpio/$(DEPDIR)/bsdcpio_test-cmdline.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/cmdline.c' object='cpio/bsdcpio_test-cmdline.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio_test-cmdline.o `test -f 'cpio/cmdline.c' || echo '$(srcdir)/'`cpio/cmdline.c
+
+cpio/bsdcpio_test-cmdline.obj: cpio/cmdline.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/bsdcpio_test-cmdline.obj -MD -MP -MF cpio/$(DEPDIR)/bsdcpio_test-cmdline.Tpo -c -o cpio/bsdcpio_test-cmdline.obj `if test -f 'cpio/cmdline.c'; then $(CYGPATH_W) 'cpio/cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cpio/cmdline.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/$(DEPDIR)/bsdcpio_test-cmdline.Tpo cpio/$(DEPDIR)/bsdcpio_test-cmdline.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/cmdline.c' object='cpio/bsdcpio_test-cmdline.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/bsdcpio_test-cmdline.obj `if test -f 'cpio/cmdline.c'; then $(CYGPATH_W) 'cpio/cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cpio/cmdline.c'; fi`
+
+cpio/test/bsdcpio_test-main.o: cpio/test/main.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-main.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-main.Tpo -c -o cpio/test/bsdcpio_test-main.o `test -f 'cpio/test/main.c' || echo '$(srcdir)/'`cpio/test/main.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-main.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/main.c' object='cpio/test/bsdcpio_test-main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-main.o `test -f 'cpio/test/main.c' || echo '$(srcdir)/'`cpio/test/main.c
+
+cpio/test/bsdcpio_test-main.obj: cpio/test/main.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-main.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-main.Tpo -c -o cpio/test/bsdcpio_test-main.obj `if test -f 'cpio/test/main.c'; then $(CYGPATH_W) 'cpio/test/main.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/main.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-main.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/main.c' object='cpio/test/bsdcpio_test-main.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-main.obj `if test -f 'cpio/test/main.c'; then $(CYGPATH_W) 'cpio/test/main.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/main.c'; fi`
+
+cpio/test/bsdcpio_test-test_0.o: cpio/test/test_0.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_0.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_0.Tpo -c -o cpio/test/bsdcpio_test-test_0.o `test -f 'cpio/test/test_0.c' || echo '$(srcdir)/'`cpio/test/test_0.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_0.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_0.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_0.c' object='cpio/test/bsdcpio_test-test_0.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_0.o `test -f 'cpio/test/test_0.c' || echo '$(srcdir)/'`cpio/test/test_0.c
+
+cpio/test/bsdcpio_test-test_0.obj: cpio/test/test_0.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_0.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_0.Tpo -c -o cpio/test/bsdcpio_test-test_0.obj `if test -f 'cpio/test/test_0.c'; then $(CYGPATH_W) 'cpio/test/test_0.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_0.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_0.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_0.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_0.c' object='cpio/test/bsdcpio_test-test_0.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_0.obj `if test -f 'cpio/test/test_0.c'; then $(CYGPATH_W) 'cpio/test/test_0.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_0.c'; fi`
+
+cpio/test/bsdcpio_test-test_basic.o: cpio/test/test_basic.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_basic.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_basic.Tpo -c -o cpio/test/bsdcpio_test-test_basic.o `test -f 'cpio/test/test_basic.c' || echo '$(srcdir)/'`cpio/test/test_basic.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_basic.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_basic.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_basic.c' object='cpio/test/bsdcpio_test-test_basic.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_basic.o `test -f 'cpio/test/test_basic.c' || echo '$(srcdir)/'`cpio/test/test_basic.c
+
+cpio/test/bsdcpio_test-test_basic.obj: cpio/test/test_basic.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_basic.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_basic.Tpo -c -o cpio/test/bsdcpio_test-test_basic.obj `if test -f 'cpio/test/test_basic.c'; then $(CYGPATH_W) 'cpio/test/test_basic.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_basic.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_basic.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_basic.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_basic.c' object='cpio/test/bsdcpio_test-test_basic.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_basic.obj `if test -f 'cpio/test/test_basic.c'; then $(CYGPATH_W) 'cpio/test/test_basic.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_basic.c'; fi`
+
+cpio/test/bsdcpio_test-test_cmdline.o: cpio/test/test_cmdline.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_cmdline.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_cmdline.Tpo -c -o cpio/test/bsdcpio_test-test_cmdline.o `test -f 'cpio/test/test_cmdline.c' || echo '$(srcdir)/'`cpio/test/test_cmdline.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_cmdline.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_cmdline.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_cmdline.c' object='cpio/test/bsdcpio_test-test_cmdline.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_cmdline.o `test -f 'cpio/test/test_cmdline.c' || echo '$(srcdir)/'`cpio/test/test_cmdline.c
+
+cpio/test/bsdcpio_test-test_cmdline.obj: cpio/test/test_cmdline.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_cmdline.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_cmdline.Tpo -c -o cpio/test/bsdcpio_test-test_cmdline.obj `if test -f 'cpio/test/test_cmdline.c'; then $(CYGPATH_W) 'cpio/test/test_cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_cmdline.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_cmdline.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_cmdline.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_cmdline.c' object='cpio/test/bsdcpio_test-test_cmdline.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_cmdline.obj `if test -f 'cpio/test/test_cmdline.c'; then $(CYGPATH_W) 'cpio/test/test_cmdline.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_cmdline.c'; fi`
+
+cpio/test/bsdcpio_test-test_format_newc.o: cpio/test/test_format_newc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_format_newc.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_format_newc.Tpo -c -o cpio/test/bsdcpio_test-test_format_newc.o `test -f 'cpio/test/test_format_newc.c' || echo '$(srcdir)/'`cpio/test/test_format_newc.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_format_newc.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_format_newc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_format_newc.c' object='cpio/test/bsdcpio_test-test_format_newc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_format_newc.o `test -f 'cpio/test/test_format_newc.c' || echo '$(srcdir)/'`cpio/test/test_format_newc.c
+
+cpio/test/bsdcpio_test-test_format_newc.obj: cpio/test/test_format_newc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_format_newc.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_format_newc.Tpo -c -o cpio/test/bsdcpio_test-test_format_newc.obj `if test -f 'cpio/test/test_format_newc.c'; then $(CYGPATH_W) 'cpio/test/test_format_newc.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_format_newc.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_format_newc.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_format_newc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_format_newc.c' object='cpio/test/bsdcpio_test-test_format_newc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_format_newc.obj `if test -f 'cpio/test/test_format_newc.c'; then $(CYGPATH_W) 'cpio/test/test_format_newc.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_format_newc.c'; fi`
+
+cpio/test/bsdcpio_test-test_gcpio_compat.o: cpio/test/test_gcpio_compat.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_gcpio_compat.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_gcpio_compat.Tpo -c -o cpio/test/bsdcpio_test-test_gcpio_compat.o `test -f 'cpio/test/test_gcpio_compat.c' || echo '$(srcdir)/'`cpio/test/test_gcpio_compat.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_gcpio_compat.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_gcpio_compat.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_gcpio_compat.c' object='cpio/test/bsdcpio_test-test_gcpio_compat.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_gcpio_compat.o `test -f 'cpio/test/test_gcpio_compat.c' || echo '$(srcdir)/'`cpio/test/test_gcpio_compat.c
+
+cpio/test/bsdcpio_test-test_gcpio_compat.obj: cpio/test/test_gcpio_compat.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_gcpio_compat.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_gcpio_compat.Tpo -c -o cpio/test/bsdcpio_test-test_gcpio_compat.obj `if test -f 'cpio/test/test_gcpio_compat.c'; then $(CYGPATH_W) 'cpio/test/test_gcpio_compat.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_gcpio_compat.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_gcpio_compat.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_gcpio_compat.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_gcpio_compat.c' object='cpio/test/bsdcpio_test-test_gcpio_compat.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_gcpio_compat.obj `if test -f 'cpio/test/test_gcpio_compat.c'; then $(CYGPATH_W) 'cpio/test/test_gcpio_compat.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_gcpio_compat.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_B_upper.o: cpio/test/test_option_B_upper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_B_upper.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_B_upper.Tpo -c -o cpio/test/bsdcpio_test-test_option_B_upper.o `test -f 'cpio/test/test_option_B_upper.c' || echo '$(srcdir)/'`cpio/test/test_option_B_upper.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_B_upper.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_B_upper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_B_upper.c' object='cpio/test/bsdcpio_test-test_option_B_upper.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_B_upper.o `test -f 'cpio/test/test_option_B_upper.c' || echo '$(srcdir)/'`cpio/test/test_option_B_upper.c
+
+cpio/test/bsdcpio_test-test_option_B_upper.obj: cpio/test/test_option_B_upper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_B_upper.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_B_upper.Tpo -c -o cpio/test/bsdcpio_test-test_option_B_upper.obj `if test -f 'cpio/test/test_option_B_upper.c'; then $(CYGPATH_W) 'cpio/test/test_option_B_upper.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_B_upper.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_B_upper.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_B_upper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_B_upper.c' object='cpio/test/bsdcpio_test-test_option_B_upper.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_B_upper.obj `if test -f 'cpio/test/test_option_B_upper.c'; then $(CYGPATH_W) 'cpio/test/test_option_B_upper.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_B_upper.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_C_upper.o: cpio/test/test_option_C_upper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_C_upper.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_C_upper.Tpo -c -o cpio/test/bsdcpio_test-test_option_C_upper.o `test -f 'cpio/test/test_option_C_upper.c' || echo '$(srcdir)/'`cpio/test/test_option_C_upper.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_C_upper.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_C_upper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_C_upper.c' object='cpio/test/bsdcpio_test-test_option_C_upper.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_C_upper.o `test -f 'cpio/test/test_option_C_upper.c' || echo '$(srcdir)/'`cpio/test/test_option_C_upper.c
+
+cpio/test/bsdcpio_test-test_option_C_upper.obj: cpio/test/test_option_C_upper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_C_upper.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_C_upper.Tpo -c -o cpio/test/bsdcpio_test-test_option_C_upper.obj `if test -f 'cpio/test/test_option_C_upper.c'; then $(CYGPATH_W) 'cpio/test/test_option_C_upper.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_C_upper.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_C_upper.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_C_upper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_C_upper.c' object='cpio/test/bsdcpio_test-test_option_C_upper.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_C_upper.obj `if test -f 'cpio/test/test_option_C_upper.c'; then $(CYGPATH_W) 'cpio/test/test_option_C_upper.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_C_upper.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_J_upper.o: cpio/test/test_option_J_upper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_J_upper.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_J_upper.Tpo -c -o cpio/test/bsdcpio_test-test_option_J_upper.o `test -f 'cpio/test/test_option_J_upper.c' || echo '$(srcdir)/'`cpio/test/test_option_J_upper.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_J_upper.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_J_upper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_J_upper.c' object='cpio/test/bsdcpio_test-test_option_J_upper.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_J_upper.o `test -f 'cpio/test/test_option_J_upper.c' || echo '$(srcdir)/'`cpio/test/test_option_J_upper.c
+
+cpio/test/bsdcpio_test-test_option_J_upper.obj: cpio/test/test_option_J_upper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_J_upper.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_J_upper.Tpo -c -o cpio/test/bsdcpio_test-test_option_J_upper.obj `if test -f 'cpio/test/test_option_J_upper.c'; then $(CYGPATH_W) 'cpio/test/test_option_J_upper.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_J_upper.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_J_upper.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_J_upper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_J_upper.c' object='cpio/test/bsdcpio_test-test_option_J_upper.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_J_upper.obj `if test -f 'cpio/test/test_option_J_upper.c'; then $(CYGPATH_W) 'cpio/test/test_option_J_upper.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_J_upper.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_L_upper.o: cpio/test/test_option_L_upper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_L_upper.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_L_upper.Tpo -c -o cpio/test/bsdcpio_test-test_option_L_upper.o `test -f 'cpio/test/test_option_L_upper.c' || echo '$(srcdir)/'`cpio/test/test_option_L_upper.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_L_upper.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_L_upper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_L_upper.c' object='cpio/test/bsdcpio_test-test_option_L_upper.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_L_upper.o `test -f 'cpio/test/test_option_L_upper.c' || echo '$(srcdir)/'`cpio/test/test_option_L_upper.c
+
+cpio/test/bsdcpio_test-test_option_L_upper.obj: cpio/test/test_option_L_upper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_L_upper.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_L_upper.Tpo -c -o cpio/test/bsdcpio_test-test_option_L_upper.obj `if test -f 'cpio/test/test_option_L_upper.c'; then $(CYGPATH_W) 'cpio/test/test_option_L_upper.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_L_upper.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_L_upper.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_L_upper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_L_upper.c' object='cpio/test/bsdcpio_test-test_option_L_upper.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_L_upper.obj `if test -f 'cpio/test/test_option_L_upper.c'; then $(CYGPATH_W) 'cpio/test/test_option_L_upper.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_L_upper.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_Z_upper.o: cpio/test/test_option_Z_upper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_Z_upper.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_Z_upper.Tpo -c -o cpio/test/bsdcpio_test-test_option_Z_upper.o `test -f 'cpio/test/test_option_Z_upper.c' || echo '$(srcdir)/'`cpio/test/test_option_Z_upper.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_Z_upper.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_Z_upper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_Z_upper.c' object='cpio/test/bsdcpio_test-test_option_Z_upper.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_Z_upper.o `test -f 'cpio/test/test_option_Z_upper.c' || echo '$(srcdir)/'`cpio/test/test_option_Z_upper.c
+
+cpio/test/bsdcpio_test-test_option_Z_upper.obj: cpio/test/test_option_Z_upper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_Z_upper.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_Z_upper.Tpo -c -o cpio/test/bsdcpio_test-test_option_Z_upper.obj `if test -f 'cpio/test/test_option_Z_upper.c'; then $(CYGPATH_W) 'cpio/test/test_option_Z_upper.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_Z_upper.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_Z_upper.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_Z_upper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_Z_upper.c' object='cpio/test/bsdcpio_test-test_option_Z_upper.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_Z_upper.obj `if test -f 'cpio/test/test_option_Z_upper.c'; then $(CYGPATH_W) 'cpio/test/test_option_Z_upper.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_Z_upper.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_a.o: cpio/test/test_option_a.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_a.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_a.Tpo -c -o cpio/test/bsdcpio_test-test_option_a.o `test -f 'cpio/test/test_option_a.c' || echo '$(srcdir)/'`cpio/test/test_option_a.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_a.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_a.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_a.c' object='cpio/test/bsdcpio_test-test_option_a.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_a.o `test -f 'cpio/test/test_option_a.c' || echo '$(srcdir)/'`cpio/test/test_option_a.c
+
+cpio/test/bsdcpio_test-test_option_a.obj: cpio/test/test_option_a.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_a.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_a.Tpo -c -o cpio/test/bsdcpio_test-test_option_a.obj `if test -f 'cpio/test/test_option_a.c'; then $(CYGPATH_W) 'cpio/test/test_option_a.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_a.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_a.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_a.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_a.c' object='cpio/test/bsdcpio_test-test_option_a.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_a.obj `if test -f 'cpio/test/test_option_a.c'; then $(CYGPATH_W) 'cpio/test/test_option_a.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_a.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_c.o: cpio/test/test_option_c.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_c.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_c.Tpo -c -o cpio/test/bsdcpio_test-test_option_c.o `test -f 'cpio/test/test_option_c.c' || echo '$(srcdir)/'`cpio/test/test_option_c.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_c.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_c.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_c.c' object='cpio/test/bsdcpio_test-test_option_c.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_c.o `test -f 'cpio/test/test_option_c.c' || echo '$(srcdir)/'`cpio/test/test_option_c.c
+
+cpio/test/bsdcpio_test-test_option_c.obj: cpio/test/test_option_c.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_c.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_c.Tpo -c -o cpio/test/bsdcpio_test-test_option_c.obj `if test -f 'cpio/test/test_option_c.c'; then $(CYGPATH_W) 'cpio/test/test_option_c.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_c.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_c.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_c.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_c.c' object='cpio/test/bsdcpio_test-test_option_c.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_c.obj `if test -f 'cpio/test/test_option_c.c'; then $(CYGPATH_W) 'cpio/test/test_option_c.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_c.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_d.o: cpio/test/test_option_d.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_d.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_d.Tpo -c -o cpio/test/bsdcpio_test-test_option_d.o `test -f 'cpio/test/test_option_d.c' || echo '$(srcdir)/'`cpio/test/test_option_d.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_d.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_d.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_d.c' object='cpio/test/bsdcpio_test-test_option_d.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_d.o `test -f 'cpio/test/test_option_d.c' || echo '$(srcdir)/'`cpio/test/test_option_d.c
+
+cpio/test/bsdcpio_test-test_option_d.obj: cpio/test/test_option_d.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_d.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_d.Tpo -c -o cpio/test/bsdcpio_test-test_option_d.obj `if test -f 'cpio/test/test_option_d.c'; then $(CYGPATH_W) 'cpio/test/test_option_d.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_d.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_d.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_d.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_d.c' object='cpio/test/bsdcpio_test-test_option_d.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_d.obj `if test -f 'cpio/test/test_option_d.c'; then $(CYGPATH_W) 'cpio/test/test_option_d.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_d.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_f.o: cpio/test/test_option_f.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_f.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_f.Tpo -c -o cpio/test/bsdcpio_test-test_option_f.o `test -f 'cpio/test/test_option_f.c' || echo '$(srcdir)/'`cpio/test/test_option_f.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_f.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_f.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_f.c' object='cpio/test/bsdcpio_test-test_option_f.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_f.o `test -f 'cpio/test/test_option_f.c' || echo '$(srcdir)/'`cpio/test/test_option_f.c
+
+cpio/test/bsdcpio_test-test_option_f.obj: cpio/test/test_option_f.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_f.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_f.Tpo -c -o cpio/test/bsdcpio_test-test_option_f.obj `if test -f 'cpio/test/test_option_f.c'; then $(CYGPATH_W) 'cpio/test/test_option_f.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_f.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_f.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_f.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_f.c' object='cpio/test/bsdcpio_test-test_option_f.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_f.obj `if test -f 'cpio/test/test_option_f.c'; then $(CYGPATH_W) 'cpio/test/test_option_f.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_f.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_help.o: cpio/test/test_option_help.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_help.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_help.Tpo -c -o cpio/test/bsdcpio_test-test_option_help.o `test -f 'cpio/test/test_option_help.c' || echo '$(srcdir)/'`cpio/test/test_option_help.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_help.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_help.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_help.c' object='cpio/test/bsdcpio_test-test_option_help.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_help.o `test -f 'cpio/test/test_option_help.c' || echo '$(srcdir)/'`cpio/test/test_option_help.c
+
+cpio/test/bsdcpio_test-test_option_help.obj: cpio/test/test_option_help.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_help.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_help.Tpo -c -o cpio/test/bsdcpio_test-test_option_help.obj `if test -f 'cpio/test/test_option_help.c'; then $(CYGPATH_W) 'cpio/test/test_option_help.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_help.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_help.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_help.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_help.c' object='cpio/test/bsdcpio_test-test_option_help.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_help.obj `if test -f 'cpio/test/test_option_help.c'; then $(CYGPATH_W) 'cpio/test/test_option_help.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_help.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_l.o: cpio/test/test_option_l.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_l.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_l.Tpo -c -o cpio/test/bsdcpio_test-test_option_l.o `test -f 'cpio/test/test_option_l.c' || echo '$(srcdir)/'`cpio/test/test_option_l.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_l.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_l.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_l.c' object='cpio/test/bsdcpio_test-test_option_l.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_l.o `test -f 'cpio/test/test_option_l.c' || echo '$(srcdir)/'`cpio/test/test_option_l.c
+
+cpio/test/bsdcpio_test-test_option_l.obj: cpio/test/test_option_l.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_l.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_l.Tpo -c -o cpio/test/bsdcpio_test-test_option_l.obj `if test -f 'cpio/test/test_option_l.c'; then $(CYGPATH_W) 'cpio/test/test_option_l.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_l.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_l.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_l.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_l.c' object='cpio/test/bsdcpio_test-test_option_l.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_l.obj `if test -f 'cpio/test/test_option_l.c'; then $(CYGPATH_W) 'cpio/test/test_option_l.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_l.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_lzma.o: cpio/test/test_option_lzma.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_lzma.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_lzma.Tpo -c -o cpio/test/bsdcpio_test-test_option_lzma.o `test -f 'cpio/test/test_option_lzma.c' || echo '$(srcdir)/'`cpio/test/test_option_lzma.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_lzma.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_lzma.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_lzma.c' object='cpio/test/bsdcpio_test-test_option_lzma.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_lzma.o `test -f 'cpio/test/test_option_lzma.c' || echo '$(srcdir)/'`cpio/test/test_option_lzma.c
+
+cpio/test/bsdcpio_test-test_option_lzma.obj: cpio/test/test_option_lzma.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_lzma.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_lzma.Tpo -c -o cpio/test/bsdcpio_test-test_option_lzma.obj `if test -f 'cpio/test/test_option_lzma.c'; then $(CYGPATH_W) 'cpio/test/test_option_lzma.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_lzma.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_lzma.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_lzma.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_lzma.c' object='cpio/test/bsdcpio_test-test_option_lzma.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_lzma.obj `if test -f 'cpio/test/test_option_lzma.c'; then $(CYGPATH_W) 'cpio/test/test_option_lzma.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_lzma.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_m.o: cpio/test/test_option_m.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_m.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_m.Tpo -c -o cpio/test/bsdcpio_test-test_option_m.o `test -f 'cpio/test/test_option_m.c' || echo '$(srcdir)/'`cpio/test/test_option_m.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_m.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_m.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_m.c' object='cpio/test/bsdcpio_test-test_option_m.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_m.o `test -f 'cpio/test/test_option_m.c' || echo '$(srcdir)/'`cpio/test/test_option_m.c
+
+cpio/test/bsdcpio_test-test_option_m.obj: cpio/test/test_option_m.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_m.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_m.Tpo -c -o cpio/test/bsdcpio_test-test_option_m.obj `if test -f 'cpio/test/test_option_m.c'; then $(CYGPATH_W) 'cpio/test/test_option_m.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_m.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_m.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_m.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_m.c' object='cpio/test/bsdcpio_test-test_option_m.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_m.obj `if test -f 'cpio/test/test_option_m.c'; then $(CYGPATH_W) 'cpio/test/test_option_m.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_m.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_t.o: cpio/test/test_option_t.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_t.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_t.Tpo -c -o cpio/test/bsdcpio_test-test_option_t.o `test -f 'cpio/test/test_option_t.c' || echo '$(srcdir)/'`cpio/test/test_option_t.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_t.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_t.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_t.c' object='cpio/test/bsdcpio_test-test_option_t.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_t.o `test -f 'cpio/test/test_option_t.c' || echo '$(srcdir)/'`cpio/test/test_option_t.c
+
+cpio/test/bsdcpio_test-test_option_t.obj: cpio/test/test_option_t.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_t.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_t.Tpo -c -o cpio/test/bsdcpio_test-test_option_t.obj `if test -f 'cpio/test/test_option_t.c'; then $(CYGPATH_W) 'cpio/test/test_option_t.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_t.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_t.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_t.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_t.c' object='cpio/test/bsdcpio_test-test_option_t.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_t.obj `if test -f 'cpio/test/test_option_t.c'; then $(CYGPATH_W) 'cpio/test/test_option_t.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_t.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_u.o: cpio/test/test_option_u.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_u.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_u.Tpo -c -o cpio/test/bsdcpio_test-test_option_u.o `test -f 'cpio/test/test_option_u.c' || echo '$(srcdir)/'`cpio/test/test_option_u.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_u.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_u.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_u.c' object='cpio/test/bsdcpio_test-test_option_u.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_u.o `test -f 'cpio/test/test_option_u.c' || echo '$(srcdir)/'`cpio/test/test_option_u.c
+
+cpio/test/bsdcpio_test-test_option_u.obj: cpio/test/test_option_u.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_u.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_u.Tpo -c -o cpio/test/bsdcpio_test-test_option_u.obj `if test -f 'cpio/test/test_option_u.c'; then $(CYGPATH_W) 'cpio/test/test_option_u.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_u.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_u.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_u.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_u.c' object='cpio/test/bsdcpio_test-test_option_u.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_u.obj `if test -f 'cpio/test/test_option_u.c'; then $(CYGPATH_W) 'cpio/test/test_option_u.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_u.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_version.o: cpio/test/test_option_version.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_version.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_version.Tpo -c -o cpio/test/bsdcpio_test-test_option_version.o `test -f 'cpio/test/test_option_version.c' || echo '$(srcdir)/'`cpio/test/test_option_version.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_version.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_version.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_version.c' object='cpio/test/bsdcpio_test-test_option_version.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_version.o `test -f 'cpio/test/test_option_version.c' || echo '$(srcdir)/'`cpio/test/test_option_version.c
+
+cpio/test/bsdcpio_test-test_option_version.obj: cpio/test/test_option_version.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_version.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_version.Tpo -c -o cpio/test/bsdcpio_test-test_option_version.obj `if test -f 'cpio/test/test_option_version.c'; then $(CYGPATH_W) 'cpio/test/test_option_version.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_version.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_version.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_version.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_version.c' object='cpio/test/bsdcpio_test-test_option_version.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_version.obj `if test -f 'cpio/test/test_option_version.c'; then $(CYGPATH_W) 'cpio/test/test_option_version.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_version.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_y.o: cpio/test/test_option_y.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_y.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_y.Tpo -c -o cpio/test/bsdcpio_test-test_option_y.o `test -f 'cpio/test/test_option_y.c' || echo '$(srcdir)/'`cpio/test/test_option_y.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_y.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_y.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_y.c' object='cpio/test/bsdcpio_test-test_option_y.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_y.o `test -f 'cpio/test/test_option_y.c' || echo '$(srcdir)/'`cpio/test/test_option_y.c
+
+cpio/test/bsdcpio_test-test_option_y.obj: cpio/test/test_option_y.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_y.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_y.Tpo -c -o cpio/test/bsdcpio_test-test_option_y.obj `if test -f 'cpio/test/test_option_y.c'; then $(CYGPATH_W) 'cpio/test/test_option_y.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_y.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_y.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_y.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_y.c' object='cpio/test/bsdcpio_test-test_option_y.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_y.obj `if test -f 'cpio/test/test_option_y.c'; then $(CYGPATH_W) 'cpio/test/test_option_y.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_y.c'; fi`
+
+cpio/test/bsdcpio_test-test_option_z.o: cpio/test/test_option_z.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_z.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_z.Tpo -c -o cpio/test/bsdcpio_test-test_option_z.o `test -f 'cpio/test/test_option_z.c' || echo '$(srcdir)/'`cpio/test/test_option_z.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_z.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_z.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_z.c' object='cpio/test/bsdcpio_test-test_option_z.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_z.o `test -f 'cpio/test/test_option_z.c' || echo '$(srcdir)/'`cpio/test/test_option_z.c
+
+cpio/test/bsdcpio_test-test_option_z.obj: cpio/test/test_option_z.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_option_z.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_option_z.Tpo -c -o cpio/test/bsdcpio_test-test_option_z.obj `if test -f 'cpio/test/test_option_z.c'; then $(CYGPATH_W) 'cpio/test/test_option_z.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_z.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_option_z.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_option_z.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_option_z.c' object='cpio/test/bsdcpio_test-test_option_z.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_option_z.obj `if test -f 'cpio/test/test_option_z.c'; then $(CYGPATH_W) 'cpio/test/test_option_z.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_option_z.c'; fi`
+
+cpio/test/bsdcpio_test-test_owner_parse.o: cpio/test/test_owner_parse.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_owner_parse.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_owner_parse.Tpo -c -o cpio/test/bsdcpio_test-test_owner_parse.o `test -f 'cpio/test/test_owner_parse.c' || echo '$(srcdir)/'`cpio/test/test_owner_parse.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_owner_parse.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_owner_parse.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_owner_parse.c' object='cpio/test/bsdcpio_test-test_owner_parse.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_owner_parse.o `test -f 'cpio/test/test_owner_parse.c' || echo '$(srcdir)/'`cpio/test/test_owner_parse.c
+
+cpio/test/bsdcpio_test-test_owner_parse.obj: cpio/test/test_owner_parse.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_owner_parse.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_owner_parse.Tpo -c -o cpio/test/bsdcpio_test-test_owner_parse.obj `if test -f 'cpio/test/test_owner_parse.c'; then $(CYGPATH_W) 'cpio/test/test_owner_parse.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_owner_parse.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_owner_parse.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_owner_parse.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_owner_parse.c' object='cpio/test/bsdcpio_test-test_owner_parse.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_owner_parse.obj `if test -f 'cpio/test/test_owner_parse.c'; then $(CYGPATH_W) 'cpio/test/test_owner_parse.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_owner_parse.c'; fi`
+
+cpio/test/bsdcpio_test-test_passthrough_dotdot.o: cpio/test/test_passthrough_dotdot.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_passthrough_dotdot.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_passthrough_dotdot.Tpo -c -o cpio/test/bsdcpio_test-test_passthrough_dotdot.o `test -f 'cpio/test/test_passthrough_dotdot.c' || echo '$(srcdir)/'`cpio/test/test_passthrough_dotdot.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_passthrough_dotdot.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_passthrough_dotdot.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_passthrough_dotdot.c' object='cpio/test/bsdcpio_test-test_passthrough_dotdot.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_passthrough_dotdot.o `test -f 'cpio/test/test_passthrough_dotdot.c' || echo '$(srcdir)/'`cpio/test/test_passthrough_dotdot.c
+
+cpio/test/bsdcpio_test-test_passthrough_dotdot.obj: cpio/test/test_passthrough_dotdot.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_passthrough_dotdot.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_passthrough_dotdot.Tpo -c -o cpio/test/bsdcpio_test-test_passthrough_dotdot.obj `if test -f 'cpio/test/test_passthrough_dotdot.c'; then $(CYGPATH_W) 'cpio/test/test_passthrough_dotdot.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_passthrough_dotdot.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_passthrough_dotdot.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_passthrough_dotdot.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_passthrough_dotdot.c' object='cpio/test/bsdcpio_test-test_passthrough_dotdot.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_passthrough_dotdot.obj `if test -f 'cpio/test/test_passthrough_dotdot.c'; then $(CYGPATH_W) 'cpio/test/test_passthrough_dotdot.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_passthrough_dotdot.c'; fi`
+
+cpio/test/bsdcpio_test-test_passthrough_reverse.o: cpio/test/test_passthrough_reverse.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_passthrough_reverse.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_passthrough_reverse.Tpo -c -o cpio/test/bsdcpio_test-test_passthrough_reverse.o `test -f 'cpio/test/test_passthrough_reverse.c' || echo '$(srcdir)/'`cpio/test/test_passthrough_reverse.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_passthrough_reverse.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_passthrough_reverse.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_passthrough_reverse.c' object='cpio/test/bsdcpio_test-test_passthrough_reverse.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_passthrough_reverse.o `test -f 'cpio/test/test_passthrough_reverse.c' || echo '$(srcdir)/'`cpio/test/test_passthrough_reverse.c
+
+cpio/test/bsdcpio_test-test_passthrough_reverse.obj: cpio/test/test_passthrough_reverse.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_passthrough_reverse.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_passthrough_reverse.Tpo -c -o cpio/test/bsdcpio_test-test_passthrough_reverse.obj `if test -f 'cpio/test/test_passthrough_reverse.c'; then $(CYGPATH_W) 'cpio/test/test_passthrough_reverse.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_passthrough_reverse.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_passthrough_reverse.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_passthrough_reverse.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_passthrough_reverse.c' object='cpio/test/bsdcpio_test-test_passthrough_reverse.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_passthrough_reverse.obj `if test -f 'cpio/test/test_passthrough_reverse.c'; then $(CYGPATH_W) 'cpio/test/test_passthrough_reverse.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_passthrough_reverse.c'; fi`
+
+cpio/test/bsdcpio_test-test_pathmatch.o: cpio/test/test_pathmatch.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_pathmatch.o -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_pathmatch.Tpo -c -o cpio/test/bsdcpio_test-test_pathmatch.o `test -f 'cpio/test/test_pathmatch.c' || echo '$(srcdir)/'`cpio/test/test_pathmatch.c
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_pathmatch.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_pathmatch.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_pathmatch.c' object='cpio/test/bsdcpio_test-test_pathmatch.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_pathmatch.o `test -f 'cpio/test/test_pathmatch.c' || echo '$(srcdir)/'`cpio/test/test_pathmatch.c
+
+cpio/test/bsdcpio_test-test_pathmatch.obj: cpio/test/test_pathmatch.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT cpio/test/bsdcpio_test-test_pathmatch.obj -MD -MP -MF cpio/test/$(DEPDIR)/bsdcpio_test-test_pathmatch.Tpo -c -o cpio/test/bsdcpio_test-test_pathmatch.obj `if test -f 'cpio/test/test_pathmatch.c'; then $(CYGPATH_W) 'cpio/test/test_pathmatch.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_pathmatch.c'; fi`
+@am__fastdepCC_TRUE@ mv -f cpio/test/$(DEPDIR)/bsdcpio_test-test_pathmatch.Tpo cpio/test/$(DEPDIR)/bsdcpio_test-test_pathmatch.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cpio/test/test_pathmatch.c' object='cpio/test/bsdcpio_test-test_pathmatch.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdcpio_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cpio/test/bsdcpio_test-test_pathmatch.obj `if test -f 'cpio/test/test_pathmatch.c'; then $(CYGPATH_W) 'cpio/test/test_pathmatch.c'; else $(CYGPATH_W) '$(srcdir)/cpio/test/test_pathmatch.c'; fi`
+
+tar/bsdtar-bsdtar.o: tar/bsdtar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-bsdtar.o -MD -MP -MF tar/$(DEPDIR)/bsdtar-bsdtar.Tpo -c -o tar/bsdtar-bsdtar.o `test -f 'tar/bsdtar.c' || echo '$(srcdir)/'`tar/bsdtar.c
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-bsdtar.Tpo tar/$(DEPDIR)/bsdtar-bsdtar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/bsdtar.c' object='tar/bsdtar-bsdtar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-bsdtar.o `test -f 'tar/bsdtar.c' || echo '$(srcdir)/'`tar/bsdtar.c
+
+tar/bsdtar-bsdtar.obj: tar/bsdtar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-bsdtar.obj -MD -MP -MF tar/$(DEPDIR)/bsdtar-bsdtar.Tpo -c -o tar/bsdtar-bsdtar.obj `if test -f 'tar/bsdtar.c'; then $(CYGPATH_W) 'tar/bsdtar.c'; else $(CYGPATH_W) '$(srcdir)/tar/bsdtar.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-bsdtar.Tpo tar/$(DEPDIR)/bsdtar-bsdtar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/bsdtar.c' object='tar/bsdtar-bsdtar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-bsdtar.obj `if test -f 'tar/bsdtar.c'; then $(CYGPATH_W) 'tar/bsdtar.c'; else $(CYGPATH_W) '$(srcdir)/tar/bsdtar.c'; fi`
+
+tar/bsdtar-cmdline.o: tar/cmdline.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-cmdline.o -MD -MP -MF tar/$(DEPDIR)/bsdtar-cmdline.Tpo -c -o tar/bsdtar-cmdline.o `test -f 'tar/cmdline.c' || echo '$(srcdir)/'`tar/cmdline.c
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-cmdline.Tpo tar/$(DEPDIR)/bsdtar-cmdline.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/cmdline.c' object='tar/bsdtar-cmdline.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-cmdline.o `test -f 'tar/cmdline.c' || echo '$(srcdir)/'`tar/cmdline.c
+
+tar/bsdtar-cmdline.obj: tar/cmdline.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-cmdline.obj -MD -MP -MF tar/$(DEPDIR)/bsdtar-cmdline.Tpo -c -o tar/bsdtar-cmdline.obj `if test -f 'tar/cmdline.c'; then $(CYGPATH_W) 'tar/cmdline.c'; else $(CYGPATH_W) '$(srcdir)/tar/cmdline.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-cmdline.Tpo tar/$(DEPDIR)/bsdtar-cmdline.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/cmdline.c' object='tar/bsdtar-cmdline.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-cmdline.obj `if test -f 'tar/cmdline.c'; then $(CYGPATH_W) 'tar/cmdline.c'; else $(CYGPATH_W) '$(srcdir)/tar/cmdline.c'; fi`
+
+tar/bsdtar-getdate.o: tar/getdate.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-getdate.o -MD -MP -MF tar/$(DEPDIR)/bsdtar-getdate.Tpo -c -o tar/bsdtar-getdate.o `test -f 'tar/getdate.c' || echo '$(srcdir)/'`tar/getdate.c
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-getdate.Tpo tar/$(DEPDIR)/bsdtar-getdate.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/getdate.c' object='tar/bsdtar-getdate.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-getdate.o `test -f 'tar/getdate.c' || echo '$(srcdir)/'`tar/getdate.c
+
+tar/bsdtar-getdate.obj: tar/getdate.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-getdate.obj -MD -MP -MF tar/$(DEPDIR)/bsdtar-getdate.Tpo -c -o tar/bsdtar-getdate.obj `if test -f 'tar/getdate.c'; then $(CYGPATH_W) 'tar/getdate.c'; else $(CYGPATH_W) '$(srcdir)/tar/getdate.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-getdate.Tpo tar/$(DEPDIR)/bsdtar-getdate.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/getdate.c' object='tar/bsdtar-getdate.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-getdate.obj `if test -f 'tar/getdate.c'; then $(CYGPATH_W) 'tar/getdate.c'; else $(CYGPATH_W) '$(srcdir)/tar/getdate.c'; fi`
+
+tar/bsdtar-read.o: tar/read.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-read.o -MD -MP -MF tar/$(DEPDIR)/bsdtar-read.Tpo -c -o tar/bsdtar-read.o `test -f 'tar/read.c' || echo '$(srcdir)/'`tar/read.c
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-read.Tpo tar/$(DEPDIR)/bsdtar-read.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/read.c' object='tar/bsdtar-read.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-read.o `test -f 'tar/read.c' || echo '$(srcdir)/'`tar/read.c
+
+tar/bsdtar-read.obj: tar/read.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-read.obj -MD -MP -MF tar/$(DEPDIR)/bsdtar-read.Tpo -c -o tar/bsdtar-read.obj `if test -f 'tar/read.c'; then $(CYGPATH_W) 'tar/read.c'; else $(CYGPATH_W) '$(srcdir)/tar/read.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-read.Tpo tar/$(DEPDIR)/bsdtar-read.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/read.c' object='tar/bsdtar-read.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-read.obj `if test -f 'tar/read.c'; then $(CYGPATH_W) 'tar/read.c'; else $(CYGPATH_W) '$(srcdir)/tar/read.c'; fi`
+
+tar/bsdtar-subst.o: tar/subst.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-subst.o -MD -MP -MF tar/$(DEPDIR)/bsdtar-subst.Tpo -c -o tar/bsdtar-subst.o `test -f 'tar/subst.c' || echo '$(srcdir)/'`tar/subst.c
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-subst.Tpo tar/$(DEPDIR)/bsdtar-subst.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/subst.c' object='tar/bsdtar-subst.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-subst.o `test -f 'tar/subst.c' || echo '$(srcdir)/'`tar/subst.c
+
+tar/bsdtar-subst.obj: tar/subst.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-subst.obj -MD -MP -MF tar/$(DEPDIR)/bsdtar-subst.Tpo -c -o tar/bsdtar-subst.obj `if test -f 'tar/subst.c'; then $(CYGPATH_W) 'tar/subst.c'; else $(CYGPATH_W) '$(srcdir)/tar/subst.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-subst.Tpo tar/$(DEPDIR)/bsdtar-subst.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/subst.c' object='tar/bsdtar-subst.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-subst.obj `if test -f 'tar/subst.c'; then $(CYGPATH_W) 'tar/subst.c'; else $(CYGPATH_W) '$(srcdir)/tar/subst.c'; fi`
+
+tar/bsdtar-tree.o: tar/tree.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-tree.o -MD -MP -MF tar/$(DEPDIR)/bsdtar-tree.Tpo -c -o tar/bsdtar-tree.o `test -f 'tar/tree.c' || echo '$(srcdir)/'`tar/tree.c
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-tree.Tpo tar/$(DEPDIR)/bsdtar-tree.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/tree.c' object='tar/bsdtar-tree.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-tree.o `test -f 'tar/tree.c' || echo '$(srcdir)/'`tar/tree.c
+
+tar/bsdtar-tree.obj: tar/tree.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-tree.obj -MD -MP -MF tar/$(DEPDIR)/bsdtar-tree.Tpo -c -o tar/bsdtar-tree.obj `if test -f 'tar/tree.c'; then $(CYGPATH_W) 'tar/tree.c'; else $(CYGPATH_W) '$(srcdir)/tar/tree.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-tree.Tpo tar/$(DEPDIR)/bsdtar-tree.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/tree.c' object='tar/bsdtar-tree.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-tree.obj `if test -f 'tar/tree.c'; then $(CYGPATH_W) 'tar/tree.c'; else $(CYGPATH_W) '$(srcdir)/tar/tree.c'; fi`
+
+tar/bsdtar-util.o: tar/util.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-util.o -MD -MP -MF tar/$(DEPDIR)/bsdtar-util.Tpo -c -o tar/bsdtar-util.o `test -f 'tar/util.c' || echo '$(srcdir)/'`tar/util.c
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-util.Tpo tar/$(DEPDIR)/bsdtar-util.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/util.c' object='tar/bsdtar-util.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-util.o `test -f 'tar/util.c' || echo '$(srcdir)/'`tar/util.c
+
+tar/bsdtar-util.obj: tar/util.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-util.obj -MD -MP -MF tar/$(DEPDIR)/bsdtar-util.Tpo -c -o tar/bsdtar-util.obj `if test -f 'tar/util.c'; then $(CYGPATH_W) 'tar/util.c'; else $(CYGPATH_W) '$(srcdir)/tar/util.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-util.Tpo tar/$(DEPDIR)/bsdtar-util.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/util.c' object='tar/bsdtar-util.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-util.obj `if test -f 'tar/util.c'; then $(CYGPATH_W) 'tar/util.c'; else $(CYGPATH_W) '$(srcdir)/tar/util.c'; fi`
+
+tar/bsdtar-write.o: tar/write.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-write.o -MD -MP -MF tar/$(DEPDIR)/bsdtar-write.Tpo -c -o tar/bsdtar-write.o `test -f 'tar/write.c' || echo '$(srcdir)/'`tar/write.c
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-write.Tpo tar/$(DEPDIR)/bsdtar-write.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/write.c' object='tar/bsdtar-write.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-write.o `test -f 'tar/write.c' || echo '$(srcdir)/'`tar/write.c
+
+tar/bsdtar-write.obj: tar/write.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-write.obj -MD -MP -MF tar/$(DEPDIR)/bsdtar-write.Tpo -c -o tar/bsdtar-write.obj `if test -f 'tar/write.c'; then $(CYGPATH_W) 'tar/write.c'; else $(CYGPATH_W) '$(srcdir)/tar/write.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-write.Tpo tar/$(DEPDIR)/bsdtar-write.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/write.c' object='tar/bsdtar-write.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-write.obj `if test -f 'tar/write.c'; then $(CYGPATH_W) 'tar/write.c'; else $(CYGPATH_W) '$(srcdir)/tar/write.c'; fi`
+
+tar/bsdtar-bsdtar_windows.o: tar/bsdtar_windows.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-bsdtar_windows.o -MD -MP -MF tar/$(DEPDIR)/bsdtar-bsdtar_windows.Tpo -c -o tar/bsdtar-bsdtar_windows.o `test -f 'tar/bsdtar_windows.c' || echo '$(srcdir)/'`tar/bsdtar_windows.c
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-bsdtar_windows.Tpo tar/$(DEPDIR)/bsdtar-bsdtar_windows.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/bsdtar_windows.c' object='tar/bsdtar-bsdtar_windows.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-bsdtar_windows.o `test -f 'tar/bsdtar_windows.c' || echo '$(srcdir)/'`tar/bsdtar_windows.c
+
+tar/bsdtar-bsdtar_windows.obj: tar/bsdtar_windows.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar-bsdtar_windows.obj -MD -MP -MF tar/$(DEPDIR)/bsdtar-bsdtar_windows.Tpo -c -o tar/bsdtar-bsdtar_windows.obj `if test -f 'tar/bsdtar_windows.c'; then $(CYGPATH_W) 'tar/bsdtar_windows.c'; else $(CYGPATH_W) '$(srcdir)/tar/bsdtar_windows.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar-bsdtar_windows.Tpo tar/$(DEPDIR)/bsdtar-bsdtar_windows.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/bsdtar_windows.c' object='tar/bsdtar-bsdtar_windows.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar-bsdtar_windows.obj `if test -f 'tar/bsdtar_windows.c'; then $(CYGPATH_W) 'tar/bsdtar_windows.c'; else $(CYGPATH_W) '$(srcdir)/tar/bsdtar_windows.c'; fi`
+
+tar/bsdtar_test-getdate.o: tar/getdate.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar_test-getdate.o -MD -MP -MF tar/$(DEPDIR)/bsdtar_test-getdate.Tpo -c -o tar/bsdtar_test-getdate.o `test -f 'tar/getdate.c' || echo '$(srcdir)/'`tar/getdate.c
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar_test-getdate.Tpo tar/$(DEPDIR)/bsdtar_test-getdate.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/getdate.c' object='tar/bsdtar_test-getdate.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar_test-getdate.o `test -f 'tar/getdate.c' || echo '$(srcdir)/'`tar/getdate.c
+
+tar/bsdtar_test-getdate.obj: tar/getdate.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar_test-getdate.obj -MD -MP -MF tar/$(DEPDIR)/bsdtar_test-getdate.Tpo -c -o tar/bsdtar_test-getdate.obj `if test -f 'tar/getdate.c'; then $(CYGPATH_W) 'tar/getdate.c'; else $(CYGPATH_W) '$(srcdir)/tar/getdate.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar_test-getdate.Tpo tar/$(DEPDIR)/bsdtar_test-getdate.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/getdate.c' object='tar/bsdtar_test-getdate.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar_test-getdate.obj `if test -f 'tar/getdate.c'; then $(CYGPATH_W) 'tar/getdate.c'; else $(CYGPATH_W) '$(srcdir)/tar/getdate.c'; fi`
+
+tar/test/bsdtar_test-main.o: tar/test/main.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-main.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-main.Tpo -c -o tar/test/bsdtar_test-main.o `test -f 'tar/test/main.c' || echo '$(srcdir)/'`tar/test/main.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-main.Tpo tar/test/$(DEPDIR)/bsdtar_test-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/main.c' object='tar/test/bsdtar_test-main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-main.o `test -f 'tar/test/main.c' || echo '$(srcdir)/'`tar/test/main.c
+
+tar/test/bsdtar_test-main.obj: tar/test/main.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-main.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-main.Tpo -c -o tar/test/bsdtar_test-main.obj `if test -f 'tar/test/main.c'; then $(CYGPATH_W) 'tar/test/main.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/main.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-main.Tpo tar/test/$(DEPDIR)/bsdtar_test-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/main.c' object='tar/test/bsdtar_test-main.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-main.obj `if test -f 'tar/test/main.c'; then $(CYGPATH_W) 'tar/test/main.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/main.c'; fi`
+
+tar/test/bsdtar_test-test_0.o: tar/test/test_0.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_0.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_0.Tpo -c -o tar/test/bsdtar_test-test_0.o `test -f 'tar/test/test_0.c' || echo '$(srcdir)/'`tar/test/test_0.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_0.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_0.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_0.c' object='tar/test/bsdtar_test-test_0.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_0.o `test -f 'tar/test/test_0.c' || echo '$(srcdir)/'`tar/test/test_0.c
+
+tar/test/bsdtar_test-test_0.obj: tar/test/test_0.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_0.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_0.Tpo -c -o tar/test/bsdtar_test-test_0.obj `if test -f 'tar/test/test_0.c'; then $(CYGPATH_W) 'tar/test/test_0.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_0.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_0.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_0.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_0.c' object='tar/test/bsdtar_test-test_0.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_0.obj `if test -f 'tar/test/test_0.c'; then $(CYGPATH_W) 'tar/test/test_0.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_0.c'; fi`
+
+tar/test/bsdtar_test-test_basic.o: tar/test/test_basic.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_basic.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_basic.Tpo -c -o tar/test/bsdtar_test-test_basic.o `test -f 'tar/test/test_basic.c' || echo '$(srcdir)/'`tar/test/test_basic.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_basic.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_basic.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_basic.c' object='tar/test/bsdtar_test-test_basic.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_basic.o `test -f 'tar/test/test_basic.c' || echo '$(srcdir)/'`tar/test/test_basic.c
+
+tar/test/bsdtar_test-test_basic.obj: tar/test/test_basic.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_basic.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_basic.Tpo -c -o tar/test/bsdtar_test-test_basic.obj `if test -f 'tar/test/test_basic.c'; then $(CYGPATH_W) 'tar/test/test_basic.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_basic.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_basic.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_basic.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_basic.c' object='tar/test/bsdtar_test-test_basic.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_basic.obj `if test -f 'tar/test/test_basic.c'; then $(CYGPATH_W) 'tar/test/test_basic.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_basic.c'; fi`
+
+tar/test/bsdtar_test-test_copy.o: tar/test/test_copy.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_copy.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_copy.Tpo -c -o tar/test/bsdtar_test-test_copy.o `test -f 'tar/test/test_copy.c' || echo '$(srcdir)/'`tar/test/test_copy.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_copy.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_copy.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_copy.c' object='tar/test/bsdtar_test-test_copy.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_copy.o `test -f 'tar/test/test_copy.c' || echo '$(srcdir)/'`tar/test/test_copy.c
+
+tar/test/bsdtar_test-test_copy.obj: tar/test/test_copy.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_copy.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_copy.Tpo -c -o tar/test/bsdtar_test-test_copy.obj `if test -f 'tar/test/test_copy.c'; then $(CYGPATH_W) 'tar/test/test_copy.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_copy.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_copy.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_copy.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_copy.c' object='tar/test/bsdtar_test-test_copy.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_copy.obj `if test -f 'tar/test/test_copy.c'; then $(CYGPATH_W) 'tar/test/test_copy.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_copy.c'; fi`
+
+tar/test/bsdtar_test-test_empty_mtree.o: tar/test/test_empty_mtree.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_empty_mtree.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_empty_mtree.Tpo -c -o tar/test/bsdtar_test-test_empty_mtree.o `test -f 'tar/test/test_empty_mtree.c' || echo '$(srcdir)/'`tar/test/test_empty_mtree.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_empty_mtree.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_empty_mtree.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_empty_mtree.c' object='tar/test/bsdtar_test-test_empty_mtree.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_empty_mtree.o `test -f 'tar/test/test_empty_mtree.c' || echo '$(srcdir)/'`tar/test/test_empty_mtree.c
+
+tar/test/bsdtar_test-test_empty_mtree.obj: tar/test/test_empty_mtree.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_empty_mtree.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_empty_mtree.Tpo -c -o tar/test/bsdtar_test-test_empty_mtree.obj `if test -f 'tar/test/test_empty_mtree.c'; then $(CYGPATH_W) 'tar/test/test_empty_mtree.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_empty_mtree.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_empty_mtree.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_empty_mtree.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_empty_mtree.c' object='tar/test/bsdtar_test-test_empty_mtree.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_empty_mtree.obj `if test -f 'tar/test/test_empty_mtree.c'; then $(CYGPATH_W) 'tar/test/test_empty_mtree.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_empty_mtree.c'; fi`
+
+tar/test/bsdtar_test-test_getdate.o: tar/test/test_getdate.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_getdate.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_getdate.Tpo -c -o tar/test/bsdtar_test-test_getdate.o `test -f 'tar/test/test_getdate.c' || echo '$(srcdir)/'`tar/test/test_getdate.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_getdate.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_getdate.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_getdate.c' object='tar/test/bsdtar_test-test_getdate.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_getdate.o `test -f 'tar/test/test_getdate.c' || echo '$(srcdir)/'`tar/test/test_getdate.c
+
+tar/test/bsdtar_test-test_getdate.obj: tar/test/test_getdate.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_getdate.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_getdate.Tpo -c -o tar/test/bsdtar_test-test_getdate.obj `if test -f 'tar/test/test_getdate.c'; then $(CYGPATH_W) 'tar/test/test_getdate.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_getdate.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_getdate.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_getdate.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_getdate.c' object='tar/test/bsdtar_test-test_getdate.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_getdate.obj `if test -f 'tar/test/test_getdate.c'; then $(CYGPATH_W) 'tar/test/test_getdate.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_getdate.c'; fi`
+
+tar/test/bsdtar_test-test_help.o: tar/test/test_help.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_help.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_help.Tpo -c -o tar/test/bsdtar_test-test_help.o `test -f 'tar/test/test_help.c' || echo '$(srcdir)/'`tar/test/test_help.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_help.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_help.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_help.c' object='tar/test/bsdtar_test-test_help.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_help.o `test -f 'tar/test/test_help.c' || echo '$(srcdir)/'`tar/test/test_help.c
+
+tar/test/bsdtar_test-test_help.obj: tar/test/test_help.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_help.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_help.Tpo -c -o tar/test/bsdtar_test-test_help.obj `if test -f 'tar/test/test_help.c'; then $(CYGPATH_W) 'tar/test/test_help.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_help.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_help.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_help.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_help.c' object='tar/test/bsdtar_test-test_help.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_help.obj `if test -f 'tar/test/test_help.c'; then $(CYGPATH_W) 'tar/test/test_help.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_help.c'; fi`
+
+tar/test/bsdtar_test-test_option_T_upper.o: tar/test/test_option_T_upper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_option_T_upper.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_option_T_upper.Tpo -c -o tar/test/bsdtar_test-test_option_T_upper.o `test -f 'tar/test/test_option_T_upper.c' || echo '$(srcdir)/'`tar/test/test_option_T_upper.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_option_T_upper.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_option_T_upper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_option_T_upper.c' object='tar/test/bsdtar_test-test_option_T_upper.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_option_T_upper.o `test -f 'tar/test/test_option_T_upper.c' || echo '$(srcdir)/'`tar/test/test_option_T_upper.c
+
+tar/test/bsdtar_test-test_option_T_upper.obj: tar/test/test_option_T_upper.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_option_T_upper.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_option_T_upper.Tpo -c -o tar/test/bsdtar_test-test_option_T_upper.obj `if test -f 'tar/test/test_option_T_upper.c'; then $(CYGPATH_W) 'tar/test/test_option_T_upper.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_option_T_upper.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_option_T_upper.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_option_T_upper.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_option_T_upper.c' object='tar/test/bsdtar_test-test_option_T_upper.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_option_T_upper.obj `if test -f 'tar/test/test_option_T_upper.c'; then $(CYGPATH_W) 'tar/test/test_option_T_upper.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_option_T_upper.c'; fi`
+
+tar/test/bsdtar_test-test_option_q.o: tar/test/test_option_q.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_option_q.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_option_q.Tpo -c -o tar/test/bsdtar_test-test_option_q.o `test -f 'tar/test/test_option_q.c' || echo '$(srcdir)/'`tar/test/test_option_q.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_option_q.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_option_q.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_option_q.c' object='tar/test/bsdtar_test-test_option_q.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_option_q.o `test -f 'tar/test/test_option_q.c' || echo '$(srcdir)/'`tar/test/test_option_q.c
+
+tar/test/bsdtar_test-test_option_q.obj: tar/test/test_option_q.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_option_q.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_option_q.Tpo -c -o tar/test/bsdtar_test-test_option_q.obj `if test -f 'tar/test/test_option_q.c'; then $(CYGPATH_W) 'tar/test/test_option_q.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_option_q.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_option_q.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_option_q.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_option_q.c' object='tar/test/bsdtar_test-test_option_q.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_option_q.obj `if test -f 'tar/test/test_option_q.c'; then $(CYGPATH_W) 'tar/test/test_option_q.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_option_q.c'; fi`
+
+tar/test/bsdtar_test-test_option_r.o: tar/test/test_option_r.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_option_r.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_option_r.Tpo -c -o tar/test/bsdtar_test-test_option_r.o `test -f 'tar/test/test_option_r.c' || echo '$(srcdir)/'`tar/test/test_option_r.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_option_r.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_option_r.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_option_r.c' object='tar/test/bsdtar_test-test_option_r.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_option_r.o `test -f 'tar/test/test_option_r.c' || echo '$(srcdir)/'`tar/test/test_option_r.c
+
+tar/test/bsdtar_test-test_option_r.obj: tar/test/test_option_r.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_option_r.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_option_r.Tpo -c -o tar/test/bsdtar_test-test_option_r.obj `if test -f 'tar/test/test_option_r.c'; then $(CYGPATH_W) 'tar/test/test_option_r.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_option_r.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_option_r.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_option_r.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_option_r.c' object='tar/test/bsdtar_test-test_option_r.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_option_r.obj `if test -f 'tar/test/test_option_r.c'; then $(CYGPATH_W) 'tar/test/test_option_r.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_option_r.c'; fi`
+
+tar/test/bsdtar_test-test_option_s.o: tar/test/test_option_s.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_option_s.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_option_s.Tpo -c -o tar/test/bsdtar_test-test_option_s.o `test -f 'tar/test/test_option_s.c' || echo '$(srcdir)/'`tar/test/test_option_s.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_option_s.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_option_s.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_option_s.c' object='tar/test/bsdtar_test-test_option_s.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_option_s.o `test -f 'tar/test/test_option_s.c' || echo '$(srcdir)/'`tar/test/test_option_s.c
+
+tar/test/bsdtar_test-test_option_s.obj: tar/test/test_option_s.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_option_s.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_option_s.Tpo -c -o tar/test/bsdtar_test-test_option_s.obj `if test -f 'tar/test/test_option_s.c'; then $(CYGPATH_W) 'tar/test/test_option_s.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_option_s.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_option_s.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_option_s.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_option_s.c' object='tar/test/bsdtar_test-test_option_s.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_option_s.obj `if test -f 'tar/test/test_option_s.c'; then $(CYGPATH_W) 'tar/test/test_option_s.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_option_s.c'; fi`
+
+tar/test/bsdtar_test-test_patterns.o: tar/test/test_patterns.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_patterns.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_patterns.Tpo -c -o tar/test/bsdtar_test-test_patterns.o `test -f 'tar/test/test_patterns.c' || echo '$(srcdir)/'`tar/test/test_patterns.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_patterns.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_patterns.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_patterns.c' object='tar/test/bsdtar_test-test_patterns.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_patterns.o `test -f 'tar/test/test_patterns.c' || echo '$(srcdir)/'`tar/test/test_patterns.c
+
+tar/test/bsdtar_test-test_patterns.obj: tar/test/test_patterns.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_patterns.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_patterns.Tpo -c -o tar/test/bsdtar_test-test_patterns.obj `if test -f 'tar/test/test_patterns.c'; then $(CYGPATH_W) 'tar/test/test_patterns.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_patterns.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_patterns.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_patterns.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_patterns.c' object='tar/test/bsdtar_test-test_patterns.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_patterns.obj `if test -f 'tar/test/test_patterns.c'; then $(CYGPATH_W) 'tar/test/test_patterns.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_patterns.c'; fi`
+
+tar/test/bsdtar_test-test_stdio.o: tar/test/test_stdio.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_stdio.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_stdio.Tpo -c -o tar/test/bsdtar_test-test_stdio.o `test -f 'tar/test/test_stdio.c' || echo '$(srcdir)/'`tar/test/test_stdio.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_stdio.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_stdio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_stdio.c' object='tar/test/bsdtar_test-test_stdio.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_stdio.o `test -f 'tar/test/test_stdio.c' || echo '$(srcdir)/'`tar/test/test_stdio.c
+
+tar/test/bsdtar_test-test_stdio.obj: tar/test/test_stdio.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_stdio.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_stdio.Tpo -c -o tar/test/bsdtar_test-test_stdio.obj `if test -f 'tar/test/test_stdio.c'; then $(CYGPATH_W) 'tar/test/test_stdio.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_stdio.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_stdio.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_stdio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_stdio.c' object='tar/test/bsdtar_test-test_stdio.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_stdio.obj `if test -f 'tar/test/test_stdio.c'; then $(CYGPATH_W) 'tar/test/test_stdio.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_stdio.c'; fi`
+
+tar/test/bsdtar_test-test_strip_components.o: tar/test/test_strip_components.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_strip_components.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_strip_components.Tpo -c -o tar/test/bsdtar_test-test_strip_components.o `test -f 'tar/test/test_strip_components.c' || echo '$(srcdir)/'`tar/test/test_strip_components.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_strip_components.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_strip_components.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_strip_components.c' object='tar/test/bsdtar_test-test_strip_components.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_strip_components.o `test -f 'tar/test/test_strip_components.c' || echo '$(srcdir)/'`tar/test/test_strip_components.c
+
+tar/test/bsdtar_test-test_strip_components.obj: tar/test/test_strip_components.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_strip_components.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_strip_components.Tpo -c -o tar/test/bsdtar_test-test_strip_components.obj `if test -f 'tar/test/test_strip_components.c'; then $(CYGPATH_W) 'tar/test/test_strip_components.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_strip_components.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_strip_components.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_strip_components.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_strip_components.c' object='tar/test/bsdtar_test-test_strip_components.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_strip_components.obj `if test -f 'tar/test/test_strip_components.c'; then $(CYGPATH_W) 'tar/test/test_strip_components.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_strip_components.c'; fi`
+
+tar/test/bsdtar_test-test_symlink_dir.o: tar/test/test_symlink_dir.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_symlink_dir.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_symlink_dir.Tpo -c -o tar/test/bsdtar_test-test_symlink_dir.o `test -f 'tar/test/test_symlink_dir.c' || echo '$(srcdir)/'`tar/test/test_symlink_dir.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_symlink_dir.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_symlink_dir.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_symlink_dir.c' object='tar/test/bsdtar_test-test_symlink_dir.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_symlink_dir.o `test -f 'tar/test/test_symlink_dir.c' || echo '$(srcdir)/'`tar/test/test_symlink_dir.c
+
+tar/test/bsdtar_test-test_symlink_dir.obj: tar/test/test_symlink_dir.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_symlink_dir.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_symlink_dir.Tpo -c -o tar/test/bsdtar_test-test_symlink_dir.obj `if test -f 'tar/test/test_symlink_dir.c'; then $(CYGPATH_W) 'tar/test/test_symlink_dir.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_symlink_dir.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_symlink_dir.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_symlink_dir.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_symlink_dir.c' object='tar/test/bsdtar_test-test_symlink_dir.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_symlink_dir.obj `if test -f 'tar/test/test_symlink_dir.c'; then $(CYGPATH_W) 'tar/test/test_symlink_dir.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_symlink_dir.c'; fi`
+
+tar/test/bsdtar_test-test_version.o: tar/test/test_version.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_version.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_version.Tpo -c -o tar/test/bsdtar_test-test_version.o `test -f 'tar/test/test_version.c' || echo '$(srcdir)/'`tar/test/test_version.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_version.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_version.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_version.c' object='tar/test/bsdtar_test-test_version.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_version.o `test -f 'tar/test/test_version.c' || echo '$(srcdir)/'`tar/test/test_version.c
+
+tar/test/bsdtar_test-test_version.obj: tar/test/test_version.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_version.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_version.Tpo -c -o tar/test/bsdtar_test-test_version.obj `if test -f 'tar/test/test_version.c'; then $(CYGPATH_W) 'tar/test/test_version.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_version.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_version.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_version.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_version.c' object='tar/test/bsdtar_test-test_version.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_version.obj `if test -f 'tar/test/test_version.c'; then $(CYGPATH_W) 'tar/test/test_version.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_version.c'; fi`
+
+tar/test/bsdtar_test-test_windows.o: tar/test/test_windows.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_windows.o -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_windows.Tpo -c -o tar/test/bsdtar_test-test_windows.o `test -f 'tar/test/test_windows.c' || echo '$(srcdir)/'`tar/test/test_windows.c
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_windows.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_windows.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_windows.c' object='tar/test/bsdtar_test-test_windows.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_windows.o `test -f 'tar/test/test_windows.c' || echo '$(srcdir)/'`tar/test/test_windows.c
+
+tar/test/bsdtar_test-test_windows.obj: tar/test/test_windows.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/test/bsdtar_test-test_windows.obj -MD -MP -MF tar/test/$(DEPDIR)/bsdtar_test-test_windows.Tpo -c -o tar/test/bsdtar_test-test_windows.obj `if test -f 'tar/test/test_windows.c'; then $(CYGPATH_W) 'tar/test/test_windows.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_windows.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/test/$(DEPDIR)/bsdtar_test-test_windows.Tpo tar/test/$(DEPDIR)/bsdtar_test-test_windows.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/test/test_windows.c' object='tar/test/bsdtar_test-test_windows.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/test/bsdtar_test-test_windows.obj `if test -f 'tar/test/test_windows.c'; then $(CYGPATH_W) 'tar/test/test_windows.c'; else $(CYGPATH_W) '$(srcdir)/tar/test/test_windows.c'; fi`
+
+tar/bsdtar_test-bsdtar_windows.o: tar/bsdtar_windows.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar_test-bsdtar_windows.o -MD -MP -MF tar/$(DEPDIR)/bsdtar_test-bsdtar_windows.Tpo -c -o tar/bsdtar_test-bsdtar_windows.o `test -f 'tar/bsdtar_windows.c' || echo '$(srcdir)/'`tar/bsdtar_windows.c
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar_test-bsdtar_windows.Tpo tar/$(DEPDIR)/bsdtar_test-bsdtar_windows.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/bsdtar_windows.c' object='tar/bsdtar_test-bsdtar_windows.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar_test-bsdtar_windows.o `test -f 'tar/bsdtar_windows.c' || echo '$(srcdir)/'`tar/bsdtar_windows.c
+
+tar/bsdtar_test-bsdtar_windows.obj: tar/bsdtar_windows.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tar/bsdtar_test-bsdtar_windows.obj -MD -MP -MF tar/$(DEPDIR)/bsdtar_test-bsdtar_windows.Tpo -c -o tar/bsdtar_test-bsdtar_windows.obj `if test -f 'tar/bsdtar_windows.c'; then $(CYGPATH_W) 'tar/bsdtar_windows.c'; else $(CYGPATH_W) '$(srcdir)/tar/bsdtar_windows.c'; fi`
+@am__fastdepCC_TRUE@ mv -f tar/$(DEPDIR)/bsdtar_test-bsdtar_windows.Tpo tar/$(DEPDIR)/bsdtar_test-bsdtar_windows.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='tar/bsdtar_windows.c' object='tar/bsdtar_test-bsdtar_windows.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bsdtar_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tar/bsdtar_test-bsdtar_windows.obj `if test -f 'tar/bsdtar_windows.c'; then $(CYGPATH_W) 'tar/bsdtar_windows.c'; else $(CYGPATH_W) '$(srcdir)/tar/bsdtar_windows.c'; fi`
+
+libarchive/libarchive_test-archive_check_magic.o: libarchive/archive_check_magic.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_check_magic.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_check_magic.Tpo -c -o libarchive/libarchive_test-archive_check_magic.o `test -f 'libarchive/archive_check_magic.c' || echo '$(srcdir)/'`libarchive/archive_check_magic.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_check_magic.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_check_magic.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_check_magic.c' object='libarchive/libarchive_test-archive_check_magic.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_check_magic.o `test -f 'libarchive/archive_check_magic.c' || echo '$(srcdir)/'`libarchive/archive_check_magic.c
+
+libarchive/libarchive_test-archive_check_magic.obj: libarchive/archive_check_magic.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_check_magic.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_check_magic.Tpo -c -o libarchive/libarchive_test-archive_check_magic.obj `if test -f 'libarchive/archive_check_magic.c'; then $(CYGPATH_W) 'libarchive/archive_check_magic.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_check_magic.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_check_magic.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_check_magic.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_check_magic.c' object='libarchive/libarchive_test-archive_check_magic.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_check_magic.obj `if test -f 'libarchive/archive_check_magic.c'; then $(CYGPATH_W) 'libarchive/archive_check_magic.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_check_magic.c'; fi`
+
+libarchive/libarchive_test-archive_entry.o: libarchive/archive_entry.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry.Tpo -c -o libarchive/libarchive_test-archive_entry.o `test -f 'libarchive/archive_entry.c' || echo '$(srcdir)/'`libarchive/archive_entry.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry.c' object='libarchive/libarchive_test-archive_entry.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry.o `test -f 'libarchive/archive_entry.c' || echo '$(srcdir)/'`libarchive/archive_entry.c
+
+libarchive/libarchive_test-archive_entry.obj: libarchive/archive_entry.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry.Tpo -c -o libarchive/libarchive_test-archive_entry.obj `if test -f 'libarchive/archive_entry.c'; then $(CYGPATH_W) 'libarchive/archive_entry.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry.c' object='libarchive/libarchive_test-archive_entry.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry.obj `if test -f 'libarchive/archive_entry.c'; then $(CYGPATH_W) 'libarchive/archive_entry.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry.c'; fi`
+
+libarchive/libarchive_test-archive_entry_copy_stat.o: libarchive/archive_entry_copy_stat.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_copy_stat.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_stat.Tpo -c -o libarchive/libarchive_test-archive_entry_copy_stat.o `test -f 'libarchive/archive_entry_copy_stat.c' || echo '$(srcdir)/'`libarchive/archive_entry_copy_stat.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_stat.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_stat.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_copy_stat.c' object='libarchive/libarchive_test-archive_entry_copy_stat.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_copy_stat.o `test -f 'libarchive/archive_entry_copy_stat.c' || echo '$(srcdir)/'`libarchive/archive_entry_copy_stat.c
+
+libarchive/libarchive_test-archive_entry_copy_stat.obj: libarchive/archive_entry_copy_stat.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_copy_stat.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_stat.Tpo -c -o libarchive/libarchive_test-archive_entry_copy_stat.obj `if test -f 'libarchive/archive_entry_copy_stat.c'; then $(CYGPATH_W) 'libarchive/archive_entry_copy_stat.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_copy_stat.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_stat.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_stat.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_copy_stat.c' object='libarchive/libarchive_test-archive_entry_copy_stat.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_copy_stat.obj `if test -f 'libarchive/archive_entry_copy_stat.c'; then $(CYGPATH_W) 'libarchive/archive_entry_copy_stat.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_copy_stat.c'; fi`
+
+libarchive/libarchive_test-archive_entry_link_resolver.o: libarchive/archive_entry_link_resolver.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_link_resolver.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_link_resolver.Tpo -c -o libarchive/libarchive_test-archive_entry_link_resolver.o `test -f 'libarchive/archive_entry_link_resolver.c' || echo '$(srcdir)/'`libarchive/archive_entry_link_resolver.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_link_resolver.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_link_resolver.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_link_resolver.c' object='libarchive/libarchive_test-archive_entry_link_resolver.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_link_resolver.o `test -f 'libarchive/archive_entry_link_resolver.c' || echo '$(srcdir)/'`libarchive/archive_entry_link_resolver.c
+
+libarchive/libarchive_test-archive_entry_link_resolver.obj: libarchive/archive_entry_link_resolver.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_link_resolver.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_link_resolver.Tpo -c -o libarchive/libarchive_test-archive_entry_link_resolver.obj `if test -f 'libarchive/archive_entry_link_resolver.c'; then $(CYGPATH_W) 'libarchive/archive_entry_link_resolver.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_link_resolver.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_link_resolver.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_link_resolver.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_link_resolver.c' object='libarchive/libarchive_test-archive_entry_link_resolver.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_link_resolver.obj `if test -f 'libarchive/archive_entry_link_resolver.c'; then $(CYGPATH_W) 'libarchive/archive_entry_link_resolver.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_link_resolver.c'; fi`
+
+libarchive/libarchive_test-archive_entry_stat.o: libarchive/archive_entry_stat.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_stat.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_stat.Tpo -c -o libarchive/libarchive_test-archive_entry_stat.o `test -f 'libarchive/archive_entry_stat.c' || echo '$(srcdir)/'`libarchive/archive_entry_stat.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_stat.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_stat.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_stat.c' object='libarchive/libarchive_test-archive_entry_stat.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_stat.o `test -f 'libarchive/archive_entry_stat.c' || echo '$(srcdir)/'`libarchive/archive_entry_stat.c
+
+libarchive/libarchive_test-archive_entry_stat.obj: libarchive/archive_entry_stat.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_stat.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_stat.Tpo -c -o libarchive/libarchive_test-archive_entry_stat.obj `if test -f 'libarchive/archive_entry_stat.c'; then $(CYGPATH_W) 'libarchive/archive_entry_stat.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_stat.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_stat.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_stat.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_stat.c' object='libarchive/libarchive_test-archive_entry_stat.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_stat.obj `if test -f 'libarchive/archive_entry_stat.c'; then $(CYGPATH_W) 'libarchive/archive_entry_stat.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_stat.c'; fi`
+
+libarchive/libarchive_test-archive_entry_strmode.o: libarchive/archive_entry_strmode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_strmode.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_strmode.Tpo -c -o libarchive/libarchive_test-archive_entry_strmode.o `test -f 'libarchive/archive_entry_strmode.c' || echo '$(srcdir)/'`libarchive/archive_entry_strmode.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_strmode.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_strmode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_strmode.c' object='libarchive/libarchive_test-archive_entry_strmode.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_strmode.o `test -f 'libarchive/archive_entry_strmode.c' || echo '$(srcdir)/'`libarchive/archive_entry_strmode.c
+
+libarchive/libarchive_test-archive_entry_strmode.obj: libarchive/archive_entry_strmode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_strmode.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_strmode.Tpo -c -o libarchive/libarchive_test-archive_entry_strmode.obj `if test -f 'libarchive/archive_entry_strmode.c'; then $(CYGPATH_W) 'libarchive/archive_entry_strmode.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_strmode.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_strmode.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_strmode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_strmode.c' object='libarchive/libarchive_test-archive_entry_strmode.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_strmode.obj `if test -f 'libarchive/archive_entry_strmode.c'; then $(CYGPATH_W) 'libarchive/archive_entry_strmode.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_strmode.c'; fi`
+
+libarchive/libarchive_test-archive_entry_xattr.o: libarchive/archive_entry_xattr.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_xattr.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_xattr.Tpo -c -o libarchive/libarchive_test-archive_entry_xattr.o `test -f 'libarchive/archive_entry_xattr.c' || echo '$(srcdir)/'`libarchive/archive_entry_xattr.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_xattr.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_xattr.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_xattr.c' object='libarchive/libarchive_test-archive_entry_xattr.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_xattr.o `test -f 'libarchive/archive_entry_xattr.c' || echo '$(srcdir)/'`libarchive/archive_entry_xattr.c
+
+libarchive/libarchive_test-archive_entry_xattr.obj: libarchive/archive_entry_xattr.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_xattr.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_xattr.Tpo -c -o libarchive/libarchive_test-archive_entry_xattr.obj `if test -f 'libarchive/archive_entry_xattr.c'; then $(CYGPATH_W) 'libarchive/archive_entry_xattr.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_xattr.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_xattr.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_xattr.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_xattr.c' object='libarchive/libarchive_test-archive_entry_xattr.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_xattr.obj `if test -f 'libarchive/archive_entry_xattr.c'; then $(CYGPATH_W) 'libarchive/archive_entry_xattr.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_xattr.c'; fi`
+
+libarchive/libarchive_test-archive_read.o: libarchive/archive_read.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read.Tpo -c -o libarchive/libarchive_test-archive_read.o `test -f 'libarchive/archive_read.c' || echo '$(srcdir)/'`libarchive/archive_read.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read.c' object='libarchive/libarchive_test-archive_read.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read.o `test -f 'libarchive/archive_read.c' || echo '$(srcdir)/'`libarchive/archive_read.c
+
+libarchive/libarchive_test-archive_read.obj: libarchive/archive_read.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read.Tpo -c -o libarchive/libarchive_test-archive_read.obj `if test -f 'libarchive/archive_read.c'; then $(CYGPATH_W) 'libarchive/archive_read.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read.c' object='libarchive/libarchive_test-archive_read.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read.obj `if test -f 'libarchive/archive_read.c'; then $(CYGPATH_W) 'libarchive/archive_read.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read.c'; fi`
+
+libarchive/libarchive_test-archive_read_data_into_fd.o: libarchive/archive_read_data_into_fd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_data_into_fd.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_data_into_fd.Tpo -c -o libarchive/libarchive_test-archive_read_data_into_fd.o `test -f 'libarchive/archive_read_data_into_fd.c' || echo '$(srcdir)/'`libarchive/archive_read_data_into_fd.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_data_into_fd.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_data_into_fd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_data_into_fd.c' object='libarchive/libarchive_test-archive_read_data_into_fd.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_data_into_fd.o `test -f 'libarchive/archive_read_data_into_fd.c' || echo '$(srcdir)/'`libarchive/archive_read_data_into_fd.c
+
+libarchive/libarchive_test-archive_read_data_into_fd.obj: libarchive/archive_read_data_into_fd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_data_into_fd.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_data_into_fd.Tpo -c -o libarchive/libarchive_test-archive_read_data_into_fd.obj `if test -f 'libarchive/archive_read_data_into_fd.c'; then $(CYGPATH_W) 'libarchive/archive_read_data_into_fd.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_data_into_fd.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_data_into_fd.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_data_into_fd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_data_into_fd.c' object='libarchive/libarchive_test-archive_read_data_into_fd.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_data_into_fd.obj `if test -f 'libarchive/archive_read_data_into_fd.c'; then $(CYGPATH_W) 'libarchive/archive_read_data_into_fd.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_data_into_fd.c'; fi`
+
+libarchive/libarchive_test-archive_read_disk.o: libarchive/archive_read_disk.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_disk.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_disk.Tpo -c -o libarchive/libarchive_test-archive_read_disk.o `test -f 'libarchive/archive_read_disk.c' || echo '$(srcdir)/'`libarchive/archive_read_disk.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_disk.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_disk.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_disk.c' object='libarchive/libarchive_test-archive_read_disk.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_disk.o `test -f 'libarchive/archive_read_disk.c' || echo '$(srcdir)/'`libarchive/archive_read_disk.c
+
+libarchive/libarchive_test-archive_read_disk.obj: libarchive/archive_read_disk.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_disk.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_disk.Tpo -c -o libarchive/libarchive_test-archive_read_disk.obj `if test -f 'libarchive/archive_read_disk.c'; then $(CYGPATH_W) 'libarchive/archive_read_disk.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_disk.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_disk.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_disk.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_disk.c' object='libarchive/libarchive_test-archive_read_disk.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_disk.obj `if test -f 'libarchive/archive_read_disk.c'; then $(CYGPATH_W) 'libarchive/archive_read_disk.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_disk.c'; fi`
+
+libarchive/libarchive_test-archive_read_disk_entry_from_file.o: libarchive/archive_read_disk_entry_from_file.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_disk_entry_from_file.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_disk_entry_from_file.Tpo -c -o libarchive/libarchive_test-archive_read_disk_entry_from_file.o `test -f 'libarchive/archive_read_disk_entry_from_file.c' || echo '$(srcdir)/'`libarchive/archive_read_disk_entry_from_file.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_disk_entry_from_file.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_disk_entry_from_file.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_disk_entry_from_file.c' object='libarchive/libarchive_test-archive_read_disk_entry_from_file.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_disk_entry_from_file.o `test -f 'libarchive/archive_read_disk_entry_from_file.c' || echo '$(srcdir)/'`libarchive/archive_read_disk_entry_from_file.c
+
+libarchive/libarchive_test-archive_read_disk_entry_from_file.obj: libarchive/archive_read_disk_entry_from_file.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_disk_entry_from_file.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_disk_entry_from_file.Tpo -c -o libarchive/libarchive_test-archive_read_disk_entry_from_file.obj `if test -f 'libarchive/archive_read_disk_entry_from_file.c'; then $(CYGPATH_W) 'libarchive/archive_read_disk_entry_from_file.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_disk_entry_from_file.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_disk_entry_from_file.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_disk_entry_from_file.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_disk_entry_from_file.c' object='libarchive/libarchive_test-archive_read_disk_entry_from_file.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_disk_entry_from_file.obj `if test -f 'libarchive/archive_read_disk_entry_from_file.c'; then $(CYGPATH_W) 'libarchive/archive_read_disk_entry_from_file.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_disk_entry_from_file.c'; fi`
+
+libarchive/libarchive_test-archive_read_disk_set_standard_lookup.o: libarchive/archive_read_disk_set_standard_lookup.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_disk_set_standard_lookup.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_disk_set_standard_lookup.Tpo -c -o libarchive/libarchive_test-archive_read_disk_set_standard_lookup.o `test -f 'libarchive/archive_read_disk_set_standard_lookup.c' || echo '$(srcdir)/'`libarchive/archive_read_disk_set_standard_lookup.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_disk_set_standard_lookup.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_disk_set_standard_lookup.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_disk_set_standard_lookup.c' object='libarchive/libarchive_test-archive_read_disk_set_standard_lookup.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_disk_set_standard_lookup.o `test -f 'libarchive/archive_read_disk_set_standard_lookup.c' || echo '$(srcdir)/'`libarchive/archive_read_disk_set_standard_lookup.c
+
+libarchive/libarchive_test-archive_read_disk_set_standard_lookup.obj: libarchive/archive_read_disk_set_standard_lookup.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_disk_set_standard_lookup.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_disk_set_standard_lookup.Tpo -c -o libarchive/libarchive_test-archive_read_disk_set_standard_lookup.obj `if test -f 'libarchive/archive_read_disk_set_standard_lookup.c'; then $(CYGPATH_W) 'libarchive/archive_read_disk_set_standard_lookup.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_disk_set_standard_lookup.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_disk_set_standard_lookup.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_disk_set_standard_lookup.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_disk_set_standard_lookup.c' object='libarchive/libarchive_test-archive_read_disk_set_standard_lookup.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_disk_set_standard_lookup.obj `if test -f 'libarchive/archive_read_disk_set_standard_lookup.c'; then $(CYGPATH_W) 'libarchive/archive_read_disk_set_standard_lookup.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_disk_set_standard_lookup.c'; fi`
+
+libarchive/libarchive_test-archive_read_extract.o: libarchive/archive_read_extract.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_extract.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_extract.Tpo -c -o libarchive/libarchive_test-archive_read_extract.o `test -f 'libarchive/archive_read_extract.c' || echo '$(srcdir)/'`libarchive/archive_read_extract.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_extract.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_extract.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_extract.c' object='libarchive/libarchive_test-archive_read_extract.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_extract.o `test -f 'libarchive/archive_read_extract.c' || echo '$(srcdir)/'`libarchive/archive_read_extract.c
+
+libarchive/libarchive_test-archive_read_extract.obj: libarchive/archive_read_extract.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_extract.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_extract.Tpo -c -o libarchive/libarchive_test-archive_read_extract.obj `if test -f 'libarchive/archive_read_extract.c'; then $(CYGPATH_W) 'libarchive/archive_read_extract.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_extract.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_extract.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_extract.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_extract.c' object='libarchive/libarchive_test-archive_read_extract.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_extract.obj `if test -f 'libarchive/archive_read_extract.c'; then $(CYGPATH_W) 'libarchive/archive_read_extract.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_extract.c'; fi`
+
+libarchive/libarchive_test-archive_read_open_fd.o: libarchive/archive_read_open_fd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_open_fd.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_open_fd.Tpo -c -o libarchive/libarchive_test-archive_read_open_fd.o `test -f 'libarchive/archive_read_open_fd.c' || echo '$(srcdir)/'`libarchive/archive_read_open_fd.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_open_fd.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_open_fd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_open_fd.c' object='libarchive/libarchive_test-archive_read_open_fd.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_open_fd.o `test -f 'libarchive/archive_read_open_fd.c' || echo '$(srcdir)/'`libarchive/archive_read_open_fd.c
+
+libarchive/libarchive_test-archive_read_open_fd.obj: libarchive/archive_read_open_fd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_open_fd.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_open_fd.Tpo -c -o libarchive/libarchive_test-archive_read_open_fd.obj `if test -f 'libarchive/archive_read_open_fd.c'; then $(CYGPATH_W) 'libarchive/archive_read_open_fd.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_open_fd.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_open_fd.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_open_fd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_open_fd.c' object='libarchive/libarchive_test-archive_read_open_fd.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_open_fd.obj `if test -f 'libarchive/archive_read_open_fd.c'; then $(CYGPATH_W) 'libarchive/archive_read_open_fd.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_open_fd.c'; fi`
+
+libarchive/libarchive_test-archive_read_open_file.o: libarchive/archive_read_open_file.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_open_file.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_open_file.Tpo -c -o libarchive/libarchive_test-archive_read_open_file.o `test -f 'libarchive/archive_read_open_file.c' || echo '$(srcdir)/'`libarchive/archive_read_open_file.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_open_file.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_open_file.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_open_file.c' object='libarchive/libarchive_test-archive_read_open_file.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_open_file.o `test -f 'libarchive/archive_read_open_file.c' || echo '$(srcdir)/'`libarchive/archive_read_open_file.c
+
+libarchive/libarchive_test-archive_read_open_file.obj: libarchive/archive_read_open_file.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_open_file.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_open_file.Tpo -c -o libarchive/libarchive_test-archive_read_open_file.obj `if test -f 'libarchive/archive_read_open_file.c'; then $(CYGPATH_W) 'libarchive/archive_read_open_file.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_open_file.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_open_file.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_open_file.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_open_file.c' object='libarchive/libarchive_test-archive_read_open_file.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_open_file.obj `if test -f 'libarchive/archive_read_open_file.c'; then $(CYGPATH_W) 'libarchive/archive_read_open_file.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_open_file.c'; fi`
+
+libarchive/libarchive_test-archive_read_open_filename.o: libarchive/archive_read_open_filename.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_open_filename.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_open_filename.Tpo -c -o libarchive/libarchive_test-archive_read_open_filename.o `test -f 'libarchive/archive_read_open_filename.c' || echo '$(srcdir)/'`libarchive/archive_read_open_filename.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_open_filename.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_open_filename.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_open_filename.c' object='libarchive/libarchive_test-archive_read_open_filename.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_open_filename.o `test -f 'libarchive/archive_read_open_filename.c' || echo '$(srcdir)/'`libarchive/archive_read_open_filename.c
+
+libarchive/libarchive_test-archive_read_open_filename.obj: libarchive/archive_read_open_filename.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_open_filename.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_open_filename.Tpo -c -o libarchive/libarchive_test-archive_read_open_filename.obj `if test -f 'libarchive/archive_read_open_filename.c'; then $(CYGPATH_W) 'libarchive/archive_read_open_filename.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_open_filename.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_open_filename.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_open_filename.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_open_filename.c' object='libarchive/libarchive_test-archive_read_open_filename.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_open_filename.obj `if test -f 'libarchive/archive_read_open_filename.c'; then $(CYGPATH_W) 'libarchive/archive_read_open_filename.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_open_filename.c'; fi`
+
+libarchive/libarchive_test-archive_read_open_memory.o: libarchive/archive_read_open_memory.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_open_memory.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_open_memory.Tpo -c -o libarchive/libarchive_test-archive_read_open_memory.o `test -f 'libarchive/archive_read_open_memory.c' || echo '$(srcdir)/'`libarchive/archive_read_open_memory.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_open_memory.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_open_memory.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_open_memory.c' object='libarchive/libarchive_test-archive_read_open_memory.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_open_memory.o `test -f 'libarchive/archive_read_open_memory.c' || echo '$(srcdir)/'`libarchive/archive_read_open_memory.c
+
+libarchive/libarchive_test-archive_read_open_memory.obj: libarchive/archive_read_open_memory.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_open_memory.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_open_memory.Tpo -c -o libarchive/libarchive_test-archive_read_open_memory.obj `if test -f 'libarchive/archive_read_open_memory.c'; then $(CYGPATH_W) 'libarchive/archive_read_open_memory.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_open_memory.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_open_memory.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_open_memory.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_open_memory.c' object='libarchive/libarchive_test-archive_read_open_memory.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_open_memory.obj `if test -f 'libarchive/archive_read_open_memory.c'; then $(CYGPATH_W) 'libarchive/archive_read_open_memory.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_open_memory.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_compression_all.o: libarchive/archive_read_support_compression_all.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_all.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_all.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_all.o `test -f 'libarchive/archive_read_support_compression_all.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_all.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_all.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_all.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_all.c' object='libarchive/libarchive_test-archive_read_support_compression_all.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_all.o `test -f 'libarchive/archive_read_support_compression_all.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_all.c
+
+libarchive/libarchive_test-archive_read_support_compression_all.obj: libarchive/archive_read_support_compression_all.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_all.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_all.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_all.obj `if test -f 'libarchive/archive_read_support_compression_all.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_all.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_all.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_all.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_all.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_all.c' object='libarchive/libarchive_test-archive_read_support_compression_all.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_all.obj `if test -f 'libarchive/archive_read_support_compression_all.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_all.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_all.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_compression_bzip2.o: libarchive/archive_read_support_compression_bzip2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_bzip2.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_bzip2.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_bzip2.o `test -f 'libarchive/archive_read_support_compression_bzip2.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_bzip2.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_bzip2.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_bzip2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_bzip2.c' object='libarchive/libarchive_test-archive_read_support_compression_bzip2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_bzip2.o `test -f 'libarchive/archive_read_support_compression_bzip2.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_bzip2.c
+
+libarchive/libarchive_test-archive_read_support_compression_bzip2.obj: libarchive/archive_read_support_compression_bzip2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_bzip2.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_bzip2.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_bzip2.obj `if test -f 'libarchive/archive_read_support_compression_bzip2.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_bzip2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_bzip2.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_bzip2.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_bzip2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_bzip2.c' object='libarchive/libarchive_test-archive_read_support_compression_bzip2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_bzip2.obj `if test -f 'libarchive/archive_read_support_compression_bzip2.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_bzip2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_bzip2.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_compression_compress.o: libarchive/archive_read_support_compression_compress.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_compress.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_compress.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_compress.o `test -f 'libarchive/archive_read_support_compression_compress.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_compress.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_compress.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_compress.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_compress.c' object='libarchive/libarchive_test-archive_read_support_compression_compress.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_compress.o `test -f 'libarchive/archive_read_support_compression_compress.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_compress.c
+
+libarchive/libarchive_test-archive_read_support_compression_compress.obj: libarchive/archive_read_support_compression_compress.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_compress.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_compress.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_compress.obj `if test -f 'libarchive/archive_read_support_compression_compress.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_compress.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_compress.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_compress.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_compress.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_compress.c' object='libarchive/libarchive_test-archive_read_support_compression_compress.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_compress.obj `if test -f 'libarchive/archive_read_support_compression_compress.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_compress.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_compress.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_compression_gzip.o: libarchive/archive_read_support_compression_gzip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_gzip.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_gzip.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_gzip.o `test -f 'libarchive/archive_read_support_compression_gzip.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_gzip.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_gzip.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_gzip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_gzip.c' object='libarchive/libarchive_test-archive_read_support_compression_gzip.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_gzip.o `test -f 'libarchive/archive_read_support_compression_gzip.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_gzip.c
+
+libarchive/libarchive_test-archive_read_support_compression_gzip.obj: libarchive/archive_read_support_compression_gzip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_gzip.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_gzip.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_gzip.obj `if test -f 'libarchive/archive_read_support_compression_gzip.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_gzip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_gzip.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_gzip.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_gzip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_gzip.c' object='libarchive/libarchive_test-archive_read_support_compression_gzip.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_gzip.obj `if test -f 'libarchive/archive_read_support_compression_gzip.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_gzip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_gzip.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_compression_none.o: libarchive/archive_read_support_compression_none.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_none.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_none.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_none.o `test -f 'libarchive/archive_read_support_compression_none.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_none.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_none.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_none.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_none.c' object='libarchive/libarchive_test-archive_read_support_compression_none.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_none.o `test -f 'libarchive/archive_read_support_compression_none.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_none.c
+
+libarchive/libarchive_test-archive_read_support_compression_none.obj: libarchive/archive_read_support_compression_none.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_none.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_none.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_none.obj `if test -f 'libarchive/archive_read_support_compression_none.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_none.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_none.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_none.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_none.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_none.c' object='libarchive/libarchive_test-archive_read_support_compression_none.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_none.obj `if test -f 'libarchive/archive_read_support_compression_none.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_none.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_none.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_compression_program.o: libarchive/archive_read_support_compression_program.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_program.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_program.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_program.o `test -f 'libarchive/archive_read_support_compression_program.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_program.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_program.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_program.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_program.c' object='libarchive/libarchive_test-archive_read_support_compression_program.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_program.o `test -f 'libarchive/archive_read_support_compression_program.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_program.c
+
+libarchive/libarchive_test-archive_read_support_compression_program.obj: libarchive/archive_read_support_compression_program.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_program.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_program.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_program.obj `if test -f 'libarchive/archive_read_support_compression_program.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_program.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_program.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_program.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_program.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_program.c' object='libarchive/libarchive_test-archive_read_support_compression_program.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_program.obj `if test -f 'libarchive/archive_read_support_compression_program.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_program.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_program.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_compression_rpm.o: libarchive/archive_read_support_compression_rpm.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_rpm.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_rpm.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_rpm.o `test -f 'libarchive/archive_read_support_compression_rpm.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_rpm.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_rpm.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_rpm.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_rpm.c' object='libarchive/libarchive_test-archive_read_support_compression_rpm.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_rpm.o `test -f 'libarchive/archive_read_support_compression_rpm.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_rpm.c
+
+libarchive/libarchive_test-archive_read_support_compression_rpm.obj: libarchive/archive_read_support_compression_rpm.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_rpm.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_rpm.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_rpm.obj `if test -f 'libarchive/archive_read_support_compression_rpm.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_rpm.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_rpm.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_rpm.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_rpm.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_rpm.c' object='libarchive/libarchive_test-archive_read_support_compression_rpm.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_rpm.obj `if test -f 'libarchive/archive_read_support_compression_rpm.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_rpm.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_rpm.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_compression_uu.o: libarchive/archive_read_support_compression_uu.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_uu.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_uu.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_uu.o `test -f 'libarchive/archive_read_support_compression_uu.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_uu.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_uu.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_uu.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_uu.c' object='libarchive/libarchive_test-archive_read_support_compression_uu.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_uu.o `test -f 'libarchive/archive_read_support_compression_uu.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_uu.c
+
+libarchive/libarchive_test-archive_read_support_compression_uu.obj: libarchive/archive_read_support_compression_uu.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_uu.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_uu.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_uu.obj `if test -f 'libarchive/archive_read_support_compression_uu.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_uu.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_uu.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_uu.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_uu.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_uu.c' object='libarchive/libarchive_test-archive_read_support_compression_uu.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_uu.obj `if test -f 'libarchive/archive_read_support_compression_uu.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_uu.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_uu.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_compression_xz.o: libarchive/archive_read_support_compression_xz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_xz.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_xz.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_xz.o `test -f 'libarchive/archive_read_support_compression_xz.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_xz.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_xz.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_xz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_xz.c' object='libarchive/libarchive_test-archive_read_support_compression_xz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_xz.o `test -f 'libarchive/archive_read_support_compression_xz.c' || echo '$(srcdir)/'`libarchive/archive_read_support_compression_xz.c
+
+libarchive/libarchive_test-archive_read_support_compression_xz.obj: libarchive/archive_read_support_compression_xz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_compression_xz.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_xz.Tpo -c -o libarchive/libarchive_test-archive_read_support_compression_xz.obj `if test -f 'libarchive/archive_read_support_compression_xz.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_xz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_xz.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_xz.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_compression_xz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_compression_xz.c' object='libarchive/libarchive_test-archive_read_support_compression_xz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_compression_xz.obj `if test -f 'libarchive/archive_read_support_compression_xz.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_compression_xz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_compression_xz.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_format_all.o: libarchive/archive_read_support_format_all.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_all.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_all.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_all.o `test -f 'libarchive/archive_read_support_format_all.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_all.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_all.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_all.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_all.c' object='libarchive/libarchive_test-archive_read_support_format_all.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_all.o `test -f 'libarchive/archive_read_support_format_all.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_all.c
+
+libarchive/libarchive_test-archive_read_support_format_all.obj: libarchive/archive_read_support_format_all.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_all.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_all.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_all.obj `if test -f 'libarchive/archive_read_support_format_all.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_all.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_all.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_all.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_all.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_all.c' object='libarchive/libarchive_test-archive_read_support_format_all.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_all.obj `if test -f 'libarchive/archive_read_support_format_all.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_all.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_all.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_format_ar.o: libarchive/archive_read_support_format_ar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_ar.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_ar.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_ar.o `test -f 'libarchive/archive_read_support_format_ar.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_ar.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_ar.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_ar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_ar.c' object='libarchive/libarchive_test-archive_read_support_format_ar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_ar.o `test -f 'libarchive/archive_read_support_format_ar.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_ar.c
+
+libarchive/libarchive_test-archive_read_support_format_ar.obj: libarchive/archive_read_support_format_ar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_ar.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_ar.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_ar.obj `if test -f 'libarchive/archive_read_support_format_ar.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_ar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_ar.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_ar.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_ar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_ar.c' object='libarchive/libarchive_test-archive_read_support_format_ar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_ar.obj `if test -f 'libarchive/archive_read_support_format_ar.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_ar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_ar.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_format_cpio.o: libarchive/archive_read_support_format_cpio.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_cpio.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_cpio.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_cpio.o `test -f 'libarchive/archive_read_support_format_cpio.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_cpio.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_cpio.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_cpio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_cpio.c' object='libarchive/libarchive_test-archive_read_support_format_cpio.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_cpio.o `test -f 'libarchive/archive_read_support_format_cpio.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_cpio.c
+
+libarchive/libarchive_test-archive_read_support_format_cpio.obj: libarchive/archive_read_support_format_cpio.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_cpio.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_cpio.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_cpio.obj `if test -f 'libarchive/archive_read_support_format_cpio.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_cpio.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_cpio.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_cpio.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_cpio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_cpio.c' object='libarchive/libarchive_test-archive_read_support_format_cpio.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_cpio.obj `if test -f 'libarchive/archive_read_support_format_cpio.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_cpio.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_cpio.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_format_empty.o: libarchive/archive_read_support_format_empty.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_empty.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_empty.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_empty.o `test -f 'libarchive/archive_read_support_format_empty.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_empty.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_empty.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_empty.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_empty.c' object='libarchive/libarchive_test-archive_read_support_format_empty.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_empty.o `test -f 'libarchive/archive_read_support_format_empty.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_empty.c
+
+libarchive/libarchive_test-archive_read_support_format_empty.obj: libarchive/archive_read_support_format_empty.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_empty.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_empty.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_empty.obj `if test -f 'libarchive/archive_read_support_format_empty.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_empty.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_empty.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_empty.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_empty.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_empty.c' object='libarchive/libarchive_test-archive_read_support_format_empty.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_empty.obj `if test -f 'libarchive/archive_read_support_format_empty.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_empty.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_empty.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_format_iso9660.o: libarchive/archive_read_support_format_iso9660.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_iso9660.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_iso9660.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_iso9660.o `test -f 'libarchive/archive_read_support_format_iso9660.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_iso9660.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_iso9660.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_iso9660.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_iso9660.c' object='libarchive/libarchive_test-archive_read_support_format_iso9660.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_iso9660.o `test -f 'libarchive/archive_read_support_format_iso9660.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_iso9660.c
+
+libarchive/libarchive_test-archive_read_support_format_iso9660.obj: libarchive/archive_read_support_format_iso9660.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_iso9660.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_iso9660.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_iso9660.obj `if test -f 'libarchive/archive_read_support_format_iso9660.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_iso9660.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_iso9660.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_iso9660.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_iso9660.c' object='libarchive/libarchive_test-archive_read_support_format_iso9660.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_iso9660.obj `if test -f 'libarchive/archive_read_support_format_iso9660.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_iso9660.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_iso9660.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_format_mtree.o: libarchive/archive_read_support_format_mtree.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_mtree.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_mtree.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_mtree.o `test -f 'libarchive/archive_read_support_format_mtree.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_mtree.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_mtree.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_mtree.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_mtree.c' object='libarchive/libarchive_test-archive_read_support_format_mtree.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_mtree.o `test -f 'libarchive/archive_read_support_format_mtree.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_mtree.c
+
+libarchive/libarchive_test-archive_read_support_format_mtree.obj: libarchive/archive_read_support_format_mtree.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_mtree.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_mtree.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_mtree.obj `if test -f 'libarchive/archive_read_support_format_mtree.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_mtree.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_mtree.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_mtree.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_mtree.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_mtree.c' object='libarchive/libarchive_test-archive_read_support_format_mtree.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_mtree.obj `if test -f 'libarchive/archive_read_support_format_mtree.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_mtree.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_mtree.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_format_raw.o: libarchive/archive_read_support_format_raw.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_raw.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_raw.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_raw.o `test -f 'libarchive/archive_read_support_format_raw.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_raw.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_raw.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_raw.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_raw.c' object='libarchive/libarchive_test-archive_read_support_format_raw.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_raw.o `test -f 'libarchive/archive_read_support_format_raw.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_raw.c
+
+libarchive/libarchive_test-archive_read_support_format_raw.obj: libarchive/archive_read_support_format_raw.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_raw.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_raw.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_raw.obj `if test -f 'libarchive/archive_read_support_format_raw.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_raw.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_raw.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_raw.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_raw.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_raw.c' object='libarchive/libarchive_test-archive_read_support_format_raw.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_raw.obj `if test -f 'libarchive/archive_read_support_format_raw.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_raw.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_raw.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_format_tar.o: libarchive/archive_read_support_format_tar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_tar.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_tar.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_tar.o `test -f 'libarchive/archive_read_support_format_tar.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_tar.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_tar.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_tar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_tar.c' object='libarchive/libarchive_test-archive_read_support_format_tar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_tar.o `test -f 'libarchive/archive_read_support_format_tar.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_tar.c
+
+libarchive/libarchive_test-archive_read_support_format_tar.obj: libarchive/archive_read_support_format_tar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_tar.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_tar.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_tar.obj `if test -f 'libarchive/archive_read_support_format_tar.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_tar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_tar.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_tar.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_tar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_tar.c' object='libarchive/libarchive_test-archive_read_support_format_tar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_tar.obj `if test -f 'libarchive/archive_read_support_format_tar.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_tar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_tar.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_format_xar.o: libarchive/archive_read_support_format_xar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_xar.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_xar.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_xar.o `test -f 'libarchive/archive_read_support_format_xar.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_xar.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_xar.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_xar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_xar.c' object='libarchive/libarchive_test-archive_read_support_format_xar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_xar.o `test -f 'libarchive/archive_read_support_format_xar.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_xar.c
+
+libarchive/libarchive_test-archive_read_support_format_xar.obj: libarchive/archive_read_support_format_xar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_xar.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_xar.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_xar.obj `if test -f 'libarchive/archive_read_support_format_xar.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_xar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_xar.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_xar.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_xar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_xar.c' object='libarchive/libarchive_test-archive_read_support_format_xar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_xar.obj `if test -f 'libarchive/archive_read_support_format_xar.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_xar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_xar.c'; fi`
+
+libarchive/libarchive_test-archive_read_support_format_zip.o: libarchive/archive_read_support_format_zip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_zip.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_zip.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_zip.o `test -f 'libarchive/archive_read_support_format_zip.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_zip.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_zip.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_zip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_zip.c' object='libarchive/libarchive_test-archive_read_support_format_zip.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_zip.o `test -f 'libarchive/archive_read_support_format_zip.c' || echo '$(srcdir)/'`libarchive/archive_read_support_format_zip.c
+
+libarchive/libarchive_test-archive_read_support_format_zip.obj: libarchive/archive_read_support_format_zip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_read_support_format_zip.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_zip.Tpo -c -o libarchive/libarchive_test-archive_read_support_format_zip.obj `if test -f 'libarchive/archive_read_support_format_zip.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_zip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_zip.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_zip.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_read_support_format_zip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_read_support_format_zip.c' object='libarchive/libarchive_test-archive_read_support_format_zip.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_read_support_format_zip.obj `if test -f 'libarchive/archive_read_support_format_zip.c'; then $(CYGPATH_W) 'libarchive/archive_read_support_format_zip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_read_support_format_zip.c'; fi`
+
+libarchive/libarchive_test-archive_string.o: libarchive/archive_string.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_string.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_string.Tpo -c -o libarchive/libarchive_test-archive_string.o `test -f 'libarchive/archive_string.c' || echo '$(srcdir)/'`libarchive/archive_string.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_string.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_string.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_string.c' object='libarchive/libarchive_test-archive_string.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_string.o `test -f 'libarchive/archive_string.c' || echo '$(srcdir)/'`libarchive/archive_string.c
+
+libarchive/libarchive_test-archive_string.obj: libarchive/archive_string.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_string.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_string.Tpo -c -o libarchive/libarchive_test-archive_string.obj `if test -f 'libarchive/archive_string.c'; then $(CYGPATH_W) 'libarchive/archive_string.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_string.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_string.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_string.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_string.c' object='libarchive/libarchive_test-archive_string.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_string.obj `if test -f 'libarchive/archive_string.c'; then $(CYGPATH_W) 'libarchive/archive_string.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_string.c'; fi`
+
+libarchive/libarchive_test-archive_string_sprintf.o: libarchive/archive_string_sprintf.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_string_sprintf.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_string_sprintf.Tpo -c -o libarchive/libarchive_test-archive_string_sprintf.o `test -f 'libarchive/archive_string_sprintf.c' || echo '$(srcdir)/'`libarchive/archive_string_sprintf.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_string_sprintf.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_string_sprintf.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_string_sprintf.c' object='libarchive/libarchive_test-archive_string_sprintf.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_string_sprintf.o `test -f 'libarchive/archive_string_sprintf.c' || echo '$(srcdir)/'`libarchive/archive_string_sprintf.c
+
+libarchive/libarchive_test-archive_string_sprintf.obj: libarchive/archive_string_sprintf.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_string_sprintf.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_string_sprintf.Tpo -c -o libarchive/libarchive_test-archive_string_sprintf.obj `if test -f 'libarchive/archive_string_sprintf.c'; then $(CYGPATH_W) 'libarchive/archive_string_sprintf.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_string_sprintf.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_string_sprintf.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_string_sprintf.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_string_sprintf.c' object='libarchive/libarchive_test-archive_string_sprintf.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_string_sprintf.obj `if test -f 'libarchive/archive_string_sprintf.c'; then $(CYGPATH_W) 'libarchive/archive_string_sprintf.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_string_sprintf.c'; fi`
+
+libarchive/libarchive_test-archive_util.o: libarchive/archive_util.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_util.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_util.Tpo -c -o libarchive/libarchive_test-archive_util.o `test -f 'libarchive/archive_util.c' || echo '$(srcdir)/'`libarchive/archive_util.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_util.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_util.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_util.c' object='libarchive/libarchive_test-archive_util.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_util.o `test -f 'libarchive/archive_util.c' || echo '$(srcdir)/'`libarchive/archive_util.c
+
+libarchive/libarchive_test-archive_util.obj: libarchive/archive_util.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_util.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_util.Tpo -c -o libarchive/libarchive_test-archive_util.obj `if test -f 'libarchive/archive_util.c'; then $(CYGPATH_W) 'libarchive/archive_util.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_util.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_util.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_util.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_util.c' object='libarchive/libarchive_test-archive_util.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_util.obj `if test -f 'libarchive/archive_util.c'; then $(CYGPATH_W) 'libarchive/archive_util.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_util.c'; fi`
+
+libarchive/libarchive_test-archive_virtual.o: libarchive/archive_virtual.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_virtual.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_virtual.Tpo -c -o libarchive/libarchive_test-archive_virtual.o `test -f 'libarchive/archive_virtual.c' || echo '$(srcdir)/'`libarchive/archive_virtual.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_virtual.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_virtual.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_virtual.c' object='libarchive/libarchive_test-archive_virtual.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_virtual.o `test -f 'libarchive/archive_virtual.c' || echo '$(srcdir)/'`libarchive/archive_virtual.c
+
+libarchive/libarchive_test-archive_virtual.obj: libarchive/archive_virtual.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_virtual.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_virtual.Tpo -c -o libarchive/libarchive_test-archive_virtual.obj `if test -f 'libarchive/archive_virtual.c'; then $(CYGPATH_W) 'libarchive/archive_virtual.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_virtual.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_virtual.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_virtual.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_virtual.c' object='libarchive/libarchive_test-archive_virtual.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_virtual.obj `if test -f 'libarchive/archive_virtual.c'; then $(CYGPATH_W) 'libarchive/archive_virtual.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_virtual.c'; fi`
+
+libarchive/libarchive_test-archive_write.o: libarchive/archive_write.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write.Tpo -c -o libarchive/libarchive_test-archive_write.o `test -f 'libarchive/archive_write.c' || echo '$(srcdir)/'`libarchive/archive_write.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write.c' object='libarchive/libarchive_test-archive_write.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write.o `test -f 'libarchive/archive_write.c' || echo '$(srcdir)/'`libarchive/archive_write.c
+
+libarchive/libarchive_test-archive_write.obj: libarchive/archive_write.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write.Tpo -c -o libarchive/libarchive_test-archive_write.obj `if test -f 'libarchive/archive_write.c'; then $(CYGPATH_W) 'libarchive/archive_write.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write.c' object='libarchive/libarchive_test-archive_write.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write.obj `if test -f 'libarchive/archive_write.c'; then $(CYGPATH_W) 'libarchive/archive_write.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write.c'; fi`
+
+libarchive/libarchive_test-archive_write_disk.o: libarchive/archive_write_disk.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_disk.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_disk.Tpo -c -o libarchive/libarchive_test-archive_write_disk.o `test -f 'libarchive/archive_write_disk.c' || echo '$(srcdir)/'`libarchive/archive_write_disk.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_disk.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_disk.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_disk.c' object='libarchive/libarchive_test-archive_write_disk.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_disk.o `test -f 'libarchive/archive_write_disk.c' || echo '$(srcdir)/'`libarchive/archive_write_disk.c
+
+libarchive/libarchive_test-archive_write_disk.obj: libarchive/archive_write_disk.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_disk.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_disk.Tpo -c -o libarchive/libarchive_test-archive_write_disk.obj `if test -f 'libarchive/archive_write_disk.c'; then $(CYGPATH_W) 'libarchive/archive_write_disk.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_disk.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_disk.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_disk.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_disk.c' object='libarchive/libarchive_test-archive_write_disk.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_disk.obj `if test -f 'libarchive/archive_write_disk.c'; then $(CYGPATH_W) 'libarchive/archive_write_disk.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_disk.c'; fi`
+
+libarchive/libarchive_test-archive_write_disk_set_standard_lookup.o: libarchive/archive_write_disk_set_standard_lookup.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_disk_set_standard_lookup.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_disk_set_standard_lookup.Tpo -c -o libarchive/libarchive_test-archive_write_disk_set_standard_lookup.o `test -f 'libarchive/archive_write_disk_set_standard_lookup.c' || echo '$(srcdir)/'`libarchive/archive_write_disk_set_standard_lookup.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_disk_set_standard_lookup.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_disk_set_standard_lookup.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_disk_set_standard_lookup.c' object='libarchive/libarchive_test-archive_write_disk_set_standard_lookup.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_disk_set_standard_lookup.o `test -f 'libarchive/archive_write_disk_set_standard_lookup.c' || echo '$(srcdir)/'`libarchive/archive_write_disk_set_standard_lookup.c
+
+libarchive/libarchive_test-archive_write_disk_set_standard_lookup.obj: libarchive/archive_write_disk_set_standard_lookup.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_disk_set_standard_lookup.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_disk_set_standard_lookup.Tpo -c -o libarchive/libarchive_test-archive_write_disk_set_standard_lookup.obj `if test -f 'libarchive/archive_write_disk_set_standard_lookup.c'; then $(CYGPATH_W) 'libarchive/archive_write_disk_set_standard_lookup.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_disk_set_standard_lookup.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_disk_set_standard_lookup.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_disk_set_standard_lookup.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_disk_set_standard_lookup.c' object='libarchive/libarchive_test-archive_write_disk_set_standard_lookup.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_disk_set_standard_lookup.obj `if test -f 'libarchive/archive_write_disk_set_standard_lookup.c'; then $(CYGPATH_W) 'libarchive/archive_write_disk_set_standard_lookup.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_disk_set_standard_lookup.c'; fi`
+
+libarchive/libarchive_test-archive_write_open_fd.o: libarchive/archive_write_open_fd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_open_fd.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_open_fd.Tpo -c -o libarchive/libarchive_test-archive_write_open_fd.o `test -f 'libarchive/archive_write_open_fd.c' || echo '$(srcdir)/'`libarchive/archive_write_open_fd.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_open_fd.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_open_fd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_open_fd.c' object='libarchive/libarchive_test-archive_write_open_fd.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_open_fd.o `test -f 'libarchive/archive_write_open_fd.c' || echo '$(srcdir)/'`libarchive/archive_write_open_fd.c
+
+libarchive/libarchive_test-archive_write_open_fd.obj: libarchive/archive_write_open_fd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_open_fd.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_open_fd.Tpo -c -o libarchive/libarchive_test-archive_write_open_fd.obj `if test -f 'libarchive/archive_write_open_fd.c'; then $(CYGPATH_W) 'libarchive/archive_write_open_fd.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_open_fd.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_open_fd.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_open_fd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_open_fd.c' object='libarchive/libarchive_test-archive_write_open_fd.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_open_fd.obj `if test -f 'libarchive/archive_write_open_fd.c'; then $(CYGPATH_W) 'libarchive/archive_write_open_fd.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_open_fd.c'; fi`
+
+libarchive/libarchive_test-archive_write_open_file.o: libarchive/archive_write_open_file.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_open_file.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_open_file.Tpo -c -o libarchive/libarchive_test-archive_write_open_file.o `test -f 'libarchive/archive_write_open_file.c' || echo '$(srcdir)/'`libarchive/archive_write_open_file.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_open_file.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_open_file.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_open_file.c' object='libarchive/libarchive_test-archive_write_open_file.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_open_file.o `test -f 'libarchive/archive_write_open_file.c' || echo '$(srcdir)/'`libarchive/archive_write_open_file.c
+
+libarchive/libarchive_test-archive_write_open_file.obj: libarchive/archive_write_open_file.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_open_file.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_open_file.Tpo -c -o libarchive/libarchive_test-archive_write_open_file.obj `if test -f 'libarchive/archive_write_open_file.c'; then $(CYGPATH_W) 'libarchive/archive_write_open_file.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_open_file.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_open_file.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_open_file.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_open_file.c' object='libarchive/libarchive_test-archive_write_open_file.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_open_file.obj `if test -f 'libarchive/archive_write_open_file.c'; then $(CYGPATH_W) 'libarchive/archive_write_open_file.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_open_file.c'; fi`
+
+libarchive/libarchive_test-archive_write_open_filename.o: libarchive/archive_write_open_filename.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_open_filename.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_open_filename.Tpo -c -o libarchive/libarchive_test-archive_write_open_filename.o `test -f 'libarchive/archive_write_open_filename.c' || echo '$(srcdir)/'`libarchive/archive_write_open_filename.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_open_filename.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_open_filename.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_open_filename.c' object='libarchive/libarchive_test-archive_write_open_filename.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_open_filename.o `test -f 'libarchive/archive_write_open_filename.c' || echo '$(srcdir)/'`libarchive/archive_write_open_filename.c
+
+libarchive/libarchive_test-archive_write_open_filename.obj: libarchive/archive_write_open_filename.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_open_filename.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_open_filename.Tpo -c -o libarchive/libarchive_test-archive_write_open_filename.obj `if test -f 'libarchive/archive_write_open_filename.c'; then $(CYGPATH_W) 'libarchive/archive_write_open_filename.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_open_filename.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_open_filename.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_open_filename.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_open_filename.c' object='libarchive/libarchive_test-archive_write_open_filename.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_open_filename.obj `if test -f 'libarchive/archive_write_open_filename.c'; then $(CYGPATH_W) 'libarchive/archive_write_open_filename.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_open_filename.c'; fi`
+
+libarchive/libarchive_test-archive_write_open_memory.o: libarchive/archive_write_open_memory.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_open_memory.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_open_memory.Tpo -c -o libarchive/libarchive_test-archive_write_open_memory.o `test -f 'libarchive/archive_write_open_memory.c' || echo '$(srcdir)/'`libarchive/archive_write_open_memory.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_open_memory.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_open_memory.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_open_memory.c' object='libarchive/libarchive_test-archive_write_open_memory.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_open_memory.o `test -f 'libarchive/archive_write_open_memory.c' || echo '$(srcdir)/'`libarchive/archive_write_open_memory.c
+
+libarchive/libarchive_test-archive_write_open_memory.obj: libarchive/archive_write_open_memory.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_open_memory.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_open_memory.Tpo -c -o libarchive/libarchive_test-archive_write_open_memory.obj `if test -f 'libarchive/archive_write_open_memory.c'; then $(CYGPATH_W) 'libarchive/archive_write_open_memory.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_open_memory.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_open_memory.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_open_memory.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_open_memory.c' object='libarchive/libarchive_test-archive_write_open_memory.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_open_memory.obj `if test -f 'libarchive/archive_write_open_memory.c'; then $(CYGPATH_W) 'libarchive/archive_write_open_memory.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_open_memory.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_compression_bzip2.o: libarchive/archive_write_set_compression_bzip2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_bzip2.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_bzip2.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_bzip2.o `test -f 'libarchive/archive_write_set_compression_bzip2.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_bzip2.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_bzip2.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_bzip2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_bzip2.c' object='libarchive/libarchive_test-archive_write_set_compression_bzip2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_compression_bzip2.o `test -f 'libarchive/archive_write_set_compression_bzip2.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_bzip2.c
+
+libarchive/libarchive_test-archive_write_set_compression_bzip2.obj: libarchive/archive_write_set_compression_bzip2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_bzip2.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_bzip2.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_bzip2.obj `if test -f 'libarchive/archive_write_set_compression_bzip2.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_bzip2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_bzip2.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_bzip2.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_bzip2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_bzip2.c' object='libarchive/libarchive_test-archive_write_set_compression_bzip2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_compression_bzip2.obj `if test -f 'libarchive/archive_write_set_compression_bzip2.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_bzip2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_bzip2.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_compression_compress.o: libarchive/archive_write_set_compression_compress.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_compress.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_compress.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_compress.o `test -f 'libarchive/archive_write_set_compression_compress.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_compress.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_compress.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_compress.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_compress.c' object='libarchive/libarchive_test-archive_write_set_compression_compress.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_compression_compress.o `test -f 'libarchive/archive_write_set_compression_compress.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_compress.c
+
+libarchive/libarchive_test-archive_write_set_compression_compress.obj: libarchive/archive_write_set_compression_compress.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_compress.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_compress.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_compress.obj `if test -f 'libarchive/archive_write_set_compression_compress.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_compress.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_compress.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_compress.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_compress.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_compress.c' object='libarchive/libarchive_test-archive_write_set_compression_compress.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_compression_compress.obj `if test -f 'libarchive/archive_write_set_compression_compress.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_compress.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_compress.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_compression_gzip.o: libarchive/archive_write_set_compression_gzip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_gzip.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_gzip.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_gzip.o `test -f 'libarchive/archive_write_set_compression_gzip.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_gzip.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_gzip.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_gzip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_gzip.c' object='libarchive/libarchive_test-archive_write_set_compression_gzip.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_compression_gzip.o `test -f 'libarchive/archive_write_set_compression_gzip.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_gzip.c
+
+libarchive/libarchive_test-archive_write_set_compression_gzip.obj: libarchive/archive_write_set_compression_gzip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_gzip.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_gzip.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_gzip.obj `if test -f 'libarchive/archive_write_set_compression_gzip.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_gzip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_gzip.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_gzip.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_gzip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_gzip.c' object='libarchive/libarchive_test-archive_write_set_compression_gzip.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_compression_gzip.obj `if test -f 'libarchive/archive_write_set_compression_gzip.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_gzip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_gzip.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_compression_none.o: libarchive/archive_write_set_compression_none.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_none.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_none.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_none.o `test -f 'libarchive/archive_write_set_compression_none.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_none.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_none.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_none.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_none.c' object='libarchive/libarchive_test-archive_write_set_compression_none.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_compression_none.o `test -f 'libarchive/archive_write_set_compression_none.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_none.c
+
+libarchive/libarchive_test-archive_write_set_compression_none.obj: libarchive/archive_write_set_compression_none.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_none.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_none.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_none.obj `if test -f 'libarchive/archive_write_set_compression_none.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_none.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_none.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_none.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_none.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_none.c' object='libarchive/libarchive_test-archive_write_set_compression_none.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_compression_none.obj `if test -f 'libarchive/archive_write_set_compression_none.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_none.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_none.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_compression_program.o: libarchive/archive_write_set_compression_program.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_program.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_program.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_program.o `test -f 'libarchive/archive_write_set_compression_program.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_program.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_program.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_program.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_program.c' object='libarchive/libarchive_test-archive_write_set_compression_program.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_compression_program.o `test -f 'libarchive/archive_write_set_compression_program.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_program.c
+
+libarchive/libarchive_test-archive_write_set_compression_program.obj: libarchive/archive_write_set_compression_program.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_program.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_program.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_program.obj `if test -f 'libarchive/archive_write_set_compression_program.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_program.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_program.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_program.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_program.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_program.c' object='libarchive/libarchive_test-archive_write_set_compression_program.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_compression_program.obj `if test -f 'libarchive/archive_write_set_compression_program.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_program.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_program.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_compression_xz.o: libarchive/archive_write_set_compression_xz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_xz.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_xz.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_xz.o `test -f 'libarchive/archive_write_set_compression_xz.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_xz.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_xz.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_xz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_xz.c' object='libarchive/libarchive_test-archive_write_set_compression_xz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_compression_xz.o `test -f 'libarchive/archive_write_set_compression_xz.c' || echo '$(srcdir)/'`libarchive/archive_write_set_compression_xz.c
+
+libarchive/libarchive_test-archive_write_set_compression_xz.obj: libarchive/archive_write_set_compression_xz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_compression_xz.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_xz.Tpo -c -o libarchive/libarchive_test-archive_write_set_compression_xz.obj `if test -f 'libarchive/archive_write_set_compression_xz.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_xz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_xz.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_xz.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_compression_xz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_compression_xz.c' object='libarchive/libarchive_test-archive_write_set_compression_xz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_compression_xz.obj `if test -f 'libarchive/archive_write_set_compression_xz.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_compression_xz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_compression_xz.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_format.o: libarchive/archive_write_set_format.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format.Tpo -c -o libarchive/libarchive_test-archive_write_set_format.o `test -f 'libarchive/archive_write_set_format.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format.c' object='libarchive/libarchive_test-archive_write_set_format.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format.o `test -f 'libarchive/archive_write_set_format.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format.c
+
+libarchive/libarchive_test-archive_write_set_format.obj: libarchive/archive_write_set_format.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format.Tpo -c -o libarchive/libarchive_test-archive_write_set_format.obj `if test -f 'libarchive/archive_write_set_format.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format.c' object='libarchive/libarchive_test-archive_write_set_format.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format.obj `if test -f 'libarchive/archive_write_set_format.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_format_ar.o: libarchive/archive_write_set_format_ar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_ar.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_ar.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_ar.o `test -f 'libarchive/archive_write_set_format_ar.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_ar.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_ar.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_ar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_ar.c' object='libarchive/libarchive_test-archive_write_set_format_ar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_ar.o `test -f 'libarchive/archive_write_set_format_ar.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_ar.c
+
+libarchive/libarchive_test-archive_write_set_format_ar.obj: libarchive/archive_write_set_format_ar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_ar.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_ar.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_ar.obj `if test -f 'libarchive/archive_write_set_format_ar.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_ar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_ar.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_ar.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_ar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_ar.c' object='libarchive/libarchive_test-archive_write_set_format_ar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_ar.obj `if test -f 'libarchive/archive_write_set_format_ar.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_ar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_ar.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_format_by_name.o: libarchive/archive_write_set_format_by_name.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_by_name.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_by_name.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_by_name.o `test -f 'libarchive/archive_write_set_format_by_name.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_by_name.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_by_name.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_by_name.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_by_name.c' object='libarchive/libarchive_test-archive_write_set_format_by_name.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_by_name.o `test -f 'libarchive/archive_write_set_format_by_name.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_by_name.c
+
+libarchive/libarchive_test-archive_write_set_format_by_name.obj: libarchive/archive_write_set_format_by_name.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_by_name.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_by_name.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_by_name.obj `if test -f 'libarchive/archive_write_set_format_by_name.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_by_name.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_by_name.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_by_name.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_by_name.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_by_name.c' object='libarchive/libarchive_test-archive_write_set_format_by_name.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_by_name.obj `if test -f 'libarchive/archive_write_set_format_by_name.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_by_name.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_by_name.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_format_cpio.o: libarchive/archive_write_set_format_cpio.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_cpio.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_cpio.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_cpio.o `test -f 'libarchive/archive_write_set_format_cpio.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_cpio.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_cpio.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_cpio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_cpio.c' object='libarchive/libarchive_test-archive_write_set_format_cpio.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_cpio.o `test -f 'libarchive/archive_write_set_format_cpio.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_cpio.c
+
+libarchive/libarchive_test-archive_write_set_format_cpio.obj: libarchive/archive_write_set_format_cpio.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_cpio.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_cpio.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_cpio.obj `if test -f 'libarchive/archive_write_set_format_cpio.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_cpio.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_cpio.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_cpio.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_cpio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_cpio.c' object='libarchive/libarchive_test-archive_write_set_format_cpio.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_cpio.obj `if test -f 'libarchive/archive_write_set_format_cpio.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_cpio.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_cpio.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_format_cpio_newc.o: libarchive/archive_write_set_format_cpio_newc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_cpio_newc.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_cpio_newc.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_cpio_newc.o `test -f 'libarchive/archive_write_set_format_cpio_newc.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_cpio_newc.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_cpio_newc.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_cpio_newc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_cpio_newc.c' object='libarchive/libarchive_test-archive_write_set_format_cpio_newc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_cpio_newc.o `test -f 'libarchive/archive_write_set_format_cpio_newc.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_cpio_newc.c
+
+libarchive/libarchive_test-archive_write_set_format_cpio_newc.obj: libarchive/archive_write_set_format_cpio_newc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_cpio_newc.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_cpio_newc.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_cpio_newc.obj `if test -f 'libarchive/archive_write_set_format_cpio_newc.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_cpio_newc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_cpio_newc.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_cpio_newc.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_cpio_newc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_cpio_newc.c' object='libarchive/libarchive_test-archive_write_set_format_cpio_newc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_cpio_newc.obj `if test -f 'libarchive/archive_write_set_format_cpio_newc.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_cpio_newc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_cpio_newc.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_format_mtree.o: libarchive/archive_write_set_format_mtree.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_mtree.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_mtree.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_mtree.o `test -f 'libarchive/archive_write_set_format_mtree.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_mtree.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_mtree.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_mtree.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_mtree.c' object='libarchive/libarchive_test-archive_write_set_format_mtree.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_mtree.o `test -f 'libarchive/archive_write_set_format_mtree.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_mtree.c
+
+libarchive/libarchive_test-archive_write_set_format_mtree.obj: libarchive/archive_write_set_format_mtree.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_mtree.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_mtree.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_mtree.obj `if test -f 'libarchive/archive_write_set_format_mtree.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_mtree.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_mtree.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_mtree.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_mtree.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_mtree.c' object='libarchive/libarchive_test-archive_write_set_format_mtree.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_mtree.obj `if test -f 'libarchive/archive_write_set_format_mtree.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_mtree.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_mtree.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_format_pax.o: libarchive/archive_write_set_format_pax.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_pax.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_pax.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_pax.o `test -f 'libarchive/archive_write_set_format_pax.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_pax.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_pax.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_pax.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_pax.c' object='libarchive/libarchive_test-archive_write_set_format_pax.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_pax.o `test -f 'libarchive/archive_write_set_format_pax.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_pax.c
+
+libarchive/libarchive_test-archive_write_set_format_pax.obj: libarchive/archive_write_set_format_pax.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_pax.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_pax.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_pax.obj `if test -f 'libarchive/archive_write_set_format_pax.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_pax.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_pax.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_pax.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_pax.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_pax.c' object='libarchive/libarchive_test-archive_write_set_format_pax.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_pax.obj `if test -f 'libarchive/archive_write_set_format_pax.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_pax.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_pax.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_format_shar.o: libarchive/archive_write_set_format_shar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_shar.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_shar.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_shar.o `test -f 'libarchive/archive_write_set_format_shar.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_shar.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_shar.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_shar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_shar.c' object='libarchive/libarchive_test-archive_write_set_format_shar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_shar.o `test -f 'libarchive/archive_write_set_format_shar.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_shar.c
+
+libarchive/libarchive_test-archive_write_set_format_shar.obj: libarchive/archive_write_set_format_shar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_shar.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_shar.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_shar.obj `if test -f 'libarchive/archive_write_set_format_shar.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_shar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_shar.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_shar.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_shar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_shar.c' object='libarchive/libarchive_test-archive_write_set_format_shar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_shar.obj `if test -f 'libarchive/archive_write_set_format_shar.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_shar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_shar.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_format_ustar.o: libarchive/archive_write_set_format_ustar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_ustar.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_ustar.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_ustar.o `test -f 'libarchive/archive_write_set_format_ustar.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_ustar.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_ustar.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_ustar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_ustar.c' object='libarchive/libarchive_test-archive_write_set_format_ustar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_ustar.o `test -f 'libarchive/archive_write_set_format_ustar.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_ustar.c
+
+libarchive/libarchive_test-archive_write_set_format_ustar.obj: libarchive/archive_write_set_format_ustar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_ustar.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_ustar.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_ustar.obj `if test -f 'libarchive/archive_write_set_format_ustar.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_ustar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_ustar.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_ustar.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_ustar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_ustar.c' object='libarchive/libarchive_test-archive_write_set_format_ustar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_ustar.obj `if test -f 'libarchive/archive_write_set_format_ustar.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_ustar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_ustar.c'; fi`
+
+libarchive/libarchive_test-archive_write_set_format_zip.o: libarchive/archive_write_set_format_zip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_zip.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_zip.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_zip.o `test -f 'libarchive/archive_write_set_format_zip.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_zip.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_zip.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_zip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_zip.c' object='libarchive/libarchive_test-archive_write_set_format_zip.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_zip.o `test -f 'libarchive/archive_write_set_format_zip.c' || echo '$(srcdir)/'`libarchive/archive_write_set_format_zip.c
+
+libarchive/libarchive_test-archive_write_set_format_zip.obj: libarchive/archive_write_set_format_zip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_write_set_format_zip.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_zip.Tpo -c -o libarchive/libarchive_test-archive_write_set_format_zip.obj `if test -f 'libarchive/archive_write_set_format_zip.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_zip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_zip.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_zip.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_write_set_format_zip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_write_set_format_zip.c' object='libarchive/libarchive_test-archive_write_set_format_zip.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_write_set_format_zip.obj `if test -f 'libarchive/archive_write_set_format_zip.c'; then $(CYGPATH_W) 'libarchive/archive_write_set_format_zip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_write_set_format_zip.c'; fi`
+
+libarchive/libarchive_test-filter_fork.o: libarchive/filter_fork.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-filter_fork.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-filter_fork.Tpo -c -o libarchive/libarchive_test-filter_fork.o `test -f 'libarchive/filter_fork.c' || echo '$(srcdir)/'`libarchive/filter_fork.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-filter_fork.Tpo libarchive/$(DEPDIR)/libarchive_test-filter_fork.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/filter_fork.c' object='libarchive/libarchive_test-filter_fork.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-filter_fork.o `test -f 'libarchive/filter_fork.c' || echo '$(srcdir)/'`libarchive/filter_fork.c
+
+libarchive/libarchive_test-filter_fork.obj: libarchive/filter_fork.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-filter_fork.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-filter_fork.Tpo -c -o libarchive/libarchive_test-filter_fork.obj `if test -f 'libarchive/filter_fork.c'; then $(CYGPATH_W) 'libarchive/filter_fork.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/filter_fork.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-filter_fork.Tpo libarchive/$(DEPDIR)/libarchive_test-filter_fork.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/filter_fork.c' object='libarchive/libarchive_test-filter_fork.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-filter_fork.obj `if test -f 'libarchive/filter_fork.c'; then $(CYGPATH_W) 'libarchive/filter_fork.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/filter_fork.c'; fi`
+
+libarchive/libarchive_test-archive_entry_copy_bhfi.o: libarchive/archive_entry_copy_bhfi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_copy_bhfi.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_bhfi.Tpo -c -o libarchive/libarchive_test-archive_entry_copy_bhfi.o `test -f 'libarchive/archive_entry_copy_bhfi.c' || echo '$(srcdir)/'`libarchive/archive_entry_copy_bhfi.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_bhfi.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_bhfi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_copy_bhfi.c' object='libarchive/libarchive_test-archive_entry_copy_bhfi.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_copy_bhfi.o `test -f 'libarchive/archive_entry_copy_bhfi.c' || echo '$(srcdir)/'`libarchive/archive_entry_copy_bhfi.c
+
+libarchive/libarchive_test-archive_entry_copy_bhfi.obj: libarchive/archive_entry_copy_bhfi.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_entry_copy_bhfi.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_bhfi.Tpo -c -o libarchive/libarchive_test-archive_entry_copy_bhfi.obj `if test -f 'libarchive/archive_entry_copy_bhfi.c'; then $(CYGPATH_W) 'libarchive/archive_entry_copy_bhfi.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_copy_bhfi.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_bhfi.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_entry_copy_bhfi.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_entry_copy_bhfi.c' object='libarchive/libarchive_test-archive_entry_copy_bhfi.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_entry_copy_bhfi.obj `if test -f 'libarchive/archive_entry_copy_bhfi.c'; then $(CYGPATH_W) 'libarchive/archive_entry_copy_bhfi.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_entry_copy_bhfi.c'; fi`
+
+libarchive/libarchive_test-archive_windows.o: libarchive/archive_windows.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_windows.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_windows.Tpo -c -o libarchive/libarchive_test-archive_windows.o `test -f 'libarchive/archive_windows.c' || echo '$(srcdir)/'`libarchive/archive_windows.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_windows.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_windows.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_windows.c' object='libarchive/libarchive_test-archive_windows.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_windows.o `test -f 'libarchive/archive_windows.c' || echo '$(srcdir)/'`libarchive/archive_windows.c
+
+libarchive/libarchive_test-archive_windows.obj: libarchive/archive_windows.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-archive_windows.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-archive_windows.Tpo -c -o libarchive/libarchive_test-archive_windows.obj `if test -f 'libarchive/archive_windows.c'; then $(CYGPATH_W) 'libarchive/archive_windows.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_windows.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-archive_windows.Tpo libarchive/$(DEPDIR)/libarchive_test-archive_windows.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/archive_windows.c' object='libarchive/libarchive_test-archive_windows.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-archive_windows.obj `if test -f 'libarchive/archive_windows.c'; then $(CYGPATH_W) 'libarchive/archive_windows.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/archive_windows.c'; fi`
+
+libarchive/libarchive_test-filter_fork_windows.o: libarchive/filter_fork_windows.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-filter_fork_windows.o -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-filter_fork_windows.Tpo -c -o libarchive/libarchive_test-filter_fork_windows.o `test -f 'libarchive/filter_fork_windows.c' || echo '$(srcdir)/'`libarchive/filter_fork_windows.c
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-filter_fork_windows.Tpo libarchive/$(DEPDIR)/libarchive_test-filter_fork_windows.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/filter_fork_windows.c' object='libarchive/libarchive_test-filter_fork_windows.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-filter_fork_windows.o `test -f 'libarchive/filter_fork_windows.c' || echo '$(srcdir)/'`libarchive/filter_fork_windows.c
+
+libarchive/libarchive_test-filter_fork_windows.obj: libarchive/filter_fork_windows.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/libarchive_test-filter_fork_windows.obj -MD -MP -MF libarchive/$(DEPDIR)/libarchive_test-filter_fork_windows.Tpo -c -o libarchive/libarchive_test-filter_fork_windows.obj `if test -f 'libarchive/filter_fork_windows.c'; then $(CYGPATH_W) 'libarchive/filter_fork_windows.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/filter_fork_windows.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/$(DEPDIR)/libarchive_test-filter_fork_windows.Tpo libarchive/$(DEPDIR)/libarchive_test-filter_fork_windows.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/filter_fork_windows.c' object='libarchive/libarchive_test-filter_fork_windows.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/libarchive_test-filter_fork_windows.obj `if test -f 'libarchive/filter_fork_windows.c'; then $(CYGPATH_W) 'libarchive/filter_fork_windows.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/filter_fork_windows.c'; fi`
+
+libarchive/test/libarchive_test-main.o: libarchive/test/main.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-main.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-main.Tpo -c -o libarchive/test/libarchive_test-main.o `test -f 'libarchive/test/main.c' || echo '$(srcdir)/'`libarchive/test/main.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-main.Tpo libarchive/test/$(DEPDIR)/libarchive_test-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/main.c' object='libarchive/test/libarchive_test-main.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-main.o `test -f 'libarchive/test/main.c' || echo '$(srcdir)/'`libarchive/test/main.c
+
+libarchive/test/libarchive_test-main.obj: libarchive/test/main.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-main.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-main.Tpo -c -o libarchive/test/libarchive_test-main.obj `if test -f 'libarchive/test/main.c'; then $(CYGPATH_W) 'libarchive/test/main.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/main.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-main.Tpo libarchive/test/$(DEPDIR)/libarchive_test-main.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/main.c' object='libarchive/test/libarchive_test-main.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-main.obj `if test -f 'libarchive/test/main.c'; then $(CYGPATH_W) 'libarchive/test/main.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/main.c'; fi`
+
+libarchive/test/libarchive_test-read_open_memory.o: libarchive/test/read_open_memory.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-read_open_memory.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-read_open_memory.Tpo -c -o libarchive/test/libarchive_test-read_open_memory.o `test -f 'libarchive/test/read_open_memory.c' || echo '$(srcdir)/'`libarchive/test/read_open_memory.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-read_open_memory.Tpo libarchive/test/$(DEPDIR)/libarchive_test-read_open_memory.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/read_open_memory.c' object='libarchive/test/libarchive_test-read_open_memory.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-read_open_memory.o `test -f 'libarchive/test/read_open_memory.c' || echo '$(srcdir)/'`libarchive/test/read_open_memory.c
+
+libarchive/test/libarchive_test-read_open_memory.obj: libarchive/test/read_open_memory.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-read_open_memory.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-read_open_memory.Tpo -c -o libarchive/test/libarchive_test-read_open_memory.obj `if test -f 'libarchive/test/read_open_memory.c'; then $(CYGPATH_W) 'libarchive/test/read_open_memory.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/read_open_memory.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-read_open_memory.Tpo libarchive/test/$(DEPDIR)/libarchive_test-read_open_memory.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/read_open_memory.c' object='libarchive/test/libarchive_test-read_open_memory.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-read_open_memory.obj `if test -f 'libarchive/test/read_open_memory.c'; then $(CYGPATH_W) 'libarchive/test/read_open_memory.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/read_open_memory.c'; fi`
+
+libarchive/test/libarchive_test-test_acl_basic.o: libarchive/test/test_acl_basic.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_acl_basic.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_acl_basic.Tpo -c -o libarchive/test/libarchive_test-test_acl_basic.o `test -f 'libarchive/test/test_acl_basic.c' || echo '$(srcdir)/'`libarchive/test/test_acl_basic.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_acl_basic.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_acl_basic.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_acl_basic.c' object='libarchive/test/libarchive_test-test_acl_basic.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_acl_basic.o `test -f 'libarchive/test/test_acl_basic.c' || echo '$(srcdir)/'`libarchive/test/test_acl_basic.c
+
+libarchive/test/libarchive_test-test_acl_basic.obj: libarchive/test/test_acl_basic.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_acl_basic.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_acl_basic.Tpo -c -o libarchive/test/libarchive_test-test_acl_basic.obj `if test -f 'libarchive/test/test_acl_basic.c'; then $(CYGPATH_W) 'libarchive/test/test_acl_basic.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_acl_basic.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_acl_basic.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_acl_basic.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_acl_basic.c' object='libarchive/test/libarchive_test-test_acl_basic.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_acl_basic.obj `if test -f 'libarchive/test/test_acl_basic.c'; then $(CYGPATH_W) 'libarchive/test/test_acl_basic.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_acl_basic.c'; fi`
+
+libarchive/test/libarchive_test-test_acl_freebsd.o: libarchive/test/test_acl_freebsd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_acl_freebsd.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_acl_freebsd.Tpo -c -o libarchive/test/libarchive_test-test_acl_freebsd.o `test -f 'libarchive/test/test_acl_freebsd.c' || echo '$(srcdir)/'`libarchive/test/test_acl_freebsd.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_acl_freebsd.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_acl_freebsd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_acl_freebsd.c' object='libarchive/test/libarchive_test-test_acl_freebsd.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_acl_freebsd.o `test -f 'libarchive/test/test_acl_freebsd.c' || echo '$(srcdir)/'`libarchive/test/test_acl_freebsd.c
+
+libarchive/test/libarchive_test-test_acl_freebsd.obj: libarchive/test/test_acl_freebsd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_acl_freebsd.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_acl_freebsd.Tpo -c -o libarchive/test/libarchive_test-test_acl_freebsd.obj `if test -f 'libarchive/test/test_acl_freebsd.c'; then $(CYGPATH_W) 'libarchive/test/test_acl_freebsd.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_acl_freebsd.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_acl_freebsd.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_acl_freebsd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_acl_freebsd.c' object='libarchive/test/libarchive_test-test_acl_freebsd.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_acl_freebsd.obj `if test -f 'libarchive/test/test_acl_freebsd.c'; then $(CYGPATH_W) 'libarchive/test/test_acl_freebsd.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_acl_freebsd.c'; fi`
+
+libarchive/test/libarchive_test-test_acl_pax.o: libarchive/test/test_acl_pax.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_acl_pax.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_acl_pax.Tpo -c -o libarchive/test/libarchive_test-test_acl_pax.o `test -f 'libarchive/test/test_acl_pax.c' || echo '$(srcdir)/'`libarchive/test/test_acl_pax.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_acl_pax.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_acl_pax.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_acl_pax.c' object='libarchive/test/libarchive_test-test_acl_pax.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_acl_pax.o `test -f 'libarchive/test/test_acl_pax.c' || echo '$(srcdir)/'`libarchive/test/test_acl_pax.c
+
+libarchive/test/libarchive_test-test_acl_pax.obj: libarchive/test/test_acl_pax.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_acl_pax.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_acl_pax.Tpo -c -o libarchive/test/libarchive_test-test_acl_pax.obj `if test -f 'libarchive/test/test_acl_pax.c'; then $(CYGPATH_W) 'libarchive/test/test_acl_pax.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_acl_pax.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_acl_pax.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_acl_pax.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_acl_pax.c' object='libarchive/test/libarchive_test-test_acl_pax.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_acl_pax.obj `if test -f 'libarchive/test/test_acl_pax.c'; then $(CYGPATH_W) 'libarchive/test/test_acl_pax.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_acl_pax.c'; fi`
+
+libarchive/test/libarchive_test-test_archive_api_feature.o: libarchive/test/test_archive_api_feature.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_archive_api_feature.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_archive_api_feature.Tpo -c -o libarchive/test/libarchive_test-test_archive_api_feature.o `test -f 'libarchive/test/test_archive_api_feature.c' || echo '$(srcdir)/'`libarchive/test/test_archive_api_feature.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_archive_api_feature.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_archive_api_feature.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_archive_api_feature.c' object='libarchive/test/libarchive_test-test_archive_api_feature.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_archive_api_feature.o `test -f 'libarchive/test/test_archive_api_feature.c' || echo '$(srcdir)/'`libarchive/test/test_archive_api_feature.c
+
+libarchive/test/libarchive_test-test_archive_api_feature.obj: libarchive/test/test_archive_api_feature.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_archive_api_feature.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_archive_api_feature.Tpo -c -o libarchive/test/libarchive_test-test_archive_api_feature.obj `if test -f 'libarchive/test/test_archive_api_feature.c'; then $(CYGPATH_W) 'libarchive/test/test_archive_api_feature.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_archive_api_feature.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_archive_api_feature.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_archive_api_feature.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_archive_api_feature.c' object='libarchive/test/libarchive_test-test_archive_api_feature.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_archive_api_feature.obj `if test -f 'libarchive/test/test_archive_api_feature.c'; then $(CYGPATH_W) 'libarchive/test/test_archive_api_feature.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_archive_api_feature.c'; fi`
+
+libarchive/test/libarchive_test-test_bad_fd.o: libarchive/test/test_bad_fd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_bad_fd.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_bad_fd.Tpo -c -o libarchive/test/libarchive_test-test_bad_fd.o `test -f 'libarchive/test/test_bad_fd.c' || echo '$(srcdir)/'`libarchive/test/test_bad_fd.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_bad_fd.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_bad_fd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_bad_fd.c' object='libarchive/test/libarchive_test-test_bad_fd.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_bad_fd.o `test -f 'libarchive/test/test_bad_fd.c' || echo '$(srcdir)/'`libarchive/test/test_bad_fd.c
+
+libarchive/test/libarchive_test-test_bad_fd.obj: libarchive/test/test_bad_fd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_bad_fd.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_bad_fd.Tpo -c -o libarchive/test/libarchive_test-test_bad_fd.obj `if test -f 'libarchive/test/test_bad_fd.c'; then $(CYGPATH_W) 'libarchive/test/test_bad_fd.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_bad_fd.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_bad_fd.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_bad_fd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_bad_fd.c' object='libarchive/test/libarchive_test-test_bad_fd.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_bad_fd.obj `if test -f 'libarchive/test/test_bad_fd.c'; then $(CYGPATH_W) 'libarchive/test/test_bad_fd.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_bad_fd.c'; fi`
+
+libarchive/test/libarchive_test-test_compat_bzip2.o: libarchive/test/test_compat_bzip2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_bzip2.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_bzip2.Tpo -c -o libarchive/test/libarchive_test-test_compat_bzip2.o `test -f 'libarchive/test/test_compat_bzip2.c' || echo '$(srcdir)/'`libarchive/test/test_compat_bzip2.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_bzip2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_bzip2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_bzip2.c' object='libarchive/test/libarchive_test-test_compat_bzip2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_bzip2.o `test -f 'libarchive/test/test_compat_bzip2.c' || echo '$(srcdir)/'`libarchive/test/test_compat_bzip2.c
+
+libarchive/test/libarchive_test-test_compat_bzip2.obj: libarchive/test/test_compat_bzip2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_bzip2.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_bzip2.Tpo -c -o libarchive/test/libarchive_test-test_compat_bzip2.obj `if test -f 'libarchive/test/test_compat_bzip2.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_bzip2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_bzip2.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_bzip2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_bzip2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_bzip2.c' object='libarchive/test/libarchive_test-test_compat_bzip2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_bzip2.obj `if test -f 'libarchive/test/test_compat_bzip2.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_bzip2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_bzip2.c'; fi`
+
+libarchive/test/libarchive_test-test_compat_cpio.o: libarchive/test/test_compat_cpio.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_cpio.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_cpio.Tpo -c -o libarchive/test/libarchive_test-test_compat_cpio.o `test -f 'libarchive/test/test_compat_cpio.c' || echo '$(srcdir)/'`libarchive/test/test_compat_cpio.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_cpio.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_cpio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_cpio.c' object='libarchive/test/libarchive_test-test_compat_cpio.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_cpio.o `test -f 'libarchive/test/test_compat_cpio.c' || echo '$(srcdir)/'`libarchive/test/test_compat_cpio.c
+
+libarchive/test/libarchive_test-test_compat_cpio.obj: libarchive/test/test_compat_cpio.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_cpio.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_cpio.Tpo -c -o libarchive/test/libarchive_test-test_compat_cpio.obj `if test -f 'libarchive/test/test_compat_cpio.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_cpio.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_cpio.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_cpio.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_cpio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_cpio.c' object='libarchive/test/libarchive_test-test_compat_cpio.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_cpio.obj `if test -f 'libarchive/test/test_compat_cpio.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_cpio.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_cpio.c'; fi`
+
+libarchive/test/libarchive_test-test_compat_gtar.o: libarchive/test/test_compat_gtar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_gtar.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_gtar.Tpo -c -o libarchive/test/libarchive_test-test_compat_gtar.o `test -f 'libarchive/test/test_compat_gtar.c' || echo '$(srcdir)/'`libarchive/test/test_compat_gtar.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_gtar.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_gtar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_gtar.c' object='libarchive/test/libarchive_test-test_compat_gtar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_gtar.o `test -f 'libarchive/test/test_compat_gtar.c' || echo '$(srcdir)/'`libarchive/test/test_compat_gtar.c
+
+libarchive/test/libarchive_test-test_compat_gtar.obj: libarchive/test/test_compat_gtar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_gtar.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_gtar.Tpo -c -o libarchive/test/libarchive_test-test_compat_gtar.obj `if test -f 'libarchive/test/test_compat_gtar.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_gtar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_gtar.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_gtar.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_gtar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_gtar.c' object='libarchive/test/libarchive_test-test_compat_gtar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_gtar.obj `if test -f 'libarchive/test/test_compat_gtar.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_gtar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_gtar.c'; fi`
+
+libarchive/test/libarchive_test-test_compat_gzip.o: libarchive/test/test_compat_gzip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_gzip.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_gzip.Tpo -c -o libarchive/test/libarchive_test-test_compat_gzip.o `test -f 'libarchive/test/test_compat_gzip.c' || echo '$(srcdir)/'`libarchive/test/test_compat_gzip.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_gzip.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_gzip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_gzip.c' object='libarchive/test/libarchive_test-test_compat_gzip.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_gzip.o `test -f 'libarchive/test/test_compat_gzip.c' || echo '$(srcdir)/'`libarchive/test/test_compat_gzip.c
+
+libarchive/test/libarchive_test-test_compat_gzip.obj: libarchive/test/test_compat_gzip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_gzip.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_gzip.Tpo -c -o libarchive/test/libarchive_test-test_compat_gzip.obj `if test -f 'libarchive/test/test_compat_gzip.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_gzip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_gzip.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_gzip.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_gzip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_gzip.c' object='libarchive/test/libarchive_test-test_compat_gzip.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_gzip.obj `if test -f 'libarchive/test/test_compat_gzip.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_gzip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_gzip.c'; fi`
+
+libarchive/test/libarchive_test-test_compat_lzma.o: libarchive/test/test_compat_lzma.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_lzma.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_lzma.Tpo -c -o libarchive/test/libarchive_test-test_compat_lzma.o `test -f 'libarchive/test/test_compat_lzma.c' || echo '$(srcdir)/'`libarchive/test/test_compat_lzma.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_lzma.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_lzma.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_lzma.c' object='libarchive/test/libarchive_test-test_compat_lzma.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_lzma.o `test -f 'libarchive/test/test_compat_lzma.c' || echo '$(srcdir)/'`libarchive/test/test_compat_lzma.c
+
+libarchive/test/libarchive_test-test_compat_lzma.obj: libarchive/test/test_compat_lzma.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_lzma.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_lzma.Tpo -c -o libarchive/test/libarchive_test-test_compat_lzma.obj `if test -f 'libarchive/test/test_compat_lzma.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_lzma.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_lzma.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_lzma.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_lzma.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_lzma.c' object='libarchive/test/libarchive_test-test_compat_lzma.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_lzma.obj `if test -f 'libarchive/test/test_compat_lzma.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_lzma.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_lzma.c'; fi`
+
+libarchive/test/libarchive_test-test_compat_solaris_tar_acl.o: libarchive/test/test_compat_solaris_tar_acl.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_solaris_tar_acl.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_solaris_tar_acl.Tpo -c -o libarchive/test/libarchive_test-test_compat_solaris_tar_acl.o `test -f 'libarchive/test/test_compat_solaris_tar_acl.c' || echo '$(srcdir)/'`libarchive/test/test_compat_solaris_tar_acl.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_solaris_tar_acl.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_solaris_tar_acl.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_solaris_tar_acl.c' object='libarchive/test/libarchive_test-test_compat_solaris_tar_acl.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_solaris_tar_acl.o `test -f 'libarchive/test/test_compat_solaris_tar_acl.c' || echo '$(srcdir)/'`libarchive/test/test_compat_solaris_tar_acl.c
+
+libarchive/test/libarchive_test-test_compat_solaris_tar_acl.obj: libarchive/test/test_compat_solaris_tar_acl.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_solaris_tar_acl.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_solaris_tar_acl.Tpo -c -o libarchive/test/libarchive_test-test_compat_solaris_tar_acl.obj `if test -f 'libarchive/test/test_compat_solaris_tar_acl.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_solaris_tar_acl.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_solaris_tar_acl.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_solaris_tar_acl.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_solaris_tar_acl.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_solaris_tar_acl.c' object='libarchive/test/libarchive_test-test_compat_solaris_tar_acl.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_solaris_tar_acl.obj `if test -f 'libarchive/test/test_compat_solaris_tar_acl.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_solaris_tar_acl.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_solaris_tar_acl.c'; fi`
+
+libarchive/test/libarchive_test-test_compat_tar_hardlink.o: libarchive/test/test_compat_tar_hardlink.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_tar_hardlink.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_tar_hardlink.Tpo -c -o libarchive/test/libarchive_test-test_compat_tar_hardlink.o `test -f 'libarchive/test/test_compat_tar_hardlink.c' || echo '$(srcdir)/'`libarchive/test/test_compat_tar_hardlink.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_tar_hardlink.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_tar_hardlink.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_tar_hardlink.c' object='libarchive/test/libarchive_test-test_compat_tar_hardlink.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_tar_hardlink.o `test -f 'libarchive/test/test_compat_tar_hardlink.c' || echo '$(srcdir)/'`libarchive/test/test_compat_tar_hardlink.c
+
+libarchive/test/libarchive_test-test_compat_tar_hardlink.obj: libarchive/test/test_compat_tar_hardlink.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_tar_hardlink.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_tar_hardlink.Tpo -c -o libarchive/test/libarchive_test-test_compat_tar_hardlink.obj `if test -f 'libarchive/test/test_compat_tar_hardlink.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_tar_hardlink.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_tar_hardlink.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_tar_hardlink.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_tar_hardlink.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_tar_hardlink.c' object='libarchive/test/libarchive_test-test_compat_tar_hardlink.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_tar_hardlink.obj `if test -f 'libarchive/test/test_compat_tar_hardlink.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_tar_hardlink.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_tar_hardlink.c'; fi`
+
+libarchive/test/libarchive_test-test_compat_xz.o: libarchive/test/test_compat_xz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_xz.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_xz.Tpo -c -o libarchive/test/libarchive_test-test_compat_xz.o `test -f 'libarchive/test/test_compat_xz.c' || echo '$(srcdir)/'`libarchive/test/test_compat_xz.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_xz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_xz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_xz.c' object='libarchive/test/libarchive_test-test_compat_xz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_xz.o `test -f 'libarchive/test/test_compat_xz.c' || echo '$(srcdir)/'`libarchive/test/test_compat_xz.c
+
+libarchive/test/libarchive_test-test_compat_xz.obj: libarchive/test/test_compat_xz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_xz.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_xz.Tpo -c -o libarchive/test/libarchive_test-test_compat_xz.obj `if test -f 'libarchive/test/test_compat_xz.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_xz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_xz.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_xz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_xz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_xz.c' object='libarchive/test/libarchive_test-test_compat_xz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_xz.obj `if test -f 'libarchive/test/test_compat_xz.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_xz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_xz.c'; fi`
+
+libarchive/test/libarchive_test-test_compat_zip.o: libarchive/test/test_compat_zip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_zip.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_zip.Tpo -c -o libarchive/test/libarchive_test-test_compat_zip.o `test -f 'libarchive/test/test_compat_zip.c' || echo '$(srcdir)/'`libarchive/test/test_compat_zip.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_zip.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_zip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_zip.c' object='libarchive/test/libarchive_test-test_compat_zip.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_zip.o `test -f 'libarchive/test/test_compat_zip.c' || echo '$(srcdir)/'`libarchive/test/test_compat_zip.c
+
+libarchive/test/libarchive_test-test_compat_zip.obj: libarchive/test/test_compat_zip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_compat_zip.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_compat_zip.Tpo -c -o libarchive/test/libarchive_test-test_compat_zip.obj `if test -f 'libarchive/test/test_compat_zip.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_zip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_zip.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_compat_zip.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_compat_zip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_compat_zip.c' object='libarchive/test/libarchive_test-test_compat_zip.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_compat_zip.obj `if test -f 'libarchive/test/test_compat_zip.c'; then $(CYGPATH_W) 'libarchive/test/test_compat_zip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_compat_zip.c'; fi`
+
+libarchive/test/libarchive_test-test_empty_write.o: libarchive/test/test_empty_write.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_empty_write.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_empty_write.Tpo -c -o libarchive/test/libarchive_test-test_empty_write.o `test -f 'libarchive/test/test_empty_write.c' || echo '$(srcdir)/'`libarchive/test/test_empty_write.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_empty_write.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_empty_write.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_empty_write.c' object='libarchive/test/libarchive_test-test_empty_write.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_empty_write.o `test -f 'libarchive/test/test_empty_write.c' || echo '$(srcdir)/'`libarchive/test/test_empty_write.c
+
+libarchive/test/libarchive_test-test_empty_write.obj: libarchive/test/test_empty_write.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_empty_write.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_empty_write.Tpo -c -o libarchive/test/libarchive_test-test_empty_write.obj `if test -f 'libarchive/test/test_empty_write.c'; then $(CYGPATH_W) 'libarchive/test/test_empty_write.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_empty_write.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_empty_write.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_empty_write.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_empty_write.c' object='libarchive/test/libarchive_test-test_empty_write.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_empty_write.obj `if test -f 'libarchive/test/test_empty_write.c'; then $(CYGPATH_W) 'libarchive/test/test_empty_write.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_empty_write.c'; fi`
+
+libarchive/test/libarchive_test-test_entry.o: libarchive/test/test_entry.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_entry.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_entry.Tpo -c -o libarchive/test/libarchive_test-test_entry.o `test -f 'libarchive/test/test_entry.c' || echo '$(srcdir)/'`libarchive/test/test_entry.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_entry.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_entry.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_entry.c' object='libarchive/test/libarchive_test-test_entry.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_entry.o `test -f 'libarchive/test/test_entry.c' || echo '$(srcdir)/'`libarchive/test/test_entry.c
+
+libarchive/test/libarchive_test-test_entry.obj: libarchive/test/test_entry.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_entry.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_entry.Tpo -c -o libarchive/test/libarchive_test-test_entry.obj `if test -f 'libarchive/test/test_entry.c'; then $(CYGPATH_W) 'libarchive/test/test_entry.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_entry.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_entry.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_entry.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_entry.c' object='libarchive/test/libarchive_test-test_entry.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_entry.obj `if test -f 'libarchive/test/test_entry.c'; then $(CYGPATH_W) 'libarchive/test/test_entry.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_entry.c'; fi`
+
+libarchive/test/libarchive_test-test_extattr_freebsd.o: libarchive/test/test_extattr_freebsd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_extattr_freebsd.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_extattr_freebsd.Tpo -c -o libarchive/test/libarchive_test-test_extattr_freebsd.o `test -f 'libarchive/test/test_extattr_freebsd.c' || echo '$(srcdir)/'`libarchive/test/test_extattr_freebsd.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_extattr_freebsd.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_extattr_freebsd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_extattr_freebsd.c' object='libarchive/test/libarchive_test-test_extattr_freebsd.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_extattr_freebsd.o `test -f 'libarchive/test/test_extattr_freebsd.c' || echo '$(srcdir)/'`libarchive/test/test_extattr_freebsd.c
+
+libarchive/test/libarchive_test-test_extattr_freebsd.obj: libarchive/test/test_extattr_freebsd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_extattr_freebsd.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_extattr_freebsd.Tpo -c -o libarchive/test/libarchive_test-test_extattr_freebsd.obj `if test -f 'libarchive/test/test_extattr_freebsd.c'; then $(CYGPATH_W) 'libarchive/test/test_extattr_freebsd.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_extattr_freebsd.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_extattr_freebsd.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_extattr_freebsd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_extattr_freebsd.c' object='libarchive/test/libarchive_test-test_extattr_freebsd.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_extattr_freebsd.obj `if test -f 'libarchive/test/test_extattr_freebsd.c'; then $(CYGPATH_W) 'libarchive/test/test_extattr_freebsd.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_extattr_freebsd.c'; fi`
+
+libarchive/test/libarchive_test-test_fuzz.o: libarchive/test/test_fuzz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_fuzz.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_fuzz.Tpo -c -o libarchive/test/libarchive_test-test_fuzz.o `test -f 'libarchive/test/test_fuzz.c' || echo '$(srcdir)/'`libarchive/test/test_fuzz.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_fuzz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_fuzz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_fuzz.c' object='libarchive/test/libarchive_test-test_fuzz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_fuzz.o `test -f 'libarchive/test/test_fuzz.c' || echo '$(srcdir)/'`libarchive/test/test_fuzz.c
+
+libarchive/test/libarchive_test-test_fuzz.obj: libarchive/test/test_fuzz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_fuzz.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_fuzz.Tpo -c -o libarchive/test/libarchive_test-test_fuzz.obj `if test -f 'libarchive/test/test_fuzz.c'; then $(CYGPATH_W) 'libarchive/test/test_fuzz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_fuzz.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_fuzz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_fuzz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_fuzz.c' object='libarchive/test/libarchive_test-test_fuzz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_fuzz.obj `if test -f 'libarchive/test/test_fuzz.c'; then $(CYGPATH_W) 'libarchive/test/test_fuzz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_fuzz.c'; fi`
+
+libarchive/test/libarchive_test-test_entry_strmode.o: libarchive/test/test_entry_strmode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_entry_strmode.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_entry_strmode.Tpo -c -o libarchive/test/libarchive_test-test_entry_strmode.o `test -f 'libarchive/test/test_entry_strmode.c' || echo '$(srcdir)/'`libarchive/test/test_entry_strmode.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_entry_strmode.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_entry_strmode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_entry_strmode.c' object='libarchive/test/libarchive_test-test_entry_strmode.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_entry_strmode.o `test -f 'libarchive/test/test_entry_strmode.c' || echo '$(srcdir)/'`libarchive/test/test_entry_strmode.c
+
+libarchive/test/libarchive_test-test_entry_strmode.obj: libarchive/test/test_entry_strmode.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_entry_strmode.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_entry_strmode.Tpo -c -o libarchive/test/libarchive_test-test_entry_strmode.obj `if test -f 'libarchive/test/test_entry_strmode.c'; then $(CYGPATH_W) 'libarchive/test/test_entry_strmode.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_entry_strmode.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_entry_strmode.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_entry_strmode.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_entry_strmode.c' object='libarchive/test/libarchive_test-test_entry_strmode.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_entry_strmode.obj `if test -f 'libarchive/test/test_entry_strmode.c'; then $(CYGPATH_W) 'libarchive/test/test_entry_strmode.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_entry_strmode.c'; fi`
+
+libarchive/test/libarchive_test-test_link_resolver.o: libarchive/test/test_link_resolver.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_link_resolver.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_link_resolver.Tpo -c -o libarchive/test/libarchive_test-test_link_resolver.o `test -f 'libarchive/test/test_link_resolver.c' || echo '$(srcdir)/'`libarchive/test/test_link_resolver.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_link_resolver.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_link_resolver.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_link_resolver.c' object='libarchive/test/libarchive_test-test_link_resolver.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_link_resolver.o `test -f 'libarchive/test/test_link_resolver.c' || echo '$(srcdir)/'`libarchive/test/test_link_resolver.c
+
+libarchive/test/libarchive_test-test_link_resolver.obj: libarchive/test/test_link_resolver.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_link_resolver.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_link_resolver.Tpo -c -o libarchive/test/libarchive_test-test_link_resolver.obj `if test -f 'libarchive/test/test_link_resolver.c'; then $(CYGPATH_W) 'libarchive/test/test_link_resolver.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_link_resolver.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_link_resolver.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_link_resolver.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_link_resolver.c' object='libarchive/test/libarchive_test-test_link_resolver.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_link_resolver.obj `if test -f 'libarchive/test/test_link_resolver.c'; then $(CYGPATH_W) 'libarchive/test/test_link_resolver.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_link_resolver.c'; fi`
+
+libarchive/test/libarchive_test-test_open_fd.o: libarchive/test/test_open_fd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_open_fd.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_open_fd.Tpo -c -o libarchive/test/libarchive_test-test_open_fd.o `test -f 'libarchive/test/test_open_fd.c' || echo '$(srcdir)/'`libarchive/test/test_open_fd.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_open_fd.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_open_fd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_open_fd.c' object='libarchive/test/libarchive_test-test_open_fd.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_open_fd.o `test -f 'libarchive/test/test_open_fd.c' || echo '$(srcdir)/'`libarchive/test/test_open_fd.c
+
+libarchive/test/libarchive_test-test_open_fd.obj: libarchive/test/test_open_fd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_open_fd.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_open_fd.Tpo -c -o libarchive/test/libarchive_test-test_open_fd.obj `if test -f 'libarchive/test/test_open_fd.c'; then $(CYGPATH_W) 'libarchive/test/test_open_fd.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_open_fd.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_open_fd.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_open_fd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_open_fd.c' object='libarchive/test/libarchive_test-test_open_fd.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_open_fd.obj `if test -f 'libarchive/test/test_open_fd.c'; then $(CYGPATH_W) 'libarchive/test/test_open_fd.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_open_fd.c'; fi`
+
+libarchive/test/libarchive_test-test_open_file.o: libarchive/test/test_open_file.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_open_file.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_open_file.Tpo -c -o libarchive/test/libarchive_test-test_open_file.o `test -f 'libarchive/test/test_open_file.c' || echo '$(srcdir)/'`libarchive/test/test_open_file.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_open_file.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_open_file.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_open_file.c' object='libarchive/test/libarchive_test-test_open_file.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_open_file.o `test -f 'libarchive/test/test_open_file.c' || echo '$(srcdir)/'`libarchive/test/test_open_file.c
+
+libarchive/test/libarchive_test-test_open_file.obj: libarchive/test/test_open_file.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_open_file.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_open_file.Tpo -c -o libarchive/test/libarchive_test-test_open_file.obj `if test -f 'libarchive/test/test_open_file.c'; then $(CYGPATH_W) 'libarchive/test/test_open_file.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_open_file.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_open_file.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_open_file.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_open_file.c' object='libarchive/test/libarchive_test-test_open_file.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_open_file.obj `if test -f 'libarchive/test/test_open_file.c'; then $(CYGPATH_W) 'libarchive/test/test_open_file.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_open_file.c'; fi`
+
+libarchive/test/libarchive_test-test_open_filename.o: libarchive/test/test_open_filename.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_open_filename.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_open_filename.Tpo -c -o libarchive/test/libarchive_test-test_open_filename.o `test -f 'libarchive/test/test_open_filename.c' || echo '$(srcdir)/'`libarchive/test/test_open_filename.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_open_filename.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_open_filename.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_open_filename.c' object='libarchive/test/libarchive_test-test_open_filename.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_open_filename.o `test -f 'libarchive/test/test_open_filename.c' || echo '$(srcdir)/'`libarchive/test/test_open_filename.c
+
+libarchive/test/libarchive_test-test_open_filename.obj: libarchive/test/test_open_filename.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_open_filename.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_open_filename.Tpo -c -o libarchive/test/libarchive_test-test_open_filename.obj `if test -f 'libarchive/test/test_open_filename.c'; then $(CYGPATH_W) 'libarchive/test/test_open_filename.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_open_filename.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_open_filename.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_open_filename.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_open_filename.c' object='libarchive/test/libarchive_test-test_open_filename.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_open_filename.obj `if test -f 'libarchive/test/test_open_filename.c'; then $(CYGPATH_W) 'libarchive/test/test_open_filename.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_open_filename.c'; fi`
+
+libarchive/test/libarchive_test-test_pax_filename_encoding.o: libarchive/test/test_pax_filename_encoding.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_pax_filename_encoding.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_pax_filename_encoding.Tpo -c -o libarchive/test/libarchive_test-test_pax_filename_encoding.o `test -f 'libarchive/test/test_pax_filename_encoding.c' || echo '$(srcdir)/'`libarchive/test/test_pax_filename_encoding.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_pax_filename_encoding.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_pax_filename_encoding.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_pax_filename_encoding.c' object='libarchive/test/libarchive_test-test_pax_filename_encoding.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_pax_filename_encoding.o `test -f 'libarchive/test/test_pax_filename_encoding.c' || echo '$(srcdir)/'`libarchive/test/test_pax_filename_encoding.c
+
+libarchive/test/libarchive_test-test_pax_filename_encoding.obj: libarchive/test/test_pax_filename_encoding.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_pax_filename_encoding.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_pax_filename_encoding.Tpo -c -o libarchive/test/libarchive_test-test_pax_filename_encoding.obj `if test -f 'libarchive/test/test_pax_filename_encoding.c'; then $(CYGPATH_W) 'libarchive/test/test_pax_filename_encoding.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_pax_filename_encoding.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_pax_filename_encoding.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_pax_filename_encoding.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_pax_filename_encoding.c' object='libarchive/test/libarchive_test-test_pax_filename_encoding.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_pax_filename_encoding.obj `if test -f 'libarchive/test/test_pax_filename_encoding.c'; then $(CYGPATH_W) 'libarchive/test/test_pax_filename_encoding.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_pax_filename_encoding.c'; fi`
+
+libarchive/test/libarchive_test-test_read_compress_program.o: libarchive/test/test_read_compress_program.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_compress_program.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_compress_program.Tpo -c -o libarchive/test/libarchive_test-test_read_compress_program.o `test -f 'libarchive/test/test_read_compress_program.c' || echo '$(srcdir)/'`libarchive/test/test_read_compress_program.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_compress_program.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_compress_program.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_compress_program.c' object='libarchive/test/libarchive_test-test_read_compress_program.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_compress_program.o `test -f 'libarchive/test/test_read_compress_program.c' || echo '$(srcdir)/'`libarchive/test/test_read_compress_program.c
+
+libarchive/test/libarchive_test-test_read_compress_program.obj: libarchive/test/test_read_compress_program.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_compress_program.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_compress_program.Tpo -c -o libarchive/test/libarchive_test-test_read_compress_program.obj `if test -f 'libarchive/test/test_read_compress_program.c'; then $(CYGPATH_W) 'libarchive/test/test_read_compress_program.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_compress_program.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_compress_program.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_compress_program.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_compress_program.c' object='libarchive/test/libarchive_test-test_read_compress_program.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_compress_program.obj `if test -f 'libarchive/test/test_read_compress_program.c'; then $(CYGPATH_W) 'libarchive/test/test_read_compress_program.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_compress_program.c'; fi`
+
+libarchive/test/libarchive_test-test_read_data_large.o: libarchive/test/test_read_data_large.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_data_large.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_data_large.Tpo -c -o libarchive/test/libarchive_test-test_read_data_large.o `test -f 'libarchive/test/test_read_data_large.c' || echo '$(srcdir)/'`libarchive/test/test_read_data_large.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_data_large.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_data_large.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_data_large.c' object='libarchive/test/libarchive_test-test_read_data_large.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_data_large.o `test -f 'libarchive/test/test_read_data_large.c' || echo '$(srcdir)/'`libarchive/test/test_read_data_large.c
+
+libarchive/test/libarchive_test-test_read_data_large.obj: libarchive/test/test_read_data_large.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_data_large.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_data_large.Tpo -c -o libarchive/test/libarchive_test-test_read_data_large.obj `if test -f 'libarchive/test/test_read_data_large.c'; then $(CYGPATH_W) 'libarchive/test/test_read_data_large.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_data_large.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_data_large.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_data_large.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_data_large.c' object='libarchive/test/libarchive_test-test_read_data_large.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_data_large.obj `if test -f 'libarchive/test/test_read_data_large.c'; then $(CYGPATH_W) 'libarchive/test/test_read_data_large.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_data_large.c'; fi`
+
+libarchive/test/libarchive_test-test_read_disk.o: libarchive/test/test_read_disk.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_disk.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_disk.Tpo -c -o libarchive/test/libarchive_test-test_read_disk.o `test -f 'libarchive/test/test_read_disk.c' || echo '$(srcdir)/'`libarchive/test/test_read_disk.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_disk.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_disk.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_disk.c' object='libarchive/test/libarchive_test-test_read_disk.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_disk.o `test -f 'libarchive/test/test_read_disk.c' || echo '$(srcdir)/'`libarchive/test/test_read_disk.c
+
+libarchive/test/libarchive_test-test_read_disk.obj: libarchive/test/test_read_disk.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_disk.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_disk.Tpo -c -o libarchive/test/libarchive_test-test_read_disk.obj `if test -f 'libarchive/test/test_read_disk.c'; then $(CYGPATH_W) 'libarchive/test/test_read_disk.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_disk.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_disk.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_disk.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_disk.c' object='libarchive/test/libarchive_test-test_read_disk.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_disk.obj `if test -f 'libarchive/test/test_read_disk.c'; then $(CYGPATH_W) 'libarchive/test/test_read_disk.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_disk.c'; fi`
+
+libarchive/test/libarchive_test-test_read_disk_entry_from_file.o: libarchive/test/test_read_disk_entry_from_file.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_disk_entry_from_file.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_disk_entry_from_file.Tpo -c -o libarchive/test/libarchive_test-test_read_disk_entry_from_file.o `test -f 'libarchive/test/test_read_disk_entry_from_file.c' || echo '$(srcdir)/'`libarchive/test/test_read_disk_entry_from_file.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_disk_entry_from_file.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_disk_entry_from_file.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_disk_entry_from_file.c' object='libarchive/test/libarchive_test-test_read_disk_entry_from_file.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_disk_entry_from_file.o `test -f 'libarchive/test/test_read_disk_entry_from_file.c' || echo '$(srcdir)/'`libarchive/test/test_read_disk_entry_from_file.c
+
+libarchive/test/libarchive_test-test_read_disk_entry_from_file.obj: libarchive/test/test_read_disk_entry_from_file.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_disk_entry_from_file.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_disk_entry_from_file.Tpo -c -o libarchive/test/libarchive_test-test_read_disk_entry_from_file.obj `if test -f 'libarchive/test/test_read_disk_entry_from_file.c'; then $(CYGPATH_W) 'libarchive/test/test_read_disk_entry_from_file.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_disk_entry_from_file.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_disk_entry_from_file.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_disk_entry_from_file.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_disk_entry_from_file.c' object='libarchive/test/libarchive_test-test_read_disk_entry_from_file.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_disk_entry_from_file.obj `if test -f 'libarchive/test/test_read_disk_entry_from_file.c'; then $(CYGPATH_W) 'libarchive/test/test_read_disk_entry_from_file.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_disk_entry_from_file.c'; fi`
+
+libarchive/test/libarchive_test-test_read_extract.o: libarchive/test/test_read_extract.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_extract.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_extract.Tpo -c -o libarchive/test/libarchive_test-test_read_extract.o `test -f 'libarchive/test/test_read_extract.c' || echo '$(srcdir)/'`libarchive/test/test_read_extract.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_extract.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_extract.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_extract.c' object='libarchive/test/libarchive_test-test_read_extract.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_extract.o `test -f 'libarchive/test/test_read_extract.c' || echo '$(srcdir)/'`libarchive/test/test_read_extract.c
+
+libarchive/test/libarchive_test-test_read_extract.obj: libarchive/test/test_read_extract.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_extract.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_extract.Tpo -c -o libarchive/test/libarchive_test-test_read_extract.obj `if test -f 'libarchive/test/test_read_extract.c'; then $(CYGPATH_W) 'libarchive/test/test_read_extract.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_extract.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_extract.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_extract.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_extract.c' object='libarchive/test/libarchive_test-test_read_extract.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_extract.obj `if test -f 'libarchive/test/test_read_extract.c'; then $(CYGPATH_W) 'libarchive/test/test_read_extract.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_extract.c'; fi`
+
+libarchive/test/libarchive_test-test_read_file_nonexistent.o: libarchive/test/test_read_file_nonexistent.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_file_nonexistent.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_file_nonexistent.Tpo -c -o libarchive/test/libarchive_test-test_read_file_nonexistent.o `test -f 'libarchive/test/test_read_file_nonexistent.c' || echo '$(srcdir)/'`libarchive/test/test_read_file_nonexistent.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_file_nonexistent.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_file_nonexistent.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_file_nonexistent.c' object='libarchive/test/libarchive_test-test_read_file_nonexistent.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_file_nonexistent.o `test -f 'libarchive/test/test_read_file_nonexistent.c' || echo '$(srcdir)/'`libarchive/test/test_read_file_nonexistent.c
+
+libarchive/test/libarchive_test-test_read_file_nonexistent.obj: libarchive/test/test_read_file_nonexistent.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_file_nonexistent.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_file_nonexistent.Tpo -c -o libarchive/test/libarchive_test-test_read_file_nonexistent.obj `if test -f 'libarchive/test/test_read_file_nonexistent.c'; then $(CYGPATH_W) 'libarchive/test/test_read_file_nonexistent.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_file_nonexistent.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_file_nonexistent.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_file_nonexistent.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_file_nonexistent.c' object='libarchive/test/libarchive_test-test_read_file_nonexistent.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_file_nonexistent.obj `if test -f 'libarchive/test/test_read_file_nonexistent.c'; then $(CYGPATH_W) 'libarchive/test/test_read_file_nonexistent.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_file_nonexistent.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_ar.o: libarchive/test/test_read_format_ar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_ar.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_ar.Tpo -c -o libarchive/test/libarchive_test-test_read_format_ar.o `test -f 'libarchive/test/test_read_format_ar.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_ar.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_ar.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_ar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_ar.c' object='libarchive/test/libarchive_test-test_read_format_ar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_ar.o `test -f 'libarchive/test/test_read_format_ar.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_ar.c
+
+libarchive/test/libarchive_test-test_read_format_ar.obj: libarchive/test/test_read_format_ar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_ar.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_ar.Tpo -c -o libarchive/test/libarchive_test-test_read_format_ar.obj `if test -f 'libarchive/test/test_read_format_ar.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_ar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_ar.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_ar.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_ar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_ar.c' object='libarchive/test/libarchive_test-test_read_format_ar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_ar.obj `if test -f 'libarchive/test/test_read_format_ar.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_ar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_ar.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_cpio_bin.o: libarchive/test/test_read_format_cpio_bin.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_bin.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin.o `test -f 'libarchive/test/test_read_format_cpio_bin.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_bin.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_bin.c' object='libarchive/test/libarchive_test-test_read_format_cpio_bin.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin.o `test -f 'libarchive/test/test_read_format_cpio_bin.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_bin.c
+
+libarchive/test/libarchive_test-test_read_format_cpio_bin.obj: libarchive/test/test_read_format_cpio_bin.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_bin.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin.obj `if test -f 'libarchive/test/test_read_format_cpio_bin.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_bin.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_bin.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_bin.c' object='libarchive/test/libarchive_test-test_read_format_cpio_bin.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin.obj `if test -f 'libarchive/test/test_read_format_cpio_bin.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_bin.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_bin.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_cpio_bin_Z.o: libarchive/test/test_read_format_cpio_bin_Z.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_bin_Z.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_Z.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_Z.o `test -f 'libarchive/test/test_read_format_cpio_bin_Z.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_bin_Z.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_Z.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_Z.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_bin_Z.c' object='libarchive/test/libarchive_test-test_read_format_cpio_bin_Z.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_Z.o `test -f 'libarchive/test/test_read_format_cpio_bin_Z.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_bin_Z.c
+
+libarchive/test/libarchive_test-test_read_format_cpio_bin_Z.obj: libarchive/test/test_read_format_cpio_bin_Z.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_bin_Z.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_Z.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_Z.obj `if test -f 'libarchive/test/test_read_format_cpio_bin_Z.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_bin_Z.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_bin_Z.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_Z.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_Z.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_bin_Z.c' object='libarchive/test/libarchive_test-test_read_format_cpio_bin_Z.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_Z.obj `if test -f 'libarchive/test/test_read_format_cpio_bin_Z.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_bin_Z.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_bin_Z.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_cpio_bin_be.o: libarchive/test/test_read_format_cpio_bin_be.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_bin_be.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_be.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_be.o `test -f 'libarchive/test/test_read_format_cpio_bin_be.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_bin_be.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_be.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_be.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_bin_be.c' object='libarchive/test/libarchive_test-test_read_format_cpio_bin_be.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_be.o `test -f 'libarchive/test/test_read_format_cpio_bin_be.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_bin_be.c
+
+libarchive/test/libarchive_test-test_read_format_cpio_bin_be.obj: libarchive/test/test_read_format_cpio_bin_be.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_bin_be.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_be.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_be.obj `if test -f 'libarchive/test/test_read_format_cpio_bin_be.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_bin_be.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_bin_be.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_be.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_be.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_bin_be.c' object='libarchive/test/libarchive_test-test_read_format_cpio_bin_be.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_be.obj `if test -f 'libarchive/test/test_read_format_cpio_bin_be.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_bin_be.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_bin_be.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_cpio_bin_bz2.o: libarchive/test/test_read_format_cpio_bin_bz2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_bin_bz2.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_bz2.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_bz2.o `test -f 'libarchive/test/test_read_format_cpio_bin_bz2.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_bin_bz2.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_bz2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_bz2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_bin_bz2.c' object='libarchive/test/libarchive_test-test_read_format_cpio_bin_bz2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_bz2.o `test -f 'libarchive/test/test_read_format_cpio_bin_bz2.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_bin_bz2.c
+
+libarchive/test/libarchive_test-test_read_format_cpio_bin_bz2.obj: libarchive/test/test_read_format_cpio_bin_bz2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_bin_bz2.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_bz2.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_bz2.obj `if test -f 'libarchive/test/test_read_format_cpio_bin_bz2.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_bin_bz2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_bin_bz2.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_bz2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_bz2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_bin_bz2.c' object='libarchive/test/libarchive_test-test_read_format_cpio_bin_bz2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_bz2.obj `if test -f 'libarchive/test/test_read_format_cpio_bin_bz2.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_bin_bz2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_bin_bz2.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_cpio_bin_gz.o: libarchive/test/test_read_format_cpio_bin_gz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_bin_gz.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_gz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_gz.o `test -f 'libarchive/test/test_read_format_cpio_bin_gz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_bin_gz.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_gz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_gz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_bin_gz.c' object='libarchive/test/libarchive_test-test_read_format_cpio_bin_gz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_gz.o `test -f 'libarchive/test/test_read_format_cpio_bin_gz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_bin_gz.c
+
+libarchive/test/libarchive_test-test_read_format_cpio_bin_gz.obj: libarchive/test/test_read_format_cpio_bin_gz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_bin_gz.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_gz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_gz.obj `if test -f 'libarchive/test/test_read_format_cpio_bin_gz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_bin_gz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_bin_gz.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_gz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_gz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_bin_gz.c' object='libarchive/test/libarchive_test-test_read_format_cpio_bin_gz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_gz.obj `if test -f 'libarchive/test/test_read_format_cpio_bin_gz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_bin_gz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_bin_gz.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_cpio_bin_lzma.o: libarchive/test/test_read_format_cpio_bin_lzma.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_bin_lzma.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_lzma.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_lzma.o `test -f 'libarchive/test/test_read_format_cpio_bin_lzma.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_bin_lzma.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_lzma.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_lzma.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_bin_lzma.c' object='libarchive/test/libarchive_test-test_read_format_cpio_bin_lzma.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_lzma.o `test -f 'libarchive/test/test_read_format_cpio_bin_lzma.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_bin_lzma.c
+
+libarchive/test/libarchive_test-test_read_format_cpio_bin_lzma.obj: libarchive/test/test_read_format_cpio_bin_lzma.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_bin_lzma.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_lzma.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_lzma.obj `if test -f 'libarchive/test/test_read_format_cpio_bin_lzma.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_bin_lzma.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_bin_lzma.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_lzma.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_lzma.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_bin_lzma.c' object='libarchive/test/libarchive_test-test_read_format_cpio_bin_lzma.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_lzma.obj `if test -f 'libarchive/test/test_read_format_cpio_bin_lzma.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_bin_lzma.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_bin_lzma.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_cpio_bin_xz.o: libarchive/test/test_read_format_cpio_bin_xz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_bin_xz.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_xz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_xz.o `test -f 'libarchive/test/test_read_format_cpio_bin_xz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_bin_xz.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_xz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_xz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_bin_xz.c' object='libarchive/test/libarchive_test-test_read_format_cpio_bin_xz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_xz.o `test -f 'libarchive/test/test_read_format_cpio_bin_xz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_bin_xz.c
+
+libarchive/test/libarchive_test-test_read_format_cpio_bin_xz.obj: libarchive/test/test_read_format_cpio_bin_xz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_bin_xz.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_xz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_xz.obj `if test -f 'libarchive/test/test_read_format_cpio_bin_xz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_bin_xz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_bin_xz.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_xz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_bin_xz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_bin_xz.c' object='libarchive/test/libarchive_test-test_read_format_cpio_bin_xz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_bin_xz.obj `if test -f 'libarchive/test/test_read_format_cpio_bin_xz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_bin_xz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_bin_xz.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_cpio_odc.o: libarchive/test/test_read_format_cpio_odc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_odc.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_odc.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_odc.o `test -f 'libarchive/test/test_read_format_cpio_odc.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_odc.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_odc.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_odc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_odc.c' object='libarchive/test/libarchive_test-test_read_format_cpio_odc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_odc.o `test -f 'libarchive/test/test_read_format_cpio_odc.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_odc.c
+
+libarchive/test/libarchive_test-test_read_format_cpio_odc.obj: libarchive/test/test_read_format_cpio_odc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_odc.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_odc.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_odc.obj `if test -f 'libarchive/test/test_read_format_cpio_odc.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_odc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_odc.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_odc.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_odc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_odc.c' object='libarchive/test/libarchive_test-test_read_format_cpio_odc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_odc.obj `if test -f 'libarchive/test/test_read_format_cpio_odc.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_odc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_odc.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.o: libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.o `test -f 'libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c' object='libarchive/test/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.o `test -f 'libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c
+
+libarchive/test/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.obj: libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.obj `if test -f 'libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c' object='libarchive/test/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4_bzip2_rpm.obj `if test -f 'libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip.o: libarchive/test/test_read_format_cpio_svr4_gzip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_gzip.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip.o `test -f 'libarchive/test/test_read_format_cpio_svr4_gzip.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_svr4_gzip.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_gzip.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_gzip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_svr4_gzip.c' object='libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip.o `test -f 'libarchive/test/test_read_format_cpio_svr4_gzip.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_svr4_gzip.c
+
+libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip.obj: libarchive/test/test_read_format_cpio_svr4_gzip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_gzip.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip.obj `if test -f 'libarchive/test/test_read_format_cpio_svr4_gzip.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_svr4_gzip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_svr4_gzip.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_gzip.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_gzip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_svr4_gzip.c' object='libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip.obj `if test -f 'libarchive/test/test_read_format_cpio_svr4_gzip.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_svr4_gzip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_svr4_gzip.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.o: libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.o `test -f 'libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c' object='libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.o `test -f 'libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c
+
+libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.obj: libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.obj `if test -f 'libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c' object='libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4_gzip_rpm.obj `if test -f 'libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_cpio_svr4c_Z.o: libarchive/test/test_read_format_cpio_svr4c_Z.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_svr4c_Z.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4c_Z.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4c_Z.o `test -f 'libarchive/test/test_read_format_cpio_svr4c_Z.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_svr4c_Z.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4c_Z.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4c_Z.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_svr4c_Z.c' object='libarchive/test/libarchive_test-test_read_format_cpio_svr4c_Z.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4c_Z.o `test -f 'libarchive/test/test_read_format_cpio_svr4c_Z.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_cpio_svr4c_Z.c
+
+libarchive/test/libarchive_test-test_read_format_cpio_svr4c_Z.obj: libarchive/test/test_read_format_cpio_svr4c_Z.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_cpio_svr4c_Z.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4c_Z.Tpo -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4c_Z.obj `if test -f 'libarchive/test/test_read_format_cpio_svr4c_Z.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_svr4c_Z.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_svr4c_Z.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4c_Z.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_cpio_svr4c_Z.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_cpio_svr4c_Z.c' object='libarchive/test/libarchive_test-test_read_format_cpio_svr4c_Z.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_cpio_svr4c_Z.obj `if test -f 'libarchive/test/test_read_format_cpio_svr4c_Z.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_cpio_svr4c_Z.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_cpio_svr4c_Z.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_empty.o: libarchive/test/test_read_format_empty.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_empty.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_empty.Tpo -c -o libarchive/test/libarchive_test-test_read_format_empty.o `test -f 'libarchive/test/test_read_format_empty.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_empty.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_empty.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_empty.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_empty.c' object='libarchive/test/libarchive_test-test_read_format_empty.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_empty.o `test -f 'libarchive/test/test_read_format_empty.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_empty.c
+
+libarchive/test/libarchive_test-test_read_format_empty.obj: libarchive/test/test_read_format_empty.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_empty.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_empty.Tpo -c -o libarchive/test/libarchive_test-test_read_format_empty.obj `if test -f 'libarchive/test/test_read_format_empty.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_empty.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_empty.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_empty.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_empty.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_empty.c' object='libarchive/test/libarchive_test-test_read_format_empty.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_empty.obj `if test -f 'libarchive/test/test_read_format_empty.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_empty.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_empty.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_gtar_gz.o: libarchive/test/test_read_format_gtar_gz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_gtar_gz.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_gz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_gtar_gz.o `test -f 'libarchive/test/test_read_format_gtar_gz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_gtar_gz.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_gz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_gz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_gtar_gz.c' object='libarchive/test/libarchive_test-test_read_format_gtar_gz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_gtar_gz.o `test -f 'libarchive/test/test_read_format_gtar_gz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_gtar_gz.c
+
+libarchive/test/libarchive_test-test_read_format_gtar_gz.obj: libarchive/test/test_read_format_gtar_gz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_gtar_gz.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_gz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_gtar_gz.obj `if test -f 'libarchive/test/test_read_format_gtar_gz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_gtar_gz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_gtar_gz.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_gz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_gz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_gtar_gz.c' object='libarchive/test/libarchive_test-test_read_format_gtar_gz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_gtar_gz.obj `if test -f 'libarchive/test/test_read_format_gtar_gz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_gtar_gz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_gtar_gz.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_gtar_lzma.o: libarchive/test/test_read_format_gtar_lzma.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_gtar_lzma.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_lzma.Tpo -c -o libarchive/test/libarchive_test-test_read_format_gtar_lzma.o `test -f 'libarchive/test/test_read_format_gtar_lzma.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_gtar_lzma.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_lzma.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_lzma.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_gtar_lzma.c' object='libarchive/test/libarchive_test-test_read_format_gtar_lzma.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_gtar_lzma.o `test -f 'libarchive/test/test_read_format_gtar_lzma.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_gtar_lzma.c
+
+libarchive/test/libarchive_test-test_read_format_gtar_lzma.obj: libarchive/test/test_read_format_gtar_lzma.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_gtar_lzma.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_lzma.Tpo -c -o libarchive/test/libarchive_test-test_read_format_gtar_lzma.obj `if test -f 'libarchive/test/test_read_format_gtar_lzma.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_gtar_lzma.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_gtar_lzma.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_lzma.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_lzma.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_gtar_lzma.c' object='libarchive/test/libarchive_test-test_read_format_gtar_lzma.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_gtar_lzma.obj `if test -f 'libarchive/test/test_read_format_gtar_lzma.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_gtar_lzma.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_gtar_lzma.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_gtar_sparse.o: libarchive/test/test_read_format_gtar_sparse.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_gtar_sparse.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_sparse.Tpo -c -o libarchive/test/libarchive_test-test_read_format_gtar_sparse.o `test -f 'libarchive/test/test_read_format_gtar_sparse.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_gtar_sparse.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_sparse.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_sparse.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_gtar_sparse.c' object='libarchive/test/libarchive_test-test_read_format_gtar_sparse.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_gtar_sparse.o `test -f 'libarchive/test/test_read_format_gtar_sparse.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_gtar_sparse.c
+
+libarchive/test/libarchive_test-test_read_format_gtar_sparse.obj: libarchive/test/test_read_format_gtar_sparse.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_gtar_sparse.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_sparse.Tpo -c -o libarchive/test/libarchive_test-test_read_format_gtar_sparse.obj `if test -f 'libarchive/test/test_read_format_gtar_sparse.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_gtar_sparse.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_gtar_sparse.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_sparse.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_gtar_sparse.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_gtar_sparse.c' object='libarchive/test/libarchive_test-test_read_format_gtar_sparse.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_gtar_sparse.obj `if test -f 'libarchive/test/test_read_format_gtar_sparse.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_gtar_sparse.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_gtar_sparse.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_iso_gz.o: libarchive/test/test_read_format_iso_gz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_iso_gz.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_iso_gz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_iso_gz.o `test -f 'libarchive/test/test_read_format_iso_gz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_iso_gz.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_iso_gz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_iso_gz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_iso_gz.c' object='libarchive/test/libarchive_test-test_read_format_iso_gz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_iso_gz.o `test -f 'libarchive/test/test_read_format_iso_gz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_iso_gz.c
+
+libarchive/test/libarchive_test-test_read_format_iso_gz.obj: libarchive/test/test_read_format_iso_gz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_iso_gz.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_iso_gz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_iso_gz.obj `if test -f 'libarchive/test/test_read_format_iso_gz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_iso_gz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_iso_gz.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_iso_gz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_iso_gz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_iso_gz.c' object='libarchive/test/libarchive_test-test_read_format_iso_gz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_iso_gz.obj `if test -f 'libarchive/test/test_read_format_iso_gz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_iso_gz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_iso_gz.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_iso_multi_extent.o: libarchive/test/test_read_format_iso_multi_extent.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_iso_multi_extent.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_iso_multi_extent.Tpo -c -o libarchive/test/libarchive_test-test_read_format_iso_multi_extent.o `test -f 'libarchive/test/test_read_format_iso_multi_extent.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_iso_multi_extent.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_iso_multi_extent.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_iso_multi_extent.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_iso_multi_extent.c' object='libarchive/test/libarchive_test-test_read_format_iso_multi_extent.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_iso_multi_extent.o `test -f 'libarchive/test/test_read_format_iso_multi_extent.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_iso_multi_extent.c
+
+libarchive/test/libarchive_test-test_read_format_iso_multi_extent.obj: libarchive/test/test_read_format_iso_multi_extent.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_iso_multi_extent.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_iso_multi_extent.Tpo -c -o libarchive/test/libarchive_test-test_read_format_iso_multi_extent.obj `if test -f 'libarchive/test/test_read_format_iso_multi_extent.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_iso_multi_extent.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_iso_multi_extent.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_iso_multi_extent.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_iso_multi_extent.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_iso_multi_extent.c' object='libarchive/test/libarchive_test-test_read_format_iso_multi_extent.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_iso_multi_extent.obj `if test -f 'libarchive/test/test_read_format_iso_multi_extent.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_iso_multi_extent.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_iso_multi_extent.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_isojoliet_bz2.o: libarchive/test/test_read_format_isojoliet_bz2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isojoliet_bz2.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_bz2.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isojoliet_bz2.o `test -f 'libarchive/test/test_read_format_isojoliet_bz2.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isojoliet_bz2.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_bz2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_bz2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isojoliet_bz2.c' object='libarchive/test/libarchive_test-test_read_format_isojoliet_bz2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isojoliet_bz2.o `test -f 'libarchive/test/test_read_format_isojoliet_bz2.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isojoliet_bz2.c
+
+libarchive/test/libarchive_test-test_read_format_isojoliet_bz2.obj: libarchive/test/test_read_format_isojoliet_bz2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isojoliet_bz2.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_bz2.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isojoliet_bz2.obj `if test -f 'libarchive/test/test_read_format_isojoliet_bz2.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isojoliet_bz2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isojoliet_bz2.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_bz2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_bz2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isojoliet_bz2.c' object='libarchive/test/libarchive_test-test_read_format_isojoliet_bz2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isojoliet_bz2.obj `if test -f 'libarchive/test/test_read_format_isojoliet_bz2.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isojoliet_bz2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isojoliet_bz2.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_isojoliet_long.o: libarchive/test/test_read_format_isojoliet_long.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isojoliet_long.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_long.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isojoliet_long.o `test -f 'libarchive/test/test_read_format_isojoliet_long.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isojoliet_long.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_long.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_long.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isojoliet_long.c' object='libarchive/test/libarchive_test-test_read_format_isojoliet_long.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isojoliet_long.o `test -f 'libarchive/test/test_read_format_isojoliet_long.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isojoliet_long.c
+
+libarchive/test/libarchive_test-test_read_format_isojoliet_long.obj: libarchive/test/test_read_format_isojoliet_long.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isojoliet_long.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_long.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isojoliet_long.obj `if test -f 'libarchive/test/test_read_format_isojoliet_long.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isojoliet_long.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isojoliet_long.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_long.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_long.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isojoliet_long.c' object='libarchive/test/libarchive_test-test_read_format_isojoliet_long.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isojoliet_long.obj `if test -f 'libarchive/test/test_read_format_isojoliet_long.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isojoliet_long.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isojoliet_long.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_isojoliet_rr.o: libarchive/test/test_read_format_isojoliet_rr.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isojoliet_rr.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_rr.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isojoliet_rr.o `test -f 'libarchive/test/test_read_format_isojoliet_rr.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isojoliet_rr.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_rr.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_rr.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isojoliet_rr.c' object='libarchive/test/libarchive_test-test_read_format_isojoliet_rr.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isojoliet_rr.o `test -f 'libarchive/test/test_read_format_isojoliet_rr.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isojoliet_rr.c
+
+libarchive/test/libarchive_test-test_read_format_isojoliet_rr.obj: libarchive/test/test_read_format_isojoliet_rr.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isojoliet_rr.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_rr.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isojoliet_rr.obj `if test -f 'libarchive/test/test_read_format_isojoliet_rr.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isojoliet_rr.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isojoliet_rr.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_rr.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isojoliet_rr.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isojoliet_rr.c' object='libarchive/test/libarchive_test-test_read_format_isojoliet_rr.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isojoliet_rr.obj `if test -f 'libarchive/test/test_read_format_isojoliet_rr.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isojoliet_rr.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isojoliet_rr.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_isorr_bz2.o: libarchive/test/test_read_format_isorr_bz2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isorr_bz2.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_bz2.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isorr_bz2.o `test -f 'libarchive/test/test_read_format_isorr_bz2.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isorr_bz2.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_bz2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_bz2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isorr_bz2.c' object='libarchive/test/libarchive_test-test_read_format_isorr_bz2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isorr_bz2.o `test -f 'libarchive/test/test_read_format_isorr_bz2.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isorr_bz2.c
+
+libarchive/test/libarchive_test-test_read_format_isorr_bz2.obj: libarchive/test/test_read_format_isorr_bz2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isorr_bz2.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_bz2.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isorr_bz2.obj `if test -f 'libarchive/test/test_read_format_isorr_bz2.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isorr_bz2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isorr_bz2.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_bz2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_bz2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isorr_bz2.c' object='libarchive/test/libarchive_test-test_read_format_isorr_bz2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isorr_bz2.obj `if test -f 'libarchive/test/test_read_format_isorr_bz2.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isorr_bz2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isorr_bz2.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_isorr_ce.o: libarchive/test/test_read_format_isorr_ce.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isorr_ce.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_ce.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isorr_ce.o `test -f 'libarchive/test/test_read_format_isorr_ce.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isorr_ce.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_ce.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_ce.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isorr_ce.c' object='libarchive/test/libarchive_test-test_read_format_isorr_ce.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isorr_ce.o `test -f 'libarchive/test/test_read_format_isorr_ce.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isorr_ce.c
+
+libarchive/test/libarchive_test-test_read_format_isorr_ce.obj: libarchive/test/test_read_format_isorr_ce.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isorr_ce.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_ce.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isorr_ce.obj `if test -f 'libarchive/test/test_read_format_isorr_ce.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isorr_ce.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isorr_ce.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_ce.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_ce.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isorr_ce.c' object='libarchive/test/libarchive_test-test_read_format_isorr_ce.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isorr_ce.obj `if test -f 'libarchive/test/test_read_format_isorr_ce.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isorr_ce.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isorr_ce.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_isorr_new_bz2.o: libarchive/test/test_read_format_isorr_new_bz2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isorr_new_bz2.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_new_bz2.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isorr_new_bz2.o `test -f 'libarchive/test/test_read_format_isorr_new_bz2.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isorr_new_bz2.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_new_bz2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_new_bz2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isorr_new_bz2.c' object='libarchive/test/libarchive_test-test_read_format_isorr_new_bz2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isorr_new_bz2.o `test -f 'libarchive/test/test_read_format_isorr_new_bz2.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isorr_new_bz2.c
+
+libarchive/test/libarchive_test-test_read_format_isorr_new_bz2.obj: libarchive/test/test_read_format_isorr_new_bz2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isorr_new_bz2.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_new_bz2.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isorr_new_bz2.obj `if test -f 'libarchive/test/test_read_format_isorr_new_bz2.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isorr_new_bz2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isorr_new_bz2.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_new_bz2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_new_bz2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isorr_new_bz2.c' object='libarchive/test/libarchive_test-test_read_format_isorr_new_bz2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isorr_new_bz2.obj `if test -f 'libarchive/test/test_read_format_isorr_new_bz2.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isorr_new_bz2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isorr_new_bz2.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_isorr_rr_moved.o: libarchive/test/test_read_format_isorr_rr_moved.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isorr_rr_moved.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_rr_moved.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isorr_rr_moved.o `test -f 'libarchive/test/test_read_format_isorr_rr_moved.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isorr_rr_moved.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_rr_moved.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_rr_moved.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isorr_rr_moved.c' object='libarchive/test/libarchive_test-test_read_format_isorr_rr_moved.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isorr_rr_moved.o `test -f 'libarchive/test/test_read_format_isorr_rr_moved.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isorr_rr_moved.c
+
+libarchive/test/libarchive_test-test_read_format_isorr_rr_moved.obj: libarchive/test/test_read_format_isorr_rr_moved.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isorr_rr_moved.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_rr_moved.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isorr_rr_moved.obj `if test -f 'libarchive/test/test_read_format_isorr_rr_moved.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isorr_rr_moved.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isorr_rr_moved.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_rr_moved.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isorr_rr_moved.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isorr_rr_moved.c' object='libarchive/test/libarchive_test-test_read_format_isorr_rr_moved.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isorr_rr_moved.obj `if test -f 'libarchive/test/test_read_format_isorr_rr_moved.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isorr_rr_moved.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isorr_rr_moved.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_isozisofs_bz2.o: libarchive/test/test_read_format_isozisofs_bz2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isozisofs_bz2.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isozisofs_bz2.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isozisofs_bz2.o `test -f 'libarchive/test/test_read_format_isozisofs_bz2.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isozisofs_bz2.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isozisofs_bz2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isozisofs_bz2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isozisofs_bz2.c' object='libarchive/test/libarchive_test-test_read_format_isozisofs_bz2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isozisofs_bz2.o `test -f 'libarchive/test/test_read_format_isozisofs_bz2.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_isozisofs_bz2.c
+
+libarchive/test/libarchive_test-test_read_format_isozisofs_bz2.obj: libarchive/test/test_read_format_isozisofs_bz2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_isozisofs_bz2.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isozisofs_bz2.Tpo -c -o libarchive/test/libarchive_test-test_read_format_isozisofs_bz2.obj `if test -f 'libarchive/test/test_read_format_isozisofs_bz2.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isozisofs_bz2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isozisofs_bz2.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isozisofs_bz2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_isozisofs_bz2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_isozisofs_bz2.c' object='libarchive/test/libarchive_test-test_read_format_isozisofs_bz2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_isozisofs_bz2.obj `if test -f 'libarchive/test/test_read_format_isozisofs_bz2.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_isozisofs_bz2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_isozisofs_bz2.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_mtree.o: libarchive/test/test_read_format_mtree.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_mtree.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree.Tpo -c -o libarchive/test/libarchive_test-test_read_format_mtree.o `test -f 'libarchive/test/test_read_format_mtree.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_mtree.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_mtree.c' object='libarchive/test/libarchive_test-test_read_format_mtree.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_mtree.o `test -f 'libarchive/test/test_read_format_mtree.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_mtree.c
+
+libarchive/test/libarchive_test-test_read_format_mtree.obj: libarchive/test/test_read_format_mtree.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_mtree.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree.Tpo -c -o libarchive/test/libarchive_test-test_read_format_mtree.obj `if test -f 'libarchive/test/test_read_format_mtree.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_mtree.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_mtree.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_mtree.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_mtree.c' object='libarchive/test/libarchive_test-test_read_format_mtree.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_mtree.obj `if test -f 'libarchive/test/test_read_format_mtree.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_mtree.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_mtree.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_pax_bz2.o: libarchive/test/test_read_format_pax_bz2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_pax_bz2.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_pax_bz2.Tpo -c -o libarchive/test/libarchive_test-test_read_format_pax_bz2.o `test -f 'libarchive/test/test_read_format_pax_bz2.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_pax_bz2.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_pax_bz2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_pax_bz2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_pax_bz2.c' object='libarchive/test/libarchive_test-test_read_format_pax_bz2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_pax_bz2.o `test -f 'libarchive/test/test_read_format_pax_bz2.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_pax_bz2.c
+
+libarchive/test/libarchive_test-test_read_format_pax_bz2.obj: libarchive/test/test_read_format_pax_bz2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_pax_bz2.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_pax_bz2.Tpo -c -o libarchive/test/libarchive_test-test_read_format_pax_bz2.obj `if test -f 'libarchive/test/test_read_format_pax_bz2.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_pax_bz2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_pax_bz2.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_pax_bz2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_pax_bz2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_pax_bz2.c' object='libarchive/test/libarchive_test-test_read_format_pax_bz2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_pax_bz2.obj `if test -f 'libarchive/test/test_read_format_pax_bz2.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_pax_bz2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_pax_bz2.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_raw.o: libarchive/test/test_read_format_raw.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_raw.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_raw.Tpo -c -o libarchive/test/libarchive_test-test_read_format_raw.o `test -f 'libarchive/test/test_read_format_raw.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_raw.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_raw.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_raw.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_raw.c' object='libarchive/test/libarchive_test-test_read_format_raw.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_raw.o `test -f 'libarchive/test/test_read_format_raw.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_raw.c
+
+libarchive/test/libarchive_test-test_read_format_raw.obj: libarchive/test/test_read_format_raw.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_raw.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_raw.Tpo -c -o libarchive/test/libarchive_test-test_read_format_raw.obj `if test -f 'libarchive/test/test_read_format_raw.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_raw.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_raw.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_raw.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_raw.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_raw.c' object='libarchive/test/libarchive_test-test_read_format_raw.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_raw.obj `if test -f 'libarchive/test/test_read_format_raw.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_raw.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_raw.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_tar.o: libarchive/test/test_read_format_tar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_tar.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tar.Tpo -c -o libarchive/test/libarchive_test-test_read_format_tar.o `test -f 'libarchive/test/test_read_format_tar.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tar.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tar.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_tar.c' object='libarchive/test/libarchive_test-test_read_format_tar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_tar.o `test -f 'libarchive/test/test_read_format_tar.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tar.c
+
+libarchive/test/libarchive_test-test_read_format_tar.obj: libarchive/test/test_read_format_tar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_tar.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tar.Tpo -c -o libarchive/test/libarchive_test-test_read_format_tar.obj `if test -f 'libarchive/test/test_read_format_tar.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tar.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tar.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_tar.c' object='libarchive/test/libarchive_test-test_read_format_tar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_tar.obj `if test -f 'libarchive/test/test_read_format_tar.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tar.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_tar_empty_filename.o: libarchive/test/test_read_format_tar_empty_filename.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_tar_empty_filename.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tar_empty_filename.Tpo -c -o libarchive/test/libarchive_test-test_read_format_tar_empty_filename.o `test -f 'libarchive/test/test_read_format_tar_empty_filename.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tar_empty_filename.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tar_empty_filename.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tar_empty_filename.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_tar_empty_filename.c' object='libarchive/test/libarchive_test-test_read_format_tar_empty_filename.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_tar_empty_filename.o `test -f 'libarchive/test/test_read_format_tar_empty_filename.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tar_empty_filename.c
+
+libarchive/test/libarchive_test-test_read_format_tar_empty_filename.obj: libarchive/test/test_read_format_tar_empty_filename.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_tar_empty_filename.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tar_empty_filename.Tpo -c -o libarchive/test/libarchive_test-test_read_format_tar_empty_filename.obj `if test -f 'libarchive/test/test_read_format_tar_empty_filename.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tar_empty_filename.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tar_empty_filename.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tar_empty_filename.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tar_empty_filename.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_tar_empty_filename.c' object='libarchive/test/libarchive_test-test_read_format_tar_empty_filename.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_tar_empty_filename.obj `if test -f 'libarchive/test/test_read_format_tar_empty_filename.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tar_empty_filename.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tar_empty_filename.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_tbz.o: libarchive/test/test_read_format_tbz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_tbz.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tbz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_tbz.o `test -f 'libarchive/test/test_read_format_tbz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tbz.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tbz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tbz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_tbz.c' object='libarchive/test/libarchive_test-test_read_format_tbz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_tbz.o `test -f 'libarchive/test/test_read_format_tbz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tbz.c
+
+libarchive/test/libarchive_test-test_read_format_tbz.obj: libarchive/test/test_read_format_tbz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_tbz.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tbz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_tbz.obj `if test -f 'libarchive/test/test_read_format_tbz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tbz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tbz.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tbz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tbz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_tbz.c' object='libarchive/test/libarchive_test-test_read_format_tbz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_tbz.obj `if test -f 'libarchive/test/test_read_format_tbz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tbz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tbz.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_tgz.o: libarchive/test/test_read_format_tgz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_tgz.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tgz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_tgz.o `test -f 'libarchive/test/test_read_format_tgz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tgz.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tgz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tgz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_tgz.c' object='libarchive/test/libarchive_test-test_read_format_tgz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_tgz.o `test -f 'libarchive/test/test_read_format_tgz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tgz.c
+
+libarchive/test/libarchive_test-test_read_format_tgz.obj: libarchive/test/test_read_format_tgz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_tgz.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tgz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_tgz.obj `if test -f 'libarchive/test/test_read_format_tgz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tgz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tgz.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tgz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tgz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_tgz.c' object='libarchive/test/libarchive_test-test_read_format_tgz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_tgz.obj `if test -f 'libarchive/test/test_read_format_tgz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tgz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tgz.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_tlz.o: libarchive/test/test_read_format_tlz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_tlz.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tlz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_tlz.o `test -f 'libarchive/test/test_read_format_tlz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tlz.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tlz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tlz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_tlz.c' object='libarchive/test/libarchive_test-test_read_format_tlz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_tlz.o `test -f 'libarchive/test/test_read_format_tlz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tlz.c
+
+libarchive/test/libarchive_test-test_read_format_tlz.obj: libarchive/test/test_read_format_tlz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_tlz.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tlz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_tlz.obj `if test -f 'libarchive/test/test_read_format_tlz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tlz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tlz.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tlz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tlz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_tlz.c' object='libarchive/test/libarchive_test-test_read_format_tlz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_tlz.obj `if test -f 'libarchive/test/test_read_format_tlz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tlz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tlz.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_txz.o: libarchive/test/test_read_format_txz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_txz.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_txz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_txz.o `test -f 'libarchive/test/test_read_format_txz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_txz.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_txz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_txz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_txz.c' object='libarchive/test/libarchive_test-test_read_format_txz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_txz.o `test -f 'libarchive/test/test_read_format_txz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_txz.c
+
+libarchive/test/libarchive_test-test_read_format_txz.obj: libarchive/test/test_read_format_txz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_txz.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_txz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_txz.obj `if test -f 'libarchive/test/test_read_format_txz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_txz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_txz.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_txz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_txz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_txz.c' object='libarchive/test/libarchive_test-test_read_format_txz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_txz.obj `if test -f 'libarchive/test/test_read_format_txz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_txz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_txz.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_tz.o: libarchive/test/test_read_format_tz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_tz.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_tz.o `test -f 'libarchive/test/test_read_format_tz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tz.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_tz.c' object='libarchive/test/libarchive_test-test_read_format_tz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_tz.o `test -f 'libarchive/test/test_read_format_tz.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_tz.c
+
+libarchive/test/libarchive_test-test_read_format_tz.obj: libarchive/test/test_read_format_tz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_tz.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tz.Tpo -c -o libarchive/test/libarchive_test-test_read_format_tz.obj `if test -f 'libarchive/test/test_read_format_tz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tz.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_tz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_tz.c' object='libarchive/test/libarchive_test-test_read_format_tz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_tz.obj `if test -f 'libarchive/test/test_read_format_tz.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_tz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_tz.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_xar.o: libarchive/test/test_read_format_xar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_xar.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_xar.Tpo -c -o libarchive/test/libarchive_test-test_read_format_xar.o `test -f 'libarchive/test/test_read_format_xar.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_xar.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_xar.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_xar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_xar.c' object='libarchive/test/libarchive_test-test_read_format_xar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_xar.o `test -f 'libarchive/test/test_read_format_xar.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_xar.c
+
+libarchive/test/libarchive_test-test_read_format_xar.obj: libarchive/test/test_read_format_xar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_xar.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_xar.Tpo -c -o libarchive/test/libarchive_test-test_read_format_xar.obj `if test -f 'libarchive/test/test_read_format_xar.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_xar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_xar.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_xar.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_xar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_xar.c' object='libarchive/test/libarchive_test-test_read_format_xar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_xar.obj `if test -f 'libarchive/test/test_read_format_xar.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_xar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_xar.c'; fi`
+
+libarchive/test/libarchive_test-test_read_format_zip.o: libarchive/test/test_read_format_zip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_zip.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip.Tpo -c -o libarchive/test/libarchive_test-test_read_format_zip.o `test -f 'libarchive/test/test_read_format_zip.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_zip.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_zip.c' object='libarchive/test/libarchive_test-test_read_format_zip.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_zip.o `test -f 'libarchive/test/test_read_format_zip.c' || echo '$(srcdir)/'`libarchive/test/test_read_format_zip.c
+
+libarchive/test/libarchive_test-test_read_format_zip.obj: libarchive/test/test_read_format_zip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_format_zip.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip.Tpo -c -o libarchive/test/libarchive_test-test_read_format_zip.obj `if test -f 'libarchive/test/test_read_format_zip.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_zip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_zip.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_format_zip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_format_zip.c' object='libarchive/test/libarchive_test-test_read_format_zip.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_format_zip.obj `if test -f 'libarchive/test/test_read_format_zip.c'; then $(CYGPATH_W) 'libarchive/test/test_read_format_zip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_format_zip.c'; fi`
+
+libarchive/test/libarchive_test-test_read_large.o: libarchive/test/test_read_large.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_large.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_large.Tpo -c -o libarchive/test/libarchive_test-test_read_large.o `test -f 'libarchive/test/test_read_large.c' || echo '$(srcdir)/'`libarchive/test/test_read_large.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_large.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_large.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_large.c' object='libarchive/test/libarchive_test-test_read_large.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_large.o `test -f 'libarchive/test/test_read_large.c' || echo '$(srcdir)/'`libarchive/test/test_read_large.c
+
+libarchive/test/libarchive_test-test_read_large.obj: libarchive/test/test_read_large.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_large.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_large.Tpo -c -o libarchive/test/libarchive_test-test_read_large.obj `if test -f 'libarchive/test/test_read_large.c'; then $(CYGPATH_W) 'libarchive/test/test_read_large.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_large.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_large.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_large.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_large.c' object='libarchive/test/libarchive_test-test_read_large.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_large.obj `if test -f 'libarchive/test/test_read_large.c'; then $(CYGPATH_W) 'libarchive/test/test_read_large.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_large.c'; fi`
+
+libarchive/test/libarchive_test-test_read_pax_truncated.o: libarchive/test/test_read_pax_truncated.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_pax_truncated.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_pax_truncated.Tpo -c -o libarchive/test/libarchive_test-test_read_pax_truncated.o `test -f 'libarchive/test/test_read_pax_truncated.c' || echo '$(srcdir)/'`libarchive/test/test_read_pax_truncated.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_pax_truncated.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_pax_truncated.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_pax_truncated.c' object='libarchive/test/libarchive_test-test_read_pax_truncated.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_pax_truncated.o `test -f 'libarchive/test/test_read_pax_truncated.c' || echo '$(srcdir)/'`libarchive/test/test_read_pax_truncated.c
+
+libarchive/test/libarchive_test-test_read_pax_truncated.obj: libarchive/test/test_read_pax_truncated.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_pax_truncated.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_pax_truncated.Tpo -c -o libarchive/test/libarchive_test-test_read_pax_truncated.obj `if test -f 'libarchive/test/test_read_pax_truncated.c'; then $(CYGPATH_W) 'libarchive/test/test_read_pax_truncated.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_pax_truncated.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_pax_truncated.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_pax_truncated.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_pax_truncated.c' object='libarchive/test/libarchive_test-test_read_pax_truncated.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_pax_truncated.obj `if test -f 'libarchive/test/test_read_pax_truncated.c'; then $(CYGPATH_W) 'libarchive/test/test_read_pax_truncated.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_pax_truncated.c'; fi`
+
+libarchive/test/libarchive_test-test_read_position.o: libarchive/test/test_read_position.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_position.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_position.Tpo -c -o libarchive/test/libarchive_test-test_read_position.o `test -f 'libarchive/test/test_read_position.c' || echo '$(srcdir)/'`libarchive/test/test_read_position.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_position.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_position.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_position.c' object='libarchive/test/libarchive_test-test_read_position.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_position.o `test -f 'libarchive/test/test_read_position.c' || echo '$(srcdir)/'`libarchive/test/test_read_position.c
+
+libarchive/test/libarchive_test-test_read_position.obj: libarchive/test/test_read_position.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_position.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_position.Tpo -c -o libarchive/test/libarchive_test-test_read_position.obj `if test -f 'libarchive/test/test_read_position.c'; then $(CYGPATH_W) 'libarchive/test/test_read_position.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_position.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_position.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_position.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_position.c' object='libarchive/test/libarchive_test-test_read_position.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_position.obj `if test -f 'libarchive/test/test_read_position.c'; then $(CYGPATH_W) 'libarchive/test/test_read_position.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_position.c'; fi`
+
+libarchive/test/libarchive_test-test_read_truncated.o: libarchive/test/test_read_truncated.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_truncated.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_truncated.Tpo -c -o libarchive/test/libarchive_test-test_read_truncated.o `test -f 'libarchive/test/test_read_truncated.c' || echo '$(srcdir)/'`libarchive/test/test_read_truncated.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_truncated.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_truncated.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_truncated.c' object='libarchive/test/libarchive_test-test_read_truncated.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_truncated.o `test -f 'libarchive/test/test_read_truncated.c' || echo '$(srcdir)/'`libarchive/test/test_read_truncated.c
+
+libarchive/test/libarchive_test-test_read_truncated.obj: libarchive/test/test_read_truncated.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_truncated.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_truncated.Tpo -c -o libarchive/test/libarchive_test-test_read_truncated.obj `if test -f 'libarchive/test/test_read_truncated.c'; then $(CYGPATH_W) 'libarchive/test/test_read_truncated.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_truncated.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_truncated.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_truncated.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_truncated.c' object='libarchive/test/libarchive_test-test_read_truncated.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_truncated.obj `if test -f 'libarchive/test/test_read_truncated.c'; then $(CYGPATH_W) 'libarchive/test/test_read_truncated.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_truncated.c'; fi`
+
+libarchive/test/libarchive_test-test_read_uu.o: libarchive/test/test_read_uu.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_uu.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_uu.Tpo -c -o libarchive/test/libarchive_test-test_read_uu.o `test -f 'libarchive/test/test_read_uu.c' || echo '$(srcdir)/'`libarchive/test/test_read_uu.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_uu.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_uu.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_uu.c' object='libarchive/test/libarchive_test-test_read_uu.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_uu.o `test -f 'libarchive/test/test_read_uu.c' || echo '$(srcdir)/'`libarchive/test/test_read_uu.c
+
+libarchive/test/libarchive_test-test_read_uu.obj: libarchive/test/test_read_uu.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_read_uu.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_read_uu.Tpo -c -o libarchive/test/libarchive_test-test_read_uu.obj `if test -f 'libarchive/test/test_read_uu.c'; then $(CYGPATH_W) 'libarchive/test/test_read_uu.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_uu.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_read_uu.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_read_uu.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_read_uu.c' object='libarchive/test/libarchive_test-test_read_uu.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_read_uu.obj `if test -f 'libarchive/test/test_read_uu.c'; then $(CYGPATH_W) 'libarchive/test/test_read_uu.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_read_uu.c'; fi`
+
+libarchive/test/libarchive_test-test_tar_filenames.o: libarchive/test/test_tar_filenames.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_tar_filenames.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_tar_filenames.Tpo -c -o libarchive/test/libarchive_test-test_tar_filenames.o `test -f 'libarchive/test/test_tar_filenames.c' || echo '$(srcdir)/'`libarchive/test/test_tar_filenames.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_tar_filenames.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_tar_filenames.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_tar_filenames.c' object='libarchive/test/libarchive_test-test_tar_filenames.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_tar_filenames.o `test -f 'libarchive/test/test_tar_filenames.c' || echo '$(srcdir)/'`libarchive/test/test_tar_filenames.c
+
+libarchive/test/libarchive_test-test_tar_filenames.obj: libarchive/test/test_tar_filenames.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_tar_filenames.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_tar_filenames.Tpo -c -o libarchive/test/libarchive_test-test_tar_filenames.obj `if test -f 'libarchive/test/test_tar_filenames.c'; then $(CYGPATH_W) 'libarchive/test/test_tar_filenames.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_tar_filenames.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_tar_filenames.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_tar_filenames.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_tar_filenames.c' object='libarchive/test/libarchive_test-test_tar_filenames.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_tar_filenames.obj `if test -f 'libarchive/test/test_tar_filenames.c'; then $(CYGPATH_W) 'libarchive/test/test_tar_filenames.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_tar_filenames.c'; fi`
+
+libarchive/test/libarchive_test-test_tar_large.o: libarchive/test/test_tar_large.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_tar_large.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_tar_large.Tpo -c -o libarchive/test/libarchive_test-test_tar_large.o `test -f 'libarchive/test/test_tar_large.c' || echo '$(srcdir)/'`libarchive/test/test_tar_large.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_tar_large.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_tar_large.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_tar_large.c' object='libarchive/test/libarchive_test-test_tar_large.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_tar_large.o `test -f 'libarchive/test/test_tar_large.c' || echo '$(srcdir)/'`libarchive/test/test_tar_large.c
+
+libarchive/test/libarchive_test-test_tar_large.obj: libarchive/test/test_tar_large.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_tar_large.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_tar_large.Tpo -c -o libarchive/test/libarchive_test-test_tar_large.obj `if test -f 'libarchive/test/test_tar_large.c'; then $(CYGPATH_W) 'libarchive/test/test_tar_large.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_tar_large.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_tar_large.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_tar_large.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_tar_large.c' object='libarchive/test/libarchive_test-test_tar_large.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_tar_large.obj `if test -f 'libarchive/test/test_tar_large.c'; then $(CYGPATH_W) 'libarchive/test/test_tar_large.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_tar_large.c'; fi`
+
+libarchive/test/libarchive_test-test_ustar_filenames.o: libarchive/test/test_ustar_filenames.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_ustar_filenames.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_ustar_filenames.Tpo -c -o libarchive/test/libarchive_test-test_ustar_filenames.o `test -f 'libarchive/test/test_ustar_filenames.c' || echo '$(srcdir)/'`libarchive/test/test_ustar_filenames.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_ustar_filenames.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_ustar_filenames.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_ustar_filenames.c' object='libarchive/test/libarchive_test-test_ustar_filenames.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_ustar_filenames.o `test -f 'libarchive/test/test_ustar_filenames.c' || echo '$(srcdir)/'`libarchive/test/test_ustar_filenames.c
+
+libarchive/test/libarchive_test-test_ustar_filenames.obj: libarchive/test/test_ustar_filenames.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_ustar_filenames.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_ustar_filenames.Tpo -c -o libarchive/test/libarchive_test-test_ustar_filenames.obj `if test -f 'libarchive/test/test_ustar_filenames.c'; then $(CYGPATH_W) 'libarchive/test/test_ustar_filenames.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_ustar_filenames.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_ustar_filenames.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_ustar_filenames.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_ustar_filenames.c' object='libarchive/test/libarchive_test-test_ustar_filenames.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_ustar_filenames.obj `if test -f 'libarchive/test/test_ustar_filenames.c'; then $(CYGPATH_W) 'libarchive/test/test_ustar_filenames.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_ustar_filenames.c'; fi`
+
+libarchive/test/libarchive_test-test_write_compress.o: libarchive/test/test_write_compress.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress.Tpo -c -o libarchive/test/libarchive_test-test_write_compress.o `test -f 'libarchive/test/test_write_compress.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_compress.c' object='libarchive/test/libarchive_test-test_write_compress.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_compress.o `test -f 'libarchive/test/test_write_compress.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress.c
+
+libarchive/test/libarchive_test-test_write_compress.obj: libarchive/test/test_write_compress.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress.Tpo -c -o libarchive/test/libarchive_test-test_write_compress.obj `if test -f 'libarchive/test/test_write_compress.c'; then $(CYGPATH_W) 'libarchive/test/test_write_compress.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_compress.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_compress.c' object='libarchive/test/libarchive_test-test_write_compress.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_compress.obj `if test -f 'libarchive/test/test_write_compress.c'; then $(CYGPATH_W) 'libarchive/test/test_write_compress.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_compress.c'; fi`
+
+libarchive/test/libarchive_test-test_write_compress_bzip2.o: libarchive/test/test_write_compress_bzip2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress_bzip2.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_bzip2.Tpo -c -o libarchive/test/libarchive_test-test_write_compress_bzip2.o `test -f 'libarchive/test/test_write_compress_bzip2.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress_bzip2.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_bzip2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_bzip2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_compress_bzip2.c' object='libarchive/test/libarchive_test-test_write_compress_bzip2.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_compress_bzip2.o `test -f 'libarchive/test/test_write_compress_bzip2.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress_bzip2.c
+
+libarchive/test/libarchive_test-test_write_compress_bzip2.obj: libarchive/test/test_write_compress_bzip2.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress_bzip2.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_bzip2.Tpo -c -o libarchive/test/libarchive_test-test_write_compress_bzip2.obj `if test -f 'libarchive/test/test_write_compress_bzip2.c'; then $(CYGPATH_W) 'libarchive/test/test_write_compress_bzip2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_compress_bzip2.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_bzip2.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_bzip2.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_compress_bzip2.c' object='libarchive/test/libarchive_test-test_write_compress_bzip2.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_compress_bzip2.obj `if test -f 'libarchive/test/test_write_compress_bzip2.c'; then $(CYGPATH_W) 'libarchive/test/test_write_compress_bzip2.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_compress_bzip2.c'; fi`
+
+libarchive/test/libarchive_test-test_write_compress_gzip.o: libarchive/test/test_write_compress_gzip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress_gzip.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_gzip.Tpo -c -o libarchive/test/libarchive_test-test_write_compress_gzip.o `test -f 'libarchive/test/test_write_compress_gzip.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress_gzip.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_gzip.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_gzip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_compress_gzip.c' object='libarchive/test/libarchive_test-test_write_compress_gzip.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_compress_gzip.o `test -f 'libarchive/test/test_write_compress_gzip.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress_gzip.c
+
+libarchive/test/libarchive_test-test_write_compress_gzip.obj: libarchive/test/test_write_compress_gzip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress_gzip.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_gzip.Tpo -c -o libarchive/test/libarchive_test-test_write_compress_gzip.obj `if test -f 'libarchive/test/test_write_compress_gzip.c'; then $(CYGPATH_W) 'libarchive/test/test_write_compress_gzip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_compress_gzip.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_gzip.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_gzip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_compress_gzip.c' object='libarchive/test/libarchive_test-test_write_compress_gzip.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_compress_gzip.obj `if test -f 'libarchive/test/test_write_compress_gzip.c'; then $(CYGPATH_W) 'libarchive/test/test_write_compress_gzip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_compress_gzip.c'; fi`
+
+libarchive/test/libarchive_test-test_write_compress_lzma.o: libarchive/test/test_write_compress_lzma.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress_lzma.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_lzma.Tpo -c -o libarchive/test/libarchive_test-test_write_compress_lzma.o `test -f 'libarchive/test/test_write_compress_lzma.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress_lzma.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_lzma.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_lzma.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_compress_lzma.c' object='libarchive/test/libarchive_test-test_write_compress_lzma.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_compress_lzma.o `test -f 'libarchive/test/test_write_compress_lzma.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress_lzma.c
+
+libarchive/test/libarchive_test-test_write_compress_lzma.obj: libarchive/test/test_write_compress_lzma.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress_lzma.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_lzma.Tpo -c -o libarchive/test/libarchive_test-test_write_compress_lzma.obj `if test -f 'libarchive/test/test_write_compress_lzma.c'; then $(CYGPATH_W) 'libarchive/test/test_write_compress_lzma.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_compress_lzma.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_lzma.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_lzma.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_compress_lzma.c' object='libarchive/test/libarchive_test-test_write_compress_lzma.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_compress_lzma.obj `if test -f 'libarchive/test/test_write_compress_lzma.c'; then $(CYGPATH_W) 'libarchive/test/test_write_compress_lzma.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_compress_lzma.c'; fi`
+
+libarchive/test/libarchive_test-test_write_compress_program.o: libarchive/test/test_write_compress_program.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress_program.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_program.Tpo -c -o libarchive/test/libarchive_test-test_write_compress_program.o `test -f 'libarchive/test/test_write_compress_program.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress_program.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_program.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_program.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_compress_program.c' object='libarchive/test/libarchive_test-test_write_compress_program.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_compress_program.o `test -f 'libarchive/test/test_write_compress_program.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress_program.c
+
+libarchive/test/libarchive_test-test_write_compress_program.obj: libarchive/test/test_write_compress_program.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress_program.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_program.Tpo -c -o libarchive/test/libarchive_test-test_write_compress_program.obj `if test -f 'libarchive/test/test_write_compress_program.c'; then $(CYGPATH_W) 'libarchive/test/test_write_compress_program.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_compress_program.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_program.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_program.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_compress_program.c' object='libarchive/test/libarchive_test-test_write_compress_program.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_compress_program.obj `if test -f 'libarchive/test/test_write_compress_program.c'; then $(CYGPATH_W) 'libarchive/test/test_write_compress_program.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_compress_program.c'; fi`
+
+libarchive/test/libarchive_test-test_write_compress_xz.o: libarchive/test/test_write_compress_xz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress_xz.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_xz.Tpo -c -o libarchive/test/libarchive_test-test_write_compress_xz.o `test -f 'libarchive/test/test_write_compress_xz.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress_xz.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_xz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_xz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_compress_xz.c' object='libarchive/test/libarchive_test-test_write_compress_xz.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_compress_xz.o `test -f 'libarchive/test/test_write_compress_xz.c' || echo '$(srcdir)/'`libarchive/test/test_write_compress_xz.c
+
+libarchive/test/libarchive_test-test_write_compress_xz.obj: libarchive/test/test_write_compress_xz.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_compress_xz.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_xz.Tpo -c -o libarchive/test/libarchive_test-test_write_compress_xz.obj `if test -f 'libarchive/test/test_write_compress_xz.c'; then $(CYGPATH_W) 'libarchive/test/test_write_compress_xz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_compress_xz.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_xz.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_compress_xz.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_compress_xz.c' object='libarchive/test/libarchive_test-test_write_compress_xz.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_compress_xz.obj `if test -f 'libarchive/test/test_write_compress_xz.c'; then $(CYGPATH_W) 'libarchive/test/test_write_compress_xz.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_compress_xz.c'; fi`
+
+libarchive/test/libarchive_test-test_write_disk.o: libarchive/test/test_write_disk.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk.Tpo -c -o libarchive/test/libarchive_test-test_write_disk.o `test -f 'libarchive/test/test_write_disk.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk.c' object='libarchive/test/libarchive_test-test_write_disk.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk.o `test -f 'libarchive/test/test_write_disk.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk.c
+
+libarchive/test/libarchive_test-test_write_disk.obj: libarchive/test/test_write_disk.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk.Tpo -c -o libarchive/test/libarchive_test-test_write_disk.obj `if test -f 'libarchive/test/test_write_disk.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk.c' object='libarchive/test/libarchive_test-test_write_disk.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk.obj `if test -f 'libarchive/test/test_write_disk.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk.c'; fi`
+
+libarchive/test/libarchive_test-test_write_disk_failures.o: libarchive/test/test_write_disk_failures.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_failures.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_failures.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_failures.o `test -f 'libarchive/test/test_write_disk_failures.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_failures.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_failures.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_failures.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk_failures.c' object='libarchive/test/libarchive_test-test_write_disk_failures.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_failures.o `test -f 'libarchive/test/test_write_disk_failures.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_failures.c
+
+libarchive/test/libarchive_test-test_write_disk_failures.obj: libarchive/test/test_write_disk_failures.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_failures.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_failures.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_failures.obj `if test -f 'libarchive/test/test_write_disk_failures.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_failures.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_failures.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_failures.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_failures.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk_failures.c' object='libarchive/test/libarchive_test-test_write_disk_failures.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_failures.obj `if test -f 'libarchive/test/test_write_disk_failures.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_failures.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_failures.c'; fi`
+
+libarchive/test/libarchive_test-test_write_disk_hardlink.o: libarchive/test/test_write_disk_hardlink.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_hardlink.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_hardlink.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_hardlink.o `test -f 'libarchive/test/test_write_disk_hardlink.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_hardlink.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_hardlink.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_hardlink.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk_hardlink.c' object='libarchive/test/libarchive_test-test_write_disk_hardlink.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_hardlink.o `test -f 'libarchive/test/test_write_disk_hardlink.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_hardlink.c
+
+libarchive/test/libarchive_test-test_write_disk_hardlink.obj: libarchive/test/test_write_disk_hardlink.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_hardlink.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_hardlink.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_hardlink.obj `if test -f 'libarchive/test/test_write_disk_hardlink.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_hardlink.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_hardlink.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_hardlink.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_hardlink.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk_hardlink.c' object='libarchive/test/libarchive_test-test_write_disk_hardlink.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_hardlink.obj `if test -f 'libarchive/test/test_write_disk_hardlink.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_hardlink.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_hardlink.c'; fi`
+
+libarchive/test/libarchive_test-test_write_disk_perms.o: libarchive/test/test_write_disk_perms.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_perms.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_perms.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_perms.o `test -f 'libarchive/test/test_write_disk_perms.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_perms.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_perms.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_perms.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk_perms.c' object='libarchive/test/libarchive_test-test_write_disk_perms.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_perms.o `test -f 'libarchive/test/test_write_disk_perms.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_perms.c
+
+libarchive/test/libarchive_test-test_write_disk_perms.obj: libarchive/test/test_write_disk_perms.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_perms.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_perms.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_perms.obj `if test -f 'libarchive/test/test_write_disk_perms.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_perms.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_perms.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_perms.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_perms.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk_perms.c' object='libarchive/test/libarchive_test-test_write_disk_perms.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_perms.obj `if test -f 'libarchive/test/test_write_disk_perms.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_perms.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_perms.c'; fi`
+
+libarchive/test/libarchive_test-test_write_disk_secure.o: libarchive/test/test_write_disk_secure.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_secure.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_secure.o `test -f 'libarchive/test/test_write_disk_secure.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_secure.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk_secure.c' object='libarchive/test/libarchive_test-test_write_disk_secure.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_secure.o `test -f 'libarchive/test/test_write_disk_secure.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_secure.c
+
+libarchive/test/libarchive_test-test_write_disk_secure.obj: libarchive/test/test_write_disk_secure.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_secure.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_secure.obj `if test -f 'libarchive/test/test_write_disk_secure.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_secure.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_secure.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_secure.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk_secure.c' object='libarchive/test/libarchive_test-test_write_disk_secure.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_secure.obj `if test -f 'libarchive/test/test_write_disk_secure.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_secure.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_secure.c'; fi`
+
+libarchive/test/libarchive_test-test_write_disk_sparse.o: libarchive/test/test_write_disk_sparse.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_sparse.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_sparse.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_sparse.o `test -f 'libarchive/test/test_write_disk_sparse.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_sparse.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_sparse.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_sparse.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk_sparse.c' object='libarchive/test/libarchive_test-test_write_disk_sparse.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_sparse.o `test -f 'libarchive/test/test_write_disk_sparse.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_sparse.c
+
+libarchive/test/libarchive_test-test_write_disk_sparse.obj: libarchive/test/test_write_disk_sparse.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_sparse.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_sparse.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_sparse.obj `if test -f 'libarchive/test/test_write_disk_sparse.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_sparse.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_sparse.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_sparse.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_sparse.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk_sparse.c' object='libarchive/test/libarchive_test-test_write_disk_sparse.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_sparse.obj `if test -f 'libarchive/test/test_write_disk_sparse.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_sparse.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_sparse.c'; fi`
+
+libarchive/test/libarchive_test-test_write_disk_symlink.o: libarchive/test/test_write_disk_symlink.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_symlink.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_symlink.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_symlink.o `test -f 'libarchive/test/test_write_disk_symlink.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_symlink.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_symlink.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_symlink.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk_symlink.c' object='libarchive/test/libarchive_test-test_write_disk_symlink.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_symlink.o `test -f 'libarchive/test/test_write_disk_symlink.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_symlink.c
+
+libarchive/test/libarchive_test-test_write_disk_symlink.obj: libarchive/test/test_write_disk_symlink.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_symlink.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_symlink.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_symlink.obj `if test -f 'libarchive/test/test_write_disk_symlink.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_symlink.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_symlink.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_symlink.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_symlink.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk_symlink.c' object='libarchive/test/libarchive_test-test_write_disk_symlink.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_symlink.obj `if test -f 'libarchive/test/test_write_disk_symlink.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_symlink.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_symlink.c'; fi`
+
+libarchive/test/libarchive_test-test_write_disk_times.o: libarchive/test/test_write_disk_times.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_times.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_times.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_times.o `test -f 'libarchive/test/test_write_disk_times.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_times.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_times.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_times.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk_times.c' object='libarchive/test/libarchive_test-test_write_disk_times.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_times.o `test -f 'libarchive/test/test_write_disk_times.c' || echo '$(srcdir)/'`libarchive/test/test_write_disk_times.c
+
+libarchive/test/libarchive_test-test_write_disk_times.obj: libarchive/test/test_write_disk_times.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_disk_times.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_times.Tpo -c -o libarchive/test/libarchive_test-test_write_disk_times.obj `if test -f 'libarchive/test/test_write_disk_times.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_times.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_times.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_times.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_disk_times.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_disk_times.c' object='libarchive/test/libarchive_test-test_write_disk_times.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_disk_times.obj `if test -f 'libarchive/test/test_write_disk_times.c'; then $(CYGPATH_W) 'libarchive/test/test_write_disk_times.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_disk_times.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_ar.o: libarchive/test/test_write_format_ar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_ar.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_ar.Tpo -c -o libarchive/test/libarchive_test-test_write_format_ar.o `test -f 'libarchive/test/test_write_format_ar.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_ar.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_ar.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_ar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_ar.c' object='libarchive/test/libarchive_test-test_write_format_ar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_ar.o `test -f 'libarchive/test/test_write_format_ar.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_ar.c
+
+libarchive/test/libarchive_test-test_write_format_ar.obj: libarchive/test/test_write_format_ar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_ar.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_ar.Tpo -c -o libarchive/test/libarchive_test-test_write_format_ar.obj `if test -f 'libarchive/test/test_write_format_ar.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_ar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_ar.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_ar.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_ar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_ar.c' object='libarchive/test/libarchive_test-test_write_format_ar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_ar.obj `if test -f 'libarchive/test/test_write_format_ar.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_ar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_ar.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_cpio.o: libarchive/test/test_write_format_cpio.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_cpio.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio.Tpo -c -o libarchive/test/libarchive_test-test_write_format_cpio.o `test -f 'libarchive/test/test_write_format_cpio.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_cpio.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_cpio.c' object='libarchive/test/libarchive_test-test_write_format_cpio.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_cpio.o `test -f 'libarchive/test/test_write_format_cpio.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_cpio.c
+
+libarchive/test/libarchive_test-test_write_format_cpio.obj: libarchive/test/test_write_format_cpio.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_cpio.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio.Tpo -c -o libarchive/test/libarchive_test-test_write_format_cpio.obj `if test -f 'libarchive/test/test_write_format_cpio.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_cpio.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_cpio.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_cpio.c' object='libarchive/test/libarchive_test-test_write_format_cpio.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_cpio.obj `if test -f 'libarchive/test/test_write_format_cpio.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_cpio.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_cpio.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_cpio_empty.o: libarchive/test/test_write_format_cpio_empty.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_cpio_empty.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_empty.Tpo -c -o libarchive/test/libarchive_test-test_write_format_cpio_empty.o `test -f 'libarchive/test/test_write_format_cpio_empty.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_cpio_empty.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_empty.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_empty.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_cpio_empty.c' object='libarchive/test/libarchive_test-test_write_format_cpio_empty.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_cpio_empty.o `test -f 'libarchive/test/test_write_format_cpio_empty.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_cpio_empty.c
+
+libarchive/test/libarchive_test-test_write_format_cpio_empty.obj: libarchive/test/test_write_format_cpio_empty.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_cpio_empty.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_empty.Tpo -c -o libarchive/test/libarchive_test-test_write_format_cpio_empty.obj `if test -f 'libarchive/test/test_write_format_cpio_empty.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_cpio_empty.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_cpio_empty.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_empty.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_empty.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_cpio_empty.c' object='libarchive/test/libarchive_test-test_write_format_cpio_empty.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_cpio_empty.obj `if test -f 'libarchive/test/test_write_format_cpio_empty.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_cpio_empty.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_cpio_empty.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_cpio_odc.o: libarchive/test/test_write_format_cpio_odc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_cpio_odc.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_odc.Tpo -c -o libarchive/test/libarchive_test-test_write_format_cpio_odc.o `test -f 'libarchive/test/test_write_format_cpio_odc.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_cpio_odc.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_odc.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_odc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_cpio_odc.c' object='libarchive/test/libarchive_test-test_write_format_cpio_odc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_cpio_odc.o `test -f 'libarchive/test/test_write_format_cpio_odc.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_cpio_odc.c
+
+libarchive/test/libarchive_test-test_write_format_cpio_odc.obj: libarchive/test/test_write_format_cpio_odc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_cpio_odc.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_odc.Tpo -c -o libarchive/test/libarchive_test-test_write_format_cpio_odc.obj `if test -f 'libarchive/test/test_write_format_cpio_odc.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_cpio_odc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_cpio_odc.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_odc.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_odc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_cpio_odc.c' object='libarchive/test/libarchive_test-test_write_format_cpio_odc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_cpio_odc.obj `if test -f 'libarchive/test/test_write_format_cpio_odc.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_cpio_odc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_cpio_odc.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_cpio_newc.o: libarchive/test/test_write_format_cpio_newc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_cpio_newc.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_newc.Tpo -c -o libarchive/test/libarchive_test-test_write_format_cpio_newc.o `test -f 'libarchive/test/test_write_format_cpio_newc.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_cpio_newc.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_newc.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_newc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_cpio_newc.c' object='libarchive/test/libarchive_test-test_write_format_cpio_newc.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_cpio_newc.o `test -f 'libarchive/test/test_write_format_cpio_newc.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_cpio_newc.c
+
+libarchive/test/libarchive_test-test_write_format_cpio_newc.obj: libarchive/test/test_write_format_cpio_newc.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_cpio_newc.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_newc.Tpo -c -o libarchive/test/libarchive_test-test_write_format_cpio_newc.obj `if test -f 'libarchive/test/test_write_format_cpio_newc.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_cpio_newc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_cpio_newc.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_newc.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_cpio_newc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_cpio_newc.c' object='libarchive/test/libarchive_test-test_write_format_cpio_newc.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_cpio_newc.obj `if test -f 'libarchive/test/test_write_format_cpio_newc.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_cpio_newc.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_cpio_newc.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_mtree.o: libarchive/test/test_write_format_mtree.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_mtree.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_mtree.Tpo -c -o libarchive/test/libarchive_test-test_write_format_mtree.o `test -f 'libarchive/test/test_write_format_mtree.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_mtree.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_mtree.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_mtree.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_mtree.c' object='libarchive/test/libarchive_test-test_write_format_mtree.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_mtree.o `test -f 'libarchive/test/test_write_format_mtree.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_mtree.c
+
+libarchive/test/libarchive_test-test_write_format_mtree.obj: libarchive/test/test_write_format_mtree.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_mtree.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_mtree.Tpo -c -o libarchive/test/libarchive_test-test_write_format_mtree.obj `if test -f 'libarchive/test/test_write_format_mtree.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_mtree.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_mtree.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_mtree.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_mtree.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_mtree.c' object='libarchive/test/libarchive_test-test_write_format_mtree.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_mtree.obj `if test -f 'libarchive/test/test_write_format_mtree.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_mtree.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_mtree.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_pax.o: libarchive/test/test_write_format_pax.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_pax.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_pax.Tpo -c -o libarchive/test/libarchive_test-test_write_format_pax.o `test -f 'libarchive/test/test_write_format_pax.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_pax.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_pax.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_pax.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_pax.c' object='libarchive/test/libarchive_test-test_write_format_pax.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_pax.o `test -f 'libarchive/test/test_write_format_pax.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_pax.c
+
+libarchive/test/libarchive_test-test_write_format_pax.obj: libarchive/test/test_write_format_pax.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_pax.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_pax.Tpo -c -o libarchive/test/libarchive_test-test_write_format_pax.obj `if test -f 'libarchive/test/test_write_format_pax.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_pax.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_pax.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_pax.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_pax.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_pax.c' object='libarchive/test/libarchive_test-test_write_format_pax.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_pax.obj `if test -f 'libarchive/test/test_write_format_pax.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_pax.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_pax.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_shar_empty.o: libarchive/test/test_write_format_shar_empty.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_shar_empty.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_shar_empty.Tpo -c -o libarchive/test/libarchive_test-test_write_format_shar_empty.o `test -f 'libarchive/test/test_write_format_shar_empty.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_shar_empty.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_shar_empty.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_shar_empty.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_shar_empty.c' object='libarchive/test/libarchive_test-test_write_format_shar_empty.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_shar_empty.o `test -f 'libarchive/test/test_write_format_shar_empty.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_shar_empty.c
+
+libarchive/test/libarchive_test-test_write_format_shar_empty.obj: libarchive/test/test_write_format_shar_empty.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_shar_empty.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_shar_empty.Tpo -c -o libarchive/test/libarchive_test-test_write_format_shar_empty.obj `if test -f 'libarchive/test/test_write_format_shar_empty.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_shar_empty.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_shar_empty.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_shar_empty.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_shar_empty.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_shar_empty.c' object='libarchive/test/libarchive_test-test_write_format_shar_empty.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_shar_empty.obj `if test -f 'libarchive/test/test_write_format_shar_empty.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_shar_empty.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_shar_empty.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_tar.o: libarchive/test/test_write_format_tar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_tar.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar.Tpo -c -o libarchive/test/libarchive_test-test_write_format_tar.o `test -f 'libarchive/test/test_write_format_tar.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_tar.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_tar.c' object='libarchive/test/libarchive_test-test_write_format_tar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_tar.o `test -f 'libarchive/test/test_write_format_tar.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_tar.c
+
+libarchive/test/libarchive_test-test_write_format_tar.obj: libarchive/test/test_write_format_tar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_tar.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar.Tpo -c -o libarchive/test/libarchive_test-test_write_format_tar.obj `if test -f 'libarchive/test/test_write_format_tar.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_tar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_tar.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_tar.c' object='libarchive/test/libarchive_test-test_write_format_tar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_tar.obj `if test -f 'libarchive/test/test_write_format_tar.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_tar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_tar.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_tar_empty.o: libarchive/test/test_write_format_tar_empty.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_tar_empty.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_empty.Tpo -c -o libarchive/test/libarchive_test-test_write_format_tar_empty.o `test -f 'libarchive/test/test_write_format_tar_empty.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_tar_empty.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_empty.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_empty.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_tar_empty.c' object='libarchive/test/libarchive_test-test_write_format_tar_empty.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_tar_empty.o `test -f 'libarchive/test/test_write_format_tar_empty.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_tar_empty.c
+
+libarchive/test/libarchive_test-test_write_format_tar_empty.obj: libarchive/test/test_write_format_tar_empty.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_tar_empty.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_empty.Tpo -c -o libarchive/test/libarchive_test-test_write_format_tar_empty.obj `if test -f 'libarchive/test/test_write_format_tar_empty.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_tar_empty.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_tar_empty.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_empty.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_empty.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_tar_empty.c' object='libarchive/test/libarchive_test-test_write_format_tar_empty.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_tar_empty.obj `if test -f 'libarchive/test/test_write_format_tar_empty.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_tar_empty.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_tar_empty.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_tar_ustar.o: libarchive/test/test_write_format_tar_ustar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_tar_ustar.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_ustar.Tpo -c -o libarchive/test/libarchive_test-test_write_format_tar_ustar.o `test -f 'libarchive/test/test_write_format_tar_ustar.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_tar_ustar.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_ustar.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_ustar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_tar_ustar.c' object='libarchive/test/libarchive_test-test_write_format_tar_ustar.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_tar_ustar.o `test -f 'libarchive/test/test_write_format_tar_ustar.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_tar_ustar.c
+
+libarchive/test/libarchive_test-test_write_format_tar_ustar.obj: libarchive/test/test_write_format_tar_ustar.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_tar_ustar.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_ustar.Tpo -c -o libarchive/test/libarchive_test-test_write_format_tar_ustar.obj `if test -f 'libarchive/test/test_write_format_tar_ustar.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_tar_ustar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_tar_ustar.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_ustar.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_tar_ustar.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_tar_ustar.c' object='libarchive/test/libarchive_test-test_write_format_tar_ustar.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_tar_ustar.obj `if test -f 'libarchive/test/test_write_format_tar_ustar.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_tar_ustar.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_tar_ustar.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_zip.o: libarchive/test/test_write_format_zip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_zip.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip.Tpo -c -o libarchive/test/libarchive_test-test_write_format_zip.o `test -f 'libarchive/test/test_write_format_zip.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_zip.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_zip.c' object='libarchive/test/libarchive_test-test_write_format_zip.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_zip.o `test -f 'libarchive/test/test_write_format_zip.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_zip.c
+
+libarchive/test/libarchive_test-test_write_format_zip.obj: libarchive/test/test_write_format_zip.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_zip.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip.Tpo -c -o libarchive/test/libarchive_test-test_write_format_zip.obj `if test -f 'libarchive/test/test_write_format_zip.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_zip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_zip.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_zip.c' object='libarchive/test/libarchive_test-test_write_format_zip.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_zip.obj `if test -f 'libarchive/test/test_write_format_zip.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_zip.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_zip.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_zip_empty.o: libarchive/test/test_write_format_zip_empty.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_zip_empty.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip_empty.Tpo -c -o libarchive/test/libarchive_test-test_write_format_zip_empty.o `test -f 'libarchive/test/test_write_format_zip_empty.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_zip_empty.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip_empty.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip_empty.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_zip_empty.c' object='libarchive/test/libarchive_test-test_write_format_zip_empty.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_zip_empty.o `test -f 'libarchive/test/test_write_format_zip_empty.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_zip_empty.c
+
+libarchive/test/libarchive_test-test_write_format_zip_empty.obj: libarchive/test/test_write_format_zip_empty.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_zip_empty.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip_empty.Tpo -c -o libarchive/test/libarchive_test-test_write_format_zip_empty.obj `if test -f 'libarchive/test/test_write_format_zip_empty.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_zip_empty.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_zip_empty.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip_empty.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip_empty.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_zip_empty.c' object='libarchive/test/libarchive_test-test_write_format_zip_empty.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_zip_empty.obj `if test -f 'libarchive/test/test_write_format_zip_empty.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_zip_empty.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_zip_empty.c'; fi`
+
+libarchive/test/libarchive_test-test_write_format_zip_no_compression.o: libarchive/test/test_write_format_zip_no_compression.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_zip_no_compression.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip_no_compression.Tpo -c -o libarchive/test/libarchive_test-test_write_format_zip_no_compression.o `test -f 'libarchive/test/test_write_format_zip_no_compression.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_zip_no_compression.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip_no_compression.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip_no_compression.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_zip_no_compression.c' object='libarchive/test/libarchive_test-test_write_format_zip_no_compression.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_zip_no_compression.o `test -f 'libarchive/test/test_write_format_zip_no_compression.c' || echo '$(srcdir)/'`libarchive/test/test_write_format_zip_no_compression.c
+
+libarchive/test/libarchive_test-test_write_format_zip_no_compression.obj: libarchive/test/test_write_format_zip_no_compression.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_format_zip_no_compression.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip_no_compression.Tpo -c -o libarchive/test/libarchive_test-test_write_format_zip_no_compression.obj `if test -f 'libarchive/test/test_write_format_zip_no_compression.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_zip_no_compression.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_zip_no_compression.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip_no_compression.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_format_zip_no_compression.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_format_zip_no_compression.c' object='libarchive/test/libarchive_test-test_write_format_zip_no_compression.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_format_zip_no_compression.obj `if test -f 'libarchive/test/test_write_format_zip_no_compression.c'; then $(CYGPATH_W) 'libarchive/test/test_write_format_zip_no_compression.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_format_zip_no_compression.c'; fi`
+
+libarchive/test/libarchive_test-test_write_open_memory.o: libarchive/test/test_write_open_memory.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_open_memory.o -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_open_memory.Tpo -c -o libarchive/test/libarchive_test-test_write_open_memory.o `test -f 'libarchive/test/test_write_open_memory.c' || echo '$(srcdir)/'`libarchive/test/test_write_open_memory.c
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_open_memory.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_open_memory.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_open_memory.c' object='libarchive/test/libarchive_test-test_write_open_memory.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_open_memory.o `test -f 'libarchive/test/test_write_open_memory.c' || echo '$(srcdir)/'`libarchive/test/test_write_open_memory.c
+
+libarchive/test/libarchive_test-test_write_open_memory.obj: libarchive/test/test_write_open_memory.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libarchive/test/libarchive_test-test_write_open_memory.obj -MD -MP -MF libarchive/test/$(DEPDIR)/libarchive_test-test_write_open_memory.Tpo -c -o libarchive/test/libarchive_test-test_write_open_memory.obj `if test -f 'libarchive/test/test_write_open_memory.c'; then $(CYGPATH_W) 'libarchive/test/test_write_open_memory.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_open_memory.c'; fi`
+@am__fastdepCC_TRUE@ mv -f libarchive/test/$(DEPDIR)/libarchive_test-test_write_open_memory.Tpo libarchive/test/$(DEPDIR)/libarchive_test-test_write_open_memory.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='libarchive/test/test_write_open_memory.c' object='libarchive/test/libarchive_test-test_write_open_memory.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarchive_test_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libarchive/test/libarchive_test-test_write_open_memory.obj `if test -f 'libarchive/test/test_write_open_memory.c'; then $(CYGPATH_W) 'libarchive/test/test_write_open_memory.c'; else $(CYGPATH_W) '$(srcdir)/libarchive/test/test_write_open_memory.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+ -rm -rf libarchive/.libs libarchive/_libs
+ -rm -rf libarchive_fe/.libs libarchive_fe/_libs
+
+distclean-libtool:
+ -rm -f libtool
+install-man1: $(man1_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)"
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.1*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 1*) ;; \
+ *) ext='1' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man1dir)/$$inst"; \
+ done
+install-man3: $(man3_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)"
+ @list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.3*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 3*) ;; \
+ *) ext='3' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst"; \
+ done
+uninstall-man3:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man3_MANS) $(dist_man3_MANS) $(nodist_man3_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.3*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 3*) ;; \
+ *) ext='3' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man3dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man3dir)/$$inst"; \
+ done
+install-man5: $(man5_MANS) $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man5dir)" || $(MKDIR_P) "$(DESTDIR)$(man5dir)"
+ @list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.5*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+ else file=$$i; fi; \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 5*) ;; \
+ *) ext='5' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst"; \
+ done
+uninstall-man5:
+ @$(NORMAL_UNINSTALL)
+ @list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
+ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+ for i in $$l2; do \
+ case "$$i" in \
+ *.5*) list="$$list $$i" ;; \
+ esac; \
+ done; \
+ for i in $$list; do \
+ ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+ case "$$ext" in \
+ 5*) ;; \
+ *) ext='5' ;; \
+ esac; \
+ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+ echo " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \
+ rm -f "$(DESTDIR)$(man5dir)/$$inst"; \
+ done
+install-pkgconfigDATA: $(pkgconfig_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
+ @list='$(pkgconfig_DATA)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
+ $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+ done
+
+uninstall-pkgconfigDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(pkgconfig_DATA)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+ done
+install-includeHEADERS: $(include_HEADERS)
+ @$(NORMAL_INSTALL)
+ test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)"
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ f=$(am__strip_dir) \
+ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+uninstall-includeHEADERS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ f=$(am__strip_dir) \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; ws='[ ]'; \
+ srcdir=$(srcdir); export srcdir; \
+ list=' $(TESTS) '; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *$$ws$$tst$$ws*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -z "$$skipped" || echo "$$skipped"; \
+ test -z "$$report" || echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d $(distdir) || mkdir $(distdir)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-hook
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
+ $(am__remove_distdir)
+
+dist-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__remove_distdir)
+
+dist dist-all: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && $(MAKE) $(AM_MAKEFLAGS) distcheck-hook \
+ && cd $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(MANS) $(DATA) $(HEADERS) \
+ config.h
+install-binPROGRAMS: install-libLTLIBRARIES
+
+installdirs:
+ for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(man3dir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(includedir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: $(BUILT_SOURCES)
+ $(MAKE) $(AM_MAKEFLAGS) install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -rm -f cpio/$(DEPDIR)/$(am__dirstamp)
+ -rm -f cpio/$(am__dirstamp)
+ -rm -f cpio/test/$(DEPDIR)/$(am__dirstamp)
+ -rm -f cpio/test/$(am__dirstamp)
+ -rm -f libarchive/$(DEPDIR)/$(am__dirstamp)
+ -rm -f libarchive/$(am__dirstamp)
+ -rm -f libarchive/test/$(DEPDIR)/$(am__dirstamp)
+ -rm -f libarchive/test/$(am__dirstamp)
+ -rm -f libarchive_fe/$(DEPDIR)/$(am__dirstamp)
+ -rm -f libarchive_fe/$(am__dirstamp)
+ -rm -f tar/$(DEPDIR)/$(am__dirstamp)
+ -rm -f tar/$(am__dirstamp)
+ -rm -f tar/test/$(DEPDIR)/$(am__dirstamp)
+ -rm -f tar/test/$(am__dirstamp)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf cpio/$(DEPDIR) cpio/test/$(DEPDIR) libarchive/$(DEPDIR) libarchive/test/$(DEPDIR) libarchive_fe/$(DEPDIR) tar/$(DEPDIR) tar/test/$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-hdr distclean-libtool distclean-local distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am: install-includeHEADERS install-man \
+ install-pkgconfigDATA
+
+install-dvi: install-dvi-am
+
+install-exec-am: install-binPROGRAMS install-libLTLIBRARIES
+
+install-html: install-html-am
+
+install-info: install-info-am
+
+install-man: install-man1 install-man3 install-man5
+
+install-pdf: install-pdf-am
+
+install-ps: install-ps-am
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -rf cpio/$(DEPDIR) cpio/test/$(DEPDIR) libarchive/$(DEPDIR) libarchive/test/$(DEPDIR) libarchive_fe/$(DEPDIR) tar/$(DEPDIR) tar/test/$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-includeHEADERS \
+ uninstall-libLTLIBRARIES uninstall-man uninstall-pkgconfigDATA
+
+uninstall-man: uninstall-man1 uninstall-man3 uninstall-man5
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am am--refresh check check-TESTS check-am \
+ clean clean-binPROGRAMS clean-checkPROGRAMS clean-generic \
+ clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \
+ ctags dist dist-all dist-bzip2 dist-gzip dist-hook dist-lzma \
+ dist-shar dist-tarZ dist-zip distcheck distclean \
+ distclean-compile distclean-generic distclean-hdr \
+ distclean-libtool distclean-local distclean-tags \
+ distcleancheck distdir distuninstallcheck dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-includeHEADERS install-info install-info-am \
+ install-libLTLIBRARIES install-man install-man1 install-man3 \
+ install-man5 install-pdf install-pdf-am install-pkgconfigDATA \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS \
+ uninstall-includeHEADERS uninstall-libLTLIBRARIES \
+ uninstall-man uninstall-man1 uninstall-man3 uninstall-man5 \
+ uninstall-pkgconfigDATA
+
+
+# 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
+
+# Verify cmake builds as part of the acceptance
+distcheck-hook:
+ mkdir $(distdir)/_build/cmtest
+ cd $(distdir)/_build/cmtest && cmake ../.. && make && make test
+ rm -rf $(distdir)/_build/cmtest
+
+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
+
+# 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
+ cat $(top_srcdir)/libarchive/test/test_*.c | grep DEFINE_TEST > libarchive/test/list.h
+
+tar/test/list.h: Makefile
+ cat $(top_srcdir)/tar/test/test_*.c | grep DEFINE_TEST > tar/test/list.h
+
+cpio/test/list.h: Makefile
+ cat $(top_srcdir)/cpio/test/test_*.c | grep DEFINE_TEST > cpio/test/list.h
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/archivers/libarchive/files/NEWS b/archivers/libarchive/files/NEWS
new file mode 100644
index 00000000000..f7b9d3c3c5f
--- /dev/null
+++ b/archivers/libarchive/files/NEWS
@@ -0,0 +1,525 @@
+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 detaults:
+ 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.
diff --git a/archivers/libarchive/files/README b/archivers/libarchive/files/README
new file mode 100644
index 00000000000..03e47e85497
--- /dev/null
+++ b/archivers/libarchive/files/README
@@ -0,0 +1,137 @@
+README for libarchive bundle.
+
+Questions? Issues?
+ * http://libarchive.googlecode.com/ is the home for ongoing
+ libarchive development, including issue tracker, additional
+ documentation, and links to the libarchive mailing lists.
+
+This distribution bundle includes the following components:
+ * libarchive: a library for reading and writing streaming archives
+ * tar: the 'bsdtar' program is a full-featured 'tar'
+ replacement built on libarchive
+ * cpio: the 'bsdcpio' program is a different interface to
+ essentially the same functionality
+ * examples: Some small example programs that you may find useful.
+ * examples/minitar: a compact sample demonstrating use of libarchive.
+ I use this for testing link pollution; it should produce a very
+ small executable file on most systems.
+ * 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
+ * configure - configuration script, see INSTALL for details.
+ * CMakeLists.txt - input for "cmake" build tool, see INSTALL
+
+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
+
+Guide to Documentation installed by this system:
+ * bsdtar.1 explains the use of the bsdtar program
+ * bsdcpio.1 explains the use of the bsdcpio 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 me
+know about any errors or omissions you find.
+
+Currently, the library automatically detects and reads the following:
+ * gzip compression
+ * bzip2 compression
+ * compress/LZW compression
+ * lzma and xz compression
+ * GNU tar format (including GNU long filenames, long link names, and
+ sparse files)
+ * Solaris 9 extended tar format (including ACLs)
+ * Old V7 tar archives
+ * POSIX ustar
+ * POSIX pax interchange format
+ * POSIX octet-oriented cpio
+ * SVR4 ASCII cpio
+ * POSIX octet-oriented cpio
+ * Binary cpio (big-endian or little-endian)
+ * ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
+ * ZIP archives (with uncompressed or "deflate" compressed entries)
+ * GNU and BSD 'ar' archives
+ * 'mtree' format
+
+The library can write:
+ * gzip compression
+ * bzip2 compression
+ * compress/LZW compression
+ * lzma and xz compression
+ * 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).
+ * POSIX octet-oriented cpio
+ * SVR4 "newc" cpio
+ * shar archives
+ * ZIP archives (with uncompressed or "deflate" compressed entries)
+ * GNU and BSD 'ar' archives
+ * 'mtree' format
+
+Notes about the library architecture:
+
+ * This is a heavily stream-oriented system. There is no direct
+ support for in-place modification or random access.
+
+ * 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.
+
+ * 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.
+ 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.
+
+ * 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: "pax interchange format" is really an extended tar format,
+ despite what the name says.
diff --git a/archivers/libarchive/files/aclocal.m4 b/archivers/libarchive/files/aclocal.m4
new file mode 100644
index 00000000000..0cffd9cf73f
--- /dev/null
+++ b/archivers/libarchive/files/aclocal.m4
@@ -0,0 +1,8850 @@
+# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 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.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(AC_AUTOCONF_VERSION, [2.62],,
+[m4_warning([this file was generated for autoconf 2.62.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically `autoreconf'.])])
+
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gordon Matzigkeit, 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.
+
+m4_define([_LT_COPYING], [dnl
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool 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 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 56 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+ [m4_default([$3],
+ [m4_fatal([Libtool version $1 or higher is required],
+ 63)])],
+ [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+ *\ * | *\ *)
+ AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
+m4_defun([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+ case $cc_temp in
+ compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+ distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
+
+
+# _LT_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+_LT_PROG_ECHO_BACKSLASH
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([["`\\]]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ _LT_PATH_MAGIC
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+ [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+ [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+ [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+ [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+ [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME. Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+ [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+ [m4_ifval([$1], [$1], [$2])])
+ lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+ m4_ifval([$4],
+ [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+ lt_dict_add_subkey([lt_decl_dict], [$2],
+ [tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+ [0], [m4_fatal([$0: too few arguments: $#])],
+ [1], [m4_fatal([$0: too few arguments: $#: $1])],
+ [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+ [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+ [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+ m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_if([$2], [],
+ m4_quote(lt_decl_varnames),
+ m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+ lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'. VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly. In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+# <var>='`$ECHO "X$<var>" | $Xsed -e "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+ [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+# # Some comment about what VAR is for.
+# visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+ [description])))[]dnl
+m4_pushdef([_libtool_name],
+ m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+ [0], [_libtool_name=[$]$1],
+ [1], [_libtool_name=$lt_[]$1],
+ [2], [_libtool_name=$lt_[]$1],
+ [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script. Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+ m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+ [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+ [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'. Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+ dnl If the libtool generation code has been placed in $CONFIG_LT,
+ dnl instead of duplicating it all over again into config.status,
+ dnl then we will have config.status run $CONFIG_LT later, so it
+ dnl needs to know what name is stored there:
+ [AC_CONFIG_COMMANDS([libtool],
+ [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+ dnl If the libtool generation code is destined for config.status,
+ dnl expand the accumulated commands and init code now:
+ [AC_CONFIG_COMMANDS([libtool],
+ [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+ *[[\\\\\\\`\\"\\\$]]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+ *[[\\\\\\\`\\"\\\$]]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\[$]0 --fallback-echo"')dnl "
+ lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`
+ ;;
+esac
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+cat >"$CONFIG_LT" <<_LTEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate a libtool stub with the current configuration.
+
+lt_cl_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AS_SHELL_SANITIZE
+_AS_PREPARE
+
+exec AS_MESSAGE_FD>&1
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+ echo
+ AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+
+Report bugs to <bug-libtool@gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2008 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+ case $[1] in
+ --version | --v* | -V )
+ echo "$lt_cl_version"; exit 0 ;;
+ --help | --h* | -h )
+ echo "$lt_cl_help"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --quiet | --q* | --silent | --s* | -q )
+ lt_cl_silent=: ;;
+
+ -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+ *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+ esac
+ shift
+done
+
+if $lt_cl_silent; then
+ exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure. Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+if test "$no_create" != yes; then
+ lt_cl_success=:
+ test "$silent" = yes &&
+ lt_config_lt_args="$lt_config_lt_args --quiet"
+ exec AS_MESSAGE_LOG_FD>/dev/null
+ $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+ exec AS_MESSAGE_LOG_FD>>config.log
+ $lt_cl_success || AS_EXIT(1)
+fi
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, create an initial libtool script with a
+# default configuration from the untagged config vars. Otherwise add code
+# to config.status for appending the configuration named by TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+ m4_if(_LT_TAG, [C], [
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+ _LT_PROG_LTMAIN
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ _LT_PROG_XSI_SHELLFNS
+
+ sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+# autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+ [C], [_LT_LANG(C)],
+ [C++], [_LT_LANG(CXX)],
+ [Java], [_LT_LANG(GCJ)],
+ [Fortran 77], [_LT_LANG(F77)],
+ [Fortran], [_LT_LANG(FC)],
+ [Windows Resource], [_LT_LANG(RC)],
+ [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+ [_LT_LANG($1)],
+ [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+ [LT_SUPPORTED_TAG([$1])dnl
+ m4_append([_LT_TAGS], [$1 ])dnl
+ m4_define([_LT_LANG_]$1[_enabled], [])dnl
+ _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [LT_LANG(CXX)],
+ [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+ [LT_LANG(F77)],
+ [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+ [LT_LANG(FC)],
+ [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [m4_ifdef([AC_PROG_GCJ],
+ [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+ m4_ifdef([A][M_PROG_GCJ],
+ [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+ m4_ifdef([LT_PROG_GCJ],
+ [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+ [LT_LANG(RC)],
+ [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+])# _LT_COMPILER_BOILERPLATE
+
+
+# _LT_LINKER_BOILERPLATE
+# ----------------------
+# Check for linker boilerplate output or warnings with
+# the simple link test code.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+ case $host_os in
+ rhapsody* | darwin*)
+ AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+ AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+ AC_CHECK_TOOL([LIPO], [lipo], [:])
+ AC_CHECK_TOOL([OTOOL], [otool], [:])
+ AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+ _LT_DECL([], [DSYMUTIL], [1],
+ [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+ _LT_DECL([], [NMEDIT], [1],
+ [Tool to change global to local symbols on Mac OS X])
+ _LT_DECL([], [LIPO], [1],
+ [Tool to manipulate fat objects and archives on Mac OS X])
+ _LT_DECL([], [OTOOL], [1],
+ [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+ _LT_DECL([], [OTOOL64], [1],
+ [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+ AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+ [lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi])
+ AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+ [lt_cv_ld_exported_symbols_list],
+ [lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [lt_cv_ld_exported_symbols_list=yes],
+ [lt_cv_ld_exported_symbols_list=no])
+ LDFLAGS="$save_LDFLAGS"
+ ])
+ case $host_os in
+ rhapsody* | darwin1.[[012]])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[[012]]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES
+# --------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+ m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=echo
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+ m4_if([$1], [CXX],
+[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
+ fi
+],[])
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+])
+
+# _LT_SYS_MODULE_PATH_AIX
+# -----------------------
+# Links a minimal program and checks the executable
+# for the system default hardcoded library path. In most cases,
+# this is /usr/lib:/lib, but when the MPI compilers are used
+# the location of the communication and MPI libs are included too.
+# If we don't find anything, use the default library path according
+# to the aix ld manual.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+ [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+ [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_SHELL_INIT
+
+
+# _LT_PROG_ECHO_BACKSLASH
+# -----------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[_LT_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$lt_ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+ ;;
+esac
+
+ECHO=${lt_ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X[$]1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $ECHO works!
+ :
+else
+ # Restart under the correct shell.
+ exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
+fi
+
+if test "X[$]1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<_LT_EOF
+[$]*
+_LT_EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$lt_ECHO"; then
+ if test "X${echo_test_string+set}" != Xset; then
+ # find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+ { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+ then
+ break
+ fi
+ done
+ fi
+
+ if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+ else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ ECHO="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ if test "X$ECHO" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ ECHO='print -r'
+ elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+ else
+ # Try using printf.
+ ECHO='printf %s\n'
+ if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ ECHO="$CONFIG_SHELL [$]0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+ if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "[$]0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ ECHO=echo
+ fi
+ fi
+ fi
+ fi
+ fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+ lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(lt_ECHO)
+])
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1],
+ [An echo program that does not interpret backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+ [AS_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
+ [AC_LANG_PUSH(C)
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+ AC_LANG_POP])
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if AC_TRY_EVAL(ac_compile); then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[AC_CHECK_TOOL(AR, ar, false)
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1])
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+ [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+ [Commands used to build an old-style archive])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$3"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ fi
+ $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+ m4_if([$5], , :, [$5])
+else
+ m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $3"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&AS_MESSAGE_LOG_FD
+ $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ else
+ $2=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+ m4_if([$4], , :, [$4])
+else
+ m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# find the maximum length of command line arguments
+AC_MSG_CHECKING([the maximum length of command line arguments])
+AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw* | cegcc*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+ = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+])
+if test -n $lt_cv_sys_max_cmd_len ; then
+ AC_MSG_RESULT($lt_cv_sys_max_cmd_len)
+else
+ AC_MSG_RESULT(none)
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+ [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "$cross_compiling" = yes; then :
+ [$4]
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}]
+_LT_EOF
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) $1 ;;
+ x$lt_dlneed_uscore) $2 ;;
+ x$lt_dlunknown|x*) $3 ;;
+ esac
+ else :
+ # compilation failed
+ $3
+ fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_DLFCN])dnl
+if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ])
+ ;;
+
+ *)
+ AC_CHECK_FUNC([shl_load],
+ [lt_cv_dlopen="shl_load"],
+ [AC_CHECK_LIB([dld], [shl_load],
+ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+ [AC_CHECK_FUNC([dlopen],
+ [lt_cv_dlopen="dlopen"],
+ [AC_CHECK_LIB([dl], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],
+ [AC_CHECK_LIB([svld], [dlopen],
+ [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
+ [AC_CHECK_LIB([dld], [dld_link],
+ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+ ])
+ ])
+ ])
+ ])
+ ])
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ AC_CACHE_CHECK([whether a program can dlopen itself],
+ lt_cv_dlopen_self, [dnl
+ _LT_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
+ lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
+ ])
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+ lt_cv_dlopen_self_static, [dnl
+ _LT_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
+ lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
+ ])
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+ [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+ [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+ [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+ [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+ [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+ fi
+ fi
+ chmod u+w . 2>&AS_MESSAGE_LOG_FD
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+ [Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ AC_MSG_CHECKING([if we can lock with hard links])
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ AC_MSG_RESULT([$hard_links])
+ if test "$hard_links" = no; then
+ AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe])
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_OBJDIR],
+[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
+[rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null])
+objdir=$lt_cv_objdir
+_LT_DECL([], [objdir], [0],
+ [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+ [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+ test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+ test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+ test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+ # Linking always hardcodes the temporary library directory.
+ _LT_TAGVAR(hardcode_action, $1)=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ _LT_TAGVAR(hardcode_action, $1)=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+ test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+_LT_TAGDECL([], [hardcode_action], [0],
+ [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+striplib=
+old_striplib=
+AC_MSG_CHECKING([whether stripping libraries is possible])
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ AC_MSG_RESULT([yes])
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+ [], [
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+ if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+ sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[[4-9]]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[[01]] | aix4.[[01]].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[[45]]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[[123]]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[[01]]* | freebsdelf3.[[01]]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix[[3-9]]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # Some binutils ld are patched to set DT_RUNPATH
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+ [shlibpath_overrides_runpath=yes])])
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[[89]] | openbsd2.[[89]].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+AC_MSG_RESULT([$dynamic_linker])
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+ [Variables whose values should be saved in libtool wrapper scripts and
+ restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+ [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+ [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+ [[List of archive names. First name is the real one, the rest are links.
+ The last name is the one that the linker finds with -lNAME]])
+_LT_DECL([], [soname_spec], [1],
+ [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [postinstall_cmds], [2],
+ [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+ [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+ [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+ [[As "finish_cmds", except a single script fragment to be evaled but
+ not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+ [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+ [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+ [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_EGREP])dnl
+AC_MSG_CHECKING([for $1])
+AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
+[case $MAGIC_CMD in
+[[\\/*] | ?:[\\/]*])
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+dnl $ac_dummy forces splitting on constant user-supplied paths.
+dnl POSIX.2 word splitting is done only on the output of word expansions,
+dnl not every word. This closes a longstanding sh security hole.
+ ac_dummy="m4_if([$2], , $PATH, [$2])"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/$1; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/$1"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac])
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ AC_MSG_RESULT($MAGIC_CMD)
+else
+ AC_MSG_RESULT(no)
+fi
+_LT_DECL([], [MAGIC_CMD], [0],
+ [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+
+AC_ARG_WITH([gnu-ld],
+ [AS_HELP_STRING([--with-gnu-ld],
+ [assume the C compiler uses GNU ld @<:@default=no@:>@])],
+ [test "$withval" = no || with_gnu_ld=yes],
+ [with_gnu_ld=no])dnl
+
+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 $CC])
+ 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.
+ [[\\/]]* | ?:[[\\/]]*)
+ re_direlt='/[[^/]][[^/]]*/\.\./'
+ # Canonicalize the pathname 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(lt_cv_path_LD,
+[if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_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="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi])
+LD="$lt_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])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_LD_GNU],
+[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+[# I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[AC_CACHE_CHECK([for $LD option to reload object files],
+ lt_cv_ld_reload_flag,
+ [lt_cv_ld_reload_flag='-r'])
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_DECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize dependent libraries],
+lt_cv_deplibs_check_method,
+[lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[[4-9]]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[[45]]*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ if ( file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[[3-9]]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+])
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+_LT_DECL([], [deplibs_check_method], [1],
+ [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+ [Command to use when deplibs_check_method == "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
+ AC_SUBST([DUMPBIN])
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+ [lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
+ cat conftest.out >&AS_MESSAGE_LOG_FD
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, cos, LIBM="-lm")
+ ;;
+esac
+AC_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+ _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+ lt_cv_prog_compiler_rtti_exceptions,
+ [-fno-rtti -fno-exceptions], [],
+ [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+ [Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+AC_MSG_CHECKING([command to parse $NM output from $compiler object])
+AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
+[
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[[BCDEGRST]]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[[BCDT]]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[[ABCDGISTW]]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDEGRST]]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[[BCDEGRST]]'
+ ;;
+osf*)
+ symcode='[[BCDEGQRST]]'
+ ;;
+solaris*)
+ symcode='[[BDRT]]'
+ ;;
+sco3.2v5*)
+ symcode='[[DT]]'
+ ;;
+sysv4.2uw2*)
+ symcode='[[DT]]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[[ABDT]]'
+ ;;
+sysv4)
+ symcode='[[DFNSTU]]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK ['"\
+" {last_section=section; section=\$ 3};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx]"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if AC_TRY_EVAL(ac_compile); then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD
+ fi
+ else
+ echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+])
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ AC_MSG_RESULT(failed)
+else
+ AC_MSG_RESULT(ok)
+fi
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+ [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+ [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+ [lt_cv_sys_global_symbol_to_c_name_address], [1],
+ [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+ [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+ [Transform the output of nm in a C name address pair when lib prefix is needed])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+m4_if([$1], [CXX], [
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix[[4-9]]*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ ;;
+ esac
+ ;;
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ if test "$host_cpu" != ia64; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ fi
+ ;;
+ aCC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ interix*)
+ # This is c89, which is MS Visual C++ (no shared libs)
+ # Anyone wants to do a port?
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ ecpc* )
+ # old Intel C++ for x86_64 which still supported -KPIC.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ icpc* )
+ # Intel C++, used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ xlc* | xlC*)
+ # IBM XL 8.0 on PPC
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd*)
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ vxworks*)
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+],
+[
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC (with -KPIC) is the default.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ ccc*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All Alpha code is PIC.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ xl*)
+ # IBM XL C 8.0/Fortran 10.1 on PPC
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C 5.9
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ *Sun\ F*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All OSF/1 code is PIC.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ rdos*)
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ solaris*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ unicos*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+
+ uts4*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *)
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+])
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+ ;;
+esac
+AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+ [How to pass a linker flag through the compiler])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+ [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+ [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+ "" | " "*) ;;
+ *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+ esac],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+ [Additional compiler flags for building library objects])
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+ _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+ $lt_tmp_static_flag,
+ [],
+ [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+ [Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ case $host_os in
+ aix[[4-9]]*)
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+ ;;
+ cygwin* | mingw* | cegcc*)
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ *)
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+ _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+], [
+ runpath_var=
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(archive_cmds, $1)=
+ _LT_TAGVAR(archive_expsym_cmds, $1)=
+ _LT_TAGVAR(compiler_needs_object, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(hardcode_automatic, $1)=no
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ _LT_TAGVAR(hardcode_minus_L, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_TAGVAR(inherit_rpath, $1)=no
+ _LT_TAGVAR(link_all_deplibs, $1)=unknown
+ _LT_TAGVAR(module_cmds, $1)=
+ _LT_TAGVAR(module_expsym_cmds, $1)=
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+ _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+ _LT_TAGVAR(thread_safe_flag_spec, $1)=
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ _LT_TAGVAR(include_expsyms, $1)=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | 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
+
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ if test "$with_gnu_ld" = yes; then
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # 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.
+ runpath_var=LD_RUN_PATH
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ case $host_os in
+ aix[[3-9]]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)=''
+ ;;
+ m68k)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ interix[[3-9]]*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ tmp_sharedflag='--shared' ;;
+ xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+
+ if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+ runpath_var=
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ _LT_TAGVAR(hardcode_direct, $1)=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
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ 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
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_TAGVAR(archive_cmds, $1)=''
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ 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
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)=''
+ ;;
+ m68k)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[[45]]*)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+ ;;
+
+ cygwin* | 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.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ # FIXME: Should let the user specify the lib program.
+ _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+
+ darwin* | rhapsody*)
+ _LT_DARWIN_LINKER_FEATURES($1)
+ ;;
+
+ dgux*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ freebsd1*)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ AC_LINK_IFELSE(int foo(void) {},
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ )
+ LDFLAGS="$save_LDFLAGS"
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(inherit_rpath, $1)=yes
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ newsos6)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ else
+ case $host_os in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ os2*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ else
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ solaris*)
+ _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ ;;
+ motorola)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4.3*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+ [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+ # Assume -lc should be added
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $_LT_TAGVAR(archive_cmds, $1) in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+ $RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
+ pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+ then
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ else
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ fi
+ _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+ AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+ [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+ [enable_shared_with_static_runtimes], [0],
+ [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+ [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+ [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+ [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+ [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+ [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+ [Commands used to build a loadable module if different from building
+ a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+ [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+ [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+ [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+ [Flag to hardcode $libdir into a binary during linking.
+ This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1],
+ [[If ld is used when linking, flag to hardcode $libdir into a binary
+ during linking. This must work even if $libdir does not exist]])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+ [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+ [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+ DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+ [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+ DIR into the resulting binary and the resulting library dependency is
+ "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+ library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+ [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+ into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+ [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+ into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+ [Set to "yes" if building a shared library automatically hardcodes DIR
+ into the library and all subsequent libraries and executables linked
+ against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+ [Set to yes if linker adds runtime paths of dependent libraries
+ to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+ [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [fix_srcfile_path], [1],
+ [Fix the shell variable $srcfile for the compiler])
+_LT_TAGDECL([], [always_export_symbols], [0],
+ [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+ [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+ [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+ [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+ [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [file_list_spec], [1],
+ [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+ LT_SYS_DLOPEN_SELF
+ _LT_CMD_STRIPLIB
+
+ # Report which library types will actually be built
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_PROG_CXX
+# ------------
+# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
+# compiler, we have our own version here.
+m4_defun([_LT_PROG_CXX],
+[
+pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
+AC_PROG_CXX
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_PROG_CXXCPP
+else
+ _lt_caught_CXX_error=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_CXX
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_CXX], [])
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[AC_REQUIRE([_LT_PROG_CXX])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="int some_variable = 0;"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC=$CC
+ lt_save_LD=$LD
+ lt_save_GCC=$GCC
+ GCC=$GXX
+ lt_save_with_gnu_ld=$with_gnu_ld
+ lt_save_path_LD=$lt_cv_path_LD
+ if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+ else
+ $as_unset lt_cv_prog_gnu_ld
+ fi
+ if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+ else
+ $as_unset lt_cv_path_LD
+ fi
+ test -z "${LDCXX+set}" || LD=$LDCXX
+ CC=${CXX-"c++"}
+ compiler=$CC
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+
+ if test -n "$compiler"; then
+ # We don't want -fno-exception when compiling C++ code, so set the
+ # no_builtin_flag separately
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+ else
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+ fi
+
+ if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+ LT_PATH_LD
+
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" |
+ $GREP 'no-whole-archive' > /dev/null; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
+
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ fi
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+
+ else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+ fi
+
+ # PORTME: fill in a description of your system's C++ link characteristics
+ AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ 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
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ 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
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ _LT_TAGVAR(archive_cmds, $1)=''
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+ if test "$GXX" = yes; then
+ case $host_os in aix4.[[012]]|aix4.[[012]].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ 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
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to
+ # export.
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty
+ # executable.
+ _LT_SYS_MODULE_PATH_AIX
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared
+ # libraries.
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ darwin* | rhapsody*)
+ _LT_DARWIN_LINKER_FEATURES($1)
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ freebsd[[12]]*)
+ # C++ shared libraries reported to be fairly broken before
+ # switch to ELF
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ freebsd-elf*)
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ ;;
+
+ freebsd* | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ gnu*)
+ ;;
+
+ hpux9*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ interix[[3-9]]*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
+ fi
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+ esac
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(inherit_rpath, $1)=yes
+ ;;
+
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc* | ecpc* )
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ case `$CC -V` in
+ *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*)
+ _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+ compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
+ _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
+ $RANLIB $oldlib'
+ _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ *) # Version 6 will use weak symbols
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+ ;;
+ xl*)
+ # IBM XL 8.0 on PPC, with GNU ld
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+ # Not sure whether something based on
+ # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+ # would be better.
+ output_verbose_link_cmd='echo'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ m88k*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+
+ *nto* | *qnx*)
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd=echo
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ case $host in
+ osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+ *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+ esac
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ case $host in
+ osf3*)
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ ;;
+ *)
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
+ $RM $lib.exp'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`$ECHO "X$templist" | $Xsed -e "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; $ECHO "X$list" | $Xsed'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ case $host in
+ osf3*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ psos*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+ _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ ;;
+ esac
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+ output_verbose_link_cmd='echo'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+ if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP "\-L"'
+ fi
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+
+ AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+ test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+ _LT_TAGVAR(GCC, $1)="$GXX"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_SYS_HIDDEN_LIBDEPS($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ CC=$lt_save_CC
+ LDCXX=$LD
+ LD=$lt_save_LD
+ GCC=$lt_save_GCC
+ with_gnu_ld=$lt_save_with_gnu_ld
+ lt_cv_path_LDCXX=$lt_cv_path_LD
+ lt_cv_path_LD=$lt_save_path_LD
+ lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+ lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
+# ---------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library. It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+ subroutine foo
+ implicit none
+ integer*4 a
+ a=0
+ return
+ end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+ subroutine foo
+ implicit none
+ integer a
+ a=0
+ return
+ end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+ private int a;
+ public void bar (void) {
+ a = 0;
+ }
+};
+_LT_EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ for p in `eval "$output_verbose_link_cmd"`; do
+ case $p in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" ||
+ test $p = "-R"; then
+ prev=$p
+ continue
+ else
+ prev=
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ case $p in
+ -L* | -R*)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+ _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+ else
+ _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$_LT_TAGVAR(postdeps, $1)"; then
+ _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+ else
+ _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
+ fi
+ fi
+ ;;
+
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
+ _LT_TAGVAR(predep_objects, $1)="$p"
+ else
+ _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+ fi
+ else
+ if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+ _LT_TAGVAR(postdep_objects, $1)="$p"
+ else
+ _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ _LT_TAGVAR(predep_objects,$1)=
+ _LT_TAGVAR(postdep_objects,$1)=
+ _LT_TAGVAR(postdeps,$1)=
+ ;;
+
+linux*)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+
+solaris*)
+ case $cc_basename in
+ CC*)
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+ [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+ [Dependencies to place before and after the objects being linked to
+ create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+ [The library search path used internally by the compiler when linking
+ a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_PROG_F77
+# ------------
+# Since AC_PROG_F77 is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_F77],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])
+AC_PROG_F77
+if test -z "$F77" || test "X$F77" = "Xno"; then
+ _lt_disable_F77=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_F77
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_F77], [])
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_REQUIRE([_LT_PROG_F77])dnl
+AC_LANG_PUSH(Fortran 77)
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code="\
+ program t
+ end
+"
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC="$CC"
+ lt_save_GCC=$GCC
+ CC=${F77-"f77"}
+ compiler=$CC
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+ GCC=$G77
+ if test -n "$compiler"; then
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_TAGVAR(GCC, $1)="$G77"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ GCC=$lt_save_GCC
+ CC="$lt_save_CC"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_PROG_FC
+# -----------
+# Since AC_PROG_FC is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_FC],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])
+AC_PROG_FC
+if test -z "$FC" || test "X$FC" = "Xno"; then
+ _lt_disable_FC=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_FC
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_FC], [])
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_REQUIRE([_LT_PROG_FC])dnl
+AC_LANG_PUSH(Fortran)
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code="\
+ program t
+ end
+"
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_COMPILER
+
+ # save warnings/boilerplate of simple test code
+ _LT_COMPILER_BOILERPLATE
+ _LT_LINKER_BOILERPLATE
+
+ # Allow CC to be a program name with arguments.
+ lt_save_CC="$CC"
+ lt_save_GCC=$GCC
+ CC=${FC-"f95"}
+ compiler=$CC
+ GCC=$ac_cv_fc_compiler_gnu
+
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+
+ if test -n "$compiler"; then
+ AC_MSG_CHECKING([if libtool supports shared libraries])
+ AC_MSG_RESULT([$can_build_shared])
+
+ AC_MSG_CHECKING([whether to build shared libraries])
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+ aix[[4-9]]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ AC_MSG_RESULT([$enable_shared])
+
+ AC_MSG_CHECKING([whether to build static libraries])
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ AC_MSG_RESULT([$enable_static])
+
+ _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_SYS_HIDDEN_LIBDEPS($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ GCC=$lt_save_GCC
+ CC="$lt_save_CC"
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC="$lt_save_CC"
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+lt_save_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+ :
+ _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+ [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+ [AC_CHECK_TOOL(GCJ, gcj,)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible. Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+ [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+# NOTE: This macro has been submitted for inclusion into #
+# GNU Autoconf as AC_PROG_SED. When it is available in #
+# a released version of Autoconf we should remove this #
+# macro and use it instead. #
+
+m4_defun([AC_PROG_SED],
+[AC_MSG_CHECKING([for a sed that does not truncate output])
+AC_CACHE_VAL(lt_cv_path_SED,
+[# Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for lt_ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
+ done
+ done
+done
+IFS=$as_save_IFS
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
+ fi
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
+ fi
+ done
+done
+])
+SED=$lt_cv_path_SED
+AC_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_XSI_SHELLFNS
+# ---------------------
+# Bourne and XSI compatible variants of some useful shell functions.
+m4_defun([_LT_PROG_XSI_SHELLFNS],
+[case $xsi_shell in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+ func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=${1%%=*}
+ func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=$(( $[*] ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=${#1}
+}
+
+_LT_EOF
+ ;;
+ *) # Bourne compatible functions.
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+dnl func_dirname_and_basename
+dnl A portable version of this function is already defined in general.m4sh
+dnl so there is no need for it here.
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+ esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[[^=]]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+ func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=`expr "$[@]"`
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
+
+_LT_EOF
+esac
+
+case $lt_shell_append in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$[1]+=\$[2]"
+}
+_LT_EOF
+ ;;
+ *)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$[1]=\$$[1]\$[2]"
+}
+
+_LT_EOF
+ ;;
+ esac
+])
+
+# Helper functions for option handling. -*- Autoconf -*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# 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.
+
+# serial 6 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it. Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+ _LT_MANGLE_DEFUN([$1], [$2]),
+ [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+ [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+ [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME. If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+ [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+ dnl
+ dnl Simply set some default values (i.e off) if boolean options were not
+ dnl specified:
+ _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+ ])
+ _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+ ])
+ dnl
+ dnl If no reference was made to various pairs of opposing options, then
+ dnl we run the default mode handler for the pair. For example, if neither
+ dnl `shared' nor `disable-shared' was passed, we enable building of shared
+ dnl archives by default:
+ _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+ _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+ _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+ _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+ [_LT_ENABLE_FAST_INSTALL])
+ ])
+])# _LT_SET_OPTIONS
+
+
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS], [0], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+ [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+ [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
+
+ _LT_DECL([build_libtool_libs], [enable_shared], [0],
+ [Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+ [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+ [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
+
+ _LT_DECL([build_old_libs], [enable_static], [0],
+ [Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+ [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+ [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+ [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+ [AS_HELP_STRING([--with-pic],
+ [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+ [pic_mode="$withval"],
+ [pic_mode=default])
+
+test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+ [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+ [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+ [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+ [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+ [m4_define([_LTDL_TYPE], [convenience])])
+
+# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# 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.
+
+# serial 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+ [$#], [2], [[$2]],
+ [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+ [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+ [$#], 1, [],
+ [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+ m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+ [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+ [m4_foreach([_Lt_suffix],
+ ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+ [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+ [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+ [lt_append([$1], [$2], [$3])$4],
+ [$5])],
+ [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+ m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+ m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+ [$5],
+ [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+ [lt_join(m4_quote(m4_default([$4], [[, ]])),
+ lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+ [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
+
+# ltversion.m4 -- version numbers -*- Autoconf -*-
+#
+# Copyright (C) 2004 Free Software Foundation, Inc.
+# Written by Scott James Remnant, 2004
+#
+# 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.
+
+# Generated from ltversion.in.
+
+# serial 3017 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.2.6b])
+m4_define([LT_PACKAGE_REVISION], [1.3017])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.2.6b'
+macro_revision='1.3017'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
+
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+# Written by Scott James Remnant, 2004.
+#
+# 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.
+
+# serial 4 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else. This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
+
+# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+#
+# 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.
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.10'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version. Point them to the right macro.
+m4_if([$1], [1.10.1], [],
+ [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.10.1])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# 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.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# 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.
+
+# serial 8
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ(2.52)dnl
+ ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+# Free Software Foundation, Inc.
+#
+# 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.
+
+# serial 9
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC, [depcc="$CC" am_compiler_list=],
+ [$1], CXX, [depcc="$CXX" am_compiler_list=],
+ [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], UPC, [depcc="$UPC" am_compiler_list=],
+ [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# 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.
+
+#serial 3
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2008 Free Software Foundation, Inc.
+#
+# 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.
+
+# serial 13
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.60])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
+ [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+ [_AM_DEPENDENCIES(OBJC)],
+ [define([AC_PROG_OBJC],
+ defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# 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.
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
+#
+# 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.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# 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.
+
+# serial 3
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# 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.
+
+# serial 5
+
+# AM_PROG_CC_C_O
+# --------------
+# Like AC_PROG_CC_C_O, but changed for automake.
+AC_DEFUN([AM_PROG_CC_C_O],
+[AC_REQUIRE([AC_PROG_CC_C_O])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([compile])dnl
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+dnl Make sure AC_PROG_CC is never called again, or it will override our
+dnl setting of CC.
+m4_define([AC_PROG_CC],
+ [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])])
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
+# Free Software Foundation, Inc.
+#
+# 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.
+
+# serial 5
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+#
+# 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.
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for `mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+ [[\\/$]]* | ?:[[\\/]]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+#
+# 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.
+
+# serial 3
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Free Software Foundation, Inc.
+#
+# 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.
+
+# serial 4
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+alias in your environment])
+ fi
+
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+#
+# 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.
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006 Free Software Foundation, Inc.
+#
+# 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.
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
+#
+# 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.
+
+# serial 2
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of `v7', `ustar', or `pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility.
+AM_MISSING_PROG([AMTAR], [tar])
+m4_if([$1], [v7],
+ [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of `-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
+m4_include([build/autoconf/check_stdcall_func.m4])
+m4_include([build/autoconf/la_uid_t.m4])
diff --git a/archivers/libarchive/files/config.h.in b/archivers/libarchive/files/config.h.in
new file mode 100644
index 00000000000..4ea8dc48e1f
--- /dev/null
+++ b/archivers/libarchive/files/config.h.in
@@ -0,0 +1,747 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Version number of bsdcpio */
+#undef BSDCPIO_VERSION_STRING
+
+/* Version number of bsdtar */
+#undef BSDTAR_VERSION_STRING
+
+/* Define to 1 if you have the `acl_create_entry' function. */
+#undef HAVE_ACL_CREATE_ENTRY
+
+/* Define to 1 if you have the `acl_get_link' function. */
+#undef HAVE_ACL_GET_LINK
+
+/* Define to 1 if you have the `acl_get_link_np' function. */
+#undef HAVE_ACL_GET_LINK_NP
+
+/* 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_perm_np' function. */
+#undef HAVE_ACL_GET_PERM_NP
+
+/* Define to 1 if you have the `acl_init' function. */
+#undef HAVE_ACL_INIT
+
+/* 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'. */
+#undef HAVE_ACL_PERMSET_T
+
+/* Define to 1 if you have the `acl_set_fd' function. */
+#undef HAVE_ACL_SET_FD
+
+/* Define to 1 if you have the `acl_set_fd_np' function. */
+#undef HAVE_ACL_SET_FD_NP
+
+/* Define to 1 if you have the `acl_set_file' function. */
+#undef HAVE_ACL_SET_FILE
+
+/* True for systems with POSIX ACL support */
+#undef HAVE_ACL_USER
+
+/* Define to 1 if you have the <attr/xattr.h> header file. */
+#undef HAVE_ATTR_XATTR_H
+
+/* Define to 1 if you have the <bzlib.h> header file. */
+#undef HAVE_BZLIB_H
+
+/* Define to 1 if you have the `chflags' function. */
+#undef HAVE_CHFLAGS
+
+/* Define to 1 if you have the `chown' function. */
+#undef HAVE_CHOWN
+
+/* Define to 1 if you have the `chroot' function. */
+#undef HAVE_CHROOT
+
+/* Define to 1 if you have the <ctype.h> header file. */
+#undef HAVE_CTYPE_H
+
+/* 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 `INT64_MAX', and to 0 if you
+ don't. */
+#undef HAVE_DECL_INT64_MAX
+
+/* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you
+ don't. */
+#undef HAVE_DECL_INT64_MIN
+
+/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you
+ don't. */
+#undef HAVE_DECL_SIZE_MAX
+
+/* Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you
+ don't. */
+#undef HAVE_DECL_SSIZE_MAX
+
+/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
+ don't. */
+#undef HAVE_DECL_STRERROR_R
+
+/* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you
+ don't. */
+#undef HAVE_DECL_UINT32_MAX
+
+/* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you
+ don't. */
+#undef HAVE_DECL_UINT64_MAX
+
+/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
+ */
+#undef HAVE_DIRENT_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* 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 */
+#undef HAVE_D_MD_ORDER
+
+/* A possible errno value for invalid file format errors */
+#undef HAVE_EFTYPE
+
+/* A possible errno value for invalid file format errors */
+#undef HAVE_EILSEQ
+
+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
+
+/* 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_file' function. */
+#undef HAVE_EXTATTR_GET_FILE
+
+/* Define to 1 if you have the `extattr_list_file' function. */
+#undef HAVE_EXTATTR_LIST_FILE
+
+/* 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_file' function. */
+#undef HAVE_EXTATTR_SET_FILE
+
+/* Define to 1 if you have the `fchdir' function. */
+#undef HAVE_FCHDIR
+
+/* Define to 1 if you have the `fchflags' function. */
+#undef HAVE_FCHFLAGS
+
+/* Define to 1 if you have the `fchmod' function. */
+#undef HAVE_FCHMOD
+
+/* Define to 1 if you have the `fchown' function. */
+#undef HAVE_FCHOWN
+
+/* Define to 1 if you have the `fcntl' function. */
+#undef HAVE_FCNTL
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#undef HAVE_FSEEKO
+
+/* Define to 1 if you have the `fsetxattr' function. */
+#undef HAVE_FSETXATTR
+
+/* Define to 1 if you have the `fstat' function. */
+#undef HAVE_FSTAT
+
+/* Define to 1 if you have the `ftruncate' function. */
+#undef HAVE_FTRUNCATE
+
+/* Define to 1 if you have the `futimens' function. */
+#undef HAVE_FUTIMENS
+
+/* Define to 1 if you have the `futimes' function. */
+#undef HAVE_FUTIMES
+
+/* Define to 1 if you have the `geteuid' function. */
+#undef HAVE_GETEUID
+
+/* Define to 1 if you have the `getpid' function. */
+#undef HAVE_GETPID
+
+/* Define to 1 if you have the `getxattr' function. */
+#undef HAVE_GETXATTR
+
+/* Define to 1 if you have the <grp.h> header file. */
+#undef HAVE_GRP_H
+
+/* Define to 1 if the system has the type `intmax_t'. */
+#undef HAVE_INTMAX_T
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <io.h> header file. */
+#undef HAVE_IO_H
+
+/* Define to 1 if you have the <langinfo.h> header file. */
+#undef HAVE_LANGINFO_H
+
+/* Define to 1 if you have the `lchflags' function. */
+#undef HAVE_LCHFLAGS
+
+/* Define to 1 if you have the `lchmod' function. */
+#undef HAVE_LCHMOD
+
+/* Define to 1 if you have the `lchown' function. */
+#undef HAVE_LCHOWN
+
+/* Define to 1 if you have the `lgetxattr' function. */
+#undef HAVE_LGETXATTR
+
+/* Define to 1 if you have the `acl' library (-lacl). */
+#undef HAVE_LIBACL
+
+/* Define to 1 if you have the `attr' library (-lattr). */
+#undef HAVE_LIBATTR
+
+/* Define to 1 if you have the `bz2' library (-lbz2). */
+#undef HAVE_LIBBZ2
+
+/* Define to 1 if you have the `expat' library (-lexpat). */
+#undef HAVE_LIBEXPAT
+
+/* Define to 1 if you have the `lzma' library (-llzma). */
+#undef HAVE_LIBLZMA
+
+/* Define to 1 if you have the `lzmadec' library (-llzmadec). */
+#undef HAVE_LIBLZMADEC
+
+/* 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. */
+#undef HAVE_LIBXML_XMLREADER_H
+
+/* Define to 1 if you have the `z' library (-lz). */
+#undef HAVE_LIBZ
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if you have the `link' function. */
+#undef HAVE_LINK
+
+/* Define to 1 if you have the <linux/fs.h> header file. */
+#undef HAVE_LINUX_FS_H
+
+/* Define to 1 if you have the `listxattr' function. */
+#undef HAVE_LISTXATTR
+
+/* Define to 1 if you have the `llistxattr' function. */
+#undef HAVE_LLISTXATTR
+
+/* Define to 1 if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define to 1 if the system has the type `long long int'. */
+#undef HAVE_LONG_LONG_INT
+
+/* Define to 1 if you have the `lsetxattr' function. */
+#undef HAVE_LSETXATTR
+
+/* Define to 1 if you have the `lstat' function. */
+#undef HAVE_LSTAT
+
+/* 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. */
+#undef HAVE_LUTIMES
+
+/* Define to 1 if you have the <lzmadec.h> header file. */
+#undef HAVE_LZMADEC_H
+
+/* Define to 1 if you have the <lzma.h> header file. */
+#undef HAVE_LZMA_H
+
+/* Define to 1 if you have the `MD5Init' function. */
+#undef HAVE_MD5INIT
+
+/* Define to 1 if you have the <md5.h> header file. */
+#undef HAVE_MD5_H
+
+/* Define to 1 if you have the `memmove' function. */
+#undef HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the `mkdir' function. */
+#undef HAVE_MKDIR
+
+/* Define to 1 if you have the `mkfifo' function. */
+#undef HAVE_MKFIFO
+
+/* Define to 1 if you have the `mknod' function. */
+#undef HAVE_MKNOD
+
+/* 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 `nl_langinfo' function. */
+#undef HAVE_NL_LANGINFO
+
+/* Define to 1 if you have the <openssl/md5.h> header file. */
+#undef HAVE_OPENSSL_MD5_H
+
+/* Define to 1 if you have the <openssl/ripemd.h> header file. */
+#undef HAVE_OPENSSL_RIPEMD_H
+
+/* Define to 1 if your openssl has the `SHA256_Init' function. */
+#undef HAVE_OPENSSL_SHA256_INIT
+
+/* Define to 1 if your openssl has the `SHA384_Init' function. */
+#undef HAVE_OPENSSL_SHA384_INIT
+
+/* Define to 1 if your openssl has the `SHA512_Init' function. */
+#undef HAVE_OPENSSL_SHA512_INIT
+
+/* Define to 1 if you have the <openssl/sha.h> header file. */
+#undef HAVE_OPENSSL_SHA_H
+
+/* Define to 1 if you have the <paths.h> header file. */
+#undef HAVE_PATHS_H
+
+/* Define to 1 if you have the `pipe' function. */
+#undef HAVE_PIPE
+
+/* Define to 1 if you have the `poll' function. */
+#undef HAVE_POLL
+
+/* Define to 1 if you have the <poll.h> header file. */
+#undef HAVE_POLL_H
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#undef HAVE_PWD_H
+
+/* Define to 1 if you have the `readlink' function. */
+#undef HAVE_READLINK
+
+/* Define to 1 if you have the <regex.h> header file. */
+#undef HAVE_REGEX_H
+
+/* Define to 1 if you have the <ripemd.h> header file. */
+#undef HAVE_RIPEMD_H
+
+/* Define to 1 if you have the `RMD160Init' function. */
+#undef HAVE_RMD160INIT
+
+/* Define to 1 if you have the <rmd160.h> header file. */
+#undef HAVE_RMD160_H
+
+/* Define to 1 if you have the `select' function. */
+#undef HAVE_SELECT
+
+/* Define to 1 if you have the `setenv' function. */
+#undef HAVE_SETENV
+
+/* Define to 1 if you have the `setlocale' function. */
+#undef HAVE_SETLOCALE
+
+/* Define to 1 if you have the `SHA1Init' function. */
+#undef HAVE_SHA1INIT
+
+/* Define to 1 if you have the <sha1.h> header file. */
+#undef HAVE_SHA1_H
+
+/* Define to 1 if you have the `SHA256Init' function. */
+#undef HAVE_SHA256INIT
+
+/* Define to 1 if you have the <sha256.h> header file. */
+#undef HAVE_SHA256_H
+
+/* Define to 1 if you have the `SHA256_Init' function. */
+#undef HAVE_SHA256_INIT
+
+/* Define to 1 if you have the <sha2.h> header file. */
+#undef HAVE_SHA2_H
+
+/* Define to 1 if you have the `SHA384Init' function. */
+#undef HAVE_SHA384INIT
+
+/* Define to 1 if you have the `SHA384_Init' function. */
+#undef HAVE_SHA384_INIT
+
+/* Define to 1 if you have the `SHA512Init' function. */
+#undef HAVE_SHA512INIT
+
+/* Define to 1 if you have the `SHA512_Init' function. */
+#undef HAVE_SHA512_INIT
+
+/* Define to 1 if you have the <sha.h> header file. */
+#undef HAVE_SHA_H
+
+/* Define to 1 if you have the `sigaction' function. */
+#undef HAVE_SIGACTION
+
+/* Define to 1 if you have the <signal.h> header file. */
+#undef HAVE_SIGNAL_H
+
+/* 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. */
+#undef HAVE_STDARG_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strchr' function. */
+#undef HAVE_STRCHR
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the `strerror_r' function. */
+#undef HAVE_STRERROR_R
+
+/* Define to 1 if you have the `strftime' function. */
+#undef HAVE_STRFTIME
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strncpy_s' function. */
+#undef HAVE_STRNCPY_S
+
+/* Define to 1 if you have the `strrchr' function. */
+#undef HAVE_STRRCHR
+
+/* Define to 1 if `st_birthtime' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_BIRTHTIME
+
+/* Define to 1 if `st_birthtimespec.tv_nsec' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
+
+/* Define to 1 if `st_blksize' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_BLKSIZE
+
+/* Define to 1 if `st_flags' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_FLAGS
+
+/* Define to 1 if `st_mtimespec.tv_nsec' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
+
+/* Define to 1 if `st_mtime_n' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_MTIME_N
+
+/* Define to 1 if `st_mtime_usec' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_MTIME_USEC
+
+/* Define to 1 if `st_mtim.tv_nsec' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
+
+/* Define to 1 if `st_umtime' is member of `struct stat'. */
+#undef HAVE_STRUCT_STAT_ST_UMTIME
+
+/* Define to 1 if you have the `symlink' function. */
+#undef HAVE_SYMLINK
+
+/* Define to 1 if you have the <sys/acl.h> header file. */
+#undef HAVE_SYS_ACL_H
+
+/* Define to 1 if you have the <sys/cdefs.h> header file. */
+#undef HAVE_SYS_CDEFS_H
+
+/* 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/extattr.h> header file. */
+#undef HAVE_SYS_EXTATTR_H
+
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
+#undef HAVE_SYS_IOCTL_H
+
+/* 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/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. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define to 1 if you have the <sys/poll.h> header file. */
+#undef HAVE_SYS_POLL_H
+
+/* Define to 1 if you have the <sys/select.h> header file. */
+#undef HAVE_SYS_SELECT_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/utime.h> header file. */
+#undef HAVE_SYS_UTIME_H
+
+/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
+#undef HAVE_SYS_WAIT_H
+
+/* Define to 1 if you have the <sys/xattr.h> header file. */
+#undef HAVE_SYS_XATTR_H
+
+/* Define to 1 if you have the `timegm' function. */
+#undef HAVE_TIMEGM
+
+/* Define to 1 if you have the <time.h> header file. */
+#undef HAVE_TIME_H
+
+/* Define to 1 if you have the `tzset' function. */
+#undef HAVE_TZSET
+
+/* Define to 1 if the system has the type `uintmax_t'. */
+#undef HAVE_UINTMAX_T
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `unsetenv' function. */
+#undef HAVE_UNSETENV
+
+/* Define to 1 if the system has the type `unsigned long long'. */
+#undef HAVE_UNSIGNED_LONG_LONG
+
+/* Define to 1 if the system has the type `unsigned long long int'. */
+#undef HAVE_UNSIGNED_LONG_LONG_INT
+
+/* Define to 1 if you have the `utime' function. */
+#undef HAVE_UTIME
+
+/* Define to 1 if you have the `utimensat' function. */
+#undef HAVE_UTIMENSAT
+
+/* Define to 1 if you have the `utimes' function. */
+#undef HAVE_UTIMES
+
+/* Define to 1 if you have the <utime.h> header file. */
+#undef HAVE_UTIME_H
+
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the `vprintf' function. */
+#undef HAVE_VPRINTF
+
+/* Define to 1 if you have the <wchar.h> header file. */
+#undef HAVE_WCHAR_H
+
+/* Define to 1 if the system has the type `wchar_t'. */
+#undef HAVE_WCHAR_T
+
+/* Define to 1 if you have the `wcrtomb' function. */
+#undef HAVE_WCRTOMB
+
+/* Define to 1 if you have the `wcscpy' function. */
+#undef HAVE_WCSCPY
+
+/* Define to 1 if you have the `wcslen' function. */
+#undef HAVE_WCSLEN
+
+/* Define to 1 if you have the `wctomb' function. */
+#undef HAVE_WCTOMB
+
+/* Define to 1 if you have the <wctype.h> header file. */
+#undef HAVE_WCTYPE_H
+
+/* Define to 1 if you have the <windows.h> header file. */
+#undef HAVE_WINDOWS_H
+
+/* Define to 1 if you have the `wmemcmp' function. */
+#undef HAVE_WMEMCMP
+
+/* Define to 1 if you have the `wmemcpy' function. */
+#undef HAVE_WMEMCPY
+
+/* Define to 1 if you have the <zlib.h> header file. */
+#undef HAVE_ZLIB_H
+
+/* Version number of libarchive as a single integer */
+#undef LIBARCHIVE_VERSION_NUMBER
+
+/* Version number of libarchive */
+#undef LIBARCHIVE_VERSION_STRING
+
+/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
+ slash. */
+#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* 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 1 if your C compiler doesn't accept -c and -o together. */
+#undef NO_MINUS_C_MINUS_O
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of `wchar_t', as computed by sizeof. */
+#undef SIZEOF_WCHAR_T
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if strerror_r returns char *. */
+#undef STRERROR_R_CHAR_P
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Version number of package */
+#undef VERSION
+
+/* Define to '0x0500' for Windows 2000 APIs. */
+#undef WINVER
+
+/* 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 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 to '0x0500' for Windows 2000 APIs. */
+#undef _WIN32_WINNT
+
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
+/* 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. */
+#undef gid_t
+
+/* Define to `unsigned long' if <sys/types.h> does not define. */
+#undef id_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
+
+/* Define to match typeof st_uid field of struct stat if <sys/types.h> doesn't
+ define. */
+#undef uid_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 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
diff --git a/archivers/libarchive/files/configure b/archivers/libarchive/files/configure
new file mode 100755
index 00000000000..3848a668abf
--- /dev/null
+++ b/archivers/libarchive/files/configure
@@ -0,0 +1,27210 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.62 for libarchive 2.8.0.
+#
+# Report bugs to <kientzle@freebsd.org>.
+#
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ 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
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+if test "x$CONFIG_SHELL" = x; then
+ if (eval ":") 2>/dev/null; then
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+
+ if test $as_have_required = yes && (eval ":
+(as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=\$LINENO
+ as_lineno_2=\$LINENO
+ test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+ test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+ :
+else
+ as_candidate_shells=
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ case $as_dir in
+ /*)
+ for as_base in sh bash ksh sh5; do
+ as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ done;;
+ esac
+done
+IFS=$as_save_IFS
+
+
+ for as_shell in $as_candidate_shells $SHELL; do
+ # Try only shells that exist, to save several forks.
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { ("$as_shell") 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+_ASEOF
+}; then
+ CONFIG_SHELL=$as_shell
+ as_have_required=yes
+ if { "$as_shell" 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+:
+(as_func_return () {
+ (exit $1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test $exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
+
+_ASEOF
+}; then
+ break
+fi
+
+fi
+
+ done
+
+ if test "x$CONFIG_SHELL" != x; then
+ for as_var in BASH_ENV ENV
+ do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ done
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+ if test $as_have_required = no; then
+ echo This script requires a shell more modern than all the
+ echo shells that I found on your system. Please install a
+ echo modern shell, or manually run the script under such a
+ echo shell if you do have one.
+ { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
+else
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0") || {
+ echo No shell found that supports shell functions.
+ echo Please tell bug-autoconf@gnu.org about your system,
+ echo including any error possibly output before this message.
+ echo This can help us improve future autoconf versions.
+ echo Configuration will now proceed without shell functions.
+}
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$lt_ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
+ ;;
+esac
+
+ECHO=${lt_ECHO-echo}
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $ECHO works!
+ :
+else
+ # Restart under the correct shell.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<_LT_EOF
+$*
+_LT_EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$lt_ECHO"; then
+ if test "X${echo_test_string+set}" != Xset; then
+ # find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if { echo_test_string=`eval $cmd`; } 2>/dev/null &&
+ { test "X$echo_test_string" = "X$echo_test_string"; } 2>/dev/null
+ then
+ break
+ fi
+ done
+ fi
+
+ if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+ else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ ECHO="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ if test "X$ECHO" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`{ print -r '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ print -r "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ ECHO='print -r'
+ elif { test -f /bin/ksh || test -f /bin/ksh$ac_exeext; } &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+ else
+ # Try using printf.
+ ECHO='printf %s\n'
+ if test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`{ $ECHO "$echo_test_string"; } 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ ECHO="$CONFIG_SHELL $0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ ECHO="$CONFIG_SHELL $0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+ if { test "X$echo_test_string" = "X`eval $cmd`"; } 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "$0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ ECHO=echo
+ fi
+ fi
+ fi
+ fi
+ fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+ lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+exec 7<&0 </dev/null 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Identity of this package.
+PACKAGE_NAME='libarchive'
+PACKAGE_TARNAME='libarchive'
+PACKAGE_VERSION='2.8.0'
+PACKAGE_STRING='libarchive 2.8.0'
+PACKAGE_BUGREPORT='kientzle@freebsd.org'
+
+ac_unique_file="libarchive"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+am__isrc
+CYGPATH_W
+PACKAGE
+VERSION
+ACLOCAL
+AUTOCONF
+AUTOMAKE
+AUTOHEADER
+MAKEINFO
+install_sh
+STRIP
+INSTALL_STRIP_PROGRAM
+MKDIR_P
+mkdir_p
+AWK
+SET_MAKE
+am__leading_dot
+AMTAR
+am__tar
+am__untar
+ARCHIVE_LIBTOOL_VERSION
+BSDCPIO_VERSION_STRING
+BSDTAR_VERSION_STRING
+LIBARCHIVE_VERSION_STRING
+LIBARCHIVE_VERSION_NUMBER
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+INC_WINDOWS_FILES_TRUE
+INC_WINDOWS_FILES_FALSE
+INC_CYGWIN_FILES_TRUE
+INC_CYGWIN_FILES_FALSE
+PLATFORMCPPFLAGS
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+DEPDIR
+am__include
+am__quote
+AMDEP_TRUE
+AMDEP_FALSE
+AMDEPBACKSLASH
+CCDEPMODE
+am__fastdepCC_TRUE
+am__fastdepCC_FALSE
+CPP
+GREP
+EGREP
+AS
+DLLTOOL
+OBJDUMP
+LIBTOOL
+SED
+FGREP
+LD
+DUMPBIN
+ac_ct_DUMPBIN
+NM
+LN_S
+AR
+RANLIB
+lt_ECHO
+DSYMUTIL
+NMEDIT
+LIPO
+OTOOL
+OTOOL64
+BUILD_BSDTAR_TRUE
+BUILD_BSDTAR_FALSE
+STATIC_BSDTAR_TRUE
+STATIC_BSDTAR_FALSE
+BUILD_BSDCPIO_TRUE
+BUILD_BSDCPIO_FALSE
+STATIC_BSDCPIO_TRUE
+STATIC_BSDCPIO_FALSE
+XML2_CONFIG
+LIBOBJS
+LTLIBOBJS'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_dependency_tracking
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+enable_libtool_lock
+enable_bsdtar
+enable_bsdcpio
+with_zlib
+with_bz2lib
+with_lzmadec
+with_lzma
+with_openssl
+with_xml2
+with_expat
+enable_xattr
+enable_acl
+enable_largefile
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2
+ { (exit 1); exit 1; }; }
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) { $as_echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ { $as_echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) { $as_echo "$as_me: error: Unrecognized options: $ac_unrecognized_opts" >&2
+ { (exit 1); exit 1; }; } ;;
+ *) $as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; }
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ { $as_echo "$as_me: error: Working directory cannot be determined" >&2
+ { (exit 1); exit 1; }; }
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ { $as_echo "$as_me: error: pwd does not report name of working directory" >&2
+ { (exit 1); exit 1; }; }
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2
+ { (exit 1); exit 1; }; }
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures libarchive 2.8.0 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/libarchive]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+
+System types:
+ --build=BUILD configure for building on BUILD [guessed]
+ --host=HOST cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of libarchive 2.8.0:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --disable-dependency-tracking speeds up one-time build
+ --enable-dependency-tracking do not reject slow dependency extractors
+ --enable-shared[=PKGS] build shared libraries [default=yes]
+ --enable-static[=PKGS] build static libraries [default=yes]
+ --enable-fast-install[=PKGS]
+ optimize for fast installation [default=yes]
+ --disable-libtool-lock avoid locking (might break parallel builds)
+ --enable-bsdtar enable build of bsdtar (default)
+ --enable-bsdtar=static force static build of bsdtar
+ --enable-bsdtar=shared force dynamic build of bsdtar
+ --disable-bsdtar disable build of bsdtar
+ --enable-bsdcpio enable build of bsdcpio (default)
+ --enable-bsdcpio=static static build of bsdcpio
+ --enable-bsdcpio=shared dynamic build of bsdcpio
+ --disable-bsdcpio disable build of bsdcpio
+ --disable-xattr Enable Extended Attributes support (default: check)
+ --disable-acl Enable ACL support (default: check)
+ --disable-largefile omit support for large files
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --without-zlib Don't build support for gzip through zlib
+ --without-bz2lib Don't build support for bzip2 through bz2lib
+ --without-lzmadec Don't build support for lzma through lzmadec
+ --without-lzma Don't build support for xz through lzma
+ --without-openssl Don't build support for mtree and xar hashes through
+ openssl
+ --without-xml2 Don't build support for xar through libxml2
+ --without-expat Don't build support for xar through expat
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <kientzle@freebsd.org>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+libarchive configure 2.8.0
+generated by GNU Autoconf 2.62
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by libarchive $as_me 2.8.0, which was
+generated by GNU Autoconf 2.62. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 2)
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ ac_configure_args="$ac_configure_args '$ac_arg'"
+ ;;
+ esac
+ done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ cat <<\_ASBOX
+## ------------------- ##
+## File substitutions. ##
+## ------------------- ##
+_ASBOX
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ ac_site_file1=$CONFIG_SITE
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test -r "$ac_site_file"; then
+ { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file"
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Make sure the srcdir contains "libarchive" directory
+
+# Use auxiliary subscripts from this subdirectory (cleans up root)
+ac_aux_dir=
+for ac_dir in build/autoconf "$srcdir"/build/autoconf; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in build/autoconf \"$srcdir\"/build/autoconf" >&5
+$as_echo "$as_me: error: cannot find install-sh or install.sh in build/autoconf \"$srcdir\"/build/autoconf" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# M4 scripts
+
+# Must follow AC_CONFIG macros above...
+am__api_version='1.10'
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t $srcdir/configure conftest.file`
+ fi
+ rm -f conftest.file
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&5
+$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+$as_echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+{ $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+done
+IFS=$as_save_IFS
+
+fi
+
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ test -d ./--version && rmdir ./--version
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+ [\\/$]* | ?:[\\/]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:$LINENO: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='libarchive'
+ VERSION='2.8.0'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility.
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
+
+
+
+
+
+
+# Libtool versioning uses different conventions on different
+# platforms. At least on FreeBSD, libtool uses an overly complex
+# convention that attempts to solve problems that most people just
+# don't have and which just causes confusion for most end users.
+ARCHIVE_MAJOR=$(( 2008000 / 1000000 ))
+ARCHIVE_MINOR=$(( (2008000 / 1000) % 1000 ))
+ARCHIVE_REVISION=$(( 2008000 % 1000 ))
+ARCHIVE_LIBTOOL_MAJOR=`echo $((${ARCHIVE_MAJOR} + ${ARCHIVE_MINOR}))`
+ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_LIBTOOL_MAJOR:$ARCHIVE_REVISION:$ARCHIVE_MINOR
+
+# Stick the version numbers into config.h
+
+cat >>confdefs.h <<\_ACEOF
+#define LIBARCHIVE_VERSION_STRING "2.8.0"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define LIBARCHIVE_VERSION_NUMBER "2008000"
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define BSDCPIO_VERSION_STRING "2.8.0"
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define BSDTAR_VERSION_STRING "2.8.0"
+_ACEOF
+
+
+# The shell variables here must be the same as the AC_SUBST() variables
+# below, but the shell variable names apparently cannot be the same as
+# the m4 macro names above. Why? Ask autoconf.
+BSDCPIO_VERSION_STRING=2.8.0
+BSDTAR_VERSION_STRING=2.8.0
+LIBARCHIVE_VERSION_STRING=2.8.0
+LIBARCHIVE_VERSION_NUMBER=2008000
+
+# Substitute the above version numbers into the various files below.
+# Yes, I believe this is the fourth time we define what are essentially
+# the same symbols. Why? Ask autoconf.
+
+
+
+
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+ac_config_files="$ac_config_files Makefile"
+
+ac_config_files="$ac_config_files build/pkgconfig/libarchive.pc"
+
+
+# Check for host type
+# Make sure we can run config.sub.
+$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
+ { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+ { (exit 1); exit 1; }; }
+
+{ $as_echo "$as_me:$LINENO: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_build_alias=$build_alias
+test "x$ac_build_alias" = x &&
+ ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
+test "x$ac_build_alias" = x &&
+ { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
+ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
+ { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
+case $ac_cv_build in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+$as_echo "$as_me: error: invalid value of canonical build" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+build=$ac_cv_build
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_build
+shift
+build_cpu=$1
+build_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+build_os=$*
+IFS=$ac_save_IFS
+case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
+
+
+{ $as_echo "$as_me:$LINENO: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "x$host_alias" = x; then
+ ac_cv_host=$ac_cv_build
+else
+ ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
+ { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
+case $ac_cv_host in
+*-*-*) ;;
+*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+$as_echo "$as_me: error: invalid value of canonical host" >&2;}
+ { (exit 1); exit 1; }; };;
+esac
+host=$ac_cv_host
+ac_save_IFS=$IFS; IFS='-'
+set x $ac_cv_host
+shift
+host_cpu=$1
+host_vendor=$2
+shift; shift
+# Remember, the first character of IFS is used to create $*,
+# except with old shells:
+host_os=$*
+IFS=$ac_save_IFS
+case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
+
+
+
+inc_windows_files=no
+inc_cygwin_files=no
+case "$host_os" in
+ *mingw* ) inc_windows_files=yes ;;
+ *cygwin*) inc_cygwin_files=yes ;;
+esac
+ if test $inc_windows_files = yes; then
+ INC_WINDOWS_FILES_TRUE=
+ INC_WINDOWS_FILES_FALSE='#'
+else
+ INC_WINDOWS_FILES_TRUE='#'
+ INC_WINDOWS_FILES_FALSE=
+fi
+
+ if test $inc_cygwin_files = yes; then
+ INC_CYGWIN_FILES_TRUE=
+ INC_CYGWIN_FILES_FALSE='#'
+else
+ INC_CYGWIN_FILES_TRUE='#'
+ INC_CYGWIN_FILES_FALSE=
+fi
+
+
+PLATFORMCPPFLAGS=
+case "$host_os" in
+ *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO ;;
+esac
+
+
+# Checks for programs.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:$LINENO: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:$LINENO: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+{ (ac_try="$ac_compiler --version >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { (ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+
+{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+if test -z "$ac_file"; then
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_compiler_gnu=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_g=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_prog_cc_c89=$ac_arg
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:$LINENO: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:$LINENO: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo done
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+ am__include=include
+ am__quote=
+ _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ fi
+fi
+
+
+{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named `D' -- because `-MD' means `put the output
+ # in D'.
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
+ # Solaris 8's {/usr,}/bin/sh.
+ touch sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ case $depmode in
+ nosideeffect)
+ # after this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ none) break ;;
+ esac
+ # We check with `-c' and `-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle `-M -o', and we need to detect this.
+ if depmode=$depmode \
+ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+if test "x$CC" != xcc; then
+ { $as_echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5
+$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; }
+else
+ { $as_echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5
+$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
+fi
+set dummy $CC; ac_cc=`$as_echo "$2" |
+ sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+# Make sure it works both with $CC and with simple cc.
+# We do the test twice because some compilers refuse to overwrite an
+# existing .o file with -o, though they will create one.
+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+rm -f conftest2.*
+if { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ test -f conftest2.$ac_objext && { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); };
+then
+ eval ac_cv_prog_cc_${ac_cc}_c_o=yes
+ if test "x$CC" != xcc; then
+ # Test first that cc exists at all.
+ if { ac_try='cc -c conftest.$ac_ext >&5'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+ rm -f conftest2.*
+ if { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ test -f conftest2.$ac_objext && { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); };
+ then
+ # cc works too.
+ :
+ else
+ # cc exists but doesn't like -o.
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
+ fi
+ fi
+ fi
+else
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
+fi
+rm -f core conftest*
+
+fi
+if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define NO_MINUS_C_MINUS_O 1
+_ACEOF
+
+fi
+
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+ac_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
+fi
+
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ # Broken: success on invalid input.
+continue
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:$LINENO: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Broken: fails on valid input.
+continue
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ # Broken: success on invalid input.
+continue
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:$LINENO: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_header_stdc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ eval "$as_ac_Header=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+ if test "${ac_cv_header_minix_config_h+set}" = set; then
+ { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
+$as_echo_n "checking for minix/config.h... " >&6; }
+if test "${ac_cv_header_minix_config_h+set}" = set; then
+ $as_echo_n "(cached) " >&6
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
+$as_echo "$ac_cv_header_minix_config_h" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5
+$as_echo_n "checking minix/config.h usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <minix/config.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5
+$as_echo_n "checking minix/config.h presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <minix/config.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5
+$as_echo_n "checking for minix/config.h... " >&6; }
+if test "${ac_cv_header_minix_config_h+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_header_minix_config_h=$ac_header_preproc
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5
+$as_echo "$ac_cv_header_minix_config_h" >&6; }
+
+fi
+if test $ac_cv_header_minix_config_h = yes; then
+ MINIX=yes
+else
+ MINIX=
+fi
+
+
+ if test "$MINIX" = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define _POSIX_SOURCE 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _POSIX_1_SOURCE 2
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _MINIX 1
+_ACEOF
+
+ fi
+
+
+
+ { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5
+$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
+if test "${ac_cv_safe_to_define___extensions__+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+# define __EXTENSIONS__ 1
+ $ac_includes_default
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_safe_to_define___extensions__=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_safe_to_define___extensions__=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5
+$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
+ test $ac_cv_safe_to_define___extensions__ = yes &&
+ cat >>confdefs.h <<\_ACEOF
+#define __EXTENSIONS__ 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define _ALL_SOURCE 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define _GNU_SOURCE 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define _POSIX_PTHREAD_SEMANTICS 1
+_ACEOF
+
+ cat >>confdefs.h <<\_ACEOF
+#define _TANDEM_SOURCE 1
+_ACEOF
+
+
+enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AS+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AS"; then
+ ac_cv_prog_AS="$AS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AS="${ac_tool_prefix}as"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AS=$ac_cv_prog_AS
+if test -n "$AS"; then
+ { $as_echo "$as_me:$LINENO: result: $AS" >&5
+$as_echo "$AS" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AS"; then
+ ac_ct_AS=$AS
+ # Extract the first word of "as", so it can be a program name with args.
+set dummy as; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_AS+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AS"; then
+ ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AS="as"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AS=$ac_cv_prog_ac_ct_AS
+if test -n "$ac_ct_AS"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
+$as_echo "$ac_ct_AS" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AS" = x; then
+ AS="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ AS=$ac_ct_AS
+ fi
+else
+ AS="$ac_cv_prog_AS"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dlltool; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DLLTOOL+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DLLTOOL"; then
+ ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+DLLTOOL=$ac_cv_prog_DLLTOOL
+if test -n "$DLLTOOL"; then
+ { $as_echo "$as_me:$LINENO: result: $DLLTOOL" >&5
+$as_echo "$DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DLLTOOL"; then
+ ac_ct_DLLTOOL=$DLLTOOL
+ # Extract the first word of "dlltool", so it can be a program name with args.
+set dummy dlltool; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DLLTOOL"; then
+ ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_DLLTOOL="dlltool"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
+if test -n "$ac_ct_DLLTOOL"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5
+$as_echo "$ac_ct_DLLTOOL" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DLLTOOL" = x; then
+ DLLTOOL="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ DLLTOOL=$ac_ct_DLLTOOL
+ fi
+else
+ DLLTOOL="$ac_cv_prog_DLLTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:$LINENO: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+ ;;
+esac
+
+test -z "$AS" && AS=as
+
+
+
+
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+
+
+
+
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+
+case `pwd` in
+ *\ * | *\ *)
+ { $as_echo "$as_me:$LINENO: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.2.6b'
+macro_revision='1.3017'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+{ $as_echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if test "${ac_cv_path_SED+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ $as_unset ac_script || ac_script=
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in sed gsed; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_SED_found && break 3
+ done
+ done
+done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ { { $as_echo "$as_me:$LINENO: error: no acceptable sed could be found in \$PATH" >&5
+$as_echo "$as_me: error: no acceptable sed could be found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+else
+ ac_cv_path_SED=$SED
+fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
+
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:$LINENO: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if test "${ac_cv_path_FGREP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+ then ac_cv_path_FGREP="$GREP -F"
+ else
+ if test -z "$FGREP"; then
+ ac_path_FGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in fgrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+ # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'FGREP' >> "conftest.nl"
+ "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ ac_count=`expr $ac_count + 1`
+ if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_FGREP="$ac_path_FGREP"
+ ac_path_FGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_FGREP_found && break 3
+ done
+ done
+done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_FGREP"; then
+ { { $as_echo "$as_me:$LINENO: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+$as_echo "$as_me: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+else
+ ac_cv_path_FGREP=$FGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
+
+
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
+else
+ with_gnu_ld=no
+fi
+
+ac_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&6; }
+ 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.
+ [\\/]* | ?:[\\/]*)
+ re_direlt='/[^/][^/]*/\.\./'
+ # Canonicalize the pathname 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
+ { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$LD"; then
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
+ lt_cv_path_LD="$ac_dir/$ac_prog"
+ # Check to see if the program is GNU ld. I'd rather use --version,
+ # but apparently some variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_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="$lt_save_ifs"
+else
+ lt_cv_path_LD="$LD" # Let the user override the test with a path.
+fi
+fi
+
+LD="$lt_cv_path_LD"
+if test -n "$LD"; then
+ { $as_echo "$as_me:$LINENO: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if test "${lt_cv_path_NM+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_nm"
+ if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then
+ # Check to see if the nm accepts a BSD-compat flag.
+ # Adding the `sed 1q' prevents false positives on HP-UX, which says:
+ # nm: unknown option "B" ignored
+ # Tru64's nm complains that /dev/null is an invalid object file
+ case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in
+ */dev/null* | *'Invalid file or object type'*)
+ lt_cv_path_NM="$tmp_nm -B"
+ break
+ ;;
+ *)
+ case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in
+ */dev/null*)
+ lt_cv_path_NM="$tmp_nm -p"
+ break
+ ;;
+ *)
+ lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but
+ continue # so that we can try to find one that supports BSD flags
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_save_ifs"
+ done
+ : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DUMPBIN+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DUMPBIN"; then
+ ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+ { $as_echo "$as_me:$LINENO: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$DUMPBIN" && break
+ done
+fi
+if test -z "$DUMPBIN"; then
+ ac_ct_DUMPBIN=$DUMPBIN
+ for ac_prog in "dumpbin -symbols" "link -dump -symbols"
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DUMPBIN"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_DUMPBIN" && break
+done
+
+ if test "x$ac_ct_DUMPBIN" = x; then
+ DUMPBIN=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ DUMPBIN=$ac_ct_DUMPBIN
+ fi
+fi
+
+
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+
+
+
+
+
+
+{ $as_echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if test "${lt_cv_nm_interface+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:5630: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:5633: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:5636: output\"" >&5)
+ cat conftest.out >&5
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
+
+{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+fi
+
+# find the maximum length of command line arguments
+{ $as_echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ i=0
+ teststring="ABCD"
+
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+
+ cygwin* | mingw* | cegcc*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # If test is not a shell built-in, we'll probably end up computing a
+ # maximum length that is only half of the actual maximum length, but
+ # we can't tell.
+ while { test "X"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+ = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on
+ # massive amounts of additional arguments before passing them to the
+ # linker. It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+
+fi
+
+if test -n $lt_cv_sys_max_cmd_len ; then
+ { $as_echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: none" >&5
+$as_echo "none" >&6; }
+fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+
+
+
+
+
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+
+{ $as_echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+{ $as_echo "$as_me:$LINENO: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
+
+
+{ $as_echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+{ $as_echo "$as_me:$LINENO: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
+
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$lt_cv_ld_reload_flag" >&6; }
+reload_flag=$lt_cv_ld_reload_flag
+case $reload_flag in
+"" | " "*) ;;
+*) reload_flag=" $reload_flag" ;;
+esac
+reload_cmds='$LD$reload_flag -o $output$reload_objs'
+case $host_os in
+ darwin*)
+ if test "$GCC" = yes; then
+ reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:$LINENO: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+
+
+{ $as_echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_file_magic_cmd='$MAGIC_CMD'
+lt_cv_file_magic_test_file=
+lt_cv_deplibs_check_method='unknown'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies not supported.
+# `unknown' -- same as none, but documents that we really don't know.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_magic [[regex]]' -- check by looking for files in library path
+# which responds to the $file_magic_cmd with a given extended regex.
+# If you have `file' or equivalent on your system and you're not sure
+# whether `pass_all' will *always* work, you probably want this one.
+
+case $host_os in
+aix[4-9]*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+beos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+bsdi[45]*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)'
+ lt_cv_file_magic_cmd='/usr/bin/file -L'
+ lt_cv_file_magic_test_file=/shlib/libc.so
+ ;;
+
+cygwin*)
+ # func_win32_libid is a shell function defined in ltmain.sh
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ ;;
+
+mingw* | pw32*)
+ # Base MSYS/MinGW do not provide the 'file' command needed by
+ # func_win32_libid shell function, so use a weaker test based on 'objdump',
+ # unless we find 'file', for example because we are cross-compiling.
+ if ( file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | dragonfly*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ case $host_cpu in
+ i*86 )
+ # Not sure whether the presence of OpenBSD here was a mistake.
+ # Let's accept both of them until this is cleared up.
+ lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*`
+ ;;
+ esac
+ else
+ lt_cv_deplibs_check_method=pass_all
+ fi
+ ;;
+
+gnu*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+hpux10.20* | hpux11*)
+ lt_cv_file_magic_cmd=/usr/bin/file
+ case $host_cpu in
+ ia64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64'
+ lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
+ ;;
+ hppa*64*)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
+ lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
+ ;;
+ *)
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
+ lt_cv_file_magic_test_file=/usr/lib/libc.sl
+ ;;
+ esac
+ ;;
+
+interix[3-9]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $LD in
+ *-32|*"-32 ") libmagic=32-bit;;
+ *-n32|*"-n32 ") libmagic=N32;;
+ *-64|*"-64 ") libmagic=64-bit;;
+ *) libmagic=never-match;;
+ esac
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
+ fi
+ ;;
+
+newos6*)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)'
+ lt_cv_file_magic_cmd=/usr/bin/file
+ lt_cv_file_magic_test_file=/usr/lib/libnls.so
+ ;;
+
+*nto* | *qnx*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+openbsd*)
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
+ else
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
+ fi
+ ;;
+
+osf3* | osf4* | osf5*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ case $host_vendor in
+ motorola)
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]'
+ lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*`
+ ;;
+ ncr)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ sequent)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )'
+ ;;
+ sni)
+ lt_cv_file_magic_cmd='/bin/file'
+ lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib"
+ lt_cv_file_magic_test_file=/lib/libc.so
+ ;;
+ siemens)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+esac
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$lt_cv_deplibs_check_method" >&6; }
+file_magic_cmd=$lt_cv_file_magic_cmd
+deplibs_check_method=$lt_cv_deplibs_check_method
+test -z "$deplibs_check_method" && deplibs_check_method=unknown
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:$LINENO: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AR="ar"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AR" = x; then
+ AR="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+
+
+
+
+
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+test -z "$RANLIB" && RANLIB=:
+
+
+
+
+
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
+
+# Character class describing NM global symbol codes.
+symcode='[BCDEGRST]'
+
+# Regexp to match symbols that can be accessed directly from C.
+sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
+ ;;
+esac
+
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# Handle CRLF in mingw tool chain
+opt_cr=
+case $build_os in
+mingw*)
+ opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ ;;
+esac
+
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
+
+ # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
+ symxfrm="\\1 $ac_symprfx\\2 \\2"
+
+ # Write the raw and C identifiers.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK '"\
+" {last_section=section; section=\$ 3};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+ (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s "$nlist"; then
+ # Try sorting and uniquifying the output.
+ if sort "$nlist" | uniq > "$nlist"T; then
+ mv -f "$nlist"T "$nlist"
+ else
+ rm -f "$nlist"T
+ fi
+
+ # Make sure that we snagged all the symbols we need.
+ if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
+ if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_EOF
+ # Now try linking the two files.
+ mv conftest.$ac_objext conftstm.$ac_objext
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
+ LIBS="conftstm.$ac_objext"
+ CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext}; then
+ pipe_works=yes
+ fi
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
+ else
+ echo "cannot find nm_test_func in $nlist" >&5
+ fi
+ else
+ echo "cannot find nm_test_var in $nlist" >&5
+ fi
+ else
+ echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5
+ fi
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf conftest* conftst*
+
+ # Do not use the global_symbol_pipe unless it works.
+ if test "$pipe_works" = yes; then
+ break
+ else
+ lt_cv_sys_global_symbol_pipe=
+ fi
+done
+
+fi
+
+if test -z "$lt_cv_sys_global_symbol_pipe"; then
+ lt_cv_sys_global_symbol_to_cdecl=
+fi
+if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
+ { $as_echo "$as_me:$LINENO: result: failed" >&5
+$as_echo "failed" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: ok" >&5
+$as_echo "ok" >&6; }
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 6854 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ { $as_echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ lt_cv_cc_needs_belf=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ lt_cv_cc_needs_belf=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$lt_cv_cc_needs_belf" >&6; }
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+
+
+ case $host_os in
+ rhapsody* | darwin*)
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
+set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DSYMUTIL+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$DSYMUTIL"; then
+ ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+DSYMUTIL=$ac_cv_prog_DSYMUTIL
+if test -n "$DSYMUTIL"; then
+ { $as_echo "$as_me:$LINENO: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_DSYMUTIL"; then
+ ac_ct_DSYMUTIL=$DSYMUTIL
+ # Extract the first word of "dsymutil", so it can be a program name with args.
+set dummy dsymutil; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_DSYMUTIL"; then
+ ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
+if test -n "$ac_ct_DSYMUTIL"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_DSYMUTIL" = x; then
+ DSYMUTIL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ DSYMUTIL=$ac_ct_DSYMUTIL
+ fi
+else
+ DSYMUTIL="$ac_cv_prog_DSYMUTIL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
+set dummy ${ac_tool_prefix}nmedit; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_NMEDIT+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NMEDIT"; then
+ ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+NMEDIT=$ac_cv_prog_NMEDIT
+if test -n "$NMEDIT"; then
+ { $as_echo "$as_me:$LINENO: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_NMEDIT"; then
+ ac_ct_NMEDIT=$NMEDIT
+ # Extract the first word of "nmedit", so it can be a program name with args.
+set dummy nmedit; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_NMEDIT"; then
+ ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_NMEDIT="nmedit"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
+if test -n "$ac_ct_NMEDIT"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_NMEDIT" = x; then
+ NMEDIT=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ NMEDIT=$ac_ct_NMEDIT
+ fi
+else
+ NMEDIT="$ac_cv_prog_NMEDIT"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_LIPO+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$LIPO"; then
+ ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+ { $as_echo "$as_me:$LINENO: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+ ac_ct_LIPO=$LIPO
+ # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_LIPO"; then
+ ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_LIPO="lipo"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_LIPO" = x; then
+ LIPO=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ LIPO=$ac_ct_LIPO
+ fi
+else
+ LIPO="$ac_cv_prog_LIPO"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL"; then
+ ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+ { $as_echo "$as_me:$LINENO: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+ ac_ct_OTOOL=$OTOOL
+ # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL"; then
+ ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OTOOL="otool"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL" = x; then
+ OTOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL=$ac_ct_OTOOL
+ fi
+else
+ OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL64+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL64"; then
+ ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+ { $as_echo "$as_me:$LINENO: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+ ac_ct_OTOOL64=$OTOOL64
+ # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL64"; then
+ ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OTOOL64="otool64"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL64" = x; then
+ OTOOL64=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL64=$ac_ct_OTOOL64
+ fi
+else
+ OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:$LINENO: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if test "${lt_cv_apple_cc_single_mod+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+ { $as_echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if test "${lt_cv_ld_exported_symbols_list+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ lt_cv_ld_exported_symbols_list=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ lt_cv_ld_exported_symbols_list=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[012]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+
+
+for ac_header in dlfcn.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ eval "$as_ac_Header=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+# Set options
+
+
+
+ enable_dlopen=no
+
+
+
+ # Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval=$enable_shared; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_shared=yes
+fi
+
+
+
+
+
+
+
+
+
+ # Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval=$enable_static; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_static=yes
+fi
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then
+ withval=$with_pic; pic_mode="$withval"
+else
+ pic_mode=default
+fi
+
+
+test -z "$pic_mode" && pic_mode=default
+
+
+
+
+
+
+
+ # Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval=$enable_fast_install; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_fast_install=yes
+fi
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if test "${lt_cv_objdir+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
+fi
+rmdir .libs 2>/dev/null
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+ fi
+ ;;
+esac
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
+
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\(["`\\]\)/\\\1/g'
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$ECHO "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ { $as_echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/${ac_tool_prefix}file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ { $as_echo "$as_me:$LINENO: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ case $MAGIC_CMD in
+[\\/*] | ?:[\\/]*)
+ lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path.
+ ;;
+*)
+ lt_save_MAGIC_CMD="$MAGIC_CMD"
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ ac_dummy="/usr/bin$PATH_SEPARATOR$PATH"
+ for ac_dir in $ac_dummy; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ if test -f $ac_dir/file; then
+ lt_cv_path_MAGIC_CMD="$ac_dir/file"
+ if test -n "$file_magic_test_file"; then
+ case $deplibs_check_method in
+ "file_magic "*)
+ file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"`
+ MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+ if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null |
+ $EGREP "$file_magic_regex" > /dev/null; then
+ :
+ else
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_EOF
+ fi ;;
+ esac
+ fi
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+ MAGIC_CMD="$lt_save_MAGIC_CMD"
+ ;;
+esac
+fi
+
+MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
+if test -n "$MAGIC_CMD"; then
+ { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+
+lt_save_CC="$CC"
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+objext=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_compiler_boilerplate=`cat conftest.err`
+$RM conftest*
+
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+
+
+if test -n "$compiler"; then
+
+lt_prog_compiler_no_builtin_flag=
+
+if test "$GCC" = yes; then
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin'
+
+ { $as_echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:8236: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:8240: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_rtti_exceptions=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
+else
+ :
+fi
+
+fi
+
+
+
+
+
+
+ lt_prog_compiler_wl=
+lt_prog_compiler_pic=
+lt_prog_compiler_static=
+
+{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_static='-static'
+
+ case $host_os in
+ aix*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ m68k)
+ # FIXME: we need at least 68020 code to build shared libraries, but
+ # adding the `-m68020' flag to GCC prevents building anything better,
+ # like `-m68040'.
+ lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic='-fno-common'
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[3-9]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ lt_prog_compiler_can_build_shared=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static='-Bstatic'
+ else
+ lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # This hack is so that the source file can tell whether it is being
+ # built for inclusion in a dll (and should export symbols for example).
+ lt_prog_compiler_pic='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
+ # not for PA HP-UX.
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='--shared'
+ lt_prog_compiler_static='--static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fpic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+ xl*)
+ # IBM XL C 8.0/Fortran 10.1 on PPC
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-qpic'
+ lt_prog_compiler_static='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ *Sun\ F*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl=''
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ lt_prog_compiler_wl='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl='-Qoption ld '
+ lt_prog_compiler_pic='-PIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic='-Kconform_pic'
+ lt_prog_compiler_static='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_can_build_shared=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic='-pic'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared=no
+ ;;
+ esac
+ fi
+
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+$as_echo "$lt_prog_compiler_pic" >&6; }
+
+
+
+
+
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic"; then
+ { $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_pic_works=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ # The option is referenced via a variable to avoid confusing sed.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:8575: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:8579: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s "$ac_outfile"; then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings other than the usual output.
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_pic_works=yes
+ fi
+ fi
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+ case $lt_prog_compiler_pic in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
+ esac
+else
+ lt_prog_compiler_pic=
+ lt_prog_compiler_can_build_shared=no
+fi
+
+fi
+
+
+
+
+
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
+{ $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_static_works=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ if test -s conftest.err; then
+ # Append any errors to the config.log.
+ cat conftest.err 1>&5
+ $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ else
+ lt_cv_prog_compiler_static_works=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+
+if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+ :
+else
+ lt_prog_compiler_static=
+fi
+
+
+
+
+
+
+
+ { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:8680: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:8684: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+ { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ lt_compiler_flag="-o out/conftest2.$ac_objext"
+ # Insert the option either (1) after the last *FLAGS variable, or
+ # (2) before a word containing "conftest.", or (3) at the end.
+ # Note that $ac_compile itself does not contain backslashes and begins
+ # with a dollar sign (not a hyphen), so the echo should work correctly.
+ lt_compile=`echo "$ac_compile" | $SED \
+ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:8735: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:8739: \$? = $ac_status" >&5
+ if (exit $ac_status) && test -s out/conftest2.$ac_objext
+ then
+ # The compiler can only warn and ignore the option if not recognized
+ # So say no if there are warnings
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $RM conftest*
+ # SGI C++ compiler will create directory out/ii_files/ for
+ # template instantiation
+ test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files
+ $RM out/* && rmdir out
+ cd ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
+ hard_links=yes
+ $RM conftest*
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ touch conftest.a
+ ln conftest.a conftest.b 2>&5 || hard_links=no
+ ln conftest.a conftest.b 2>/dev/null && hard_links=no
+ { $as_echo "$as_me:$LINENO: result: $hard_links" >&5
+$as_echo "$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;}
+ need_locks=warn
+ fi
+else
+ need_locks=no
+fi
+
+
+
+
+
+
+ { $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
+
+ runpath_var=
+ allow_undefined_flag=
+ always_export_symbols=no
+ archive_cmds=
+ archive_expsym_cmds=
+ compiler_needs_object=no
+ enable_shared_with_static_runtimes=no
+ export_dynamic_flag_spec=
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ hardcode_automatic=no
+ hardcode_direct=no
+ hardcode_direct_absolute=no
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld=
+ hardcode_libdir_separator=
+ hardcode_minus_L=no
+ hardcode_shlibpath_var=unsupported
+ inherit_rpath=no
+ link_all_deplibs=unknown
+ module_cmds=
+ module_expsym_cmds=
+ old_archive_from_new_cmds=
+ old_archive_from_expsyms_cmds=
+ thread_safe_flag_spec=
+ whole_archive_flag_spec=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms=
+ # exclude_expsyms can be an extended regexp of symbols to exclude
+ # it will be wrapped by ` (' and `)$', so one must not match beginning or
+ # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc',
+ # as well as any symbol that contains `d'.
+ exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out
+ # platforms (ab)use it in PIC code, but their linkers get confused if
+ # the symbol is explicitly referenced. Since portable code cannot
+ # rely on this symbol name, it's probably fine to never include it in
+ # preloaded symbol tables.
+ # Exclude shared library initialization/finalization symbols.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | 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
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ wlarc='${wl}'
+
+ # 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.
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ export_dynamic_flag_spec='${wl}--export-dynamic'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11
+ *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ...
+ *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ...
+ *\ 2.11.*) ;; # other 2.11 versions
+ *) supports_anon_versioning=yes ;;
+ esac
+
+ # See if GNU ld supports shared libraries.
+ 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
+ cat <<_LT_EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, is reported
+*** to be unable to reliably create shared libraries on AIX.
+*** Therefore, libtool is disabling shared libraries support. If you
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec='-L$libdir'
+ allow_undefined_flag=unsupported
+ always_export_symbols=no
+ enable_shared_with_static_runtimes=yes
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ cp $export_symbols $output_objdir/$soname.def;
+ else
+ echo EXPORTS > $output_objdir/$soname.def;
+ cat $export_symbols >> $output_objdir/$soname.def;
+ fi~
+ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ interix[3-9]*)
+ hardcode_direct=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag -Mnomain' ;;
+ ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ tmp_addflag=' -i_dynamic' ;;
+ efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64
+ tmp_addflag=' -i_dynamic -nofor_main' ;;
+ ifc* | ifort*) # Intel Fortran compiler
+ tmp_addflag=' -nofor_main' ;;
+ lf95*) # Lahey Fortran 8.1
+ whole_archive_flag_spec=
+ tmp_sharedflag='--shared' ;;
+ xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld='-rpath $libdir'
+ archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~
+ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
+ echo "local: *; };" >> $output_objdir/$libname.ver~
+ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ ld_shlibs=no
+ fi
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ ld_shlibs=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: The releases 2.8.* of the GNU linker cannot reliably
+*** create shared libraries on Solaris systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.9.1 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ 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
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs=no
+ fi
+ ;;
+ esac
+
+ if test "$ld_shlibs" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec=
+ export_dynamic_flag_spec=
+ whole_archive_flag_spec=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag=unsupported
+ always_export_symbols=yes
+ archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ # Note: this linker hardcodes the directories in LIBPATH if there
+ # are no directories specified by -L.
+ hardcode_minus_L=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; 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
+ exp_sym_flag='-Bexport'
+ no_entry_flag=""
+ else
+ # If we're using GNU nm, then we don't want the "-C" option.
+ # -C means demangle to AIX nm, but means don't demangle with GNU nm
+ if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ fi
+ 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
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
+ fi
+
+ # When large executables or shared objects are built, AIX ld can
+ # have problems creating the table of contents. If linking a library
+ # or program results in "error TOC overflow" add -mminimal-toc to
+ # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
+ # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
+
+ archive_cmds=''
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ file_list_spec='${wl}-f,'
+
+ if test "$GCC" = yes; then
+ case $host_os in aix4.[012]|aix4.[012].*)
+ # We only want to do this on AIX 4.2 and lower, the check
+ # below for broken collect2 doesn't work under 4.3+
+ 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
+ # It fails to find uninstalled libraries when the uninstalled
+ # path is not listed in the libpath. Setting hardcode_minus_L
+ # to unsupported forces relinking
+ hardcode_minus_L=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ else
+ # not using gcc
+ if test "$host_cpu" = ia64; then
+ # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release
+ # chokes on -Wl,-G. The following line is correct:
+ shared_flag='-G'
+ else
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag='${wl}-G'
+ else
+ shared_flag='${wl}-bM:SRE'
+ fi
+ fi
+ fi
+
+ export_dynamic_flag_spec='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ always_export_symbols=yes
+ if test "$aix_use_runtimelinking" = yes; then
+ # Warning - without using the other runtime loading flags (-brtl),
+ # -berok will link without error, but may produce a broken library.
+ allow_undefined_flag='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag="-z nodefs"
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# Check for a 64-bit object if we didn't find anything.
+if test -z "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Warning - without using the other run time loading flags,
+ # -berok will link without error, but may produce a broken library.
+ no_undefined_flag=' ${wl}-bernotok'
+ allow_undefined_flag=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
+ archive_cmds_need_lc=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_minus_L=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec=-rdynamic
+ ;;
+
+ cygwin* | 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=' '
+ allow_undefined_flag=unsupported
+ # Tell ltmain to make .lib files, not .a files.
+ libext=lib
+ # Tell ltmain to make .dll files, not .so files.
+ shrext_cmds=".dll"
+ # FIXME: Setting linknames here is a bad hack.
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_from_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes=yes
+ ;;
+
+ darwin* | rhapsody*)
+
+
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ whole_archive_flag_spec=''
+ link_all_deplibs=yes
+ allow_undefined_flag="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=echo
+ archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+ else
+ ld_shlibs=no
+ fi
+
+ ;;
+
+ dgux*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ freebsd1*)
+ ld_shlibs=no
+ ;;
+
+ # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
+ # support. Future versions do this automatically, but an explicit c++rt0.o
+ # does not break anything, and helps significantly (at the cost of a little
+ # extra space).
+ freebsd2.2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds='$RM $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ fi
+ 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
+ export_dynamic_flag_spec='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_flag_spec_ld='+b $libdir'
+ hardcode_libdir_separator=:
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+ # 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 "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ else
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ fi
+ 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_shlibpath_var=no
+ ;;
+ *)
+ hardcode_direct=yes
+ hardcode_direct_absolute=yes
+ export_dynamic_flag_spec='${wl}-E'
+
+ # 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*)
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ cat >conftest.$ac_ext <<_ACEOF
+int foo(void) {}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
+ else
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ inherit_rpath=yes
+ link_all_deplibs=yes
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ newsos6)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ hardcode_shlibpath_var=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct=yes
+ hardcode_shlibpath_var=no
+ hardcode_direct_absolute=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-R$libdir'
+ ;;
+ *)
+ archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ 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
+ allow_undefined_flag=unsupported
+ archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~$ECHO DATA >> $output_objdir/$libname.def~$ECHO " SINGLE NONSHARED" >> $output_objdir/$libname.def~$ECHO EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def'
+ old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag=' -expect_unresolved \*'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ hardcode_libdir_flag_spec='-rpath $libdir'
+ fi
+ archive_cmds_need_lc='no'
+ hardcode_libdir_separator=:
+ ;;
+
+ solaris*)
+ no_undefined_flag=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp'
+ ;;
+ *)
+ wlarc='${wl}'
+ archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ hardcode_libdir_flag_spec='-R$libdir'
+ hardcode_shlibpath_var=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs=yes
+ ;;
+
+ sunos4*)
+ if test "x$host_vendor" = xsequent; then
+ # Use $CC to link under sequent, because it throws in some extra .o
+ # files that make .init and .fini sections work.
+ archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_direct=yes
+ hardcode_minus_L=yes
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds='$CC -r -o $output$reload_objs'
+ hardcode_direct=no
+ ;;
+ motorola)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var=no
+ ;;
+
+ sysv4.3*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ export_dynamic_flag_spec='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag='${wl}-z,text'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ no_undefined_flag='${wl}-z,text'
+ allow_undefined_flag='${wl}-z,nodefs'
+ archive_cmds_need_lc=no
+ hardcode_shlibpath_var=no
+ hardcode_libdir_flag_spec='${wl}-R,$libdir'
+ hardcode_libdir_separator=':'
+ link_all_deplibs=yes
+ export_dynamic_flag_spec='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_shlibpath_var=no
+ ;;
+
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+
+{ $as_echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
+test "$ld_shlibs" = no && can_build_shared=no
+
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds in
+ *'~'*)
+ # FIXME: we may have to deal with multi-command sequences.
+ ;;
+ '$CC '*)
+ # Test whether the compiler implicitly links with -lc since on some
+ # systems, -lgcc has to come before -lc. If gcc already passes -lc
+ # to ld, don't add -lc before -lgcc.
+ { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+ $RM conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc=no
+ else
+ archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+ { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+$as_echo "$archive_cmds_need_lc" >&6; }
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
+
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if $ECHO "$lt_search_path_spec" | $GREP ';' >/dev/null ; then
+ # if the path contains ";" then we assume it to be the separator
+ # otherwise default to the standard path separator (i.e. ":") - it is
+ # assumed that no part of a normal pathname contains ";" but that should
+ # okay in the real world where ";" in dirpaths is itself problematic.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[lt_foo]++; }
+ if (lt_freq[lt_foo] == 1) { print lt_foo; }
+}'`
+ sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi
+library_names_spec=
+libname_spec='lib$name'
+soname_spec=
+shrext_cmds=".so"
+postinstall_cmds=
+postuninstall_cmds=
+finish_cmds=
+finish_eval=
+shlibpath_var=
+shlibpath_overrides_runpath=unknown
+version_type=none
+dynamic_linker="$host_os ld.so"
+sys_lib_dlsearch_path_spec="/lib /usr/lib"
+need_lib_prefix=unknown
+hardcode_into_libs=no
+
+# when you set need_version to no, make sure it does not cause -set_version
+# flags to be left without arguments
+need_version=unknown
+
+case $host_os in
+aix3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
+ shlibpath_var=LIBPATH
+
+ # AIX 3 has no versioning support, so we append a major version to the name.
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+
+aix[4-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ hardcode_into_libs=yes
+ if test "$host_cpu" = ia64; then
+ # AIX 5 supports IA64
+ library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ else
+ # With GCC up to 2.95.x, collect2 would create an import file
+ # for dependence libraries. The import file would start with
+ # the line `#! .'. This would cause the generated library to
+ # depend on `.', always an invalid library. This was fixed in
+ # development snapshots of GCC prior to 3.0.
+ case $host_os in
+ aix4 | aix4.[01] | aix4.[01].*)
+ if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
+ echo ' yes '
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
+ :
+ else
+ can_build_shared=no
+ fi
+ ;;
+ esac
+ # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
+ # soname into executable. Probably we can add versioning support to
+ # collect2, so additional links can be useful in future.
+ if test "$aix_use_runtimelinking" = yes; then
+ # If using run time linking (on AIX 4.2 or later) use lib<name>.so
+ # instead of lib<name>.a to let people know that these are not
+ # typical AIX shared libraries.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ else
+ # We preserve .a as extension for shared libraries through AIX4.2
+ # and later when we are not doing run time linking.
+ library_names_spec='${libname}${release}.a $libname.a'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ fi
+ shlibpath_var=LIBPATH
+ fi
+ ;;
+
+amigaos*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ library_names_spec='$libname.ixlibrary $libname.a'
+ # Create ${libname}_ixlibrary.a entries in /sys/libs.
+ finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$ECHO "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done'
+ ;;
+ esac
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
+ sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
+ # the default ld.so.conf also contains /usr/contrib/lib and
+ # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
+ # libtool to hard-code these into programs
+ ;;
+
+cygwin* | mingw* | pw32* | cegcc*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32* | yes,cegcc*)
+ library_names_spec='$libname.dll.a'
+ # DLL is installed to $(libdir)/../bin by postinstall_cmds
+ postinstall_cmds='base_file=`basename \${file}`~
+ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~
+ dldir=$destdir/`dirname \$dlpath`~
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
+ dlpath=$dir/\$dldll~
+ $RM \$dlpath'
+ shlibpath_overrides_runpath=yes
+
+ case $host_os in
+ cygwin*)
+ # Cygwin DLLs use 'cyg' prefix rather than 'lib'
+ soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw* | cegcc*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | $GREP "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ ;;
+ pw32*)
+ # pw32 DLLs use 'pw' prefix rather than 'lib'
+ library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ ;;
+ esac
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # FIXME: first we should search . and the directory the executable is in
+ shlibpath_var=PATH
+ ;;
+
+darwin* | rhapsody*)
+ dynamic_linker="$host_os dyld"
+ version_type=darwin
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ soname_spec='${libname}${release}${major}$shared_ext'
+ shlibpath_overrides_runpath=yes
+ shlibpath_var=DYLD_LIBRARY_PATH
+ shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`'
+
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
+ ;;
+
+dgux*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+freebsd* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[123]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ version_type=freebsd-$objformat
+ case $version_type in
+ freebsd-elf*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ need_version=no
+ need_lib_prefix=no
+ ;;
+ freebsd-*)
+ library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
+ need_version=yes
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_os in
+ freebsd2*)
+ shlibpath_overrides_runpath=yes
+ ;;
+ freebsd3.[01]* | freebsdelf3.[01]*)
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
+ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+ esac
+ ;;
+
+gnu*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ hardcode_into_libs=yes
+ ;;
+
+hpux9* | hpux10* | hpux11*)
+ # Give a soname corresponding to the major version so that dld.sl refuses to
+ # link against other versions.
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ case $host_cpu in
+ ia64*)
+ shrext_cmds='.so'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.so"
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ if test "X$HPUX_IA64_MODE" = X32; then
+ sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
+ else
+ sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ fi
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ hppa*64*)
+ shrext_cmds='.sl'
+ hardcode_into_libs=yes
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
+ shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
+ sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
+ ;;
+ *)
+ shrext_cmds='.sl'
+ dynamic_linker="$host_os dld.sl"
+ shlibpath_var=SHLIB_PATH
+ shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ ;;
+ esac
+ # HP-UX runs *really* slowly unless shared libraries are mode 555.
+ postinstall_cmds='chmod 555 $lib'
+ ;;
+
+interix[3-9]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+irix5* | irix6* | nonstopux*)
+ case $host_os in
+ nonstopux*) version_type=nonstopux ;;
+ *)
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ version_type=linux
+ else
+ version_type=irix
+ fi ;;
+ esac
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
+ case $host_os in
+ irix5* | nonstopux*)
+ libsuff= shlibsuff=
+ ;;
+ *)
+ case $LD in # libtool.m4 will add one of these switches to LD
+ *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
+ libsuff= shlibsuff= libmagic=32-bit;;
+ *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
+ libsuff=32 shlibsuff=N32 libmagic=N32;;
+ *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
+ libsuff=64 shlibsuff=64 libmagic=64-bit;;
+ *) libsuff= shlibsuff= libmagic=never-match;;
+ esac
+ ;;
+ esac
+ shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
+ sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
+ hardcode_into_libs=yes
+ ;;
+
+# No shared lib support for Linux oldld, aout, or coff.
+linux*oldld* | linux*aout* | linux*coff*)
+ dynamic_linker=no
+ ;;
+
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # Some binutils ld are patched to set DT_RUNPATH
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then
+ shlibpath_overrides_runpath=yes
+fi
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+ # This implies no fast_install, which is unacceptable.
+ # Some rework will be needed to allow for fast_install
+ # before this can be enabled.
+ hardcode_into_libs=yes
+
+ # Append ld.so.conf contents to the search path
+ if test -f /etc/ld.so.conf; then
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
+ fi
+
+ # We used to test for /lib/ld.so.1 and disable shared libraries on
+ # powerpc, because MkLinux only supported shared libraries with the
+ # GNU dynamic linker. Since this was broken with cross compilers,
+ # most powerpc-linux boxes support dynamic linking these days and
+ # people can always --disable-shared, the test was removed, and we
+ # assume the GNU/Linux dynamic linker is in use.
+ dynamic_linker='GNU/Linux ld.so'
+ ;;
+
+netbsd*)
+ version_type=sunos
+ need_lib_prefix=no
+ need_version=no
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ dynamic_linker='NetBSD (a.out) ld.so'
+ else
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ dynamic_linker='NetBSD ld.elf_so'
+ fi
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ ;;
+
+newsos6)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ ;;
+
+*nto* | *qnx*)
+ version_type=qnx
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ need_lib_prefix=no
+ # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs.
+ case $host_os in
+ openbsd3.3 | openbsd3.3.*) need_version=yes ;;
+ *) need_version=no ;;
+ esac
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ case $host_os in
+ openbsd2.[89] | openbsd2.[89].*)
+ shlibpath_overrides_runpath=no
+ ;;
+ *)
+ shlibpath_overrides_runpath=yes
+ ;;
+ esac
+ else
+ shlibpath_overrides_runpath=yes
+ fi
+ ;;
+
+os2*)
+ libname_spec='$name'
+ shrext_cmds=".dll"
+ need_lib_prefix=no
+ library_names_spec='$libname${shared_ext} $libname.a'
+ dynamic_linker='OS/2 ld.exe'
+ shlibpath_var=LIBPATH
+ ;;
+
+osf3* | osf4* | osf5*)
+ version_type=osf
+ need_lib_prefix=no
+ need_version=no
+ soname_spec='${libname}${release}${shared_ext}$major'
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
+ sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+solaris*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ # ldd complains unless libraries are executable
+ postinstall_cmds='chmod +x $lib'
+ ;;
+
+sunos4*)
+ version_type=sunos
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
+ finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ if test "$with_gnu_ld" = yes; then
+ need_lib_prefix=no
+ fi
+ need_version=yes
+ ;;
+
+sysv4 | sysv4.3*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ case $host_vendor in
+ sni)
+ shlibpath_overrides_runpath=no
+ need_lib_prefix=no
+ runpath_var=LD_RUN_PATH
+ ;;
+ siemens)
+ need_lib_prefix=no
+ ;;
+ motorola)
+ need_lib_prefix=no
+ need_version=no
+ shlibpath_overrides_runpath=no
+ sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
+ ;;
+ esac
+ ;;
+
+sysv4*MP*)
+ if test -d /usr/nec ;then
+ version_type=linux
+ library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
+ soname_spec='$libname${shared_ext}.$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ fi
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/Linux.
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+uts4*)
+ version_type=linux
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ ;;
+
+*)
+ dynamic_linker=no
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
+test "$dynamic_linker" = no && can_build_shared=no
+
+variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
+if test "$GCC" = yes; then
+ variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+fi
+
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
+hardcode_action=
+if test -n "$hardcode_libdir_flag_spec" ||
+ test -n "$runpath_var" ||
+ test "X$hardcode_automatic" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$hardcode_direct" != no &&
+ # If the only mechanism to avoid hardcoding is shlibpath_var, we
+ # have to relink, otherwise we might link with an installed library
+ # when we should be linking with a yet-to-be-installed one
+ ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
+ test "$hardcode_minus_L" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action=unsupported
+fi
+{ $as_echo "$as_me:$LINENO: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
+
+if test "$hardcode_action" = relink ||
+ test "$inherit_rpath" = yes; then
+ # Fast installation is not supported
+ enable_fast_install=no
+elif test "$shlibpath_overrides_runpath" = yes ||
+ test "$enable_shared" = no; then
+ # Fast installation is not necessary
+ enable_fast_install=needless
+fi
+
+
+
+
+
+
+ if test "x$enable_dlopen" != xyes; then
+ enable_dlopen=unknown
+ enable_dlopen_self=unknown
+ enable_dlopen_self_static=unknown
+else
+ lt_cv_dlopen=no
+ lt_cv_dlopen_libs=
+
+ case $host_os in
+ beos*)
+ lt_cv_dlopen="load_add_on"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+ ;;
+
+ mingw* | pw32* | cegcc*)
+ lt_cv_dlopen="LoadLibrary"
+ lt_cv_dlopen_libs=
+ ;;
+
+ cygwin*)
+ lt_cv_dlopen="dlopen"
+ lt_cv_dlopen_libs=
+ ;;
+
+ darwin*)
+ # if libdl is installed we need to link against it
+ { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_dl_dlopen=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dl_dlopen=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+
+ lt_cv_dlopen="dyld"
+ lt_cv_dlopen_libs=
+ lt_cv_dlopen_self=yes
+
+fi
+
+ ;;
+
+ *)
+ { $as_echo "$as_me:$LINENO: checking for shl_load" >&5
+$as_echo_n "checking for shl_load... " >&6; }
+if test "${ac_cv_func_shl_load+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char shl_load (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+/* 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_shl_load || defined __stub___shl_load
+choke me
+#endif
+
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_func_shl_load=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func_shl_load=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+$as_echo "$ac_cv_func_shl_load" >&6; }
+if test $ac_cv_func_shl_load = yes; then
+ lt_cv_dlopen="shl_load"
+else
+ { $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_dld_shl_load=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dld_shl_load=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test $ac_cv_lib_dld_shl_load = yes; then
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+else
+ { $as_echo "$as_me:$LINENO: checking for dlopen" >&5
+$as_echo_n "checking for dlopen... " >&6; }
+if test "${ac_cv_func_dlopen+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+/* 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_dlopen || defined __stub___dlopen
+choke me
+#endif
+
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_func_dlopen=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func_dlopen=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+$as_echo "$ac_cv_func_dlopen" >&6; }
+if test $ac_cv_func_dlopen = yes; then
+ lt_cv_dlopen="dlopen"
+else
+ { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_dl_dlopen=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dl_dlopen=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
+else
+ { $as_echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsvld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_svld_dlopen=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_svld_dlopen=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test $ac_cv_lib_svld_dlopen = yes; then
+ lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
+else
+ { $as_echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldld $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dld_link ();
+int
+main ()
+{
+return dld_link ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_dld_dld_link=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dld_dld_link=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test $ac_cv_lib_dld_dld_link = yes; then
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+
+fi
+
+ ;;
+ esac
+
+ if test "x$lt_cv_dlopen" != xno; then
+ enable_dlopen=yes
+ else
+ enable_dlopen=no
+ fi
+
+ case $lt_cv_dlopen in
+ dlopen)
+ save_CPPFLAGS="$CPPFLAGS"
+ test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H"
+
+ save_LDFLAGS="$LDFLAGS"
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\"
+
+ save_LIBS="$LIBS"
+ LIBS="$lt_cv_dlopen_libs $LIBS"
+
+ { $as_echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line 11535 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
+
+ if test "x$lt_cv_dlopen_self" = xyes; then
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ { $as_echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ lt_cv_dlopen_self_static=cross
+else
+ lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
+ lt_status=$lt_dlunknown
+ cat > conftest.$ac_ext <<_LT_EOF
+#line 11631 "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#ifdef RTLD_GLOBAL
+# define LT_DLGLOBAL RTLD_GLOBAL
+#else
+# ifdef DL_GLOBAL
+# define LT_DLGLOBAL DL_GLOBAL
+# else
+# define LT_DLGLOBAL 0
+# endif
+#endif
+
+/* We may have to define LT_DLLAZY_OR_NOW in the command line if we
+ find out it does not work in some platform. */
+#ifndef LT_DLLAZY_OR_NOW
+# ifdef RTLD_LAZY
+# define LT_DLLAZY_OR_NOW RTLD_LAZY
+# else
+# ifdef DL_LAZY
+# define LT_DLLAZY_OR_NOW DL_LAZY
+# else
+# ifdef RTLD_NOW
+# define LT_DLLAZY_OR_NOW RTLD_NOW
+# else
+# ifdef DL_NOW
+# define LT_DLLAZY_OR_NOW DL_NOW
+# else
+# define LT_DLLAZY_OR_NOW 0
+# endif
+# endif
+# endif
+# endif
+#endif
+
+void fnord() { int i=42;}
+int main ()
+{
+ void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
+ int status = $lt_dlunknown;
+
+ if (self)
+ {
+ if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
+ /* dlclose (self); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}
+_LT_EOF
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&5 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;;
+ x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;;
+ esac
+ else :
+ # compilation failed
+ lt_cv_dlopen_self_static=no
+ fi
+fi
+rm -fr conftest*
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
+ fi
+
+ CPPFLAGS="$save_CPPFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ LIBS="$save_LIBS"
+ ;;
+ esac
+
+ case $lt_cv_dlopen_self in
+ yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;;
+ *) enable_dlopen_self=unknown ;;
+ esac
+
+ case $lt_cv_dlopen_self_static in
+ yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;;
+ *) enable_dlopen_self_static=unknown ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+striplib=
+old_striplib=
+{ $as_echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ { $as_echo "$as_me:$LINENO: result: yes" >&5
+$as_echo "yes" >&6; }
+ else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ ;;
+ *)
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+ ;;
+ esac
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+ # Report which library types will actually be built
+ { $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+ { $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
+
+ { $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&6; }
+ test "$can_build_shared" = "no" && enable_shared=no
+
+ # On AIX, shared libraries and static libraries use the same namespace, and
+ # are all built from PIC.
+ case $host_os in
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
+ fi
+ ;;
+
+ aix[4-9]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+ esac
+ { $as_echo "$as_me:$LINENO: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
+
+ { $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ { $as_echo "$as_me:$LINENO: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
+
+
+
+
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+CC="$lt_save_CC"
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ac_config_commands="$ac_config_commands libtool"
+
+
+
+
+# Only expand once:
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+$as_echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+
+#
+# Options for building bsdtar.
+#
+# Default is to build bsdtar, but allow people to override that.
+#
+# Check whether --enable-bsdtar was given.
+if test "${enable_bsdtar+set}" = set; then
+ enableval=$enable_bsdtar;
+else
+ enable_bsdtar=yes
+fi
+
+
+case "$enable_bsdtar" in
+yes)
+ if test "$enable_static" = "no"; then
+ static_bsdtar=no
+ else
+ static_bsdtar=yes
+ fi
+ build_bsdtar=yes
+ ;;
+dynamic|shared)
+ if test "$enable_shared" = "no"; then
+ { { $as_echo "$as_me:$LINENO: error: Shared linking of bsdtar requires shared libarchive
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: Shared linking of bsdtar requires shared libarchive
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ build_bsdtar=yes
+ static_bsdtar=no
+ ;;
+static)
+ build_bsdtar=yes
+ static_bsdtar=yes
+ ;;
+no)
+ build_bsdtar=no
+ static_bsdtar=no
+ ;;
+*)
+ { { $as_echo "$as_me:$LINENO: error: Unsupported value for --enable-bsdtar
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: Unsupported value for --enable-bsdtar
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+esac
+
+ if test "$build_bsdtar" = yes ; then
+ BUILD_BSDTAR_TRUE=
+ BUILD_BSDTAR_FALSE='#'
+else
+ BUILD_BSDTAR_TRUE='#'
+ BUILD_BSDTAR_FALSE=
+fi
+
+ if test "$static_bsdtar" = yes ; then
+ STATIC_BSDTAR_TRUE=
+ STATIC_BSDTAR_FALSE='#'
+else
+ STATIC_BSDTAR_TRUE='#'
+ STATIC_BSDTAR_FALSE=
+fi
+
+
+#
+# Options for building bsdcpio.
+#
+# Default is not to build bsdcpio, but that can be overridden.
+#
+# Check whether --enable-bsdcpio was given.
+if test "${enable_bsdcpio+set}" = set; then
+ enableval=$enable_bsdcpio;
+else
+ enable_bsdcpio=yes
+fi
+
+
+case "$enable_bsdcpio" in
+yes)
+ if test "$enable_static" = "no"; then
+ static_bsdcpio=no
+ else
+ static_bsdcpio=yes
+ fi
+ build_bsdcpio=yes
+ ;;
+dynamic|shared)
+ if test "$enabled_shared" = "no"; then
+ { { $as_echo "$as_me:$LINENO: error: Shared linking of bsdcpio requires shared libarchive
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: Shared linking of bsdcpio requires shared libarchive
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ build_bsdcpio=yes
+ ;;
+static)
+ build_bsdcpio=yes
+ static_bsdcpio=yes
+ ;;
+no)
+ build_bsdcpio=no
+ static_bsdcpio=no
+ ;;
+*)
+ { { $as_echo "$as_me:$LINENO: error: Unsupported value for --enable-bsdcpio
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: Unsupported value for --enable-bsdcpio
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+esac
+
+ if test "$build_bsdcpio" = yes ; then
+ BUILD_BSDCPIO_TRUE=
+ BUILD_BSDCPIO_FALSE='#'
+else
+ BUILD_BSDCPIO_TRUE='#'
+ BUILD_BSDCPIO_FALSE=
+fi
+
+ if test "$static_bsdcpio" = yes ; then
+ STATIC_BSDCPIO_TRUE=
+ STATIC_BSDCPIO_FALSE='#'
+else
+ STATIC_BSDCPIO_TRUE='#'
+ STATIC_BSDCPIO_FALSE=
+fi
+
+
+# Set up defines needed before including any headers
+case $host in
+ *mingw* | *cygwin* )
+
+cat >>confdefs.h <<\_ACEOF
+#define _WIN32_WINNT 0x0500
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define WINVER 0x0500
+_ACEOF
+
+ ;;
+esac
+
+# Checks for header files.
+
+
+
+
+
+ac_header_dirent=no
+for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do
+ as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5
+$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <$ac_hdr>
+
+int
+main ()
+{
+if ((DIR *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ eval "$as_ac_Header=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1
+_ACEOF
+
+ac_header_dirent=$ac_hdr; break
+fi
+
+done
+# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
+if test $ac_header_dirent = dirent.h; then
+ { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if test "${ac_cv_search_opendir+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' dir; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_search_opendir=$ac_res
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext
+ if test "${ac_cv_search_opendir+set}" = set; then
+ break
+fi
+done
+if test "${ac_cv_search_opendir+set}" = set; then
+ :
+else
+ ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+else
+ { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5
+$as_echo_n "checking for library containing opendir... " >&6; }
+if test "${ac_cv_search_opendir+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char opendir ();
+int
+main ()
+{
+return opendir ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' x; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_search_opendir=$ac_res
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext
+ if test "${ac_cv_search_opendir+set}" = set; then
+ break
+fi
+done
+if test "${ac_cv_search_opendir+set}" = set; then
+ :
+else
+ ac_cv_search_opendir=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5
+$as_echo "$ac_cv_search_opendir" >&6; }
+ac_res=$ac_cv_search_opendir
+if test "$ac_res" != no; then
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5
+$as_echo_n "checking for sys/wait.h that is POSIX.1 compatible... " >&6; }
+if test "${ac_cv_header_sys_wait_h+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/wait.h>
+#ifndef WEXITSTATUS
+# define WEXITSTATUS(stat_val) ((unsigned int) (stat_val) >> 8)
+#endif
+#ifndef WIFEXITED
+# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
+#endif
+
+int
+main ()
+{
+ int s;
+ wait (&s);
+ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_header_sys_wait_h=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_sys_wait_h=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5
+$as_echo "$ac_cv_header_sys_wait_h" >&6; }
+if test $ac_cv_header_sys_wait_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_SYS_WAIT_H 1
+_ACEOF
+
+fi
+
+
+
+
+
+for ac_header in acl/libacl.h attr/xattr.h ctype.h errno.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+for ac_header in ext2fs/ext2_fs.h fcntl.h grp.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+for ac_header in inttypes.h io.h langinfo.h limits.h linux/fs.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+
+
+for ac_header in locale.h paths.h poll.h pwd.h regex.h signal.h stdarg.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+for ac_header in stdint.h stdlib.h string.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+for ac_header in sys/acl.h sys/cdefs.h sys/extattr.h sys/ioctl.h sys/mkdev.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+for ac_header in sys/param.h sys/poll.h sys/select.h sys/time.h sys/utime.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+
+for ac_header in time.h unistd.h utime.h wchar.h wctype.h windows.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# Checks for libraries.
+
+# Check whether --with-zlib was given.
+if test "${with_zlib+set}" = set; then
+ withval=$with_zlib;
+fi
+
+
+if test "x$with_zlib" != "xno"; then
+
+for ac_header in zlib.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+{ $as_echo "$as_me:$LINENO: checking for inflate in -lz" >&5
+$as_echo_n "checking for inflate in -lz... " >&6; }
+if test "${ac_cv_lib_z_inflate+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lz $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char inflate ();
+int
+main ()
+{
+return inflate ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_z_inflate=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_z_inflate=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflate" >&5
+$as_echo "$ac_cv_lib_z_inflate" >&6; }
+if test $ac_cv_lib_z_inflate = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBZ 1
+_ACEOF
+
+ LIBS="-lz $LIBS"
+
+fi
+
+fi
+
+
+# Check whether --with-bz2lib was given.
+if test "${with_bz2lib+set}" = set; then
+ withval=$with_bz2lib;
+fi
+
+
+if test "x$with_bz2lib" != "xno"; then
+
+for ac_header in bzlib.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+{ $as_echo "$as_me:$LINENO: checking for BZ2_bzDecompressInit in -lbz2" >&5
+$as_echo_n "checking for BZ2_bzDecompressInit in -lbz2... " >&6; }
+if test "${ac_cv_lib_bz2_BZ2_bzDecompressInit+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lbz2 $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char BZ2_bzDecompressInit ();
+int
+main ()
+{
+return BZ2_bzDecompressInit ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_bz2_BZ2_bzDecompressInit=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_bz2_BZ2_bzDecompressInit=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_bz2_BZ2_bzDecompressInit" >&5
+$as_echo "$ac_cv_lib_bz2_BZ2_bzDecompressInit" >&6; }
+if test $ac_cv_lib_bz2_BZ2_bzDecompressInit = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBBZ2 1
+_ACEOF
+
+ LIBS="-lbz2 $LIBS"
+
+fi
+
+fi
+
+
+# Check whether --with-lzmadec was given.
+if test "${with_lzmadec+set}" = set; then
+ withval=$with_lzmadec;
+fi
+
+
+if test "x$with_lzmadec" != "xno"; then
+
+for ac_header in lzmadec.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+{ $as_echo "$as_me:$LINENO: checking for lzmadec_decode in -llzmadec" >&5
+$as_echo_n "checking for lzmadec_decode in -llzmadec... " >&6; }
+if test "${ac_cv_lib_lzmadec_lzmadec_decode+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-llzmadec $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char lzmadec_decode ();
+int
+main ()
+{
+return lzmadec_decode ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_lzmadec_lzmadec_decode=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_lzmadec_lzmadec_decode=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_lzmadec_lzmadec_decode" >&5
+$as_echo "$ac_cv_lib_lzmadec_lzmadec_decode" >&6; }
+if test $ac_cv_lib_lzmadec_lzmadec_decode = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBLZMADEC 1
+_ACEOF
+
+ LIBS="-llzmadec $LIBS"
+
+fi
+
+fi
+
+
+# Check whether --with-lzma was given.
+if test "${with_lzma+set}" = set; then
+ withval=$with_lzma;
+fi
+
+
+if test "x$with_lzma" != "xno"; then
+
+for ac_header in lzma.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+{ $as_echo "$as_me:$LINENO: checking for lzma_stream_decoder in -llzma" >&5
+$as_echo_n "checking for lzma_stream_decoder in -llzma... " >&6; }
+if test "${ac_cv_lib_lzma_lzma_stream_decoder+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-llzma $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char lzma_stream_decoder ();
+int
+main ()
+{
+return lzma_stream_decoder ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_lzma_lzma_stream_decoder=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_lzma_lzma_stream_decoder=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_lzma_lzma_stream_decoder" >&5
+$as_echo "$ac_cv_lib_lzma_lzma_stream_decoder" >&6; }
+if test $ac_cv_lib_lzma_lzma_stream_decoder = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBLZMA 1
+_ACEOF
+
+ LIBS="-llzma $LIBS"
+
+fi
+
+fi
+
+
+# Check whether --with-openssl was given.
+if test "${with_openssl+set}" = set; then
+ withval=$with_openssl;
+fi
+
+
+
+# Check whether --with-xml2 was given.
+if test "${with_xml2+set}" = set; then
+ withval=$with_xml2;
+fi
+
+
+# Check whether --with-expat was given.
+if test "${with_expat+set}" = set; then
+ withval=$with_expat;
+fi
+
+
+if test "x$with_xml2" != "xno"; then
+ # Extract the first word of "xml2-config", so it can be a program name with args.
+set dummy xml2-config; ac_word=$2
+{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_XML2_CONFIG+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ case $XML2_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_XML2_CONFIG="$XML2_CONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in ${PATH}
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_XML2_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+fi
+XML2_CONFIG=$ac_cv_path_XML2_CONFIG
+if test -n "$XML2_CONFIG"; then
+ { $as_echo "$as_me:$LINENO: result: $XML2_CONFIG" >&5
+$as_echo "$XML2_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:$LINENO: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ if test "x$XML2_CONFIG" != "x"; then
+ CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`"
+ LIBS="${LIBS} `${XML2_CONFIG} --libs`"
+ fi
+
+for ac_header in libxml/xmlreader.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+{ $as_echo "$as_me:$LINENO: checking for xmlInitParser in -lxml2" >&5
+$as_echo_n "checking for xmlInitParser in -lxml2... " >&6; }
+if test "${ac_cv_lib_xml2_xmlInitParser+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lxml2 $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char xmlInitParser ();
+int
+main ()
+{
+return xmlInitParser ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_xml2_xmlInitParser=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_xml2_xmlInitParser=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_xml2_xmlInitParser" >&5
+$as_echo "$ac_cv_lib_xml2_xmlInitParser" >&6; }
+if test $ac_cv_lib_xml2_xmlInitParser = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBXML2 1
+_ACEOF
+
+ LIBS="-lxml2 $LIBS"
+
+fi
+
+fi
+if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then
+ if test "x$with_expat" != "xno"; then
+
+for ac_header in expat.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+{ $as_echo "$as_me:$LINENO: checking for XML_ParserCreate in -lexpat" >&5
+$as_echo_n "checking for XML_ParserCreate in -lexpat... " >&6; }
+if test "${ac_cv_lib_expat_XML_ParserCreate+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lexpat $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char XML_ParserCreate ();
+int
+main ()
+{
+return XML_ParserCreate ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_expat_XML_ParserCreate=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_expat_XML_ParserCreate=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_expat_XML_ParserCreate" >&5
+$as_echo "$ac_cv_lib_expat_XML_ParserCreate" >&6; }
+if test $ac_cv_lib_expat_XML_ParserCreate = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBEXPAT 1
+_ACEOF
+
+ LIBS="-lexpat $LIBS"
+
+fi
+
+ fi
+fi
+
+
+
+
+
+
+
+
+for ac_header in md5.h ripemd.h rmd160.h sha.h sha1.h sha2.h sha256.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+# Common names for libc implementation on NetBSD and OpenBSD
+
+
+
+for ac_func in MD5Init RMD160Init SHA1Init
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+# SHA2 on NetBSD and older OpenBSD
+
+
+
+for ac_func in SHA256_Init SHA384_Init SHA512_Init
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+# SHA2 on newer OpenBSD
+
+
+
+for ac_func in SHA256Init SHA384Init SHA512Init
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+if test "x$with_openssl" != "xno"; then
+ if test "$ac_cv_func_MD5Init" != "yes"; then
+
+for ac_header in openssl/md5.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ { $as_echo "$as_me:$LINENO: checking for library containing MD5_Init" >&5
+$as_echo_n "checking for library containing MD5_Init... " >&6; }
+if test "${ac_cv_search_MD5_Init+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char MD5_Init ();
+int
+main ()
+{
+return MD5_Init ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' crypto; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_search_MD5_Init=$ac_res
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext
+ if test "${ac_cv_search_MD5_Init+set}" = set; then
+ break
+fi
+done
+if test "${ac_cv_search_MD5_Init+set}" = set; then
+ :
+else
+ ac_cv_search_MD5_Init=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_MD5_Init" >&5
+$as_echo "$ac_cv_search_MD5_Init" >&6; }
+ac_res=$ac_cv_search_MD5_Init
+if test "$ac_res" != no; then
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+ fi
+ if test "$ac_cv_func_RMD160Init" != "yes"; then
+
+for ac_header in openssl/ripemd.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ { $as_echo "$as_me:$LINENO: checking for library containing RIPEMD160_Init" >&5
+$as_echo_n "checking for library containing RIPEMD160_Init... " >&6; }
+if test "${ac_cv_search_RIPEMD160_Init+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char RIPEMD160_Init ();
+int
+main ()
+{
+return RIPEMD160_Init ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' crypto; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_search_RIPEMD160_Init=$ac_res
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext
+ if test "${ac_cv_search_RIPEMD160_Init+set}" = set; then
+ break
+fi
+done
+if test "${ac_cv_search_RIPEMD160_Init+set}" = set; then
+ :
+else
+ ac_cv_search_RIPEMD160_Init=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_RIPEMD160_Init" >&5
+$as_echo "$ac_cv_search_RIPEMD160_Init" >&6; }
+ac_res=$ac_cv_search_RIPEMD160_Init
+if test "$ac_res" != no; then
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+ fi
+ if test "$ac_cv_func_SHA1Init" != "yes"; then
+
+for ac_header in openssl/sha.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ { $as_echo "$as_me:$LINENO: checking for library containing SHA1_Init" >&5
+$as_echo_n "checking for library containing SHA1_Init... " >&6; }
+if test "${ac_cv_search_SHA1_Init+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char SHA1_Init ();
+int
+main ()
+{
+return SHA1_Init ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' crypto; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_search_SHA1_Init=$ac_res
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext
+ if test "${ac_cv_search_SHA1_Init+set}" = set; then
+ break
+fi
+done
+if test "${ac_cv_search_SHA1_Init+set}" = set; then
+ :
+else
+ ac_cv_search_SHA1_Init=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_SHA1_Init" >&5
+$as_echo "$ac_cv_search_SHA1_Init" >&6; }
+ac_res=$ac_cv_search_SHA1_Init
+if test "$ac_res" != no; then
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+ fi
+ if test "$ac_cv_func_SHA256Init" != "yes" ||
+ test "$ac_cv_func_SHA384Init" != "yes" ||
+ test "$ac_cv_func_SHA512Init" != "yes"; then
+ if test "$ac_cv_func_SHA256_Init" != "yes" ||
+ test "$ac_cv_func_SHA384_Init" != "yes" ||
+ test "$ac_cv_func_SHA512_Init" != "yes"; then
+
+for ac_header in openssl/sha.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+ # TODO: Does AC_SEARCH_LIBS support more than one function at once?
+ # This appears to always fail.
+ { $as_echo "$as_me:$LINENO: checking for library containing SHA256_Init SHA384_Init SHA512_Init" >&5
+$as_echo_n "checking for library containing SHA256_Init SHA384_Init SHA512_Init... " >&6; }
+if test "${ac_cv_search_SHA256_Init_SHA384_Init_SHA512_Init+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_func_search_save_LIBS=$LIBS
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char SHA256_Init SHA384_Init SHA512_Init ();
+int
+main ()
+{
+return SHA256_Init SHA384_Init SHA512_Init ();
+ ;
+ return 0;
+}
+_ACEOF
+for ac_lib in '' crypto; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_search_SHA256_Init_SHA384_Init_SHA512_Init=$ac_res
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext
+ if test "${ac_cv_search_SHA256_Init_SHA384_Init_SHA512_Init+set}" = set; then
+ break
+fi
+done
+if test "${ac_cv_search_SHA256_Init_SHA384_Init_SHA512_Init+set}" = set; then
+ :
+else
+ ac_cv_search_SHA256_Init_SHA384_Init_SHA512_Init=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_SHA256_Init_SHA384_Init_SHA512_Init" >&5
+$as_echo "$ac_cv_search_SHA256_Init_SHA384_Init_SHA512_Init" >&6; }
+ac_res=$ac_cv_search_SHA256_Init_SHA384_Init_SHA512_Init
+if test "$ac_res" != no; then
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+
+fi
+
+
+ # TODO: Actually test for these. Previously our C code did not
+ # test for these at all and just assumed availability. Now that
+ # the C code tests these macros we preserve previous behavior
+ # for the autotools build by hard-coding availability.
+ if test "$ac_cv_header_openssl_sha_h" = "yes"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_OPENSSL_SHA256_INIT 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_OPENSSL_SHA384_INIT 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_OPENSSL_SHA512_INIT 1
+_ACEOF
+
+ fi
+ fi
+ fi
+fi
+
+# TODO: Give the user the option of using a pre-existing system
+# libarchive. This will define HAVE_LIBARCHIVE which will cause
+# bsdtar_platform.h to use #include <...> for the libarchive headers.
+# Need to include Makefile.am magic to link against system
+# -larchive in that case.
+#AC_CHECK_LIB(archive,archive_version)
+
+# Checks for typedefs, structures, and compiler characteristics.
+{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if test "${ac_cv_c_const+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset cs;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *pcpcc;
+ char **ppc;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ pcpcc = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++pcpcc;
+ ppc = (char**) pcpcc;
+ pcpcc = (char const *const *) ppc;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !cs[0] && !zero.x;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_c_const=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_c_const=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const /**/
+_ACEOF
+
+fi
+
+# AC_TYPE_UID_T defaults to "int", which is incorrect for MinGW
+# and MSVC. Use a customized version.
+{ $as_echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5
+$as_echo_n "checking for uid_t in sys/types.h... " >&6; }
+if test "${la_cv_type_uid_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "uid_t" >/dev/null 2>&1; then
+ la_cv_type_uid_t=yes
+else
+ la_cv_type_uid_t=no
+fi
+rm -f conftest*
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $la_cv_type_uid_t" >&5
+$as_echo "$la_cv_type_uid_t" >&6; }
+if test $la_cv_type_uid_t = no; then
+ case $host in
+ *mingw*) def_uid_t=short ;;
+ *) def_uid_t=int ;;
+ esac
+
+cat >>confdefs.h <<_ACEOF
+#define uid_t $def_uid_t
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define gid_t $def_uid_t
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for mode_t" >&5
+$as_echo_n "checking for mode_t... " >&6; }
+if test "${ac_cv_type_mode_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_mode_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (mode_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((mode_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_mode_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5
+$as_echo "$ac_cv_type_mode_t" >&6; }
+if test $ac_cv_type_mode_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define mode_t int
+_ACEOF
+
+fi
+
+# AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on
+# most systems... default to "long long" instead.
+{ $as_echo "$as_me:$LINENO: checking for off_t" >&5
+$as_echo_n "checking for off_t... " >&6; }
+if test "${ac_cv_type_off_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_off_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (off_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((off_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_off_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+$as_echo "$ac_cv_type_off_t" >&6; }
+if test $ac_cv_type_off_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define off_t long long
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for size_t" >&5
+$as_echo_n "checking for size_t... " >&6; }
+if test "${ac_cv_type_size_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_size_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (size_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((size_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_size_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+$as_echo "$ac_cv_type_size_t" >&6; }
+if test $ac_cv_type_size_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for id_t" >&5
+$as_echo_n "checking for id_t... " >&6; }
+if test "${ac_cv_type_id_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_id_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (id_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((id_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_id_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_id_t" >&5
+$as_echo "$ac_cv_type_id_t" >&6; }
+if test $ac_cv_type_id_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define id_t unsigned long
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for uintptr_t" >&5
+$as_echo_n "checking for uintptr_t... " >&6; }
+if test "${ac_cv_type_uintptr_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_uintptr_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (uintptr_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((uintptr_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_uintptr_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5
+$as_echo "$ac_cv_type_uintptr_t" >&6; }
+if test $ac_cv_type_uintptr_t = yes; then
+ :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define uintptr_t unsigned int
+_ACEOF
+
+fi
+
+
+# Check for birthtime in struct stat
+{ $as_echo "$as_me:$LINENO: checking for struct stat.st_birthtime" >&5
+$as_echo_n "checking for struct stat.st_birthtime... " >&6; }
+if test "${ac_cv_member_struct_stat_st_birthtime+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (ac_aggr.st_birthtime)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_birthtime=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (sizeof ac_aggr.st_birthtime)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_birthtime=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_member_struct_stat_st_birthtime=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_birthtime" >&5
+$as_echo "$ac_cv_member_struct_stat_st_birthtime" >&6; }
+if test $ac_cv_member_struct_stat_st_birthtime = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1
+_ACEOF
+
+
+fi
+
+
+# Check for high-resolution timestamps in struct stat
+{ $as_echo "$as_me:$LINENO: checking for struct stat.st_birthtimespec.tv_nsec" >&5
+$as_echo_n "checking for struct stat.st_birthtimespec.tv_nsec... " >&6; }
+if test "${ac_cv_member_struct_stat_st_birthtimespec_tv_nsec+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (ac_aggr.st_birthtimespec.tv_nsec)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_birthtimespec_tv_nsec=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (sizeof ac_aggr.st_birthtimespec.tv_nsec)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_birthtimespec_tv_nsec=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_member_struct_stat_st_birthtimespec_tv_nsec=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" >&5
+$as_echo "$ac_cv_member_struct_stat_st_birthtimespec_tv_nsec" >&6; }
+if test $ac_cv_member_struct_stat_st_birthtimespec_tv_nsec = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1
+_ACEOF
+
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for struct stat.st_mtimespec.tv_nsec" >&5
+$as_echo_n "checking for struct stat.st_mtimespec.tv_nsec... " >&6; }
+if test "${ac_cv_member_struct_stat_st_mtimespec_tv_nsec+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (ac_aggr.st_mtimespec.tv_nsec)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_mtimespec_tv_nsec=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (sizeof ac_aggr.st_mtimespec.tv_nsec)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_mtimespec_tv_nsec=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_member_struct_stat_st_mtimespec_tv_nsec=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_mtimespec_tv_nsec" >&5
+$as_echo "$ac_cv_member_struct_stat_st_mtimespec_tv_nsec" >&6; }
+if test $ac_cv_member_struct_stat_st_mtimespec_tv_nsec = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1
+_ACEOF
+
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for struct stat.st_mtim.tv_nsec" >&5
+$as_echo_n "checking for struct stat.st_mtim.tv_nsec... " >&6; }
+if test "${ac_cv_member_struct_stat_st_mtim_tv_nsec+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (ac_aggr.st_mtim.tv_nsec)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_mtim_tv_nsec=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (sizeof ac_aggr.st_mtim.tv_nsec)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_mtim_tv_nsec=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_member_struct_stat_st_mtim_tv_nsec=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_mtim_tv_nsec" >&5
+$as_echo "$ac_cv_member_struct_stat_st_mtim_tv_nsec" >&6; }
+if test $ac_cv_member_struct_stat_st_mtim_tv_nsec = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1
+_ACEOF
+
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for struct stat.st_mtime_n" >&5
+$as_echo_n "checking for struct stat.st_mtime_n... " >&6; }
+if test "${ac_cv_member_struct_stat_st_mtime_n+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (ac_aggr.st_mtime_n)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_mtime_n=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (sizeof ac_aggr.st_mtime_n)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_mtime_n=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_member_struct_stat_st_mtime_n=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_mtime_n" >&5
+$as_echo "$ac_cv_member_struct_stat_st_mtime_n" >&6; }
+if test $ac_cv_member_struct_stat_st_mtime_n = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_MTIME_N 1
+_ACEOF
+
+
+fi
+ # AIX
+{ $as_echo "$as_me:$LINENO: checking for struct stat.st_umtime" >&5
+$as_echo_n "checking for struct stat.st_umtime... " >&6; }
+if test "${ac_cv_member_struct_stat_st_umtime+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (ac_aggr.st_umtime)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_umtime=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (sizeof ac_aggr.st_umtime)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_umtime=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_member_struct_stat_st_umtime=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_umtime" >&5
+$as_echo "$ac_cv_member_struct_stat_st_umtime" >&6; }
+if test $ac_cv_member_struct_stat_st_umtime = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_UMTIME 1
+_ACEOF
+
+
+fi
+ # Tru64
+{ $as_echo "$as_me:$LINENO: checking for struct stat.st_mtime_usec" >&5
+$as_echo_n "checking for struct stat.st_mtime_usec... " >&6; }
+if test "${ac_cv_member_struct_stat_st_mtime_usec+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (ac_aggr.st_mtime_usec)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_mtime_usec=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (sizeof ac_aggr.st_mtime_usec)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_mtime_usec=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_member_struct_stat_st_mtime_usec=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_mtime_usec" >&5
+$as_echo "$ac_cv_member_struct_stat_st_mtime_usec" >&6; }
+if test $ac_cv_member_struct_stat_st_mtime_usec = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_MTIME_USEC 1
+_ACEOF
+
+
+fi
+ # Hurd
+# Check for block size support in struct stat
+{ $as_echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5
+$as_echo_n "checking for struct stat.st_blksize... " >&6; }
+if test "${ac_cv_member_struct_stat_st_blksize+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (ac_aggr.st_blksize)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_blksize=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (sizeof ac_aggr.st_blksize)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_blksize=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_member_struct_stat_st_blksize=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blksize" >&5
+$as_echo "$ac_cv_member_struct_stat_st_blksize" >&6; }
+if test $ac_cv_member_struct_stat_st_blksize = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+_ACEOF
+
+
+fi
+
+# Check for st_flags in struct stat (BSD fflags)
+{ $as_echo "$as_me:$LINENO: checking for struct stat.st_flags" >&5
+$as_echo_n "checking for struct stat.st_flags... " >&6; }
+if test "${ac_cv_member_struct_stat_st_flags+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (ac_aggr.st_flags)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_flags=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (sizeof ac_aggr.st_flags)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_stat_st_flags=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_member_struct_stat_st_flags=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_flags" >&5
+$as_echo "$ac_cv_member_struct_stat_st_flags" >&6; }
+if test $ac_cv_member_struct_stat_st_flags = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_FLAGS 1
+_ACEOF
+
+
+fi
+
+
+# If you have uintmax_t, we assume printf supports %ju
+# If you have unsigned long long, we assume printf supports %llu
+# TODO: Check for %ju and %llu support directly.
+{ $as_echo "$as_me:$LINENO: checking for uintmax_t" >&5
+$as_echo_n "checking for uintmax_t... " >&6; }
+if test "${ac_cv_type_uintmax_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_uintmax_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (uintmax_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((uintmax_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_uintmax_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uintmax_t" >&5
+$as_echo "$ac_cv_type_uintmax_t" >&6; }
+if test $ac_cv_type_uintmax_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UINTMAX_T 1
+_ACEOF
+
+
+fi
+{ $as_echo "$as_me:$LINENO: checking for unsigned long long" >&5
+$as_echo_n "checking for unsigned long long... " >&6; }
+if test "${ac_cv_type_unsigned_long_long+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_unsigned_long_long=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (unsigned long long))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((unsigned long long)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_unsigned_long_long=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long" >&5
+$as_echo "$ac_cv_type_unsigned_long_long" >&6; }
+if test $ac_cv_type_unsigned_long_long = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_UNSIGNED_LONG_LONG 1
+_ACEOF
+
+
+fi
+
+
+# We need int64_t, uint64_t, intmax_t, and uintmax_t
+
+ { $as_echo "$as_me:$LINENO: checking for long long int" >&5
+$as_echo_n "checking for long long int... " >&6; }
+if test "${ac_cv_type_long_long_int+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+
+ /* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* For now, do not test the preprocessor; as of 2007 there are too many
+ implementations with broken preprocessors. Perhaps this can
+ be revisited in 2012. In the meantime, code should not expect
+ #if to work with literals wider than 32 bits. */
+ /* Test literals. */
+ long long int ll = 9223372036854775807ll;
+ long long int nll = -9223372036854775807LL;
+ unsigned long long int ull = 18446744073709551615ULL;
+ /* Test constant expressions. */
+ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
+ ? 1 : -1)];
+ typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
+ ? 1 : -1)];
+ int i = 63;
+int
+main ()
+{
+/* Test availability of runtime routines for shift and division. */
+ long long int llmax = 9223372036854775807ll;
+ unsigned long long int ullmax = 18446744073709551615ull;
+ return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
+ | (llmax / ll) | (llmax % ll)
+ | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+ | (ullmax / ull) | (ullmax % ull));
+ ;
+ return 0;
+}
+
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ if test "$cross_compiling" = yes; then
+ ac_cv_type_long_long_int=yes
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <limits.h>
+ #ifndef LLONG_MAX
+ # define HALF \
+ (1LL << (sizeof (long long int) * CHAR_BIT - 2))
+ # define LLONG_MAX (HALF - 1 + HALF)
+ #endif
+int
+main ()
+{
+long long int n = 1;
+ int i;
+ for (i = 0; ; i++)
+ {
+ long long int m = n << i;
+ if (m >> i != n)
+ return 1;
+ if (LLONG_MAX / 2 < m)
+ break;
+ }
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_long_long_int=yes
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_type_long_long_int=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_long_long_int=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_long_long_int" >&5
+$as_echo "$ac_cv_type_long_long_int" >&6; }
+ if test $ac_cv_type_long_long_int = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LONG_LONG_INT 1
+_ACEOF
+
+ fi
+
+
+
+ { $as_echo "$as_me:$LINENO: checking for intmax_t" >&5
+$as_echo_n "checking for intmax_t... " >&6; }
+if test "${ac_cv_type_intmax_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_intmax_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (intmax_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((intmax_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_intmax_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_intmax_t" >&5
+$as_echo "$ac_cv_type_intmax_t" >&6; }
+if test $ac_cv_type_intmax_t = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_INTMAX_T 1
+_ACEOF
+
+else
+ test $ac_cv_type_long_long_int = yes \
+ && ac_type='long long int' \
+ || ac_type='long int'
+
+cat >>confdefs.h <<_ACEOF
+#define intmax_t $ac_type
+_ACEOF
+
+fi
+
+
+
+ { $as_echo "$as_me:$LINENO: checking for int64_t" >&5
+$as_echo_n "checking for int64_t... " >&6; }
+if test "${ac_cv_c_int64_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_int64_t=no
+ for ac_type in 'int64_t' 'int' 'long int' \
+ 'long long int' 'short int' 'signed char'; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(0 < ($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 1))];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 1)
+ < ($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 2))];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ case $ac_type in
+ int64_t) ac_cv_c_int64_t=yes ;;
+ *) ac_cv_c_int64_t=$ac_type ;;
+esac
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_int64_t" != no && break
+ done
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_int64_t" >&5
+$as_echo "$ac_cv_c_int64_t" >&6; }
+ case $ac_cv_c_int64_t in #(
+ no|yes) ;; #(
+ *)
+
+cat >>confdefs.h <<_ACEOF
+#define int64_t $ac_cv_c_int64_t
+_ACEOF
+;;
+ esac
+
+
+ { $as_echo "$as_me:$LINENO: checking for unsigned long long int" >&5
+$as_echo_n "checking for unsigned long long int... " >&6; }
+if test "${ac_cv_type_unsigned_long_long_int+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+
+ /* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* For now, do not test the preprocessor; as of 2007 there are too many
+ implementations with broken preprocessors. Perhaps this can
+ be revisited in 2012. In the meantime, code should not expect
+ #if to work with literals wider than 32 bits. */
+ /* Test literals. */
+ long long int ll = 9223372036854775807ll;
+ long long int nll = -9223372036854775807LL;
+ unsigned long long int ull = 18446744073709551615ULL;
+ /* Test constant expressions. */
+ typedef int a[((-9223372036854775807LL < 0 && 0 < 9223372036854775807ll)
+ ? 1 : -1)];
+ typedef int b[(18446744073709551615ULL <= (unsigned long long int) -1
+ ? 1 : -1)];
+ int i = 63;
+int
+main ()
+{
+/* Test availability of runtime routines for shift and division. */
+ long long int llmax = 9223372036854775807ll;
+ unsigned long long int ullmax = 18446744073709551615ull;
+ return ((ll << 63) | (ll >> 63) | (ll < i) | (ll > i)
+ | (llmax / ll) | (llmax % ll)
+ | (ull << 63) | (ull >> 63) | (ull << i) | (ull >> i)
+ | (ullmax / ull) | (ullmax % ull));
+ ;
+ return 0;
+}
+
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_type_unsigned_long_long_int=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_unsigned_long_long_int=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long_long_int" >&5
+$as_echo "$ac_cv_type_unsigned_long_long_int" >&6; }
+ if test $ac_cv_type_unsigned_long_long_int = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UNSIGNED_LONG_LONG_INT 1
+_ACEOF
+
+ fi
+
+
+
+ { $as_echo "$as_me:$LINENO: checking for uintmax_t" >&5
+$as_echo_n "checking for uintmax_t... " >&6; }
+if test "${ac_cv_type_uintmax_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_uintmax_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (uintmax_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((uintmax_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_uintmax_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uintmax_t" >&5
+$as_echo "$ac_cv_type_uintmax_t" >&6; }
+if test $ac_cv_type_uintmax_t = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_UINTMAX_T 1
+_ACEOF
+
+else
+ test $ac_cv_type_unsigned_long_long_int = yes \
+ && ac_type='unsigned long long int' \
+ || ac_type='unsigned long int'
+
+cat >>confdefs.h <<_ACEOF
+#define uintmax_t $ac_type
+_ACEOF
+
+fi
+
+
+
+ { $as_echo "$as_me:$LINENO: checking for uint64_t" >&5
+$as_echo_n "checking for uint64_t... " >&6; }
+if test "${ac_cv_c_uint64_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_uint64_t=no
+ for ac_type in 'uint64_t' 'unsigned int' 'unsigned long int' \
+ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(($ac_type) -1 >> (64 - 1) == 1)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ case $ac_type in
+ uint64_t) ac_cv_c_uint64_t=yes ;;
+ *) ac_cv_c_uint64_t=$ac_type ;;
+esac
+
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_uint64_t" != no && break
+ done
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_uint64_t" >&5
+$as_echo "$ac_cv_c_uint64_t" >&6; }
+ case $ac_cv_c_uint64_t in #(
+ no|yes) ;; #(
+ *)
+
+cat >>confdefs.h <<\_ACEOF
+#define _UINT64_T 1
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint64_t $ac_cv_c_uint64_t
+_ACEOF
+;;
+ esac
+
+
+# TODO: If any of these are missing, define them right here.
+{ $as_echo "$as_me:$LINENO: checking whether SIZE_MAX is declared" >&5
+$as_echo_n "checking whether SIZE_MAX is declared... " >&6; }
+if test "${ac_cv_have_decl_SIZE_MAX+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef SIZE_MAX
+ (void) SIZE_MAX;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_SIZE_MAX=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_SIZE_MAX=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_SIZE_MAX" >&5
+$as_echo "$ac_cv_have_decl_SIZE_MAX" >&6; }
+if test $ac_cv_have_decl_SIZE_MAX = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SIZE_MAX 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SIZE_MAX 0
+_ACEOF
+
+
+fi
+{ $as_echo "$as_me:$LINENO: checking whether SSIZE_MAX is declared" >&5
+$as_echo_n "checking whether SSIZE_MAX is declared... " >&6; }
+if test "${ac_cv_have_decl_SSIZE_MAX+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef SSIZE_MAX
+ (void) SSIZE_MAX;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_SSIZE_MAX=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_SSIZE_MAX=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_SSIZE_MAX" >&5
+$as_echo "$ac_cv_have_decl_SSIZE_MAX" >&6; }
+if test $ac_cv_have_decl_SSIZE_MAX = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SSIZE_MAX 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SSIZE_MAX 0
+_ACEOF
+
+
+fi
+{ $as_echo "$as_me:$LINENO: checking whether INT64_MAX is declared" >&5
+$as_echo_n "checking whether INT64_MAX is declared... " >&6; }
+if test "${ac_cv_have_decl_INT64_MAX+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef INT64_MAX
+ (void) INT64_MAX;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_INT64_MAX=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_INT64_MAX=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_INT64_MAX" >&5
+$as_echo "$ac_cv_have_decl_INT64_MAX" >&6; }
+if test $ac_cv_have_decl_INT64_MAX = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_INT64_MAX 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_INT64_MAX 0
+_ACEOF
+
+
+fi
+{ $as_echo "$as_me:$LINENO: checking whether INT64_MIN is declared" >&5
+$as_echo_n "checking whether INT64_MIN is declared... " >&6; }
+if test "${ac_cv_have_decl_INT64_MIN+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef INT64_MIN
+ (void) INT64_MIN;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_INT64_MIN=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_INT64_MIN=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_INT64_MIN" >&5
+$as_echo "$ac_cv_have_decl_INT64_MIN" >&6; }
+if test $ac_cv_have_decl_INT64_MIN = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_INT64_MIN 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_INT64_MIN 0
+_ACEOF
+
+
+fi
+{ $as_echo "$as_me:$LINENO: checking whether UINT64_MAX is declared" >&5
+$as_echo_n "checking whether UINT64_MAX is declared... " >&6; }
+if test "${ac_cv_have_decl_UINT64_MAX+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef UINT64_MAX
+ (void) UINT64_MAX;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_UINT64_MAX=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_UINT64_MAX=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_UINT64_MAX" >&5
+$as_echo "$ac_cv_have_decl_UINT64_MAX" >&6; }
+if test $ac_cv_have_decl_UINT64_MAX = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_UINT64_MAX 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_UINT64_MAX 0
+_ACEOF
+
+
+fi
+{ $as_echo "$as_me:$LINENO: checking whether UINT32_MAX is declared" >&5
+$as_echo_n "checking whether UINT32_MAX is declared... " >&6; }
+if test "${ac_cv_have_decl_UINT32_MAX+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef UINT32_MAX
+ (void) UINT32_MAX;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_UINT32_MAX=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_UINT32_MAX=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_UINT32_MAX" >&5
+$as_echo "$ac_cv_have_decl_UINT32_MAX" >&6; }
+if test $ac_cv_have_decl_UINT32_MAX = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_UINT32_MAX 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_UINT32_MAX 0
+_ACEOF
+
+
+fi
+
+
+
+{ $as_echo "$as_me:$LINENO: checking whether EFTYPE is declared" >&5
+$as_echo_n "checking whether EFTYPE is declared... " >&6; }
+if test "${ac_cv_have_decl_EFTYPE+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <errno.h>
+
+int
+main ()
+{
+#ifndef EFTYPE
+ (void) EFTYPE;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_EFTYPE=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_EFTYPE=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_EFTYPE" >&5
+$as_echo "$ac_cv_have_decl_EFTYPE" >&6; }
+if test $ac_cv_have_decl_EFTYPE = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_EFTYPE 1
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking whether EILSEQ is declared" >&5
+$as_echo_n "checking whether EILSEQ is declared... " >&6; }
+if test "${ac_cv_have_decl_EILSEQ+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <errno.h>
+
+int
+main ()
+{
+#ifndef EILSEQ
+ (void) EILSEQ;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_EILSEQ=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_EILSEQ=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_EILSEQ" >&5
+$as_echo "$ac_cv_have_decl_EILSEQ" >&6; }
+if test $ac_cv_have_decl_EILSEQ = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_EILSEQ 1
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for wchar_t" >&5
+$as_echo_n "checking for wchar_t... " >&6; }
+if test "${ac_cv_type_wchar_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_wchar_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof (wchar_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+if (sizeof ((wchar_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_wchar_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_wchar_t" >&5
+$as_echo "$ac_cv_type_wchar_t" >&6; }
+if test $ac_cv_type_wchar_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_WCHAR_T 1
+_ACEOF
+ # The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:$LINENO: checking size of wchar_t" >&5
+$as_echo_n "checking size of wchar_t... " >&6; }
+if test "${ac_cv_sizeof_wchar_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=$ac_mid; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_wchar_t=$ac_lo;;
+'') if test "$ac_cv_type_wchar_t" = yes; then
+ { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (wchar_t)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+ else
+ ac_cv_sizeof_wchar_t=0
+ fi ;;
+esac
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+static long int longval () { return (long int) (sizeof (wchar_t)); }
+static unsigned long int ulongval () { return (long int) (sizeof (wchar_t)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (((long int) (sizeof (wchar_t))) < 0)
+ {
+ long int i = longval ();
+ if (i != ((long int) (sizeof (wchar_t))))
+ return 1;
+ fprintf (f, "%ld", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ((long int) (sizeof (wchar_t))))
+ return 1;
+ fprintf (f, "%lu", i);
+ }
+ /* Do not output a trailing newline, as this causes \r\n confusion
+ on some platforms. */
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_wchar_t=`cat conftest.val`
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_wchar_t" = yes; then
+ { { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (wchar_t)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+ else
+ ac_cv_sizeof_wchar_t=0
+ fi
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_wchar_t" >&5
+$as_echo "$ac_cv_sizeof_wchar_t" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_WCHAR_T $ac_cv_sizeof_wchar_t
+_ACEOF
+
+
+fi
+
+
+{ $as_echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
+if test "${ac_cv_header_time+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_header_time=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_time=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+$as_echo "$ac_cv_header_time" >&6; }
+if test $ac_cv_header_time = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
+
+fi
+
+
+# Checks for library functions.
+if test $ac_cv_c_compiler_gnu = yes; then
+ { $as_echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
+$as_echo_n "checking whether $CC needs -traditional... " >&6; }
+if test "${ac_cv_prog_gcc_traditional+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_pattern="Autoconf.*'x'"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sgtty.h>
+Autoconf TIOCGETP
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "$ac_pattern" >/dev/null 2>&1; then
+ ac_cv_prog_gcc_traditional=yes
+else
+ ac_cv_prog_gcc_traditional=no
+fi
+rm -f conftest*
+
+
+ if test $ac_cv_prog_gcc_traditional = no; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <termio.h>
+Autoconf TCGETA
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "$ac_pattern" >/dev/null 2>&1; then
+ ac_cv_prog_gcc_traditional=yes
+fi
+rm -f conftest*
+
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5
+$as_echo "$ac_cv_prog_gcc_traditional" >&6; }
+ if test $ac_cv_prog_gcc_traditional = yes; then
+ CC="$CC -traditional"
+ fi
+fi
+
+{ $as_echo "$as_me:$LINENO: checking whether sys/types.h defines makedev" >&5
+$as_echo_n "checking whether sys/types.h defines makedev... " >&6; }
+if test "${ac_cv_header_sys_types_h_makedev+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+int
+main ()
+{
+return makedev(0, 0);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_header_sys_types_h_makedev=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_sys_types_h_makedev=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h_makedev" >&5
+$as_echo "$ac_cv_header_sys_types_h_makedev" >&6; }
+
+if test $ac_cv_header_sys_types_h_makedev = no; then
+if test "${ac_cv_header_sys_mkdev_h+set}" = set; then
+ { $as_echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5
+$as_echo_n "checking for sys/mkdev.h... " >&6; }
+if test "${ac_cv_header_sys_mkdev_h+set}" = set; then
+ $as_echo_n "(cached) " >&6
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5
+$as_echo "$ac_cv_header_sys_mkdev_h" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking sys/mkdev.h usability" >&5
+$as_echo_n "checking sys/mkdev.h usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <sys/mkdev.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking sys/mkdev.h presence" >&5
+$as_echo_n "checking sys/mkdev.h presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/mkdev.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: sys/mkdev.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: sys/mkdev.h: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: sys/mkdev.h: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: sys/mkdev.h: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: sys/mkdev.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: sys/mkdev.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5
+$as_echo_n "checking for sys/mkdev.h... " >&6; }
+if test "${ac_cv_header_sys_mkdev_h+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_header_sys_mkdev_h=$ac_header_preproc
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5
+$as_echo "$ac_cv_header_sys_mkdev_h" >&6; }
+
+fi
+if test $ac_cv_header_sys_mkdev_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define MAJOR_IN_MKDEV 1
+_ACEOF
+
+fi
+
+
+
+ if test $ac_cv_header_sys_mkdev_h = no; then
+ if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then
+ { $as_echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5
+$as_echo_n "checking for sys/sysmacros.h... " >&6; }
+if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then
+ $as_echo_n "(cached) " >&6
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5
+$as_echo "$ac_cv_header_sys_sysmacros_h" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking sys/sysmacros.h usability" >&5
+$as_echo_n "checking sys/sysmacros.h usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <sys/sysmacros.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking sys/sysmacros.h presence" >&5
+$as_echo_n "checking sys/sysmacros.h presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/sysmacros.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: sys/sysmacros.h: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: sys/sysmacros.h: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: sys/sysmacros.h: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: sys/sysmacros.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: sys/sysmacros.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5
+$as_echo_n "checking for sys/sysmacros.h... " >&6; }
+if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_header_sys_sysmacros_h=$ac_header_preproc
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5
+$as_echo "$ac_cv_header_sys_sysmacros_h" >&6; }
+
+fi
+if test $ac_cv_header_sys_sysmacros_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define MAJOR_IN_SYSMACROS 1
+_ACEOF
+
+fi
+
+
+ fi
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for _LARGEFILE_SOURCE value needed for large files" >&5
+$as_echo_n "checking for _LARGEFILE_SOURCE value needed for large files... " >&6; }
+if test "${ac_cv_sys_largefile_source+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h> /* for off_t */
+ #include <stdio.h>
+int
+main ()
+{
+int (*fp) (FILE *, off_t, int) = fseeko;
+ return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_sys_largefile_source=no; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define _LARGEFILE_SOURCE 1
+#include <sys/types.h> /* for off_t */
+ #include <stdio.h>
+int
+main ()
+{
+int (*fp) (FILE *, off_t, int) = fseeko;
+ return fseeko (stdin, 0, 0) && fp (stdin, 0, 0);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_sys_largefile_source=1; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+ ac_cv_sys_largefile_source=unknown
+ break
+done
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_source" >&5
+$as_echo "$ac_cv_sys_largefile_source" >&6; }
+case $ac_cv_sys_largefile_source in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source
+_ACEOF
+;;
+esac
+rm -rf conftest*
+
+# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug
+# in glibc 2.1.3, but that breaks too many other things.
+# If you want fseeko and ftello with glibc, upgrade to a fixed glibc.
+if test $ac_cv_sys_largefile_source != unknown; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_FSEEKO 1
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking for working memcmp" >&5
+$as_echo_n "checking for working memcmp... " >&6; }
+if test "${ac_cv_func_memcmp_working+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_memcmp_working=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* Some versions of memcmp are not 8-bit clean. */
+ char c0 = '\100', c1 = '\200', c2 = '\201';
+ if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
+ return 1;
+
+ /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+ or more and with at least one buffer not starting on a 4-byte boundary.
+ William Lewis provided this test program. */
+ {
+ char foo[21];
+ char bar[21];
+ int i;
+ for (i = 0; i < 4; i++)
+ {
+ char *a = foo + i;
+ char *b = bar + i;
+ strcpy (a, "--------01111111");
+ strcpy (b, "--------10000000");
+ if (memcmp (a, b, 16) >= 0)
+ return 1;
+ }
+ return 0;
+ }
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_memcmp_working=yes
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_memcmp_working=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_memcmp_working" >&5
+$as_echo "$ac_cv_func_memcmp_working" >&6; }
+test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
+ *" memcmp.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS memcmp.$ac_objext"
+ ;;
+esac
+
+
+{ $as_echo "$as_me:$LINENO: checking whether lstat dereferences a symlink specified with a trailing slash" >&5
+$as_echo_n "checking whether lstat dereferences a symlink specified with a trailing slash... " >&6; }
+if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ rm -f conftest.sym conftest.file
+echo >conftest.file
+if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+ /* Linux will dereference the symlink and fail.
+ That is better in the sense that it means we will not
+ have to compile and use the lstat wrapper. */
+ return lstat ("conftest.sym/", &sbuf) == 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_lstat_dereferences_slashed_symlink=yes
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+else
+ # If the `ln -s' command failed, then we probably don't even
+ # have an lstat function.
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
+fi
+rm -f conftest.sym conftest.file
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
+$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; }
+
+test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
+
+cat >>confdefs.h <<_ACEOF
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+_ACEOF
+
+
+if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
+ case " $LIBOBJS " in
+ *" lstat.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS lstat.$ac_objext"
+ ;;
+esac
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking whether lstat accepts an empty string" >&5
+$as_echo_n "checking whether lstat accepts an empty string... " >&6; }
+if test "${ac_cv_func_lstat_empty_string_bug+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_lstat_empty_string_bug=yes
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+ return lstat ("", &sbuf) == 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_lstat_empty_string_bug=no
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_lstat_empty_string_bug=yes
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_lstat_empty_string_bug" >&5
+$as_echo "$ac_cv_func_lstat_empty_string_bug" >&6; }
+if test $ac_cv_func_lstat_empty_string_bug = yes; then
+ case " $LIBOBJS " in
+ *" lstat.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS lstat.$ac_objext"
+ ;;
+esac
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_LSTAT_EMPTY_STRING_BUG 1
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking whether stat accepts an empty string" >&5
+$as_echo_n "checking whether stat accepts an empty string... " >&6; }
+if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_func_stat_empty_string_bug=yes
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+struct stat sbuf;
+ return stat ("", &sbuf) == 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_stat_empty_string_bug=no
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_func_stat_empty_string_bug=yes
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_stat_empty_string_bug" >&5
+$as_echo "$ac_cv_func_stat_empty_string_bug" >&6; }
+if test $ac_cv_func_stat_empty_string_bug = yes; then
+ case " $LIBOBJS " in
+ *" stat.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS stat.$ac_objext"
+ ;;
+esac
+
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STAT_EMPTY_STRING_BUG 1
+_ACEOF
+
+fi
+
+{ $as_echo "$as_me:$LINENO: checking whether strerror_r is declared" >&5
+$as_echo_n "checking whether strerror_r is declared... " >&6; }
+if test "${ac_cv_have_decl_strerror_r+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef strerror_r
+ (void) strerror_r;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_strerror_r=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_strerror_r=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_strerror_r" >&5
+$as_echo "$ac_cv_have_decl_strerror_r" >&6; }
+if test $ac_cv_have_decl_strerror_r = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRERROR_R 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRERROR_R 0
+_ACEOF
+
+
+fi
+
+
+
+for ac_func in strerror_r
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+{ $as_echo "$as_me:$LINENO: checking whether strerror_r returns char *" >&5
+$as_echo_n "checking whether strerror_r returns char *... " >&6; }
+if test "${ac_cv_func_strerror_r_char_p+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+
+ ac_cv_func_strerror_r_char_p=no
+ if test $ac_cv_have_decl_strerror_r = yes; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ char buf[100];
+ char x = *strerror_r (0, buf, sizeof buf);
+ char *p = strerror_r (0, buf, sizeof buf);
+ return !p || x;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_func_strerror_r_char_p=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ else
+ # strerror_r is not declared. Choose between
+ # systems that have relatively inaccessible declarations for the
+ # function. BeOS and DEC UNIX 4.0 fall in this category, but the
+ # former has a strerror_r that returns char*, while the latter
+ # has a strerror_r that returns `int'.
+ # This test should segfault on the DEC system.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ extern char *strerror_r ();
+int
+main ()
+{
+char buf[100];
+ char x = *strerror_r (0, buf, sizeof buf);
+ return ! isalpha (x);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func_strerror_r_char_p=yes
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+ fi
+
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_strerror_r_char_p" >&5
+$as_echo "$ac_cv_func_strerror_r_char_p" >&6; }
+if test $ac_cv_func_strerror_r_char_p = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STRERROR_R_CHAR_P 1
+_ACEOF
+
+fi
+
+
+for ac_func in strftime
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+ # strftime is in -lintl on SCO UNIX.
+{ $as_echo "$as_me:$LINENO: checking for strftime in -lintl" >&5
+$as_echo_n "checking for strftime in -lintl... " >&6; }
+if test "${ac_cv_lib_intl_strftime+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char strftime ();
+int
+main ()
+{
+return strftime ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_intl_strftime=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_intl_strftime=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_intl_strftime" >&5
+$as_echo "$ac_cv_lib_intl_strftime" >&6; }
+if test $ac_cv_lib_intl_strftime = yes; then
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRFTIME 1
+_ACEOF
+
+LIBS="-lintl $LIBS"
+fi
+
+fi
+done
+
+
+for ac_func in vprintf
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+{ $as_echo "$as_me:$LINENO: checking for _doprnt" >&5
+$as_echo_n "checking for _doprnt... " >&6; }
+if test "${ac_cv_func__doprnt+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define _doprnt to an innocuous variant, in case <limits.h> declares _doprnt.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define _doprnt innocuous__doprnt
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char _doprnt (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef _doprnt
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char _doprnt ();
+/* 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__doprnt || defined __stub____doprnt
+choke me
+#endif
+
+int
+main ()
+{
+return _doprnt ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_func__doprnt=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func__doprnt=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5
+$as_echo "$ac_cv_func__doprnt" >&6; }
+if test $ac_cv_func__doprnt = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DOPRNT 1
+_ACEOF
+
+fi
+
+fi
+done
+
+
+# check for:
+# CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES)
+# To avoid necessity for including windows.h or special forward declaration
+# workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *'
+{ $as_echo "$as_me:$LINENO: checking for CreateHardLinkA" >&5
+$as_echo_n "checking for CreateHardLinkA... " >&6; }
+if test "${ac_cv_func_CreateHardLinkA+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char __stdcall CreateHardLinkA ( const char *, const char *, void * ) 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 CreateHardLinkA ( const char *, const char *, void * );
+char (*f) ( const char *, const char *, void * );
+
+int
+main ()
+{
+/* 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_CreateHardLinkA) || defined (__stub___CreateHardLinkA)
+choke me
+#else
+f = CreateHardLinkA;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_func_CreateHardLinkA=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func_CreateHardLinkA=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_CreateHardLinkA" >&5
+$as_echo "$ac_cv_func_CreateHardLinkA" >&6; }
+
+
+
+
+for ac_func in chflags chown chroot
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+
+for ac_func in fchdir fchflags fchmod fchown fcntl fork
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+
+for ac_func in fstat ftruncate futimens futimes geteuid getpid
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+for ac_func in lchflags lchmod lchown link lstat
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+
+for ac_func in lutimes memmove memset mkdir mkfifo mknod
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+for ac_func in nl_langinfo pipe poll readlink
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+for ac_func in select setenv setlocale sigaction
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+
+
+for ac_func in strchr strdup strerror strncpy_s strrchr symlink timegm
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+
+for ac_func in tzset unsetenv utime utimensat utimes vfork
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+
+
+for ac_func in wcrtomb wcscpy wcslen wctomb wmemcmp wmemcpy
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+# detects cygwin-1.7, as opposed to older versions
+
+for ac_func in cygwin_conv_path
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+# FreeBSD's nl_langinfo supports an option to specify whether the
+# current locale uses month/day or day/month ordering. It makes the
+# output a little prettier...
+{ $as_echo "$as_me:$LINENO: checking whether D_MD_ORDER is declared" >&5
+$as_echo_n "checking whether D_MD_ORDER is declared... " >&6; }
+if test "${ac_cv_have_decl_D_MD_ORDER+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if HAVE_LANGINFO_H
+#include <langinfo.h>
+#endif
+
+
+int
+main ()
+{
+#ifndef D_MD_ORDER
+ (void) D_MD_ORDER;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_D_MD_ORDER=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_D_MD_ORDER=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_D_MD_ORDER" >&5
+$as_echo "$ac_cv_have_decl_D_MD_ORDER" >&6; }
+if test $ac_cv_have_decl_D_MD_ORDER = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_D_MD_ORDER 1
+_ACEOF
+
+fi
+
+
+# Check for dirent.d_namlen field explicitly
+# (This is a bit more straightforward than, if not quite as portable as,
+# the recipe given by the autoconf maintainers.)
+{ $as_echo "$as_me:$LINENO: checking for struct dirent.d_namlen" >&5
+$as_echo_n "checking for struct dirent.d_namlen... " >&6; }
+if test "${ac_cv_member_struct_dirent_d_namlen+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+
+
+int
+main ()
+{
+static struct dirent ac_aggr;
+if (ac_aggr.d_namlen)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_dirent_d_namlen=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+
+
+int
+main ()
+{
+static struct dirent ac_aggr;
+if (sizeof ac_aggr.d_namlen)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_dirent_d_namlen=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_member_struct_dirent_d_namlen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_dirent_d_namlen" >&5
+$as_echo "$ac_cv_member_struct_dirent_d_namlen" >&6; }
+
+
+# Check for Extended Attributes support
+# Check whether --enable-xattr was given.
+if test "${enable_xattr+set}" = set; then
+ enableval=$enable_xattr;
+fi
+
+
+if test "x$enable_xattr" != "xno"; then
+
+for ac_header in attr/xattr.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in sys/xattr.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+{ $as_echo "$as_me:$LINENO: checking for setxattr in -lattr" >&5
+$as_echo_n "checking for setxattr in -lattr... " >&6; }
+if test "${ac_cv_lib_attr_setxattr+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lattr $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char setxattr ();
+int
+main ()
+{
+return setxattr ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_attr_setxattr=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_attr_setxattr=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_attr_setxattr" >&5
+$as_echo "$ac_cv_lib_attr_setxattr" >&6; }
+if test $ac_cv_lib_attr_setxattr = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBATTR 1
+_ACEOF
+
+ LIBS="-lattr $LIBS"
+
+fi
+
+
+
+for ac_func in extattr_get_file extattr_list_file
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+for ac_func in extattr_set_fd extattr_set_file
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+for ac_func in fsetxattr getxattr
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+
+
+
+for ac_func in lgetxattr listxattr llistxattr lsetxattr
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+fi
+
+# Check for ACL support
+#
+# The ACL support in libarchive is written against the POSIX1e draft,
+# which was never officially approved and varies quite a bit across
+# platforms. Worse, some systems have completely non-POSIX acl functions,
+# which makes the following checks rather more complex than I would like.
+#
+# Check whether --enable-acl was given.
+if test "${enable_acl+set}" = set; then
+ enableval=$enable_acl;
+fi
+
+
+if test "x$enable_acl" != "xno"; then
+
+for ac_header in sys/acl.h
+do
+as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5
+$as_echo_n "checking $ac_header usability... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5
+$as_echo_n "checking $ac_header presence... " >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ----------------------------------- ##
+## Report this to kientzle@freebsd.org ##
+## ----------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5
+$as_echo_n "checking for $ac_header... " >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+
+fi
+if test `eval 'as_val=${'$as_ac_Header'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+{ $as_echo "$as_me:$LINENO: checking for acl_get_file in -lacl" >&5
+$as_echo_n "checking for acl_get_file in -lacl... " >&6; }
+if test "${ac_cv_lib_acl_acl_get_file+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lacl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char acl_get_file ();
+int
+main ()
+{
+return acl_get_file ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ ac_cv_lib_acl_acl_get_file=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_acl_acl_get_file=no
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_acl_acl_get_file" >&5
+$as_echo "$ac_cv_lib_acl_acl_get_file" >&6; }
+if test $ac_cv_lib_acl_acl_get_file = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBACL 1
+_ACEOF
+
+ LIBS="-lacl $LIBS"
+
+fi
+
+
+
+
+
+
+for ac_func in acl_create_entry acl_init acl_set_fd acl_set_fd_np acl_set_file
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+ { $as_echo "$as_me:$LINENO: checking for acl_permset_t" >&5
+$as_echo_n "checking for acl_permset_t... " >&6; }
+if test "${ac_cv_type_acl_permset_t+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_type_acl_permset_t=no
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ #if HAVE_SYS_ACL_H
+ #include <sys/acl.h>
+ #endif
+
+
+int
+main ()
+{
+if (sizeof (acl_permset_t))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ #if HAVE_SYS_ACL_H
+ #include <sys/acl.h>
+ #endif
+
+
+int
+main ()
+{
+if (sizeof ((acl_permset_t)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_acl_permset_t=yes
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_acl_permset_t" >&5
+$as_echo "$ac_cv_type_acl_permset_t" >&6; }
+if test $ac_cv_type_acl_permset_t = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_ACL_PERMSET_T 1
+_ACEOF
+
+
+fi
+
+
+ # The "acl_get_perm()" function was omitted from the POSIX draft.
+ # (It's a pretty obvious oversight; otherwise, there's no way to
+ # test for specific permissions in a permset.) Linux uses the obvious
+ # name, FreeBSD adds _np to mark it as "non-Posix extension."
+ # Test for both as a double-check that we really have POSIX-style ACL support.
+
+
+
+
+for ac_func in acl_get_perm_np acl_get_perm acl_get_link acl_get_link_np
+do
+as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5
+$as_echo_n "checking for $ac_func... " >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $ac_func ();
+/* 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_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
+int
+main ()
+{
+return $ac_func ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then
+ eval "$as_ac_var=yes"
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
+fi
+
+rm -rf conftest.dSYM
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'`
+ { $as_echo "$as_me:$LINENO: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if test `eval 'as_val=${'$as_ac_var'}
+ $as_echo "$as_val"'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+ # MacOS has an acl.h that isn't POSIX. It can be detected by
+ # checking for ACL_USER
+ { $as_echo "$as_me:$LINENO: checking whether ACL_USER is declared" >&5
+$as_echo_n "checking whether ACL_USER is declared... " >&6; }
+if test "${ac_cv_have_decl_ACL_USER+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/acl.h>
+
+int
+main ()
+{
+#ifndef ACL_USER
+ (void) ACL_USER;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_ACL_USER=yes
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_ACL_USER=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_ACL_USER" >&5
+$as_echo "$ac_cv_have_decl_ACL_USER" >&6; }
+if test $ac_cv_have_decl_ACL_USER = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ACL_USER 1
+_ACEOF
+
+fi
+
+fi
+
+# Additional requirements
+# Check whether --enable-largefile was given.
+if test "${enable_largefile+set}" = set; then
+ enableval=$enable_largefile;
+fi
+
+if test "$enable_largefile" != no; then
+
+ { $as_echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if test "${ac_cv_sys_largefile_CC+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_sys_largefile_CC=no
+ if test "$GCC" != yes; then
+ ac_save_CC=$CC
+ while :; do
+ # IRIX 6.2 and later do not support large files by default,
+ # so use the C compiler's -n32 option if that helps.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ CC="$CC -n32"
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_sys_largefile_CC=' -n32'; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext
+ break
+ done
+ CC=$ac_save_CC
+ rm -f conftest.$ac_ext
+ fi
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$ac_cv_sys_largefile_CC" >&6; }
+ if test "$ac_cv_sys_largefile_CC" != no; then
+ CC=$CC$ac_cv_sys_largefile_CC
+ fi
+
+ { $as_echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_sys_file_offset_bits=no; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_sys_file_offset_bits=64; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_sys_file_offset_bits=unknown
+ break
+done
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
+case $ac_cv_sys_file_offset_bits in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+;;
+esac
+rm -rf conftest*
+ if test $ac_cv_sys_file_offset_bits = unknown; then
+ { $as_echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if test "${ac_cv_sys_large_files+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_sys_large_files=no; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+ We can't simply define LARGE_OFF_T to be 9223372036854775807,
+ since some C++ compilers masquerading as C compilers
+ incorrectly reject 9223372036854775807. */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+ int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+ && LARGE_OFF_T % 2147483647 == 1)
+ ? 1 : -1];
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_sys_large_files=1; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cv_sys_large_files=unknown
+ break
+done
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
+case $ac_cv_sys_large_files in #(
+ no | unknown) ;;
+ *)
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+;;
+esac
+rm -rf conftest*
+ fi
+fi
+
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+$as_echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) $as_unset $ac_var ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ test "x$cache_file" != "x/dev/null" &&
+ { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
+ else
+ { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${INC_WINDOWS_FILES_TRUE}" && test -z "${INC_WINDOWS_FILES_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"INC_WINDOWS_FILES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"INC_WINDOWS_FILES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${INC_CYGWIN_FILES_TRUE}" && test -z "${INC_CYGWIN_FILES_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"INC_CYGWIN_FILES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"INC_CYGWIN_FILES\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_BSDTAR_TRUE}" && test -z "${BUILD_BSDTAR_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"BUILD_BSDTAR\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"BUILD_BSDTAR\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${STATIC_BSDTAR_TRUE}" && test -z "${STATIC_BSDTAR_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"STATIC_BSDTAR\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"STATIC_BSDTAR\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${BUILD_BSDCPIO_TRUE}" && test -z "${BUILD_BSDCPIO_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"BUILD_BSDCPIO\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"BUILD_BSDCPIO\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${STATIC_BSDCPIO_TRUE}" && test -z "${STATIC_BSDCPIO_FALSE}"; then
+ { { $as_echo "$as_me:$LINENO: error: conditional \"STATIC_BSDCPIO\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+$as_echo "$as_me: error: conditional \"STATIC_BSDCPIO\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+: ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
+fi
+
+
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ 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
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
+fi
+
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# CDPATH.
+$as_unset CDPATH
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in
+-n*)
+ case `echo 'x\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ *) ECHO_C='\c';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -p'
+ fi
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p=:
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+
+# Save the log message, to keep $[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by libarchive $as_me 2.8.0, which was
+generated by GNU Autoconf 2.62. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ -q, --quiet do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf@gnu.org>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_version="\\
+libarchive config.status 2.8.0
+configured by $0, generated by GNU Autoconf 2.62,
+ with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright (C) 2008 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ CONFIG_FILES="$CONFIG_FILES '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ { $as_echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) { $as_echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+AS='`$ECHO "X$AS" | $Xsed -e "$delay_single_quote_subst"`'
+DLLTOOL='`$ECHO "X$DLLTOOL" | $Xsed -e "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
+macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
+enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
+host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
+host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
+host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
+build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
+build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
+build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
+SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
+Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
+GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
+EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
+FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
+LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
+NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
+LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
+exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
+AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
+GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
+SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
+ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
+need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
+LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
+libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
+version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
+striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# Quote evaled strings.
+for var in SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+deplibs_check_method \
+file_magic_cmd \
+AR \
+AR_FLAGS \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+SHELL \
+ECHO \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_wl \
+lt_prog_compiler_pic \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
+hardcode_libdir_separator \
+fix_srcfile_path \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+finish_eval \
+old_striplib \
+striplib; do
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec; do
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
+ ;;
+esac
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'
+
+
+
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "build/pkgconfig/libarchive.pc") CONFIG_FILES="$CONFIG_FILES build/pkgconfig/libarchive.pc" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
+
+ *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp=
+ trap 'exit_status=$?
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} ||
+{
+ $as_echo "$as_me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=' '
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\).*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\).*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+ || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5
+$as_echo "$as_me: error: could not setup config files machinery" >&2;}
+ { (exit 1); exit 1; }; }
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_t=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_t"; then
+ break
+ elif $ac_last_try; then
+ { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5
+$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;}
+ { (exit 1); exit 1; }; }
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", line, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5
+$as_echo "$as_me: error: could not setup config headers machinery" >&2;}
+ { (exit 1); exit 1; }; }
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+$as_echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+ { (exit 1); exit 1; }; };;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ ac_file_inputs="$ac_file_inputs '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:$LINENO: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$tmp/stdin" \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; } ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p
+'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
+ case $ac_file in
+ -) cat "$tmp/out" && rm -f "$tmp/out";;
+ *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ esac \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
+ } >"$tmp/config.h" \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+ if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$tmp/config.h" "$ac_file" \
+ || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5
+$as_echo "$as_me: error: could not create $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+ || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5
+$as_echo "$as_me: error: could not create -" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$_am_arg" : 'X\(//\)[^/]' \| \
+ X"$_am_arg" : 'X\(//\)$' \| \
+ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named `Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running `make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # When using ansi2knr, U may be empty or an underscore; expand it
+ U=`sed -n 's/^U = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ { as_dir=$dirpart/$fdir
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+$as_echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+done
+ ;;
+ "libtool":C)
+
+ # See if we are running on zsh, and set the options which allow our
+ # commands through without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool 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 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool 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 GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags=""
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Assembler program.
+AS=$AS
+
+# DLL creation program.
+DLLTOOL=$DLLTOOL
+
+# Object dumper program.
+OBJDUMP=$OBJDUMP
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="\$SED -e 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == "file_magic".
+file_magic_cmd=$lt_file_magic_cmd
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that does not interpret backslashes.
+ECHO=$lt_ECHO
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist
+hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec
+
+# If ld is used when linking, flag to hardcode \$libdir into a binary
+# during linking. This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single "-rpath" flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# Set to "yes" if building a shared library automatically hardcodes DIR
+# into the library and all subsequent libraries and executables linked
+# against it.
+hardcode_automatic=$hardcode_automatic
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to "yes" if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_EOF >> "$cfgfile"
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+_LT_EOF
+ ;;
+ esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ case $xsi_shell in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+ func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=${1%%=*}
+ func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=$(( $* ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=${#1}
+}
+
+_LT_EOF
+ ;;
+ *) # Bourne compatible functions.
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+ esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[^=]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+ func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=`expr "$@"`
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
+
+_LT_EOF
+esac
+
+case $lt_shell_append in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1+=\$2"
+}
+_LT_EOF
+ ;;
+ *)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1=\$$1\$2"
+}
+
+_LT_EOF
+ ;;
+ esac
+
+
+ sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+
+ ;;
+
+ esac
+done # for ac_tag
+
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:$LINENO: WARNING: Unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: Unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
diff --git a/archivers/libarchive/files/configure.ac b/archivers/libarchive/files/configure.ac
new file mode 100644
index 00000000000..f0f8e321150
--- /dev/null
+++ b/archivers/libarchive/files/configure.ac
@@ -0,0 +1,486 @@
+dnl Process this file with autoconf to produce a configure script.
+
+dnl First, define all of the version numbers up front.
+dnl In particular, this allows the version macro to be used in AC_INIT
+
+dnl These first two version numbers are updated automatically on each release.
+m4_define([LIBARCHIVE_VERSION_S],[2.8.0])
+m4_define([LIBARCHIVE_VERSION_N],[2008000])
+
+dnl bsdtar and bsdcpio versioning tracks libarchive
+m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S())
+m4_define([BSDCPIO_VERSION_S],LIBARCHIVE_VERSION_S())
+
+#
+# Now starts the "real" configure script.
+#
+
+AC_INIT([libarchive],LIBARCHIVE_VERSION_S(),[kientzle@freebsd.org])
+# Make sure the srcdir contains "libarchive" directory
+AC_CONFIG_SRCDIR([libarchive])
+# Use auxiliary subscripts from this subdirectory (cleans up root)
+AC_CONFIG_AUX_DIR([build/autoconf])
+# M4 scripts
+AC_CONFIG_MACRO_DIR([build/autoconf])
+# Must follow AC_CONFIG macros above...
+AM_INIT_AUTOMAKE()
+
+# Libtool versioning uses different conventions on different
+# platforms. At least on FreeBSD, libtool uses an overly complex
+# convention that attempts to solve problems that most people just
+# don't have and which just causes confusion for most end users.
+ARCHIVE_MAJOR=$(( LIBARCHIVE_VERSION_N() / 1000000 ))
+ARCHIVE_MINOR=$(( (LIBARCHIVE_VERSION_N() / 1000) % 1000 ))
+ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 ))
+ARCHIVE_LIBTOOL_MAJOR=`echo $((${ARCHIVE_MAJOR} + ${ARCHIVE_MINOR}))`
+ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_LIBTOOL_MAJOR:$ARCHIVE_REVISION:$ARCHIVE_MINOR
+
+# Stick the version numbers into config.h
+AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()",
+ [Version number of libarchive])
+AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_NUMBER],"LIBARCHIVE_VERSION_N()",
+ [Version number of libarchive as a single integer])
+AC_DEFINE([BSDCPIO_VERSION_STRING],"BSDCPIO_VERSION_S()",
+ [Version number of bsdcpio])
+AC_DEFINE([BSDTAR_VERSION_STRING],"BSDTAR_VERSION_S()",
+ [Version number of bsdtar])
+
+# The shell variables here must be the same as the AC_SUBST() variables
+# below, but the shell variable names apparently cannot be the same as
+# the m4 macro names above. Why? Ask autoconf.
+BSDCPIO_VERSION_STRING=BSDCPIO_VERSION_S()
+BSDTAR_VERSION_STRING=BSDTAR_VERSION_S()
+LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S()
+LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N()
+
+# Substitute the above version numbers into the various files below.
+# Yes, I believe this is the fourth time we define what are essentially
+# the same symbols. Why? Ask autoconf.
+AC_SUBST(ARCHIVE_LIBTOOL_VERSION)
+AC_SUBST(BSDCPIO_VERSION_STRING)
+AC_SUBST(BSDTAR_VERSION_STRING)
+AC_SUBST(LIBARCHIVE_VERSION_STRING)
+AC_SUBST(LIBARCHIVE_VERSION_NUMBER)
+
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([build/pkgconfig/libarchive.pc])
+
+# Check for host type
+AC_CANONICAL_HOST
+
+dnl Compilation on mingw and Cygwin needs special Makefile rules
+inc_windows_files=no
+inc_cygwin_files=no
+case "$host_os" in
+ *mingw* ) inc_windows_files=yes ;;
+ *cygwin*) inc_cygwin_files=yes ;;
+esac
+AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes])
+AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes])
+
+dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc)
+PLATFORMCPPFLAGS=
+case "$host_os" in
+ *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO ;;
+esac
+AC_SUBST(PLATFORMCPPFLAGS)
+
+# Checks for programs.
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_USE_SYSTEM_EXTENSIONS
+AC_LIBTOOL_WIN32_DLL
+AC_PROG_LIBTOOL
+AC_CHECK_TOOL([STRIP],[strip])
+
+#
+# Options for building bsdtar.
+#
+# Default is to build bsdtar, but allow people to override that.
+#
+AC_ARG_ENABLE([bsdtar],
+ [AS_HELP_STRING([--enable-bsdtar], [enable build of bsdtar (default)])
+ AS_HELP_STRING([--enable-bsdtar=static], [force static build of bsdtar])
+ AS_HELP_STRING([--enable-bsdtar=shared], [force dynamic build of bsdtar])
+AS_HELP_STRING([--disable-bsdtar], [disable build of bsdtar])],
+ [], [enable_bsdtar=yes])
+
+case "$enable_bsdtar" in
+yes)
+ if test "$enable_static" = "no"; then
+ static_bsdtar=no
+ else
+ static_bsdtar=yes
+ fi
+ build_bsdtar=yes
+ ;;
+dynamic|shared)
+ if test "$enable_shared" = "no"; then
+ AC_MSG_FAILURE([Shared linking of bsdtar requires shared libarchive])
+ fi
+ build_bsdtar=yes
+ static_bsdtar=no
+ ;;
+static)
+ build_bsdtar=yes
+ static_bsdtar=yes
+ ;;
+no)
+ build_bsdtar=no
+ static_bsdtar=no
+ ;;
+*)
+ AC_MSG_FAILURE([Unsupported value for --enable-bsdtar])
+ ;;
+esac
+
+AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ])
+AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ])
+
+#
+# Options for building bsdcpio.
+#
+# Default is not to build bsdcpio, but that can be overridden.
+#
+AC_ARG_ENABLE([bsdcpio],
+ [AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio (default)])
+ AS_HELP_STRING([--enable-bsdcpio=static], [static build of bsdcpio])
+ AS_HELP_STRING([--enable-bsdcpio=shared], [dynamic build of bsdcpio])
+AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio])],
+ [], [enable_bsdcpio=yes])
+
+case "$enable_bsdcpio" in
+yes)
+ if test "$enable_static" = "no"; then
+ static_bsdcpio=no
+ else
+ static_bsdcpio=yes
+ fi
+ build_bsdcpio=yes
+ ;;
+dynamic|shared)
+ if test "$enabled_shared" = "no"; then
+ AC_MSG_FAILURE([Shared linking of bsdcpio requires shared libarchive])
+ fi
+ build_bsdcpio=yes
+ ;;
+static)
+ build_bsdcpio=yes
+ static_bsdcpio=yes
+ ;;
+no)
+ build_bsdcpio=no
+ static_bsdcpio=no
+ ;;
+*)
+ AC_MSG_FAILURE([Unsupported value for --enable-bsdcpio])
+ ;;
+esac
+
+AM_CONDITIONAL([BUILD_BSDCPIO], [ test "$build_bsdcpio" = yes ])
+AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ])
+
+# Set up defines needed before including any headers
+case $host in
+ *mingw* | *cygwin* )
+ AC_DEFINE([_WIN32_WINNT], 0x0500, [Define to '0x0500' for Windows 2000 APIs.])
+ AC_DEFINE([WINVER], 0x0500, [Define to '0x0500' for Windows 2000 APIs.])
+ ;;
+esac
+
+# Checks for header files.
+AC_HEADER_DIRENT
+AC_HEADER_SYS_WAIT
+AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h ctype.h errno.h])
+AC_CHECK_HEADERS([ext2fs/ext2_fs.h fcntl.h grp.h])
+AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h linux/fs.h])
+AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h regex.h signal.h stdarg.h])
+AC_CHECK_HEADERS([stdint.h stdlib.h string.h])
+AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/extattr.h sys/ioctl.h sys/mkdev.h])
+AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/time.h sys/utime.h])
+AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h windows.h])
+
+# Checks for libraries.
+AC_ARG_WITH([zlib],
+ AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib]))
+
+if test "x$with_zlib" != "xno"; then
+ AC_CHECK_HEADERS([zlib.h])
+ AC_CHECK_LIB(z,inflate)
+fi
+
+AC_ARG_WITH([bz2lib],
+ AS_HELP_STRING([--without-bz2lib], [Don't build support for bzip2 through bz2lib]))
+
+if test "x$with_bz2lib" != "xno"; then
+ AC_CHECK_HEADERS([bzlib.h])
+ AC_CHECK_LIB(bz2,BZ2_bzDecompressInit)
+fi
+
+AC_ARG_WITH([lzmadec],
+ AS_HELP_STRING([--without-lzmadec], [Don't build support for lzma through lzmadec]))
+
+if test "x$with_lzmadec" != "xno"; then
+ AC_CHECK_HEADERS([lzmadec.h])
+ AC_CHECK_LIB(lzmadec,lzmadec_decode)
+fi
+
+AC_ARG_WITH([lzma],
+ AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma]))
+
+if test "x$with_lzma" != "xno"; then
+ AC_CHECK_HEADERS([lzma.h])
+ AC_CHECK_LIB(lzma,lzma_stream_decoder)
+fi
+
+AC_ARG_WITH([openssl],
+ AS_HELP_STRING([--without-openssl], [Don't build support for mtree and xar hashes through openssl]))
+
+AC_ARG_WITH([xml2],
+ AS_HELP_STRING([--without-xml2], [Don't build support for xar through libxml2]))
+AC_ARG_WITH([expat],
+ AS_HELP_STRING([--without-expat], [Don't build support for xar through expat]))
+
+if test "x$with_xml2" != "xno"; then
+ AC_PATH_PROG([XML2_CONFIG], [xml2-config],, [${PATH}])
+ if test "x$XML2_CONFIG" != "x"; then
+ CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`"
+ LIBS="${LIBS} `${XML2_CONFIG} --libs`"
+ fi
+ AC_CHECK_HEADERS([libxml/xmlreader.h])
+ AC_CHECK_LIB(xml2,xmlInitParser)
+fi
+if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then
+ if test "x$with_expat" != "xno"; then
+ AC_CHECK_HEADERS([expat.h])
+ AC_CHECK_LIB(expat,XML_ParserCreate)
+ fi
+fi
+
+AC_CHECK_HEADERS([md5.h ripemd.h rmd160.h sha.h sha1.h sha2.h sha256.h])
+# Common names for libc implementation on NetBSD and OpenBSD
+AC_CHECK_FUNCS(MD5Init RMD160Init SHA1Init)
+# SHA2 on NetBSD and older OpenBSD
+AC_CHECK_FUNCS(SHA256_Init SHA384_Init SHA512_Init)
+# SHA2 on newer OpenBSD
+AC_CHECK_FUNCS(SHA256Init SHA384Init SHA512Init)
+
+if test "x$with_openssl" != "xno"; then
+ if test "$ac_cv_func_MD5Init" != "yes"; then
+ AC_CHECK_HEADERS([openssl/md5.h])
+ AC_SEARCH_LIBS([MD5_Init], [crypto])
+ fi
+ if test "$ac_cv_func_RMD160Init" != "yes"; then
+ AC_CHECK_HEADERS([openssl/ripemd.h])
+ AC_SEARCH_LIBS([RIPEMD160_Init], [crypto])
+ fi
+ if test "$ac_cv_func_SHA1Init" != "yes"; then
+ AC_CHECK_HEADERS([openssl/sha.h])
+ AC_SEARCH_LIBS([SHA1_Init], [crypto])
+ fi
+ if test "$ac_cv_func_SHA256Init" != "yes" ||
+ test "$ac_cv_func_SHA384Init" != "yes" ||
+ test "$ac_cv_func_SHA512Init" != "yes"; then
+ if test "$ac_cv_func_SHA256_Init" != "yes" ||
+ test "$ac_cv_func_SHA384_Init" != "yes" ||
+ test "$ac_cv_func_SHA512_Init" != "yes"; then
+ AC_CHECK_HEADERS([openssl/sha.h])
+ # TODO: Does AC_SEARCH_LIBS support more than one function at once?
+ # This appears to always fail.
+ AC_SEARCH_LIBS([SHA256_Init SHA384_Init SHA512_Init], [crypto])
+
+ # TODO: Actually test for these. Previously our C code did not
+ # test for these at all and just assumed availability. Now that
+ # the C code tests these macros we preserve previous behavior
+ # for the autotools build by hard-coding availability.
+ if test "$ac_cv_header_openssl_sha_h" = "yes"; then
+ AC_DEFINE(HAVE_OPENSSL_SHA256_INIT, 1,
+ [Define to 1 if your openssl has the `SHA256_Init' function.])
+ AC_DEFINE(HAVE_OPENSSL_SHA384_INIT, 1,
+ [Define to 1 if your openssl has the `SHA384_Init' function.])
+ AC_DEFINE(HAVE_OPENSSL_SHA512_INIT, 1,
+ [Define to 1 if your openssl has the `SHA512_Init' function.])
+ fi
+ fi
+ fi
+fi
+
+# TODO: Give the user the option of using a pre-existing system
+# libarchive. This will define HAVE_LIBARCHIVE which will cause
+# bsdtar_platform.h to use #include <...> for the libarchive headers.
+# Need to include Makefile.am magic to link against system
+# -larchive in that case.
+#AC_CHECK_LIB(archive,archive_version)
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+# AC_TYPE_UID_T defaults to "int", which is incorrect for MinGW
+# and MSVC. Use a customized version.
+la_TYPE_UID_T
+AC_TYPE_MODE_T
+# AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on
+# most systems... default to "long long" instead.
+AC_CHECK_TYPE(off_t, [long long])
+AC_TYPE_SIZE_T
+AC_CHECK_TYPE(id_t, [unsigned long])
+AC_CHECK_TYPE(uintptr_t, [unsigned int])
+
+# Check for birthtime in struct stat
+AC_CHECK_MEMBERS([struct stat.st_birthtime])
+
+# Check for high-resolution timestamps in struct stat
+AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec])
+AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec])
+AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
+AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX
+AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64
+AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd
+# Check for block size support in struct stat
+AC_CHECK_MEMBERS([struct stat.st_blksize])
+# Check for st_flags in struct stat (BSD fflags)
+AC_CHECK_MEMBERS([struct stat.st_flags])
+
+# If you have uintmax_t, we assume printf supports %ju
+# If you have unsigned long long, we assume printf supports %llu
+# TODO: Check for %ju and %llu support directly.
+AC_CHECK_TYPES([uintmax_t, unsigned long long])
+
+# We need int64_t, uint64_t, intmax_t, and uintmax_t
+AC_TYPE_INTMAX_T
+AC_TYPE_INT64_T
+AC_TYPE_UINTMAX_T
+AC_TYPE_UINT64_T
+
+# TODO: If any of these are missing, define them right here.
+AC_CHECK_DECLS([SIZE_MAX, SSIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX])
+
+AC_CHECK_DECL([EFTYPE],
+ [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])],
+ [],
+ [#include <errno.h>])
+AC_CHECK_DECL([EILSEQ],
+ [AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])],
+ [],
+ [#include <errno.h>])
+AC_CHECK_TYPE([wchar_t],
+ [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]wchar_t), 1, [Define to 1 if the system has the type `wchar_t'.])dnl
+ AC_CHECK_SIZEOF([wchar_t])],
+ [])
+
+AC_HEADER_TIME
+
+# Checks for library functions.
+AC_PROG_GCC_TRADITIONAL
+AC_HEADER_MAJOR
+AC_FUNC_FSEEKO
+AC_FUNC_MEMCMP
+AC_FUNC_LSTAT
+AC_FUNC_STAT
+AC_FUNC_STRERROR_R
+AC_FUNC_STRFTIME
+AC_FUNC_VPRINTF
+# check for:
+# CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES)
+# To avoid necessity for including windows.h or special forward declaration
+# workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *'
+AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *])
+AC_CHECK_FUNCS([chflags chown chroot])
+AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fork])
+AC_CHECK_FUNCS([fstat ftruncate futimens futimes geteuid getpid])
+AC_CHECK_FUNCS([lchflags lchmod lchown link lstat])
+AC_CHECK_FUNCS([lutimes memmove memset mkdir mkfifo mknod])
+AC_CHECK_FUNCS([nl_langinfo pipe poll readlink])
+AC_CHECK_FUNCS([select setenv setlocale sigaction])
+AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm])
+AC_CHECK_FUNCS([tzset unsetenv utime utimensat utimes vfork])
+AC_CHECK_FUNCS([wcrtomb wcscpy wcslen wctomb wmemcmp wmemcpy])
+# detects cygwin-1.7, as opposed to older versions
+AC_CHECK_FUNCS([cygwin_conv_path])
+
+# FreeBSD's nl_langinfo supports an option to specify whether the
+# current locale uses month/day or day/month ordering. It makes the
+# output a little prettier...
+AC_CHECK_DECL([D_MD_ORDER],
+[AC_DEFINE(HAVE_D_MD_ORDER, 1, [Define to 1 if nl_langinfo supports D_MD_ORDER])],
+[],
+[#if HAVE_LANGINFO_H
+#include <langinfo.h>
+#endif
+])
+
+# Check for dirent.d_namlen field explicitly
+# (This is a bit more straightforward than, if not quite as portable as,
+# the recipe given by the autoconf maintainers.)
+AC_CHECK_MEMBER(struct dirent.d_namlen,,,
+[#if HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+])
+
+# Check for Extended Attributes support
+AC_ARG_ENABLE([xattr],
+ AS_HELP_STRING([--disable-xattr],
+ [Enable Extended Attributes support (default: check)]))
+
+if test "x$enable_xattr" != "xno"; then
+ AC_CHECK_HEADERS([attr/xattr.h])
+ AC_CHECK_HEADERS([sys/xattr.h])
+ AC_CHECK_LIB(attr,setxattr)
+ AC_CHECK_FUNCS([extattr_get_file extattr_list_file])
+ AC_CHECK_FUNCS([extattr_set_fd extattr_set_file])
+ AC_CHECK_FUNCS([fsetxattr getxattr])
+ AC_CHECK_FUNCS([lgetxattr listxattr llistxattr lsetxattr])
+fi
+
+# Check for ACL support
+#
+# The ACL support in libarchive is written against the POSIX1e draft,
+# which was never officially approved and varies quite a bit across
+# platforms. Worse, some systems have completely non-POSIX acl functions,
+# which makes the following checks rather more complex than I would like.
+#
+AC_ARG_ENABLE([acl],
+ AS_HELP_STRING([--disable-acl],
+ [Enable ACL support (default: check)]))
+
+if test "x$enable_acl" != "xno"; then
+ AC_CHECK_HEADERS([sys/acl.h])
+ AC_CHECK_LIB([acl],[acl_get_file])
+ AC_CHECK_FUNCS([acl_create_entry acl_init acl_set_fd acl_set_fd_np acl_set_file])
+
+ AC_CHECK_TYPES(acl_permset_t,,,
+ [#if HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ #if HAVE_SYS_ACL_H
+ #include <sys/acl.h>
+ #endif
+ ])
+
+ # The "acl_get_perm()" function was omitted from the POSIX draft.
+ # (It's a pretty obvious oversight; otherwise, there's no way to
+ # test for specific permissions in a permset.) Linux uses the obvious
+ # name, FreeBSD adds _np to mark it as "non-Posix extension."
+ # Test for both as a double-check that we really have POSIX-style ACL support.
+ AC_CHECK_FUNCS(acl_get_perm_np acl_get_perm acl_get_link acl_get_link_np,,,
+ [#if HAVE_SYS_TYPES_H
+ #include <sys/types.h>
+ #endif
+ #if HAVE_SYS_ACL_H
+ #include <sys/acl.h>
+ #endif
+ ])
+
+ # MacOS has an acl.h that isn't POSIX. It can be detected by
+ # checking for ACL_USER
+ AC_CHECK_DECL([ACL_USER],
+ [AC_DEFINE(HAVE_ACL_USER, 1, [True for systems with POSIX ACL support])],
+ [],
+ [#include <sys/acl.h>])
+fi
+
+# Additional requirements
+AC_SYS_LARGEFILE
+
+AC_OUTPUT
diff --git a/archivers/libarchive/files/contrib/README b/archivers/libarchive/files/contrib/README
new file mode 100644
index 00000000000..2eb0114ff56
--- /dev/null
+++ b/archivers/libarchive/files/contrib/README
@@ -0,0 +1,32 @@
+Many people have graciously sent me configuration
+files and other useful tidbits for use with libarchive.
+
+I do not support or use any of these; but if you can use them, enjoy!
+
+======================================================================
+
+From: Andre Stechert <andre@splunk.com>
+
+libarchive_autodetect-st_lib_archive.m4
+
+M4 macros for use with autoconf to detect whether a suitable
+version of libarchive is installed on this system.
+
+
+======================================================================
+
+libarchive.spec
+
+An RPM ".spec" file for building libarchive on most systems.
+This apparently was originally developed by a group at pld-linux.org.
+Several people have sent me different versions of this file.
+
+======================================================================
+
+From: Robert Meier <rm1023@dcx.com>
+
+libarchive.1aix53.spec
+
+As above, for use on AIX5.3.
+
+======================================================================
diff --git a/archivers/libarchive/files/contrib/libarchive.1aix53.spec b/archivers/libarchive/files/contrib/libarchive.1aix53.spec
new file mode 100644
index 00000000000..e271dda8172
--- /dev/null
+++ b/archivers/libarchive/files/contrib/libarchive.1aix53.spec
@@ -0,0 +1,187 @@
+# $LastChangedRevision: 1827 $, $LastChangedDate: 2010-01-16 16:21:36 -0800 (Sat, 16 Jan 2010) $
+Summary: Library to create and read several different archive formats
+Summary(pl): Biblioteka do tworzenia i odczytu ró¿nych formatów archiwów
+Name: libarchive
+Version: 2.0a3
+Release: 1aix53
+License: BSD
+Group: Libraries
+Source0: http://people.freebsd.org/~kientzle/libarchive/src/%{name}-%{version}.tar.gz
+Patch: %{name}-0123457890.patch
+URL: http://people.freebsd.org/~kientzle/libarchive/
+Requires: glibc
+Requires: zlib
+Requires: bzip2
+BuildRequires: gcc
+BuildRequires: gcc-c++
+BuildRequires: gawk
+BuildRequires: zlib-devel
+BuildRequires: bzip2
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+%description
+Libarchive is a programming library that can create and read several
+different streaming archive formats, including most popular TAR
+variants and several CPIO formats. It can also write SHAR archives.
+
+%description -l pl
+Libarchive jest bibliotek± s³u¿ac± to tworzenia i odczytu wielu
+ró¿nych strumieniowych formatów archiwów, w³±czaj±c w to popularne
+odmiany TAR oraz wiele formatów CPIO. Biblioteka ta potrafi tak¿e
+zapisywaæ archiwa SHAR.
+
+%package devel
+Summary: Header files for libarchive library
+Summary(pl): Pliki nag³ówkowe biblioteki libarchive
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Header files for libarchive library.
+
+%description devel -l pl
+Pliki nag³ówkowe biblioteki libarchive.
+
+%package static
+Summary: Static libarchive library
+Summary(pl): Statyczna biblioteka libarchive
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+
+%description static
+Static libarchive library.
+
+%description static -l pl
+Statyczna biblioteka libarchive.
+
+%package -n bsdtar
+Summary: bsdtar - tar(1) implementation based on libarchive
+Summary(pl): bsdtar - implementacja programu tar(1) oparta na libarchive
+Group: Applications/Archiving
+Requires: %{name} = %{version}-%{release}
+
+%description -n bsdtar
+bsdtar - tar(1) implementation based on libarchive.
+
+%description -n bsdtar -l pl
+bsdtar - implementacja programu tar(1), oparta na libarchive.
+
+%prep
+%setup -q
+%patch0 -p1
+
+%build
+# Specify paths to avoid use of vacpp
+# -maix64 - required to use large files with aix-5.3
+# -static - required for interoperability without copying libraries
+# -D_BSD - required to include definition of makedev
+# -X64 - required to assemble 64-bit COFF files
+mkdir -p %{buildroot}
+PATH=/opt/freeware/libexec:/opt/freeware/bin:/usr/local/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:. \
+CPATH=/opt/freeware/include:/usr/local/include \
+LIBPATH=/opt/freeware/lib:/usr/local/lib:/usr/share/lib \
+LD_LIBRARY_PATH=/opt/freeware/lib:/usr/local/lib:/usr/share/lib \
+CFLAGS="$RPM_OPT_FLAGS -maix64 -static -D_BSD" \
+CXXFLAGS="$RPM_OPT_FLAGS -maix64 -static -D_BSD" \
+AR="ar -X64" \
+./configure \
+--prefix=%{_prefix} \
+--libexecdir=%{_libexecdir} \
+--mandir=%{_mandir} \
+--infodir=%{_infodir} \
+--enable-shared=yes \
+--enable-static=yes \
+| tee %{buildroot}/config.log
+make | tee %{buildroot}/make.log
+
+%install
+[ "%buildroot" != "/" ] && [ -d %buildroot ] && rm -rf %buildroot;
+make DESTDIR=%buildroot install
+# original install builds, but does install bsdtar
+cp .libs/%{name}.a %{buildroot}%{_libdir}
+cp bsdtar %{buildroot}%{_bindir}
+cp tar/bsdtar.1 %{buildroot}%{_mandir}/man1
+
+%clean
+rm -fr %buildroot
+
+%files
+%defattr(644,root,root,755)
+%{_libdir}/libarchive.a
+
+%files devel
+%defattr(644,root,root,755)
+%{_libdir}/libarchive.la
+%{_includedir}/*.h
+%doc %{_mandir}/man3/*
+%doc %{_mandir}/man5/*
+
+%files -n bsdtar
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/bsdtar
+%doc %{_mandir}/man1/bsdtar.1*
+
+%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback@pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log: libarchive.1aix53.spec,v $
+Revision 1.3 2010/02/20 03:54:07 joerg
+Merge again...
+
+Revision 1.1.1.2 2010/02/20 03:49:41 joerg
+Import libarchive 2.8.0:
+- Infrastructure:
+ - Allow command line tools as fallback for missing compression
+ libraries. If compiled without gzip for example, gunzip will
+ be used automatically.
+ - Improved support for a number of platforms like high-resolution
+ timestamps and Extended Attributes on various Unix systems
+ - New convience interface for creating archives based on disk content,
+ complement of the archive_write_disk interface.
+- Frontends:
+ - bsdcpio ready for public consumption
+ - hand-written date parser replaces the yacc code
+- Filter system:
+ - Simplified read filter chains
+ - Option support for filters
+ - LZMA, XZ, uudecode handled
+- Format support:
+ - Write support for mtree files based on file system or archive
+ content
+ - Basic read support for Joliet
+ - Write support for zip files
+ - Write support for shar archives, both text-only and binary-safe
+
+Release 1aix53 2006/12/12 rm1023@dcx.com
+- tweak for aix-5.3
+- added libarchive-0123457890.patch for "0123457890" error
+- replaced libarchive-1.3.1.tar.gz with libarchive-2.0a3.tar.gz
+- removed obsolete -CVE-2006-5680.patch and -man_progname.patch
+
+Revision 1.6 2006/11/15 10:41:28 qboosh
+- BR: acl-devel,attr-devel
+- devel deps
+
+Revision 1.5 2006/11/08 22:22:25 twittner
+- up to 1.3.1
+- added BR: e2fsprogs-devel
+- added -CVE-2006-5680.patch agains entering in infinite
+loop in corrupt archives
+- added bsdtar package (bsdtar is included now in libarchive
+sources)
+- rel. 0.1 for testing
+
+Revision 1.4 2005/12/15 18:26:36 twittner
+- up to 1.2.37
+- removed -shared.patch (no longer needed)
+
+Revision 1.3 2005/10/05 17:00:12 arekm
+- up to 1.02.034
+
+Revision 1.2 2005/07/27 20:17:21 qboosh
+- typo
+
+Revision 1.1 2005/07/27 08:36:03 adamg
+- new
diff --git a/archivers/libarchive/files/contrib/libarchive.spec b/archivers/libarchive/files/contrib/libarchive.spec
new file mode 100644
index 00000000000..f6a31c23973
--- /dev/null
+++ b/archivers/libarchive/files/contrib/libarchive.spec
@@ -0,0 +1,174 @@
+# $LastChangedRevision: 1827 $, $LastChangedDate: 2010-01-16 16:21:36 -0800 (Sat, 16 Jan 2010) $
+Summary: Library to create and read several different archive formats
+Summary(pl): Biblioteka do tworzenia i odczytu ró¿nych formatów archiwów
+Name: libarchive
+Version: 2.0a3
+Release: 1
+License: BSD
+Group: Libraries
+Source0: http://people.freebsd.org/~kientzle/libarchive/src/%{name}-%{version}.tar.gz
+Patch: %{name}-0123457890.patch
+URL: http://people.freebsd.org/~kientzle/libarchive/
+Requires: glibc
+Requires: zlib
+Requires: bzip2
+BuildRequires: gcc
+BuildRequires: gcc-c++
+BuildRequires: gawk
+BuildRequires: zlib-devel
+BuildRequires: bzip2
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+%description
+Libarchive is a programming library that can create and read several
+different streaming archive formats, including most popular TAR
+variants and several CPIO formats. It can also write SHAR archives.
+
+%description -l pl
+Libarchive jest bibliotek± s³u¿ac± to tworzenia i odczytu wielu
+ró¿nych strumieniowych formatów archiwów, w³±czaj±c w to popularne
+odmiany TAR oraz wiele formatów CPIO. Biblioteka ta potrafi tak¿e
+zapisywaæ archiwa SHAR.
+
+%package devel
+Summary: Header files for libarchive library
+Summary(pl): Pliki nag³ówkowe biblioteki libarchive
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description devel
+Header files for libarchive library.
+
+%description devel -l pl
+Pliki nag³ówkowe biblioteki libarchive.
+
+%package static
+Summary: Static libarchive library
+Summary(pl): Statyczna biblioteka libarchive
+Group: Development/Libraries
+Requires: %{name}-devel = %{version}-%{release}
+
+%description static
+Static libarchive library.
+
+%description static -l pl
+Statyczna biblioteka libarchive.
+
+%package -n bsdtar
+Summary: bsdtar - tar(1) implementation based on libarchive
+Summary(pl): bsdtar - implementacja programu tar(1) oparta na libarchive
+Group: Applications/Archiving
+Requires: %{name} = %{version}-%{release}
+
+%description -n bsdtar
+bsdtar - tar(1) implementation based on libarchive.
+
+%description -n bsdtar -l pl
+bsdtar - implementacja programu tar(1), oparta na libarchive.
+
+%prep
+%setup -q
+%patch0 -p1
+
+%build
+mkdir -p %{buildroot}
+./configure \
+--prefix=%{_prefix} \
+--libexecdir=%{_libexecdir} \
+--mandir=%{_mandir} \
+--infodir=%{_infodir} \
+--enable-shared=yes \
+--enable-static=yes \
+| tee %{buildroot}/config.log
+make | tee %{buildroot}/make.log
+
+%install
+[ "%buildroot" != "/" ] && [ -d %buildroot ] && rm -rf %buildroot;
+make DESTDIR=%buildroot install
+# original install builds, but does install bsdtar
+cp .libs/%{name}.a %{buildroot}%{_libdir}
+cp bsdtar %{buildroot}%{_bindir}
+cp tar/bsdtar.1 %{buildroot}%{_mandir}/man1
+
+%clean
+rm -fr %buildroot
+
+%files
+%defattr(644,root,root,755)
+%{_libdir}/libarchive.a
+
+%files devel
+%defattr(644,root,root,755)
+%{_libdir}/libarchive.la
+%{_includedir}/*.h
+%doc %{_mandir}/man3/*
+%doc %{_mandir}/man5/*
+
+%files -n bsdtar
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/bsdtar
+%doc %{_mandir}/man1/bsdtar.1*
+
+%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback@pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log: libarchive.spec,v $
+Revision 1.3 2010/02/20 03:54:07 joerg
+Merge again...
+
+Revision 1.1.1.2 2010/02/20 03:49:41 joerg
+Import libarchive 2.8.0:
+- Infrastructure:
+ - Allow command line tools as fallback for missing compression
+ libraries. If compiled without gzip for example, gunzip will
+ be used automatically.
+ - Improved support for a number of platforms like high-resolution
+ timestamps and Extended Attributes on various Unix systems
+ - New convience interface for creating archives based on disk content,
+ complement of the archive_write_disk interface.
+- Frontends:
+ - bsdcpio ready for public consumption
+ - hand-written date parser replaces the yacc code
+- Filter system:
+ - Simplified read filter chains
+ - Option support for filters
+ - LZMA, XZ, uudecode handled
+- Format support:
+ - Write support for mtree files based on file system or archive
+ content
+ - Basic read support for Joliet
+ - Write support for zip files
+ - Write support for shar archives, both text-only and binary-safe
+
+Release 1 2006/12/12 rm1023@dcx.com
+- added libarchive-0123457890.patch for "0123457890" error
+- replaced libarchive-1.3.1.tar.gz with libarchive-2.0a3.tar.gz
+- removed obsolete -CVE-2006-5680.patch and -man_progname.patch
+
+Revision 1.6 2006/11/15 10:41:28 qboosh
+- BR: acl-devel,attr-devel
+- devel deps
+
+Revision 1.5 2006/11/08 22:22:25 twittner
+- up to 1.3.1
+- added BR: e2fsprogs-devel
+- added -CVE-2006-5680.patch agains entering in infinite
+loop in corrupt archives
+- added bsdtar package (bsdtar is included now in libarchive
+sources)
+- rel. 0.1 for testing
+
+Revision 1.4 2005/12/15 18:26:36 twittner
+- up to 1.2.37
+- removed -shared.patch (no longer needed)
+
+Revision 1.3 2005/10/05 17:00:12 arekm
+- up to 1.02.034
+
+Revision 1.2 2005/07/27 20:17:21 qboosh
+- typo
+
+Revision 1.1 2005/07/27 08:36:03 adamg
+- new
diff --git a/archivers/libarchive/files/contrib/libarchive_autodetect-st_lib_archive.m4 b/archivers/libarchive/files/contrib/libarchive_autodetect-st_lib_archive.m4
new file mode 100644
index 00000000000..4419e888f24
--- /dev/null
+++ b/archivers/libarchive/files/contrib/libarchive_autodetect-st_lib_archive.m4
@@ -0,0 +1,154 @@
+dnl
+dnl @synopsis ST_LIB_ARCHIVE([ENABLED-DEFAULT])
+dnl
+dnl This macro figures out what's necessary to link a program against an
+dnl instance of the BSD libarchive package by Tim Kientzle.
+dnl
+dnl See http://people.freebsd.org/~kientzle/libarchive/ for more info.
+dnl
+dnl It exports and substitutes the variables LIBARCHIVE_LIBS, LIBARCHIVE_LDFLAGS,
+dnl and LIBARCHIVE_CPPFLAGS to appropriate values for the identified instance of
+dnl libarchive. The values are AC_SUBST'd, so a user could, for example, simply
+dnl include @LIBARCHIVE_CPPFLAGS@ in the definition of AM_CPPFLAGS in a Makefile.am.
+dnl
+dnl ENABLED-DEFAULT is either "yes" or "no" and determines whether the default value
+dnl is --with-libarchive or --without-libarchive. It is not possible to specify a
+dnl default directory. More simply, any reasonable choice for a default should just
+dnl go into the auto-detect list.
+dnl
+dnl The macro defines the symbol HAVE_LIBARCHIVE if the library is found. You
+dnl should use autoheader to include a definition for this symbol in a config.h
+dnl file. Sample usage in a C/C++ source is as follows:
+dnl
+dnl #ifdef HAVE_LIBARCHIVE
+dnl #include <archive.h>
+dnl #endif /* HAVE_LIBARCHIVE */
+dnl
+dnl @category InstalledPackages
+dnl @author Andre Stechert <andre@splunk.com>
+dnl @version 2006-04-20
+dnl @license GPLWithACException
+
+AC_DEFUN([ST_LIB_ARCHIVE],
+[
+#
+# Handle input from the configurer and blend with the requirements from the maintainer.
+# We go through the trouble of creating a second set of variables other than the with_foo
+# variables in order to be sure that error/corner cases have been cleaned up.
+#
+# After this statement, three trusted variable are defined.
+#
+# st_lib_archive_ENABLED will be either "yes" or "no". its value determines whether
+# or not we bother with the rest of the checks and whether or not we export a
+# bunch of variables.
+#
+# st_lib_archive_LOCATION will be either "auto" or "defined". if it is "auto", then
+# we try a bunch of standard locations. if it is "defined", then we just try the value
+# provided in st_lib_archive_DIR.
+#
+# st_lib_archive_DIR will contain the string provided by the user, provided that it's
+# actually a directory.
+#
+AC_MSG_CHECKING([if libarchive is wanted])
+AC_ARG_WITH([libarchive],
+ AS_HELP_STRING([--with-libarchive=DIR], [libarchive installation directory]),
+ [if test "x$with_libarchive" = "xno" ; then
+ st_lib_archive_ENABLED=no
+ elif test "x$with_libarchive" = "xyes" ; then
+ st_lib_archive_ENABLED=yes
+ st_lib_archive_LOCATION=auto
+ else
+ st_lib_archive_ENABLED=yes
+ st_lib_archive_LOCATION=defined
+ if test -d "$with_libarchive" ; then
+ st_lib_archive_DIR="$with_libarchive"
+ else
+ AC_MSG_ERROR([$with_libarchive is not a directory])
+ fi
+ fi],
+ [if test "x$1" = "xno" ; then
+ st_lib_archive_ENABLED=no
+ elif test "x$1" = "xyes" ; then
+ st_lib_archive_ENABLED=yes
+ else
+ st_lib_archive_ENABLED=yes
+ fi])
+
+if test "$st_lib_archive_ENABLED" = "yes" ; then
+ AC_MSG_RESULT([yes])
+#
+# After this statement, one trusted variable is defined.
+#
+# st_lib_archive_LIB will be either "lib" or "lib64", depending on whether the configurer
+# specified 32, 64. The default is "lib".
+#
+ AC_MSG_CHECKING([whether to use lib or lib64])
+ AC_ARG_WITH([libarchive-bits],
+ AS_HELP_STRING([--with-libarchive-bits=32/64], [if 64, look in /lib64 on hybrid systems]),
+ [if test "x$with_libarchive_bits" = "x32" ; then
+ st_lib_archive_LIB=lib
+ elif test "x$with_libarchive_bits" = "x64" ; then
+ st_lib_archive_LIB=lib64
+ else
+ AC_MSG_ERROR([the argument must be either 32 or 64])
+ fi],
+ [st_lib_archive_LIB=lib])
+ AC_MSG_RESULT($st_lib_archive_LIB)
+#
+# Save the environment before verifying libarchive availability
+#
+ st_lib_archive_SAVECPPFLAGS="$CPPFLAGS"
+ st_lib_archive_SAVELDFLAGS="$LDFLAGS"
+ AC_LANG_SAVE
+ AC_LANG_C
+
+ if test "x$st_lib_archive_LOCATION" = "xdefined" ; then
+ CPPFLAGS="-I$st_lib_archive_DIR/include $st_lib_archive_SAVECPPFLAGS"
+ LDFLAGS="-L$st_lib_archive_DIR/$st_lib_archive_LIB $st_lib_archive_SAVELDFLAGS"
+ AC_CHECK_LIB(archive, archive_read_new, [st_lib_archive_found_lib=yes], [st_lib_archive_found_lib=no])
+ AC_CHECK_HEADER(archive.h, [st_lib_archive_found_hdr=yes], [st_lib_archive_found_hdr=no])
+ if test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes"; then
+ LIBARCHIVE_CPPFLAGS="-I$dir/include"
+ LIBARCHIVE_LDFLAGS="-L$dir/$st_lib_archive_LIB"
+ else
+ AC_MSG_ERROR([could not find libarchive in the requested location])
+ fi
+ else
+ #
+ # These are the common install directories for Linux, FreeBSD, Solaris, and Mac.
+ #
+ for dir in /usr /usr/local /usr/sfw /opt/csw /opt/local /sw
+ do
+ if test -d "$dir" ; then
+ CPPFLAGS="-I$dir/include $st_lib_archive_SAVECPPFLAGS"
+ LDFLAGS="-L$dir/$st_lib_archive_LIB $st_lib_archive_SAVELDFLAGS"
+ AC_CHECK_LIB(archive, archive_read_new, [st_lib_archive_found_lib=yes], [st_lib_archive_found_lib=no])
+ AC_CHECK_HEADER(archive.h, [st_lib_archive_found_hdr=yes], [st_lib_archive_found_hdr=no])
+ if test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes"; then
+ LIBARCHIVE_CPPFLAGS="-I$dir/include"
+ LIBARCHIVE_LDFLAGS="-L$dir/$st_lib_archive_LIB"
+ break
+ fi
+ fi
+ done
+ fi
+
+ if test "x$st_lib_archive_found_hdr" = "xyes" && test "x$st_lib_archive_found_lib" = "xyes" ; then
+ LIBARCHIVE_LIBS="-larchive"
+ AC_DEFINE([HAVE_LIBARCHIVE], [1], [Defined to 1 if libarchive is available for use.])
+ AC_SUBST(LIBARCHIVE_LIBS)
+ AC_SUBST(LIBARCHIVE_CPPFLAGS)
+ AC_SUBST(LIBARCHIVE_LDFLAGS)
+ fi
+
+#
+# Restore the environment now that we're done.
+#
+ AC_LANG_RESTORE
+ CPPFLAGS="$st_lib_archive_SAVECPPFLAGS"
+ LDFLAGS="$st_lib_archive_SAVELDFLAGS"
+else
+ AC_MSG_RESULT([no])
+fi
+AM_CONDITIONAL(LIBARCHIVE, test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes")
+])
diff --git a/archivers/libarchive/files/contrib/psota-benchmark/results.txt b/archivers/libarchive/files/contrib/psota-benchmark/results.txt
new file mode 100644
index 00000000000..8197b28f7ea
--- /dev/null
+++ b/archivers/libarchive/files/contrib/psota-benchmark/results.txt
@@ -0,0 +1,122 @@
+ODP: [Bug-tar] GNU tar, star and BSD tar speed comparision +new script
+
+Jan Psota
+Thu, 25 Oct 2007 06:51:13 -0700
+
+Latest TCP script at the bottom (3180 bytes).
+4 tests: 64bit dual core Athlon tmpfs / disk (reiserfs) - 60MB/s,
+ 32bit Athlon tmpfs / disk (reiserfs) - 55MB/s
+Both machines were idle -- used for testing only.
+Tarball and extracted files were on different physical devices.
+Test data: linux 2.6.22/3 kernel sources for memory operations,
+for the other data average file size should bring enough info.
+
+2 x [...] processor means 1 processor with 2 cores (2 entries in cpuinfo).
+Archive format is set to pax (Joerg).
+Let's end with it. I only wanted to send You a new version of TCP script :-).
+
+--
+Jan Psota
+
+TCP, version 2007-10-25
+Linux 2.6.22-suspend2-r2 / Gentoo Base System release 2.0.0_rc5
+2012MB of memory, 2 x AMD Athlon(tm) 64 X2 Dual Core Processor 4200+ 2211.348
+512 KB 4426.24 bmips
+gcc (GCC) 4.2.2 (Gentoo 4.2.2 p1.0)
+CFLAGS="-O2 -march=k8 -pipe"
+
+bsdtar: bsdtar 2.3.4 - libarchive 2.3.4
+gnutar: tar (GNU tar) 1.19
+star: star: star 1.5a85 (x86_64-unknown-linux-gnu)
+
+best time of 5 repetitions,
+ src=linux-2.6.23, 291M in 23867 files, avg 13KB/file,
+ archive=/tmp/tcp.tar, extract to /tmp/tcptmp
+program operation real user system %CPU speed
+bsdtar create 0.764 0.232 0.532 99.96 370308 KB/s
+gnutar create 0.743 0.200 0.512 95.87 380775 KB/s
+star create 0.587 0.040 0.820 100.00 441247 KB/s
+
+bsdtar list 0.164 0.096 0.068 99.84 1579341 KB/s
+gnutar list 0.218 0.064 0.152 98.92 1188128 KB/s
+star list 0.359 0.044 0.240 79.09 721481 KB/s
+
+bsdtar extract 0.733 0.200 0.504 96.02 353358 KB/s
+gnutar extract 0.625 0.092 0.508 96.02 414419 KB/s
+star extract 0.875 0.096 0.980 100.00 296013 KB/s
+
+bsdtar compare 0.001 0.000 0.000 0.00 259012000 KB/s
+gnutar compare 0.719 0.288 0.400 95.66 360239 KB/s
+star compare 0.695 0.224 0.636 100.00 372679 KB/s
+
+[...]
+best time of 3 repetitions,
+ src=/home, 3.2G in 7447 files, avg 554KB/file,
+ archive=/var/tcp.tar, extract to /mnt/a/tcptmp
+program operation real user system %CPU speed
+bsdtar create 184.680 0.552 13.365 7.53 17958 KB/s
+gnutar create 159.240 0.256 12.417 7.95 20827 KB/s
+star create 181.779 0.140 14.789 8.21 18203 KB/s
+
+bsdtar list 0.053 0.032 0.016 91.41 62435471 KB/s
+gnutar list 56.535 0.136 3.764 6.89 58531 KB/s
+star list 56.652 0.080 5.236 9.38 58410 KB/s
+
+bsdtar extract 78.914 0.820 15.149 20.23 41932 KB/s
+gnutar extract 78.480 0.196 14.197 18.33 42164 KB/s
+star extract 79.439 0.132 12.973 16.49 41655 KB/s
+
+bsdtar compare 0.001 0.000 0.000 0.00 3309080000 KB/s
+gnutar compare 61.771 3.464 8.905 20.02 53570 KB/s
+star compare 57.561 1.728 9.897 20.19 57488 KB/s
+
+
+Linux 2.6.22-suspend2-smp / Gentoo Base System release 2.0.0_rc5
+504MB of memory, 1 x AMD Athlon(tm) Processor 1500.033 256 KB 3002.55 bmips
+gcc (GCC) 4.2.2 (Gentoo 4.2.2 p1.0)
+CFLAGS="-O2 -march=athlon-xp -mfpmath=sse -frename-registers -pipe"
+
+bsdtar: bsdtar 2.3.4 - libarchive 2.3.4
+gnutar: tar (GNU tar) 1.19
+star: star: star 1.5a85 (i686-pc-linux-gnu)
+
+best time of 3 repetitions,
+ src=/usr/src/linux-2.6.22-suspend2/drivers, 119M in 5900 files,
+ avg 21KB/file, archive=/tmp/tcp.tar, extract to /tmp/tcptmp
+program operation real user system %CPU speed
+bsdtar create 1.329 0.192 1.132 99.63 89784 KB/s
+gnutar create 1.223 0.124 1.092 99.46 97566 KB/s
+star create 1.848 0.036 1.708 94.36 61372 KB/s
+
+bsdtar list 0.167 0.060 0.108 100.00 679137 KB/s
+gnutar list 0.161 0.040 0.124 100.00 704447 KB/s
+star list 0.859 0.044 0.716 88.51 132032 KB/s
+
+bsdtar extract 1.186 0.172 1.012 99.87 95629 KB/s
+gnutar extract 1.064 0.056 1.004 99.63 106593 KB/s
+star extract 1.920 0.088 1.724 94.40 59070 KB/s
+
+bsdtar compare 0.002 0.000 0.000 0.00 56708000 KB/s
+gnutar compare 0.925 0.232 0.692 99.90 122611 KB/s
+star compare 1.569 0.376 1.096 93.79 72285 KB/s
+
+[...]
+best time of 3 repetitions,
+ src=/home/jasiu, 2.1G in 8416 files, avg 277KB/file,
+ archive=/home/j2/tcp.tar, extract to /mnt/a/tar/tcptmp
+program operation real user system %CPU speed
+bsdtar create 182.171 1.692 29.130 16.91 11584 KB/s
+gnutar create 174.999 0.632 27.450 16.04 12059 KB/s
+star create 180.004 0.360 41.795 23.41 11677 KB/s
+
+bsdtar list 0.214 0.076 0.136 99.04 9822294 KB/s
+gnutar list 0.210 0.076 0.136 100.00 10009385 KB/s
+star list 43.462 0.148 18.109 42.00 48363 KB/s
+
+bsdtar extract 94.912 4.476 31.574 37.98 22146 KB/s
+gnutar extract 94.657 0.396 29.462 31.54 22206 KB/s
+star extract 100.814 0.400 39.906 39.98 20849 KB/s
+
+bsdtar compare 0.003 0.000 0.004 100.00 700657000 KB/s
+gnutar compare 80.174 3.932 20.365 30.30 26217 KB/s
+star compare 73.911 8.341 27.670 48.72 28439 KB/s
diff --git a/archivers/libarchive/files/contrib/psota-benchmark/tcp.sh b/archivers/libarchive/files/contrib/psota-benchmark/tcp.sh
new file mode 100644
index 00000000000..6c0e4b5e92e
--- /dev/null
+++ b/archivers/libarchive/files/contrib/psota-benchmark/tcp.sh
@@ -0,0 +1,104 @@
+#!/bin/sh
+# tar comparision program
+# 2007-10-25 Jan Psota
+
+n=3 # number of repetitions
+TAR=(bsdtar gnutar star) # TApeArchivers to compare
+OPT=("" "--seek" "-no-fsync")
+pax="--format=pax" # comment out for defaults
+OPN=(create list extract compare) # operations
+version="2007-10-25"
+TIMEFORMAT=$'%R\t%U\t%S\t%P'
+LC_ALL=C
+
+test $# -ge 2 || {
+ echo -e "usage:\t$0 source_dir where_to_place_archive
+[where_to_extract_it]
+
+TCP, version $version
+TCP stands for Tar Comparision Program here.
+It currently compares: BSD tar (bsdtar), GNU tar (gnutar) and star in archive
+creation, listing, extraction and archive-to-extracted comparision.
+Tcp prints out best time of n=$n repetitions.
+
+Tcp creates temporary archive named tcp.tar with $pax and some native
+(--seek/-no-fsync) options and extracts it to [\$3]/tcptmp/.
+If unset, third argument defaults to [\$2].
+After normal exit tcp removes tarball and extracted files.
+Tcp does not check filesystems destination directories are on for free space,
+so make sure there is enough space (a bit more than source_dir uses) for both:
+archive and extracted files.
+Do not use white space in arguments.
+ Jan Psota, $version"
+ exit 0
+}
+src=$1
+dst=$2/tcp.tar
+dst_path=${3:-$2}/tcptmp
+test -e $dst -o -e /tmp/tcp \
+ && { echo "$dst or /tmp/tcp exists, exiting"; exit 1; }
+mkdir $dst_path || exit 2
+
+use_times ()
+{
+ awk -F"\t" -vN=$n -vL="`du -k $dst`" -vOFS="\t" -vORS="" '
+ { if (NF==4) { printf "\t%s\t%10.1d KB/s\n", $0, ($1+0>0 ?
+(L+0)/($1+0) : 0) } }' \
+ /tmp/tcp | sort | head -1
+ > /tmp/tcp
+}
+
+test -d $src || { echo "'$src' is not a directory"; exit 3; }
+
+# system information: type, release, memory, cpu(s), compiler and flags
+echo -e "TCP, version $version\n"`uname -sr`" / "`head -1 /etc/*-release`
+free -m | awk '/^Mem/ { printf "%dMB of memory, ", $2 }'
+test -e /proc/cpuinfo \
+ && awk -F: '/name|cache size|MHz|mips/ { if (!a) b=b $2 }
+ /^$/ { a++ } END { print a" x"b" bmips" }' /proc/cpuinfo
+test -e /etc/gentoo-release \
+ && gcc --version | head -1 && grep ^CFLAGS /etc/make.conf
+
+# tar versions
+echo
+for tar in [EMAIL PROTECTED]; do echo -ne "$tar:\t"; $tar --version | head -1;
+done
+
+echo -e "\nbest time of $n repetitions,\n"\
+" src=$src, "\
+`du -sh $src | awk '{print $1}'`" in "`find $src | wc -l`" files, "\
+"avg "$((`du -sk $src | awk '{print $1}'`/`find $src -type f | wc
+-l`))"KB/file,\n"\
+" archive=$dst, extract to $dst_path"
+
+echo -e "program\toperation\treal\tuser\tsystem\t%CPU\t speed"
+> /tmp/tcp
+let op_num=0
+for op in "cf $dst $pax -C $src ." "tf $dst" "xf $dst -C $dst_path" \
+ "f $dst -C $dst_path --diff"; do
+ let tar_num=0
+ for tar in [EMAIL PROTECTED]; do
+ echo -en "$tar\t${OPN[op_num]}\t"
+ for ((i=1; i<=$n; i++)); do
+ echo $op | grep -q ^cf && rm -f $dst
+ echo $op | grep -q ^xf &&
+ { chmod -R u+w $dst_path
+ rm -rf $dst_path; mkdir $dst_path; }
+ sync
+ if echo $op | grep -q ^f; then # op == compare
+ time $tar $op ${OPT[$tar_num]} > /dev/null
+ else # op in (create | list | extract)
+ time $tar $op ${OPT[$tar_num]} > /dev/null \
+ || break 3
+ fi 2>> /tmp/tcp
+ done
+ use_times
+ let tar_num++
+ done
+ let op_num++
+ echo
+done
+rm -rf $dst_path $dst
+echo
+cat /tmp/tcp
+rm -f /tmp/tcp
diff --git a/archivers/libarchive/files/cpio/bsdcpio.1 b/archivers/libarchive/files/cpio/bsdcpio.1
new file mode 100644
index 00000000000..79b6997ef4a
--- /dev/null
+++ b/archivers/libarchive/files/cpio/bsdcpio.1
@@ -0,0 +1,405 @@
+.\" 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 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 December 21, 2007
+.Dt BSDCPIO 1
+.Os
+.Sh NAME
+.Nm cpio
+.Nd copy files to and from archives
+.Sh SYNOPSIS
+.Nm
+.Brq Fl i
+.Op Ar options
+.Op Ar pattern ...
+.Op Ar < archive
+.Nm
+.Brq Fl o
+.Op Ar options
+.Ar < name-list
+.Op Ar > archive
+.Nm
+.Brq Fl p
+.Op Ar options
+.Ar dest-dir
+.Ar < name-list
+.Sh DESCRIPTION
+.Nm
+copies files between archives and directories.
+This implementation can extract from tar, pax, cpio, zip, jar, ar,
+and ISO 9660 cdrom images and can create tar, pax, cpio, ar,
+and shar archives.
+.Pp
+The first option to
+.Nm
+is a mode indicator from the following list:
+.Bl -tag -compact -width indent
+.It Fl i
+Input.
+Read an archive from standard input (unless overriden) and extract the
+contents to disk or (if the
+.Fl t
+option is specified)
+list the contents to standard output.
+If one or more file patterns are specified, only files matching
+one of the patterns will be extracted.
+.It Fl o
+Output.
+Read a list of filenames from standard input and produce a new archive
+on standard output (unless overriden) containing the specified items.
+.It Fl p
+Pass-through.
+Read a list of filenames from standard input and copy the files to the
+specified directory.
+.El
+.Pp
+.Sh OPTIONS
+Unless specifically stated otherwise, options are applicable in
+all operating modes.
+.Bl -tag -width indent
+.It Fl 0
+Read filenames separated by NUL characters instead of newlines.
+This is necessary if any of the filenames being read might contain newlines.
+.It Fl A
+(o mode only)
+Append to the specified archive.
+(Not yet implemented.)
+.It Fl a
+(o and p modes)
+Reset access times on files after they are read.
+.It Fl B
+(o mode only)
+Block output to records of 5120 bytes.
+.It Fl C Ar size
+(o mode only)
+Block output to records of
+.Ar size
+bytes.
+.It Fl c
+(o mode only)
+Use the old POSIX portable character format.
+Equivalent to
+.Fl -format Ar odc .
+.It Fl d
+(i and p modes)
+Create directories as necessary.
+.It Fl E Ar file
+(i mode only)
+Read list of file name patterns from
+.Ar file
+to list and extract.
+.It Fl F Ar file
+Read archive from or write archive to
+.Ar file .
+.It Fl f Ar pattern
+(i mode only)
+Ignore files that match
+.Ar pattern .
+.It Fl -format Ar format
+(o mode only)
+Produce the output archive in the specified format.
+Supported formats include:
+.Pp
+.Bl -tag -width "iso9660" -compact
+.It Ar cpio
+Synonym for
+.Ar odc .
+.It Ar newc
+The SVR4 portable cpio format.
+.It Ar odc
+The old POSIX.1 portable octet-oriented cpio format.
+.It Ar pax
+The POSIX.1 pax format, an extension of the ustar format.
+.It Ar ustar
+The POSIX.1 tar format.
+.El
+.Pp
+The default format is
+.Ar odc .
+See
+.Xr libarchive_formats 5
+for more complete information about the
+formats currently supported by the underlying
+.Xr libarchive 3
+library.
+.It Fl H Ar format
+Synonym for
+.Fl -format .
+.It Fl h , Fl -help
+Print usage information.
+.It Fl I Ar file
+Read archive from
+.Ar file .
+.It Fl i
+Input mode.
+See above for description.
+.It Fl -insecure
+(i and p mode only)
+Disable security checks during extraction or copying.
+This allows extraction via symbolic links and path names containing
+.Sq ..
+in the name.
+.It Fl J
+(o mode only)
+Compress the file with xz-compatible compression before writing it.
+In input mode, this option is ignored; xz compression is recognized
+automatically on input.
+.It Fl j
+Synonym for
+.Fl y .
+.It Fl L
+(o and p modes)
+All symbolic links will be followed.
+Normally, symbolic links are archived and copied as symbolic links.
+With this option, the target of the link will be archived or copied instead.
+.It Fl l
+(p mode only)
+Create links from the target directory to the original files,
+instead of copying.
+.It Fl lzma
+(o mode only)
+Compress the file with lzma-compatible compression before writing it.
+In input mode, this option is ignored; lzma compression is recognized
+automatically on input.
+.It Fl m
+(i and p modes)
+Set file modification time on created files to match
+those in the source.
+.It Fl n
+(i mode, only with
+.Fl t )
+Display numeric uid and gid.
+By default,
+.Nm
+displays the user and group names when they are provided in the
+archive, or looks up the user and group names in the system
+password database.
+.It Fl no-preserve-owner
+(i mode only)
+Do not attempt to restore file ownership.
+This is the default when run by non-root users.
+.It Fl O Ar file
+Write archive to
+.Ar file .
+.It Fl o
+Output mode.
+See above for description.
+.It Fl p
+Pass-through mode.
+See above for description.
+.It Fl preserve-owner
+(i mode only)
+Restore file ownership.
+This is the default when run by the root user.
+.It Fl -quiet
+Suppress unnecessary messages.
+.It Fl R Oo user Oc Ns Oo : Oc Ns Oo group Oc
+Set the owner and/or group on files in the output.
+If group is specified with no user
+(for example,
+.Fl R Ar :wheel )
+then the group will be set but not the user.
+If the user is specified with a trailing colon and no group
+(for example,
+.Fl R Ar root: )
+then the group will be set to the user's default group.
+If the user is specified with no trailing colon, then
+the user will be set but not the group.
+In
+.Fl i
+and
+.Fl p
+modes, this option can only be used by the super-user.
+(For compatibility, a period can be used in place of the colon.)
+.It Fl r
+(All modes.)
+Rename files interactively.
+For each file, a prompt is written to
+.Pa /dev/tty
+containing the name of the file and a line is read from
+.Pa /dev/tty .
+If the line read is blank, the file is skipped.
+If the line contains a single period, the file is processed normally.
+Otherwise, the line is taken to be the new name of the file.
+.It Fl t
+(i mode only)
+List the contents of the archive to stdout;
+do not restore the contents to disk.
+.It Fl u
+(i and p modes)
+Unconditionally overwrite existing files.
+Ordinarily, an older file will not overwrite a newer file on disk.
+.It Fl v
+Print the name of each file to stderr as it is processed.
+With
+.Fl t ,
+provide a detailed listing of each file.
+.It Fl -version
+Print the program version information and exit.
+.It Fl y
+(o mode only)
+Compress the archive with bzip2-compatible compression before writing it.
+In input mode, this option is ignored;
+bzip2 compression is recognized automatically on input.
+.It Fl Z
+(o mode only)
+Compress the archive with compress-compatible compression before writing it.
+In input mode, this option is ignored;
+compression is recognized automatically on input.
+.It Fl z
+(o mode only)
+Compress the archive with gzip-compatible compression before writing it.
+In input mode, this option is ignored;
+gzip compression is recognized automatically on input.
+.El
+.Sh ENVIRONMENT
+The following environment variables affect the execution of
+.Nm :
+.Bl -tag -width ".Ev BLOCKSIZE"
+.It Ev LANG
+The locale to use.
+See
+.Xr environ 7
+for more information.
+.It Ev TZ
+The timezone to use when displaying dates.
+See
+.Xr environ 7
+for more information.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+The
+.Nm
+command is traditionally used to copy file heirarchies in conjunction
+with the
+.Xr find 1
+command.
+The first example here simply copies all files from
+.Pa src
+to
+.Pa dest :
+.Dl Nm find Pa src | Nm Fl pmud Pa dest
+.Pp
+By carefully selecting options to the
+.Xr find 1
+command and combining it with other standard utilities,
+it is possible to exercise very fine control over which files are copied.
+This next example copies files from
+.Pa src
+to
+.Pa dest
+that are more than 2 days old and whose names match a particular pattern:
+.Dl Nm find Pa src Fl mtime Ar +2 | Nm grep foo[bar] | Nm Fl pdmu Pa dest
+.Pp
+This example copies files from
+.Pa src
+to
+.Pa dest
+that are more than 2 days old and which contain the word
+.Do foobar Dc :
+.Dl Nm find Pa src Fl mtime Ar +2 | Nm xargs Nm grep -l foobar | Nm Fl pdmu Pa dest
+.Sh COMPATIBILITY
+The mode options i, o, and p and the options
+a, B, c, d, f, l, m, r, t, u, and v comply with SUSv2.
+.Pp
+The old POSIX.1 standard specified that only
+.Fl i ,
+.Fl o ,
+and
+.Fl p
+were interpreted as command-line options.
+Each took a single argument of a list of modifier
+characters.
+For example, the standard syntax allows
+.Fl imu
+but does not support
+.Fl miu
+or
+.Fl i Fl m Fl u ,
+since
+.Ar m
+and
+.Ar u
+are only modifiers to
+.Fl i ,
+they are not command-line options in their own right.
+The syntax supported by this implementation is backwards-compatible
+with the standard.
+For best compatibility, scripts should limit themselves to the
+standard syntax.
+.Sh SEE ALSO
+.Xr bzip2 1 ,
+.Xr tar 1 ,
+.Xr gzip 1 ,
+.Xr mt 1 ,
+.Xr pax 1 ,
+.Xr libarchive 3 ,
+.Xr cpio 5 ,
+.Xr libarchive-formats 5 ,
+.Xr tar 5
+.Sh STANDARDS
+There is no current POSIX standard for the cpio command; it appeared
+in
+.St -p1003.1-96
+but was dropped from
+.St -p1003.1-2001 .
+.Pp
+The cpio, ustar, and pax interchange file formats are defined by
+.St -p1003.1-2001
+for the pax command.
+.Sh HISTORY
+The original
+.Nm cpio
+and
+.Nm find
+utilities were written by Dick Haight
+while working in AT&T's Unix Support Group.
+They first appeared in 1977 in PWB/UNIX 1.0, the
+.Dq Programmer's Work Bench
+system developed for use within AT&T.
+They were first released outside of AT&T as part of System III Unix in 1981.
+As a result,
+.Nm cpio
+actually predates
+.Nm tar ,
+even though it was not well-known outside of AT&T until some time later.
+.Pp
+This is a complete re-implementation based on the
+.Xr libarchive 3
+library.
+.Sh BUGS
+The cpio archive format has several basic limitations:
+It does not store user and group names, only numbers.
+As a result, it cannot be reliably used to transfer
+files between systems with dissimilar user and group numbering.
+Older cpio formats limit the user and group numbers to
+16 or 18 bits, which is insufficient for modern systems.
+The cpio archive formats cannot support files over 4 gigabytes,
+except for the
+.Dq odc
+variant, which can support files up to 8 gigabytes.
diff --git a/archivers/libarchive/files/cpio/cmdline.c b/archivers/libarchive/files/cpio/cmdline.c
new file mode 100644
index 00000000000..2223798c124
--- /dev/null
+++ b/archivers/libarchive/files/cpio/cmdline.c
@@ -0,0 +1,369 @@
+/*-
+ * 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
+ * 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.
+ */
+
+
+#include "cpio_platform.h"
+__FBSDID("$FreeBSD: src/usr.bin/cpio/cmdline.c,v 1.5 2008/12/06 07:30:40 kientzle Exp $");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "cpio.h"
+#include "err.h"
+
+/*
+ * Short options for cpio. Please keep this sorted.
+ */
+static const char *short_options = "0AaBC:cdE:F:f:H:hI:iJjLlmnO:opR:rtuvW:yZz";
+
+/*
+ * Long options for cpio. Please keep this sorted.
+ */
+static const struct option {
+ const char *name;
+ int required; /* 1 if this option requires an argument */
+ int equivalent; /* Equivalent short option. */
+} cpio_longopts[] = {
+ { "create", 0, 'o' },
+ { "extract", 0, 'i' },
+ { "file", 1, 'F' },
+ { "format", 1, 'H' },
+ { "help", 0, 'h' },
+ { "insecure", 0, OPTION_INSECURE },
+ { "link", 0, 'l' },
+ { "list", 0, 't' },
+ { "lzma", 0, OPTION_LZMA },
+ { "make-directories", 0, 'd' },
+ { "no-preserve-owner", 0, OPTION_NO_PRESERVE_OWNER },
+ { "null", 0, '0' },
+ { "numeric-uid-gid", 0, 'n' },
+ { "owner", 1, 'R' },
+ { "pass-through", 0, 'p' },
+ { "preserve-modification-time", 0, 'm' },
+ { "preserve-owner", 0, OPTION_PRESERVE_OWNER },
+ { "quiet", 0, OPTION_QUIET },
+ { "unconditional", 0, 'u' },
+ { "verbose", 0, 'v' },
+ { "version", 0, OPTION_VERSION },
+ { "xz", 0, 'J' },
+ { NULL, 0, 0 }
+};
+
+/*
+ * I used to try to select platform-provided getopt() or
+ * getopt_long(), but that caused a lot of headaches. In particular,
+ * I couldn't consistently use long options in the test harness
+ * because not all platforms have getopt_long(). That in turn led to
+ * overuse of the -W hack in the test harness, which made it rough to
+ * run the test harness against GNU cpio. (I periodically run the
+ * test harness here against GNU cpio as a sanity-check. Yes,
+ * I've found a couple of bugs in GNU cpio that way.)
+ */
+int
+cpio_getopt(struct cpio *cpio)
+{
+ enum { state_start = 0, state_next_word, state_short, state_long };
+ static int state = state_start;
+ static char *opt_word;
+
+ const struct option *popt, *match = NULL, *match2 = NULL;
+ const char *p, *long_prefix = "--";
+ size_t optlength;
+ int opt = '?';
+ int required = 0;
+
+ cpio->optarg = NULL;
+
+ /* First time through, initialize everything. */
+ if (state == state_start) {
+ /* Skip program name. */
+ ++cpio->argv;
+ --cpio->argc;
+ state = state_next_word;
+ }
+
+ /*
+ * We're ready to look at the next word in argv.
+ */
+ if (state == state_next_word) {
+ /* No more arguments, so no more options. */
+ if (cpio->argv[0] == NULL)
+ return (-1);
+ /* Doesn't start with '-', so no more options. */
+ if (cpio->argv[0][0] != '-')
+ return (-1);
+ /* "--" marks end of options; consume it and return. */
+ if (strcmp(cpio->argv[0], "--") == 0) {
+ ++cpio->argv;
+ --cpio->argc;
+ return (-1);
+ }
+ /* Get next word for parsing. */
+ opt_word = *cpio->argv++;
+ --cpio->argc;
+ if (opt_word[1] == '-') {
+ /* Set up long option parser. */
+ state = state_long;
+ opt_word += 2; /* Skip leading '--' */
+ } else {
+ /* Set up short option parser. */
+ state = state_short;
+ ++opt_word; /* Skip leading '-' */
+ }
+ }
+
+ /*
+ * We're parsing a group of POSIX-style single-character options.
+ */
+ if (state == state_short) {
+ /* Peel next option off of a group of short options. */
+ opt = *opt_word++;
+ if (opt == '\0') {
+ /* End of this group; recurse to get next option. */
+ state = state_next_word;
+ return cpio_getopt(cpio);
+ }
+
+ /* 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, opt_word already points to it. */
+ if (opt_word[0] == '\0') {
+ /* Otherwise, pick up the next word. */
+ opt_word = *cpio->argv;
+ if (opt_word == NULL) {
+ lafe_warnc(0,
+ "Option -%c requires an argument",
+ opt);
+ return ('?');
+ }
+ ++cpio->argv;
+ --cpio->argc;
+ }
+ if (opt == 'W') {
+ state = state_long;
+ long_prefix = "-W "; /* For clearer errors. */
+ } else {
+ state = state_next_word;
+ cpio->optarg = opt_word;
+ }
+ }
+ }
+
+ /* We're reading a long option, including -W long=arg convention. */
+ if (state == state_long) {
+ /* After this long option, we'll be starting a new word. */
+ state = state_next_word;
+
+ /* Option name ends at '=' if there is one. */
+ p = strchr(opt_word, '=');
+ if (p != NULL) {
+ optlength = (size_t)(p - opt_word);
+ cpio->optarg = (char *)(uintptr_t)(p + 1);
+ } else {
+ optlength = strlen(opt_word);
+ }
+
+ /* Search the table for an unambiguous match. */
+ for (popt = cpio_longopts; popt->name != NULL; popt++) {
+ /* Short-circuit if first chars don't match. */
+ if (popt->name[0] != opt_word[0])
+ continue;
+ /* If option is a prefix of name in table, record it.*/
+ if (strncmp(opt_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, opt_word);
+ return ('?');
+ }
+ if (match2 != NULL) {
+ lafe_warnc(0,
+ "Ambiguous option %s%s (matches --%s and --%s)",
+ long_prefix, opt_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 (cpio->optarg == NULL) {
+ cpio->optarg = *cpio->argv;
+ if (cpio->optarg == NULL) {
+ lafe_warnc(0,
+ "Option %s%s requires an argument",
+ long_prefix, match->name);
+ return ('?');
+ }
+ ++cpio->argv;
+ --cpio->argc;
+ }
+ } else {
+ /* Argument forbidden: fail if there is one. */
+ if (cpio->optarg != NULL) {
+ lafe_warnc(0,
+ "Option %s%s does not allow an argument",
+ long_prefix, match->name);
+ return ('?');
+ }
+ }
+ return (match->equivalent);
+ }
+
+ return (opt);
+}
+
+
+/*
+ * Parse the argument to the -R or --owner flag.
+ *
+ * The format is one of the following:
+ * <username|uid> - Override user but not group
+ * <username>: - Override both, group is user's default group
+ * <uid>: - Override user but not group
+ * <username|uid>:<groupname|gid> - Override both
+ * :<groupname|gid> - Override group but not user
+ *
+ * Where uid/gid are decimal representations and groupname/username
+ * are names to be looked up in system database. Note that we try
+ * to look up an argument as a name first, then try numeric parsing.
+ *
+ * A period can be used instead of the colon.
+ *
+ * Sets uid/gid return as appropriate, -1 indicates uid/gid not specified.
+ *
+ * Returns NULL if no error, otherwise returns error string for display.
+ *
+ */
+const char *
+owner_parse(const char *spec, int *uid, int *gid)
+{
+ static char errbuff[128];
+ const char *u, *ue, *g;
+
+ *uid = -1;
+ *gid = -1;
+
+ if (spec[0] == '\0')
+ return ("Invalid empty user/group spec");
+
+ /*
+ * Split spec into [user][:.][group]
+ * u -> first char of username, NULL if no username
+ * ue -> first char after username (colon, period, or \0)
+ * g -> first char of group name
+ */
+ if (*spec == ':' || *spec == '.') {
+ /* If spec starts with ':' or '.', then just group. */
+ ue = u = NULL;
+ g = spec + 1;
+ } else {
+ /* Otherwise, [user] or [user][:] or [user][:][group] */
+ ue = u = spec;
+ while (*ue != ':' && *ue != '.' && *ue != '\0')
+ ++ue;
+ g = ue;
+ if (*g != '\0') /* Skip : or . to find first char of group. */
+ ++g;
+ }
+
+ if (u != NULL) {
+ /* Look up user: ue is first char after end of user. */
+ char *user;
+ struct passwd *pwent;
+
+ user = (char *)malloc(ue - u + 1);
+ if (user == NULL)
+ return ("Couldn't allocate memory");
+ memcpy(user, u, ue - u);
+ user[ue - u] = '\0';
+ if ((pwent = getpwnam(user)) != NULL) {
+ *uid = pwent->pw_uid;
+ if (*ue != '\0')
+ *gid = pwent->pw_gid;
+ } else {
+ char *end;
+ errno = 0;
+ *uid = strtoul(user, &end, 10);
+ if (errno || *end != '\0') {
+ snprintf(errbuff, sizeof(errbuff),
+ "Couldn't lookup user ``%s''", user);
+ errbuff[sizeof(errbuff) - 1] = '\0';
+ return (errbuff);
+ }
+ }
+ free(user);
+ }
+
+ if (*g != '\0') {
+ struct group *grp;
+ if ((grp = getgrnam(g)) != NULL) {
+ *gid = grp->gr_gid;
+ } else {
+ char *end;
+ errno = 0;
+ *gid = strtoul(g, &end, 10);
+ if (errno || *end != '\0') {
+ snprintf(errbuff, sizeof(errbuff),
+ "Couldn't lookup group ``%s''", g);
+ errbuff[sizeof(errbuff) - 1] = '\0';
+ return (errbuff);
+ }
+ }
+ }
+ return (NULL);
+}
diff --git a/archivers/libarchive/files/cpio/cpio.c b/archivers/libarchive/files/cpio/cpio.c
new file mode 100644
index 00000000000..7d5031bbcd8
--- /dev/null
+++ b/archivers/libarchive/files/cpio/cpio.c
@@ -0,0 +1,1267 @@
+/*-
+ * 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
+ * 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.
+ */
+
+
+#include "cpio_platform.h"
+__FBSDID("$FreeBSD: src/usr.bin/cpio/cpio.c,v 1.15 2008/12/06 07:30:40 kientzle Exp $");
+
+#include <sys/types.h>
+#include <archive.h>
+#include <archive_entry.h>
+
+#ifdef HAVE_SYS_MKDEV_H
+#include <sys/mkdev.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
+#include "cpio.h"
+#include "err.h"
+#include "line_reader.h"
+#include "matching.h"
+
+/* Fixed size of uname/gname caches. */
+#define name_cache_size 101
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+struct name_cache {
+ int probes;
+ int hits;
+ size_t size;
+ struct {
+ id_t id;
+ char *name;
+ } cache[name_cache_size];
+};
+
+static int extract_data(struct archive *, struct archive *);
+const char * cpio_i64toa(int64_t);
+static const char *cpio_rename(const char *name);
+static int entry_to_archive(struct cpio *, struct archive_entry *);
+static int file_to_archive(struct cpio *, const char *);
+static void free_cache(struct name_cache *cache);
+static void list_item_verbose(struct cpio *, struct archive_entry *);
+static void long_help(void);
+static const char *lookup_gname(struct cpio *, gid_t gid);
+static int lookup_gname_helper(struct cpio *,
+ const char **name, id_t gid);
+static const char *lookup_uname(struct cpio *, uid_t uid);
+static int lookup_uname_helper(struct cpio *,
+ const char **name, id_t uid);
+static void mode_in(struct cpio *);
+static void mode_list(struct cpio *);
+static void mode_out(struct cpio *);
+static void mode_pass(struct cpio *, const char *);
+static int restore_time(struct cpio *, struct archive_entry *,
+ const char *, int fd);
+static void usage(void);
+static void version(void);
+
+int
+main(int argc, char *argv[])
+{
+ static char buff[16384];
+ struct cpio _cpio; /* Allocated on stack. */
+ struct cpio *cpio;
+ const char *errmsg;
+ int uid, gid;
+ int opt;
+
+ cpio = &_cpio;
+ memset(cpio, 0, sizeof(*cpio));
+ cpio->buff = buff;
+ cpio->buff_size = sizeof(buff);
+
+ /* Need lafe_progname before calling lafe_warnc. */
+ if (*argv == NULL)
+ lafe_progname = "bsdcpio";
+ else {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ lafe_progname = strrchr(*argv, '\\');
+#else
+ lafe_progname = strrchr(*argv, '/');
+#endif
+ if (lafe_progname != NULL)
+ lafe_progname++;
+ else
+ lafe_progname = *argv;
+ }
+
+ cpio->uid_override = -1;
+ cpio->gid_override = -1;
+ cpio->argv = argv;
+ cpio->argc = argc;
+ cpio->mode = '\0';
+ cpio->verbose = 0;
+ cpio->compress = '\0';
+ cpio->extract_flags = ARCHIVE_EXTRACT_NO_AUTODIR;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_PERM;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_FFLAGS;
+ cpio->extract_flags |= ARCHIVE_EXTRACT_ACL;
+#if !defined(_WIN32) && !defined(__CYGWIN__)
+ if (geteuid() == 0)
+ cpio->extract_flags |= ARCHIVE_EXTRACT_OWNER;
+#endif
+ cpio->bytes_per_block = 512;
+ cpio->filename = NULL;
+
+ while ((opt = cpio_getopt(cpio)) != -1) {
+ switch (opt) {
+ case '0': /* GNU convention: --null, -0 */
+ cpio->option_null = 1;
+ break;
+ case 'A': /* NetBSD/OpenBSD */
+ cpio->option_append = 1;
+ break;
+ case 'a': /* POSIX 1997 */
+ cpio->option_atime_restore = 1;
+ break;
+ case 'B': /* POSIX 1997 */
+ cpio->bytes_per_block = 5120;
+ break;
+ case 'C': /* NetBSD/OpenBSD */
+ cpio->bytes_per_block = atoi(cpio->optarg);
+ if (cpio->bytes_per_block <= 0)
+ lafe_errc(1, 0, "Invalid blocksize %s", cpio->optarg);
+ break;
+ case 'c': /* POSIX 1997 */
+ cpio->format = "odc";
+ break;
+ case 'd': /* POSIX 1997 */
+ cpio->extract_flags &= ~ARCHIVE_EXTRACT_NO_AUTODIR;
+ break;
+ case 'E': /* NetBSD/OpenBSD */
+ lafe_include_from_file(&cpio->matching,
+ cpio->optarg, cpio->option_null);
+ break;
+ case 'F': /* NetBSD/OpenBSD/GNU cpio */
+ cpio->filename = cpio->optarg;
+ break;
+ case 'f': /* POSIX 1997 */
+ lafe_exclude(&cpio->matching, cpio->optarg);
+ break;
+ case 'H': /* GNU cpio (also --format) */
+ cpio->format = cpio->optarg;
+ break;
+ case 'h':
+ long_help();
+ break;
+ case 'I': /* NetBSD/OpenBSD */
+ cpio->filename = cpio->optarg;
+ break;
+ case 'i': /* POSIX 1997 */
+ if (cpio->mode != '\0')
+ lafe_errc(1, 0,
+ "Cannot use both -i and -%c", cpio->mode);
+ cpio->mode = opt;
+ break;
+ case 'J': /* GNU tar, others */
+ cpio->compress = opt;
+ break;
+ case 'j': /* GNU tar, others */
+ cpio->compress = opt;
+ break;
+ case OPTION_INSECURE:
+ cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_SYMLINKS;
+ cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ break;
+ case 'L': /* GNU cpio */
+ cpio->option_follow_links = 1;
+ break;
+ case 'l': /* POSIX 1997 */
+ cpio->option_link = 1;
+ break;
+ case OPTION_LZMA: /* GNU tar, others */
+ cpio->compress = opt;
+ break;
+ case 'm': /* POSIX 1997 */
+ cpio->extract_flags |= ARCHIVE_EXTRACT_TIME;
+ break;
+ case 'n': /* GNU cpio */
+ cpio->option_numeric_uid_gid = 1;
+ break;
+ case OPTION_NO_PRESERVE_OWNER: /* GNU cpio */
+ cpio->extract_flags &= ~ARCHIVE_EXTRACT_OWNER;
+ break;
+ case 'O': /* GNU cpio */
+ cpio->filename = cpio->optarg;
+ break;
+ case 'o': /* POSIX 1997 */
+ if (cpio->mode != '\0')
+ lafe_errc(1, 0,
+ "Cannot use both -o and -%c", cpio->mode);
+ cpio->mode = opt;
+ break;
+ case 'p': /* POSIX 1997 */
+ if (cpio->mode != '\0')
+ lafe_errc(1, 0,
+ "Cannot use both -p and -%c", cpio->mode);
+ cpio->mode = opt;
+ cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT;
+ break;
+ case OPTION_PRESERVE_OWNER:
+ cpio->extract_flags |= ARCHIVE_EXTRACT_OWNER;
+ break;
+ case OPTION_QUIET: /* GNU cpio */
+ cpio->quiet = 1;
+ break;
+ case 'R': /* GNU cpio, also --owner */
+ errmsg = owner_parse(cpio->optarg, &uid, &gid);
+ if (errmsg) {
+ lafe_warnc(-1, "%s", errmsg);
+ usage();
+ }
+ if (uid != -1)
+ cpio->uid_override = uid;
+ if (gid != -1)
+ cpio->gid_override = gid;
+ break;
+ case 'r': /* POSIX 1997 */
+ cpio->option_rename = 1;
+ break;
+ case 't': /* POSIX 1997 */
+ cpio->option_list = 1;
+ break;
+ case 'u': /* POSIX 1997 */
+ cpio->extract_flags
+ &= ~ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
+ break;
+ case 'v': /* POSIX 1997 */
+ cpio->verbose++;
+ break;
+ case OPTION_VERSION: /* GNU convention */
+ version();
+ break;
+#if 0
+ /*
+ * cpio_getopt() handles -W specially, so it's not
+ * available here.
+ */
+ case 'W': /* Obscure, but useful GNU convention. */
+ break;
+#endif
+ case 'y': /* tar convention */
+ cpio->compress = opt;
+ break;
+ case 'Z': /* tar convention */
+ cpio->compress = opt;
+ break;
+ case 'z': /* tar convention */
+ cpio->compress = opt;
+ break;
+ default:
+ usage();
+ }
+ }
+
+ /*
+ * Sanity-check args, error out on nonsensical combinations.
+ */
+ /* -t implies -i if no mode was specified. */
+ if (cpio->option_list && cpio->mode == '\0')
+ cpio->mode = 'i';
+ /* -t requires -i */
+ if (cpio->option_list && cpio->mode != 'i')
+ lafe_errc(1, 0, "Option -t requires -i");
+ /* -n requires -it */
+ if (cpio->option_numeric_uid_gid && !cpio->option_list)
+ lafe_errc(1, 0, "Option -n requires -it");
+ /* Can only specify format when writing */
+ if (cpio->format != NULL && cpio->mode != 'o')
+ lafe_errc(1, 0, "Option --format requires -o");
+ /* -l requires -p */
+ if (cpio->option_link && cpio->mode != 'p')
+ lafe_errc(1, 0, "Option -l requires -p");
+ /* TODO: Flag other nonsensical combinations. */
+
+ switch (cpio->mode) {
+ case 'o':
+ /* TODO: Implement old binary format in libarchive,
+ use that here. */
+ if (cpio->format == NULL)
+ cpio->format = "odc"; /* Default format */
+
+ mode_out(cpio);
+ break;
+ case 'i':
+ while (*cpio->argv != NULL) {
+ lafe_include(&cpio->matching, *cpio->argv);
+ --cpio->argc;
+ ++cpio->argv;
+ }
+ if (cpio->option_list)
+ mode_list(cpio);
+ else
+ mode_in(cpio);
+ break;
+ case 'p':
+ if (*cpio->argv == NULL || **cpio->argv == '\0')
+ lafe_errc(1, 0,
+ "-p mode requires a target directory");
+ mode_pass(cpio, *cpio->argv);
+ break;
+ default:
+ lafe_errc(1, 0,
+ "Must specify at least one of -i, -o, or -p");
+ }
+
+ free_cache(cpio->gname_cache);
+ free_cache(cpio->uname_cache);
+ return (cpio->return_value);
+}
+
+static void
+usage(void)
+{
+ const char *p;
+
+ p = lafe_progname;
+
+ fprintf(stderr, "Brief Usage:\n");
+ fprintf(stderr, " List: %s -it < archive\n", p);
+ fprintf(stderr, " Extract: %s -i < archive\n", p);
+ fprintf(stderr, " Create: %s -o < filenames > archive\n", p);
+ fprintf(stderr, " Help: %s --help\n", p);
+ exit(1);
+}
+
+static const char *long_help_msg =
+ "First option must be a mode specifier:\n"
+ " -i Input -o Output -p Pass\n"
+ "Common Options:\n"
+ " -v Verbose\n"
+ "Create: %p -o [options] < [list of files] > [archive]\n"
+ " -J,-y,-z,--lzma Compress archive with xz/bzip2/gzip/lzma\n"
+ " --format {odc|newc|ustar} Select archive format\n"
+ "List: %p -it < [archive]\n"
+ "Extract: %p -i [options] < [archive]\n";
+
+
+/*
+ * Note that the word 'bsdcpio' will always appear in the first line
+ * of output.
+ *
+ * In particular, /bin/sh scripts that need to test for the presence
+ * of bsdcpio can use the following template:
+ *
+ * if (cpio --help 2>&1 | grep bsdcpio >/dev/null 2>&1 ) then \
+ * echo bsdcpio; else echo not bsdcpio; fi
+ */
+static void
+long_help(void)
+{
+ const char *prog;
+ const char *p;
+
+ prog = lafe_progname;
+
+ fflush(stderr);
+
+ p = (strcmp(prog,"bsdcpio") != 0) ? "(bsdcpio)" : "";
+ printf("%s%s: manipulate archive files\n", prog, p);
+
+ for (p = long_help_msg; *p != '\0'; p++) {
+ if (*p == '%') {
+ if (p[1] == 'p') {
+ fputs(prog, stdout);
+ p++;
+ } else
+ putchar('%');
+ } else
+ putchar(*p);
+ }
+ version();
+}
+
+static void
+version(void)
+{
+ fprintf(stdout,"bsdcpio %s -- %s\n",
+ BSDCPIO_VERSION_STRING,
+ archive_version());
+ exit(0);
+}
+
+static void
+mode_out(struct cpio *cpio)
+{
+ struct archive_entry *entry, *spare;
+ struct lafe_line_reader *lr;
+ const char *p;
+ int r;
+
+ if (cpio->option_append)
+ lafe_errc(1, 0, "Append mode not yet supported.");
+
+ cpio->archive_read_disk = archive_read_disk_new();
+ if (cpio->archive_read_disk == NULL)
+ lafe_errc(1, 0, "Failed to allocate archive object");
+ if (cpio->option_follow_links)
+ archive_read_disk_set_symlink_logical(cpio->archive_read_disk);
+ else
+ archive_read_disk_set_symlink_physical(cpio->archive_read_disk);
+ archive_read_disk_set_standard_lookup(cpio->archive_read_disk);
+
+ cpio->archive = archive_write_new();
+ if (cpio->archive == NULL)
+ lafe_errc(1, 0, "Failed to allocate archive object");
+ switch (cpio->compress) {
+ case 'J':
+ r = archive_write_set_compression_xz(cpio->archive);
+ break;
+ case OPTION_LZMA:
+ r = archive_write_set_compression_lzma(cpio->archive);
+ break;
+ case 'j': case 'y':
+ r = archive_write_set_compression_bzip2(cpio->archive);
+ break;
+ case 'z':
+ r = archive_write_set_compression_gzip(cpio->archive);
+ break;
+ case 'Z':
+ r = archive_write_set_compression_compress(cpio->archive);
+ break;
+ default:
+ r = archive_write_set_compression_none(cpio->archive);
+ break;
+ }
+ if (r < ARCHIVE_WARN)
+ lafe_errc(1, 0, "Requested compression not available");
+ r = archive_write_set_format_by_name(cpio->archive, cpio->format);
+ if (r != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
+ archive_write_set_bytes_per_block(cpio->archive, cpio->bytes_per_block);
+ cpio->linkresolver = archive_entry_linkresolver_new();
+ archive_entry_linkresolver_set_strategy(cpio->linkresolver,
+ archive_format(cpio->archive));
+
+ /*
+ * The main loop: Copy each file into the output archive.
+ */
+ r = archive_write_open_file(cpio->archive, cpio->filename);
+ if (r != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
+ lr = lafe_line_reader("-", cpio->option_null);
+ while ((p = lafe_line_reader_next(lr)) != NULL)
+ file_to_archive(cpio, p);
+ lafe_line_reader_free(lr);
+
+ /*
+ * The hardlink detection may have queued up a couple of entries
+ * that can now be flushed.
+ */
+ entry = NULL;
+ archive_entry_linkify(cpio->linkresolver, &entry, &spare);
+ while (entry != NULL) {
+ entry_to_archive(cpio, entry);
+ archive_entry_free(entry);
+ entry = NULL;
+ archive_entry_linkify(cpio->linkresolver, &entry, &spare);
+ }
+
+ r = archive_write_close(cpio->archive);
+ if (r != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
+
+ if (!cpio->quiet) {
+ int64_t blocks =
+ (archive_position_uncompressed(cpio->archive) + 511)
+ / 512;
+ fprintf(stderr, "%lu %s\n", (unsigned long)blocks,
+ blocks == 1 ? "block" : "blocks");
+ }
+ archive_write_finish(cpio->archive);
+}
+
+/*
+ * This is used by both out mode (to copy objects from disk into
+ * an archive) and pass mode (to copy objects from disk to
+ * an archive_write_disk "archive").
+ */
+static int
+file_to_archive(struct cpio *cpio, const char *srcpath)
+{
+ const char *destpath;
+ struct archive_entry *entry, *spare;
+ size_t len;
+ const char *p;
+ int r;
+
+ /*
+ * Create an archive_entry describing the source file.
+ *
+ */
+ entry = archive_entry_new();
+ if (entry == NULL)
+ lafe_errc(1, 0, "Couldn't allocate entry");
+ archive_entry_copy_sourcepath(entry, srcpath);
+ r = archive_read_disk_entry_from_file(cpio->archive_read_disk,
+ entry, -1, NULL);
+ if (r < ARCHIVE_FAILED)
+ lafe_errc(1, 0, "%s",
+ archive_error_string(cpio->archive_read_disk));
+ if (r < ARCHIVE_OK)
+ lafe_warnc(0, "%s",
+ archive_error_string(cpio->archive_read_disk));
+ if (r <= ARCHIVE_FAILED) {
+ cpio->return_value = 1;
+ return (r);
+ }
+
+ if (cpio->uid_override >= 0)
+ archive_entry_set_uid(entry, cpio->uid_override);
+ if (cpio->gid_override >= 0)
+ archive_entry_set_gid(entry, cpio->gid_override);
+
+ /*
+ * Generate a destination path for this entry.
+ * "destination path" is the name to which it will be copied in
+ * pass mode or the name that will go into the archive in
+ * output mode.
+ */
+ destpath = srcpath;
+ if (cpio->destdir) {
+ len = strlen(cpio->destdir) + strlen(srcpath) + 8;
+ if (len >= cpio->pass_destpath_alloc) {
+ while (len >= cpio->pass_destpath_alloc) {
+ cpio->pass_destpath_alloc += 512;
+ cpio->pass_destpath_alloc *= 2;
+ }
+ free(cpio->pass_destpath);
+ cpio->pass_destpath = malloc(cpio->pass_destpath_alloc);
+ if (cpio->pass_destpath == NULL)
+ lafe_errc(1, ENOMEM,
+ "Can't allocate path buffer");
+ }
+ strcpy(cpio->pass_destpath, cpio->destdir);
+ p = srcpath;
+ while (p[0] == '/')
+ ++p;
+ strcat(cpio->pass_destpath, p);
+ destpath = cpio->pass_destpath;
+ }
+ if (cpio->option_rename)
+ destpath = cpio_rename(destpath);
+ if (destpath == NULL)
+ return (0);
+ archive_entry_copy_pathname(entry, destpath);
+
+ /*
+ * If we're trying to preserve hardlinks, match them here.
+ */
+ spare = NULL;
+ if (cpio->linkresolver != NULL
+ && archive_entry_filetype(entry) != AE_IFDIR) {
+ archive_entry_linkify(cpio->linkresolver, &entry, &spare);
+ }
+
+ if (entry != NULL) {
+ r = entry_to_archive(cpio, entry);
+ archive_entry_free(entry);
+ if (spare != NULL) {
+ if (r == 0)
+ r = entry_to_archive(cpio, spare);
+ archive_entry_free(spare);
+ }
+ }
+ return (r);
+}
+
+static int
+entry_to_archive(struct cpio *cpio, struct archive_entry *entry)
+{
+ const char *destpath = archive_entry_pathname(entry);
+ const char *srcpath = archive_entry_sourcepath(entry);
+ int fd = -1;
+ ssize_t bytes_read;
+ int r;
+
+ /* Print out the destination name to the user. */
+ if (cpio->verbose)
+ fprintf(stderr,"%s", destpath);
+
+ /*
+ * Option_link only makes sense in pass mode and for
+ * regular files. Also note: if a link operation fails
+ * because of cross-device restrictions, we'll fall back
+ * to copy mode for that entry.
+ *
+ * TODO: Test other cpio implementations to see if they
+ * hard-link anything other than regular files here.
+ */
+ if (cpio->option_link
+ && archive_entry_filetype(entry) == AE_IFREG)
+ {
+ struct archive_entry *t;
+ /* Save the original entry in case we need it later. */
+ t = archive_entry_clone(entry);
+ if (t == NULL)
+ lafe_errc(1, ENOMEM, "Can't create link");
+ /* Note: link(2) doesn't create parent directories,
+ * so we use archive_write_header() instead as a
+ * convenience. */
+ archive_entry_set_hardlink(t, srcpath);
+ /* This is a straight link that carries no data. */
+ archive_entry_set_size(t, 0);
+ r = archive_write_header(cpio->archive, t);
+ archive_entry_free(t);
+ if (r != ARCHIVE_OK)
+ lafe_warnc(archive_errno(cpio->archive),
+ "%s", archive_error_string(cpio->archive));
+ if (r == ARCHIVE_FATAL)
+ exit(1);
+#ifdef EXDEV
+ if (r != ARCHIVE_OK && archive_errno(cpio->archive) == EXDEV) {
+ /* Cross-device link: Just fall through and use
+ * the original entry to copy the file over. */
+ lafe_warnc(0, "Copying file instead");
+ } else
+#endif
+ return (0);
+ }
+
+ /*
+ * Make sure we can open the file (if necessary) before
+ * trying to write the header.
+ */
+ if (archive_entry_filetype(entry) == AE_IFREG) {
+ if (archive_entry_size(entry) > 0) {
+ fd = open(srcpath, O_RDONLY | O_BINARY);
+ if (fd < 0) {
+ lafe_warnc(errno,
+ "%s: could not open file", srcpath);
+ goto cleanup;
+ }
+ }
+ } else {
+ archive_entry_set_size(entry, 0);
+ }
+
+ r = archive_write_header(cpio->archive, entry);
+
+ if (r != ARCHIVE_OK)
+ lafe_warnc(archive_errno(cpio->archive),
+ "%s: %s",
+ srcpath,
+ archive_error_string(cpio->archive));
+
+ if (r == ARCHIVE_FATAL)
+ exit(1);
+
+ if (r >= ARCHIVE_WARN && fd >= 0) {
+ bytes_read = read(fd, cpio->buff, cpio->buff_size);
+ while (bytes_read > 0) {
+ r = archive_write_data(cpio->archive,
+ cpio->buff, bytes_read);
+ if (r < 0)
+ lafe_errc(1, archive_errno(cpio->archive),
+ "%s", archive_error_string(cpio->archive));
+ if (r < bytes_read) {
+ lafe_warnc(0,
+ "Truncated write; file may have grown while being archived.");
+ }
+ bytes_read = read(fd, cpio->buff, cpio->buff_size);
+ }
+ }
+
+ fd = restore_time(cpio, entry, srcpath, fd);
+
+cleanup:
+ if (cpio->verbose)
+ fprintf(stderr,"\n");
+ if (fd >= 0)
+ close(fd);
+ return (0);
+}
+
+static int
+restore_time(struct cpio *cpio, struct archive_entry *entry,
+ const char *name, int fd)
+{
+#ifndef HAVE_UTIMES
+ static int warned = 0;
+
+ (void)cpio; /* UNUSED */
+ (void)entry; /* UNUSED */
+ (void)name; /* UNUSED */
+
+ if (!warned)
+ lafe_warnc(0, "Can't restore access times on this platform");
+ warned = 1;
+ return (fd);
+#else
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ struct __timeval times[2];
+#else
+ struct timeval times[2];
+#endif
+
+ if (!cpio->option_atime_restore)
+ return (fd);
+
+ times[1].tv_sec = archive_entry_mtime(entry);
+ times[1].tv_usec = archive_entry_mtime_nsec(entry) / 1000;
+
+ times[0].tv_sec = archive_entry_atime(entry);
+ times[0].tv_usec = archive_entry_atime_nsec(entry) / 1000;
+
+#if defined(HAVE_FUTIMES) && !defined(__CYGWIN__)
+ if (fd >= 0 && futimes(fd, times) == 0)
+ return (fd);
+#endif
+ /*
+ * Some platform cannot restore access times if the file descriptor
+ * is still opened.
+ */
+ if (fd >= 0) {
+ close(fd);
+ fd = -1;
+ }
+
+#ifdef HAVE_LUTIMES
+ if (lutimes(name, times) != 0)
+#else
+ if ((AE_IFLNK != archive_entry_filetype(entry))
+ && utimes(name, times) != 0)
+#endif
+ lafe_warnc(errno, "Can't update time for %s", name);
+#endif
+ return (fd);
+}
+
+
+static void
+mode_in(struct cpio *cpio)
+{
+ struct archive *a;
+ struct archive_entry *entry;
+ struct archive *ext;
+ const char *destpath;
+ int r;
+
+ ext = archive_write_disk_new();
+ if (ext == NULL)
+ lafe_errc(1, 0, "Couldn't allocate restore object");
+ r = archive_write_disk_set_options(ext, cpio->extract_flags);
+ if (r != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(ext));
+ a = archive_read_new();
+ if (a == NULL)
+ lafe_errc(1, 0, "Couldn't allocate archive object");
+ archive_read_support_compression_all(a);
+ archive_read_support_format_all(a);
+
+ if (archive_read_open_file(a, cpio->filename, cpio->bytes_per_block))
+ lafe_errc(1, archive_errno(a),
+ "%s", archive_error_string(a));
+ for (;;) {
+ r = archive_read_next_header(a, &entry);
+ if (r == ARCHIVE_EOF)
+ break;
+ if (r != ARCHIVE_OK) {
+ lafe_errc(1, archive_errno(a),
+ "%s", archive_error_string(a));
+ }
+ if (lafe_excluded(cpio->matching, archive_entry_pathname(entry)))
+ continue;
+ if (cpio->option_rename) {
+ destpath = cpio_rename(archive_entry_pathname(entry));
+ archive_entry_set_pathname(entry, destpath);
+ } else
+ destpath = archive_entry_pathname(entry);
+ if (destpath == NULL)
+ continue;
+ if (cpio->verbose)
+ fprintf(stdout, "%s\n", destpath);
+ if (cpio->uid_override >= 0)
+ archive_entry_set_uid(entry, cpio->uid_override);
+ if (cpio->gid_override >= 0)
+ archive_entry_set_gid(entry, cpio->gid_override);
+ r = archive_write_header(ext, entry);
+ if (r != ARCHIVE_OK) {
+ fprintf(stderr, "%s: %s\n",
+ archive_entry_pathname(entry),
+ archive_error_string(ext));
+ } else if (archive_entry_size(entry) > 0) {
+ r = extract_data(a, ext);
+ if (r != ARCHIVE_OK)
+ cpio->return_value = 1;
+ }
+ }
+ r = archive_read_close(a);
+ if (r != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(a));
+ r = archive_write_close(ext);
+ if (r != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(ext));
+ if (!cpio->quiet) {
+ int64_t blocks = (archive_position_uncompressed(a) + 511)
+ / 512;
+ fprintf(stderr, "%lu %s\n", (unsigned long)blocks,
+ blocks == 1 ? "block" : "blocks");
+ }
+ archive_read_finish(a);
+ archive_write_finish(ext);
+ exit(cpio->return_value);
+}
+
+/*
+ * Exits if there's a fatal error. Returns ARCHIVE_OK
+ * if everything is kosher.
+ */
+static int
+extract_data(struct archive *ar, struct archive *aw)
+{
+ int r;
+ size_t size;
+ const void *block;
+ off_t offset;
+
+ for (;;) {
+ r = archive_read_data_block(ar, &block, &size, &offset);
+ if (r == ARCHIVE_EOF)
+ return (ARCHIVE_OK);
+ if (r != ARCHIVE_OK) {
+ lafe_warnc(archive_errno(ar),
+ "%s", archive_error_string(ar));
+ exit(1);
+ }
+ r = archive_write_data_block(aw, block, size, offset);
+ if (r != ARCHIVE_OK) {
+ lafe_warnc(archive_errno(aw),
+ "%s", archive_error_string(aw));
+ return (r);
+ }
+ }
+}
+
+static void
+mode_list(struct cpio *cpio)
+{
+ struct archive *a;
+ struct archive_entry *entry;
+ int r;
+
+ a = archive_read_new();
+ if (a == NULL)
+ lafe_errc(1, 0, "Couldn't allocate archive object");
+ archive_read_support_compression_all(a);
+ archive_read_support_format_all(a);
+
+ if (archive_read_open_file(a, cpio->filename, cpio->bytes_per_block))
+ lafe_errc(1, archive_errno(a),
+ "%s", archive_error_string(a));
+ for (;;) {
+ r = archive_read_next_header(a, &entry);
+ if (r == ARCHIVE_EOF)
+ break;
+ if (r != ARCHIVE_OK) {
+ lafe_errc(1, archive_errno(a),
+ "%s", archive_error_string(a));
+ }
+ if (lafe_excluded(cpio->matching, archive_entry_pathname(entry)))
+ continue;
+ if (cpio->verbose)
+ list_item_verbose(cpio, entry);
+ else
+ fprintf(stdout, "%s\n", archive_entry_pathname(entry));
+ }
+ r = archive_read_close(a);
+ if (r != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(a));
+ if (!cpio->quiet) {
+ int64_t blocks = (archive_position_uncompressed(a) + 511)
+ / 512;
+ fprintf(stderr, "%lu %s\n", (unsigned long)blocks,
+ blocks == 1 ? "block" : "blocks");
+ }
+ archive_read_finish(a);
+ exit(0);
+}
+
+/*
+ * Display information about the current file.
+ *
+ * The format here roughly duplicates the output of 'ls -l'.
+ * This is based on SUSv2, where 'tar tv' is documented as
+ * listing additional information in an "unspecified format,"
+ * and 'pax -l' is documented as using the same format as 'ls -l'.
+ */
+static void
+list_item_verbose(struct cpio *cpio, struct archive_entry *entry)
+{
+ char size[32];
+ char date[32];
+ char uids[16], gids[16];
+ const char *uname, *gname;
+ FILE *out = stdout;
+ const char *fmt;
+ time_t mtime;
+ static time_t now;
+
+ if (!now)
+ time(&now);
+
+ if (cpio->option_numeric_uid_gid) {
+ /* Format numeric uid/gid for display. */
+ strcpy(uids, cpio_i64toa(archive_entry_uid(entry)));
+ uname = uids;
+ strcpy(gids, cpio_i64toa(archive_entry_gid(entry)));
+ gname = gids;
+ } else {
+ /* Use uname if it's present, else lookup name from uid. */
+ uname = archive_entry_uname(entry);
+ if (uname == NULL)
+ uname = lookup_uname(cpio, archive_entry_uid(entry));
+ /* Use gname if it's present, else lookup name from gid. */
+ gname = archive_entry_gname(entry);
+ if (gname == NULL)
+ gname = lookup_gname(cpio, archive_entry_gid(entry));
+ }
+
+ /* Print device number or file size. */
+ if (archive_entry_filetype(entry) == AE_IFCHR
+ || archive_entry_filetype(entry) == AE_IFBLK) {
+ snprintf(size, sizeof(size), "%lu,%lu",
+ (unsigned long)archive_entry_rdevmajor(entry),
+ (unsigned long)archive_entry_rdevminor(entry));
+ } else {
+ strcpy(size, cpio_i64toa(archive_entry_size(entry)));
+ }
+
+ /* Format the time using 'ls -l' conventions. */
+ mtime = archive_entry_mtime(entry);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Windows' strftime function does not support %e format. */
+ if (mtime - now > 365*86400/2
+ || mtime - now < -365*86400/2)
+ fmt = cpio->day_first ? "%d %b %Y" : "%b %d %Y";
+ else
+ fmt = cpio->day_first ? "%d %b %H:%M" : "%b %d %H:%M";
+#else
+ if (abs(mtime - now) > (365/2)*86400)
+ fmt = cpio->day_first ? "%e %b %Y" : "%b %e %Y";
+ else
+ fmt = cpio->day_first ? "%e %b %H:%M" : "%b %e %H:%M";
+#endif
+ strftime(date, sizeof(date), fmt, localtime(&mtime));
+
+ fprintf(out, "%s%3d %-8s %-8s %8s %12s %s",
+ archive_entry_strmode(entry),
+ archive_entry_nlink(entry),
+ uname, gname, size, date,
+ archive_entry_pathname(entry));
+
+ /* Extra information for links. */
+ if (archive_entry_hardlink(entry)) /* Hard link */
+ fprintf(out, " link to %s", archive_entry_hardlink(entry));
+ else if (archive_entry_symlink(entry)) /* Symbolic link */
+ fprintf(out, " -> %s", archive_entry_symlink(entry));
+ fprintf(out, "\n");
+}
+
+static void
+mode_pass(struct cpio *cpio, const char *destdir)
+{
+ struct lafe_line_reader *lr;
+ const char *p;
+ int r;
+
+ /* Ensure target dir has a trailing '/' to simplify path surgery. */
+ cpio->destdir = malloc(strlen(destdir) + 8);
+ strcpy(cpio->destdir, destdir);
+ if (destdir[strlen(destdir) - 1] != '/')
+ strcat(cpio->destdir, "/");
+
+ cpio->archive = archive_write_disk_new();
+ if (cpio->archive == NULL)
+ lafe_errc(1, 0, "Failed to allocate archive object");
+ r = archive_write_disk_set_options(cpio->archive, cpio->extract_flags);
+ if (r != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
+ cpio->linkresolver = archive_entry_linkresolver_new();
+ archive_write_disk_set_standard_lookup(cpio->archive);
+
+ cpio->archive_read_disk = archive_read_disk_new();
+ if (cpio->archive_read_disk == NULL)
+ lafe_errc(1, 0, "Failed to allocate archive object");
+ if (cpio->option_follow_links)
+ archive_read_disk_set_symlink_logical(cpio->archive_read_disk);
+ else
+ archive_read_disk_set_symlink_physical(cpio->archive_read_disk);
+ archive_read_disk_set_standard_lookup(cpio->archive_read_disk);
+
+ lr = lafe_line_reader("-", cpio->option_null);
+ while ((p = lafe_line_reader_next(lr)) != NULL)
+ file_to_archive(cpio, p);
+ lafe_line_reader_free(lr);
+
+ archive_entry_linkresolver_free(cpio->linkresolver);
+ r = archive_write_close(cpio->archive);
+ if (r != ARCHIVE_OK)
+ lafe_errc(1, 0, "%s", archive_error_string(cpio->archive));
+
+ if (!cpio->quiet) {
+ int64_t blocks =
+ (archive_position_uncompressed(cpio->archive) + 511)
+ / 512;
+ fprintf(stderr, "%lu %s\n", (unsigned long)blocks,
+ blocks == 1 ? "block" : "blocks");
+ }
+
+ archive_write_finish(cpio->archive);
+}
+
+/*
+ * Prompt for a new name for this entry. Returns a pointer to the
+ * new name or NULL if the entry should not be copied. This
+ * implements the semantics defined in POSIX.1-1996, which specifies
+ * that an input of '.' means the name should be unchanged. GNU cpio
+ * treats '.' as a literal new name.
+ */
+static const char *
+cpio_rename(const char *name)
+{
+ static char buff[1024];
+ FILE *t;
+ char *p, *ret;
+
+ t = fopen("/dev/tty", "r+");
+ if (t == NULL)
+ return (name);
+ fprintf(t, "%s (Enter/./(new name))? ", name);
+ fflush(t);
+
+ p = fgets(buff, sizeof(buff), t);
+ fclose(t);
+ if (p == NULL)
+ /* End-of-file is a blank line. */
+ return (NULL);
+
+ while (*p == ' ' || *p == '\t')
+ ++p;
+ if (*p == '\n' || *p == '\0')
+ /* Empty line. */
+ return (NULL);
+ if (*p == '.' && p[1] == '\n')
+ /* Single period preserves original name. */
+ return (name);
+ ret = p;
+ /* Trim the final newline. */
+ while (*p != '\0' && *p != '\n')
+ ++p;
+ /* Overwrite the final \n with a null character. */
+ *p = '\0';
+ return (ret);
+}
+
+static void
+free_cache(struct name_cache *cache)
+{
+ size_t i;
+
+ if (cache != NULL) {
+ for (i = 0; i < cache->size; i++)
+ free(cache->cache[i].name);
+ free(cache);
+ }
+}
+
+/*
+ * Lookup uname/gname from uid/gid, return NULL if no match.
+ */
+static const char *
+lookup_name(struct cpio *cpio, struct name_cache **name_cache_variable,
+ int (*lookup_fn)(struct cpio *, const char **, id_t), id_t id)
+{
+ char asnum[16];
+ struct name_cache *cache;
+ const char *name;
+ int slot;
+
+
+ if (*name_cache_variable == NULL) {
+ *name_cache_variable = malloc(sizeof(struct name_cache));
+ if (*name_cache_variable == NULL)
+ lafe_errc(1, ENOMEM, "No more memory");
+ memset(*name_cache_variable, 0, sizeof(struct name_cache));
+ (*name_cache_variable)->size = name_cache_size;
+ }
+
+ cache = *name_cache_variable;
+ cache->probes++;
+
+ slot = id % cache->size;
+ if (cache->cache[slot].name != NULL) {
+ if (cache->cache[slot].id == id) {
+ cache->hits++;
+ return (cache->cache[slot].name);
+ }
+ free(cache->cache[slot].name);
+ cache->cache[slot].name = NULL;
+ }
+
+ if (lookup_fn(cpio, &name, id) == 0) {
+ if (name == NULL || name[0] == '\0') {
+ /* If lookup failed, format it as a number. */
+ snprintf(asnum, sizeof(asnum), "%u", (unsigned)id);
+ name = asnum;
+ }
+ cache->cache[slot].name = strdup(name);
+ if (cache->cache[slot].name != NULL) {
+ cache->cache[slot].id = id;
+ return (cache->cache[slot].name);
+ }
+ /*
+ * Conveniently, NULL marks an empty slot, so
+ * if the strdup() fails, we've just failed to
+ * cache it. No recovery necessary.
+ */
+ }
+ return (NULL);
+}
+
+static const char *
+lookup_uname(struct cpio *cpio, uid_t uid)
+{
+ return (lookup_name(cpio, &cpio->uname_cache,
+ &lookup_uname_helper, (id_t)uid));
+}
+
+static int
+lookup_uname_helper(struct cpio *cpio, const char **name, id_t id)
+{
+ struct passwd *pwent;
+
+ (void)cpio; /* UNUSED */
+
+ errno = 0;
+ pwent = getpwuid((uid_t)id);
+ if (pwent == NULL) {
+ *name = NULL;
+ if (errno != 0 && errno != ENOENT)
+ lafe_warnc(errno, "getpwuid(%d) failed", id);
+ return (errno);
+ }
+
+ *name = pwent->pw_name;
+ return (0);
+}
+
+static const char *
+lookup_gname(struct cpio *cpio, gid_t gid)
+{
+ return (lookup_name(cpio, &cpio->gname_cache,
+ &lookup_gname_helper, (id_t)gid));
+}
+
+static int
+lookup_gname_helper(struct cpio *cpio, const char **name, id_t id)
+{
+ struct group *grent;
+
+ (void)cpio; /* UNUSED */
+
+ errno = 0;
+ grent = getgrgid((gid_t)id);
+ if (grent == NULL) {
+ *name = NULL;
+ if (errno != 0)
+ lafe_warnc(errno, "getgrgid(%d) failed", id);
+ return (errno);
+ }
+
+ *name = grent->gr_name;
+ return (0);
+}
+
+/*
+ * It would be nice to just use printf() for formatting large numbers,
+ * but the compatibility problems are a big headache. Hence the
+ * following simple utility function.
+ */
+const char *
+cpio_i64toa(int64_t n0)
+{
+ // 2^64 =~ 1.8 * 10^19, so 20 decimal digits suffice.
+ // We also need 1 byte for '-' and 1 for '\0'.
+ static char buff[22];
+ int64_t n = n0 < 0 ? -n0 : n0;
+ char *p = buff + sizeof(buff);
+
+ *--p = '\0';
+ do {
+ *--p = '0' + (int)(n % 10);
+ n /= 10;
+ } while (n > 0);
+ if (n0 < 0)
+ *--p = '-';
+ return p;
+}
diff --git a/archivers/libarchive/files/cpio/cpio.h b/archivers/libarchive/files/cpio/cpio.h
new file mode 100644
index 00000000000..3eed83494b8
--- /dev/null
+++ b/archivers/libarchive/files/cpio/cpio.h
@@ -0,0 +1,109 @@
+/*-
+ * 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/cpio/cpio.h,v 1.7 2008/12/06 07:30:40 kientzle Exp $
+ */
+
+#ifndef CPIO_H_INCLUDED
+#define CPIO_H_INCLUDED
+
+#include "cpio_platform.h"
+#include <stdio.h>
+
+#include "matching.h"
+
+/*
+ * The internal state for the "cpio" program.
+ *
+ * Keeping all of the state in a structure like this simplifies memory
+ * leak testing (at exit, anything left on the heap is suspect). A
+ * pointer to this structure is passed to most cpio internal
+ * functions.
+ */
+struct cpio {
+ /* Option parsing */
+ const char *optarg;
+
+ /* Options */
+ const char *filename;
+ char mode; /* -i -o -p */
+ char compress; /* -j, -y, or -z */
+ const char *format; /* -H format */
+ int bytes_per_block; /* -b block_size */
+ int verbose; /* -v */
+ int quiet; /* --quiet */
+ int extract_flags; /* Flags for extract operation */
+ char symlink_mode; /* H or L, per BSD conventions */
+ const char *compress_program;
+ int option_append; /* -A, only relevant for -o */
+ int option_atime_restore; /* -a */
+ int option_follow_links; /* -L */
+ int option_link; /* -l */
+ int option_list; /* -t */
+ char option_null; /* --null */
+ int option_numeric_uid_gid; /* -n */
+ int option_rename; /* -r */
+ char *destdir;
+ size_t pass_destpath_alloc;
+ char *pass_destpath;
+ int uid_override;
+ int gid_override;
+ int day_first; /* true if locale prefers day/mon */
+
+ /* If >= 0, then close this when done. */
+ int fd;
+
+ /* Miscellaneous state information */
+ struct archive *archive;
+ struct archive *archive_read_disk;
+ int argc;
+ char **argv;
+ int return_value; /* Value returned by main() */
+ struct archive_entry_linkresolver *linkresolver;
+
+ struct name_cache *uname_cache;
+ struct name_cache *gname_cache;
+
+ /* Work data. */
+ struct lafe_matching *matching;
+ char *buff;
+ size_t buff_size;
+};
+
+const char *owner_parse(const char *, int *, int *);
+
+
+/* Fake short equivalents for long options that otherwise lack them. */
+enum {
+ OPTION_INSECURE = 1,
+ OPTION_LZMA,
+ OPTION_NO_PRESERVE_OWNER,
+ OPTION_PRESERVE_OWNER,
+ OPTION_QUIET,
+ OPTION_VERSION
+};
+
+int cpio_getopt(struct cpio *cpio);
+
+#endif
diff --git a/archivers/libarchive/files/cpio/cpio_platform.h b/archivers/libarchive/files/cpio/cpio_platform.h
new file mode 100644
index 00000000000..31d9a738fcb
--- /dev/null
+++ b/archivers/libarchive/files/cpio/cpio_platform.h
@@ -0,0 +1,77 @@
+/*-
+ * 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/cpio/cpio_platform.h,v 1.2 2008/12/06 07:15:42 kientzle Exp $
+ */
+
+/*
+ * This header is the first thing included in any of the cpio
+ * source files. As far as possible, platform-specific issues should
+ * be dealt with here and not within individual source files.
+ */
+
+#ifndef CPIO_PLATFORM_H_INCLUDED
+#define CPIO_PLATFORM_H_INCLUDED
+
+#if defined(PLATFORM_CONFIG_H)
+/* Use hand-built config.h in environments that need it. */
+#include PLATFORM_CONFIG_H
+#else
+/* Read config.h or die trying. */
+#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. */
+#if defined(__GNUC__) && (__GNUC__ > 2 || \
+ (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
+#define __LA_DEAD __attribute__((__noreturn__))
+#else
+#define __LA_DEAD
+#endif
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#include "cpio_windows.h"
+#endif
+
+#endif /* !CPIO_PLATFORM_H_INCLUDED */
diff --git a/archivers/libarchive/files/cpio/test/list.h b/archivers/libarchive/files/cpio/test/list.h
new file mode 100644
index 00000000000..55968c363fa
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/list.h
@@ -0,0 +1,27 @@
+DEFINE_TEST(test_0)
+DEFINE_TEST(test_basic)
+DEFINE_TEST(test_cmdline)
+DEFINE_TEST(test_format_newc)
+DEFINE_TEST(test_gcpio_compat)
+DEFINE_TEST(test_option_B_upper)
+DEFINE_TEST(test_option_C_upper)
+DEFINE_TEST(test_option_J_upper)
+DEFINE_TEST(test_option_L_upper)
+DEFINE_TEST(test_option_Z_upper)
+DEFINE_TEST(test_option_a)
+DEFINE_TEST(test_option_c)
+DEFINE_TEST(test_option_d)
+DEFINE_TEST(test_option_f)
+DEFINE_TEST(test_option_help)
+DEFINE_TEST(test_option_l)
+DEFINE_TEST(test_option_lzma)
+DEFINE_TEST(test_option_m)
+DEFINE_TEST(test_option_t)
+DEFINE_TEST(test_option_u)
+DEFINE_TEST(test_option_version)
+DEFINE_TEST(test_option_y)
+DEFINE_TEST(test_option_z)
+DEFINE_TEST(test_owner_parse)
+DEFINE_TEST(test_passthrough_dotdot)
+DEFINE_TEST(test_passthrough_reverse)
+DEFINE_TEST(test_pathmatch)
diff --git a/archivers/libarchive/files/cpio/test/main.c b/archivers/libarchive/files/cpio/test/main.c
new file mode 100644
index 00000000000..a8b68146eb7
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/main.c
@@ -0,0 +1,2124 @@
+/*
+ * Copyright (c) 2003-2009 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"
+#include <errno.h>
+#include <locale.h>
+#include <stdarg.h>
+#include <time.h>
+
+/*
+ * This same file is used pretty much verbatim for all test harnesses.
+ *
+ * The next few lines are the only differences.
+ * TODO: Move this into a separate configuration header, have all test
+ * suites share one copy of this file.
+ */
+__FBSDID("$FreeBSD: src/usr.bin/cpio/test/main.c,v 1.3 2008/08/24 04:58:22 kientzle Exp $");
+#define KNOWNREF "test_option_f.cpio.uu"
+#define ENVBASE "BSDCPIO" /* Prefix for environment variables. */
+#define PROGRAM "bsdcpio" /* Name of program being tested. */
+#undef LIBRARY /* Not testing a library. */
+#undef EXTRA_DUMP /* How to dump extra data */
+/* How to generate extra version info. */
+#define EXTRA_VERSION (systemf("%s --version", testprog) ? "" : "")
+
+/*
+ *
+ * Windows support routines
+ *
+ * Note: Configuration is a tricky issue. Using HAVE_* feature macros
+ * in the test harness is dangerous because they cover up
+ * configuration errors. The classic example of this is omitting a
+ * configure check. If libarchive and libarchive_test both look for
+ * the same feature macro, such errors are hard to detect. Platform
+ * macros (e.g., _WIN32 or __GNUC__) are a little better, but can
+ * easily lead to very messy code. It's best to limit yourself
+ * to only the most generic programming techniques in the test harness
+ * and thus avoid conditionals altogether. Where that's not possible,
+ * try to minimize conditionals by grouping platform-specific tests in
+ * one place (e.g., test_acl_freebsd) or by adding new assert()
+ * functions (e.g., assertMakeHardlink()) to cover up platform
+ * differences. Platform-specific coding in libarchive_test is often
+ * a symptom that some capability is missing from libarchive itself.
+ */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#include <io.h>
+#include <windows.h>
+#ifndef F_OK
+#define F_OK (0)
+#endif
+#ifndef S_ISDIR
+#define S_ISDIR(m) ((m) & _S_IFDIR)
+#endif
+#ifndef S_ISREG
+#define S_ISREG(m) ((m) & _S_IFREG)
+#endif
+#if !defined(__BORLANDC__)
+#define access _access
+#define chdir _chdir
+#endif
+#ifndef fileno
+#define fileno _fileno
+#endif
+/*#define fstat _fstat64*/
+#if !defined(__BORLANDC__)
+#define getcwd _getcwd
+#endif
+#define lstat stat
+/*#define lstat _stat64*/
+/*#define stat _stat64*/
+#define rmdir _rmdir
+#if !defined(__BORLANDC__)
+#define strdup _strdup
+#define umask _umask
+#endif
+#define int64_t __int64
+#endif
+
+#if defined(HAVE__CrtSetReportMode)
+# include <crtdbg.h>
+#endif
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+void *GetFunctionKernel32(const char *name)
+{
+ static HINSTANCE lib;
+ static int set;
+ if (!set) {
+ set = 1;
+ lib = LoadLibrary("kernel32.dll");
+ }
+ if (lib == NULL) {
+ fprintf(stderr, "Can't load kernel32.dll?!\n");
+ exit(1);
+ }
+ return (void *)GetProcAddress(lib, name);
+}
+
+static int
+my_CreateSymbolicLinkA(const char *linkname, const char *target, int flags)
+{
+ static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, DWORD);
+ static int set;
+ if (!set) {
+ set = 1;
+ f = GetFunctionKernel32("CreateSymbolicLinkA");
+ }
+ return f == NULL ? 0 : (*f)(linkname, target, flags);
+}
+
+static int
+my_CreateHardLinkA(const char *linkname, const char *target)
+{
+ static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES);
+ static int set;
+ if (!set) {
+ set = 1;
+ f = GetFunctionKernel32("CreateHardLinkA");
+ }
+ return f == NULL ? 0 : (*f)(linkname, target, NULL);
+}
+
+int
+my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi)
+{
+ HANDLE h;
+ int r;
+
+ memset(bhfi, 0, sizeof(*bhfi));
+ h = CreateFile(path, FILE_READ_ATTRIBUTES, 0, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (h == INVALID_HANDLE_VALUE)
+ return (0);
+ r = GetFileInformationByHandle(h, bhfi);
+ CloseHandle(h);
+ return (r);
+}
+#endif
+
+#if defined(HAVE__CrtSetReportMode)
+static void
+invalid_parameter_handler(const wchar_t * expression,
+ const wchar_t * function, const wchar_t * file,
+ unsigned int line, uintptr_t pReserved)
+{
+ /* nop */
+}
+#endif
+
+/*
+ *
+ * OPTIONS FLAGS
+ *
+ */
+
+/* Enable core dump on failure. */
+static int dump_on_failure = 0;
+/* Default is to remove temp dirs and log data for successful tests. */
+static int keep_temp_files = 0;
+/* Default is to just report pass/fail for each test. */
+static int verbosity = 0;
+#define VERBOSITY_SUMMARY_ONLY -1 /* -q */
+#define VERBOSITY_PASSFAIL 0 /* Default */
+#define VERBOSITY_LIGHT_REPORT 1 /* -v */
+#define VERBOSITY_FULL 2 /* -vv */
+/* A few places generate even more output for verbosity > VERBOSITY_FULL,
+ * mostly for debugging the test harness itself. */
+/* Cumulative count of assertion failures. */
+static int failures = 0;
+/* Cumulative count of reported skips. */
+static int skips = 0;
+/* Cumulative count of assertions checked. */
+static int assertions = 0;
+
+/* Directory where uuencoded reference files can be found. */
+static const char *refdir;
+
+/*
+ * Report log information selectively to console and/or disk log.
+ */
+static int log_console = 0;
+static FILE *logfile;
+static void
+vlogprintf(const char *fmt, va_list ap)
+{
+#ifdef va_copy
+ va_list lfap;
+ va_copy(lfap, ap);
+#endif
+ if (log_console)
+ vfprintf(stdout, fmt, ap);
+ if (logfile != NULL)
+#ifdef va_copy
+ vfprintf(logfile, fmt, lfap);
+ va_end(lfap);
+#else
+ vfprintf(logfile, fmt, ap);
+#endif
+}
+
+static void
+logprintf(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vlogprintf(fmt, ap);
+ va_end(ap);
+}
+
+/* Set up a message to display only if next assertion fails. */
+static char msgbuff[4096];
+static const char *msg, *nextmsg;
+void
+failure(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vsprintf(msgbuff, fmt, ap);
+ va_end(ap);
+ nextmsg = msgbuff;
+}
+
+/*
+ * Copy arguments into file-local variables.
+ * This was added to permit vararg assert() functions without needing
+ * variadic wrapper macros. Turns out that the vararg capability is almost
+ * never used, so almost all of the vararg assertions can be simplified
+ * by removing the vararg capability and reworking the wrapper macro to
+ * pass __FILE__, __LINE__ directly into the function instead of using
+ * this hook. I suspect this machinery is used so rarely that we
+ * would be better off just removing it entirely. That would simplify
+ * the code here noticably.
+ */
+static const char *test_filename;
+static int test_line;
+static void *test_extra;
+void assertion_setup(const char *filename, int line)
+{
+ test_filename = filename;
+ test_line = line;
+}
+
+/* Called at the beginning of each assert() function. */
+static void
+assertion_count(const char *file, int line)
+{
+ (void)file; /* UNUSED */
+ (void)line; /* UNUSED */
+ ++assertions;
+ /* Proper handling of "failure()" message. */
+ msg = nextmsg;
+ nextmsg = NULL;
+ /* Uncomment to print file:line after every assertion.
+ * Verbose, but occasionally useful in tracking down crashes. */
+ /* printf("Checked %s:%d\n", file, line); */
+}
+
+/*
+ * For each test source file, we remember how many times each
+ * assertion was reported. Cleared before each new test,
+ * used by test_summarize().
+ */
+static struct line {
+ int count;
+ int skip;
+} failed_lines[10000];
+
+/* Count this failure, setup up log destination and handle initial report. */
+static void
+failure_start(const char *filename, int line, const char *fmt, ...)
+{
+ va_list ap;
+
+ /* Record another failure for this line. */
+ ++failures;
+ /* test_filename = filename; */
+ failed_lines[line].count++;
+
+ /* Determine whether to log header to console. */
+ switch (verbosity) {
+ case VERBOSITY_FULL:
+ log_console = 1;
+ break;
+ case VERBOSITY_LIGHT_REPORT:
+ log_console = (failed_lines[line].count < 2);
+ break;
+ default:
+ log_console = 0;
+ }
+
+ /* Log file:line header for this failure */
+ va_start(ap, fmt);
+#if _MSC_VER
+ logprintf("%s(%d): ", filename, line);
+#else
+ logprintf("%s:%d: ", filename, line);
+#endif
+ vlogprintf(fmt, ap);
+ va_end(ap);
+ logprintf("\n");
+
+ if (msg != NULL && msg[0] != '\0') {
+ logprintf(" Description: %s\n", msg);
+ msg = NULL;
+ }
+
+ /* Determine whether to log details to console. */
+ if (verbosity == VERBOSITY_LIGHT_REPORT)
+ log_console = 0;
+}
+
+/* Complete reporting of failed tests. */
+/*
+ * The 'extra' hook here is used by libarchive to include libarchive
+ * error messages with assertion failures. It could also be used
+ * to add strerror() output, for example. Just define the EXTRA_DUMP()
+ * macro appropriately.
+ */
+static void
+failure_finish(void *extra)
+{
+ (void)extra; /* UNUSED (maybe) */
+#ifdef EXTRA_DUMP
+ if (extra != NULL)
+ logprintf(" detail: %s\n", EXTRA_DUMP(extra));
+#endif
+
+ if (dump_on_failure) {
+ fprintf(stderr,
+ " *** forcing core dump so failure can be debugged ***\n");
+ *(char *)(NULL) = 0;
+ exit(1);
+ }
+}
+
+/* Inform user that we're skipping some checks. */
+void
+test_skipping(const char *fmt, ...)
+{
+ char buff[1024];
+ va_list ap;
+
+ va_start(ap, fmt);
+ vsprintf(buff, fmt, ap);
+ va_end(ap);
+ /* failure_start() isn't quite right, but is awfully convenient. */
+ failure_start(test_filename, test_line, "SKIPPING: %s", buff);
+ --failures; /* Undo failures++ in failure_start() */
+ /* Don't failure_finish() here. */
+ /* Mark as skip, so doesn't count as failed test. */
+ failed_lines[test_line].skip = 1;
+ ++skips;
+}
+
+/*
+ *
+ * ASSERTIONS
+ *
+ */
+
+/* Generic assert() just displays the failed condition. */
+int
+assertion_assert(const char *file, int line, int value,
+ const char *condition, void *extra)
+{
+ assertion_count(file, line);
+ if (!value) {
+ failure_start(file, line, "Assertion failed: %s", condition);
+ failure_finish(extra);
+ }
+ return (value);
+}
+
+/* chdir() and report any errors */
+int
+assertion_chdir(const char *file, int line, const char *pathname)
+{
+ assertion_count(file, line);
+ if (chdir(pathname) == 0)
+ return (1);
+ failure_start(file, line, "chdir(\"%s\")", pathname);
+ failure_finish(NULL);
+ return (0);
+
+}
+
+/* Verify two integers are equal. */
+int
+assertion_equal_int(const char *file, int line,
+ long long v1, const char *e1, long long v2, const char *e2, void *extra)
+{
+ assertion_count(file, line);
+ if (v1 == v2)
+ return (1);
+ failure_start(file, line, "%s != %s", e1, e2);
+ logprintf(" %s=%lld (0x%llx, 0%llo)\n", e1, v1, v1, v1);
+ logprintf(" %s=%lld (0x%llx, 0%llo)\n", e2, v2, v2, v2);
+ failure_finish(extra);
+ return (0);
+}
+
+static void strdump(const char *e, const char *p)
+{
+ const char *q = p;
+
+ logprintf(" %s = ", e);
+ if (p == NULL) {
+ logprintf("NULL");
+ return;
+ }
+ logprintf("\"");
+ while (*p != '\0') {
+ unsigned int c = 0xff & *p++;
+ switch (c) {
+ case '\a': printf("\a"); break;
+ case '\b': printf("\b"); break;
+ case '\n': printf("\n"); break;
+ case '\r': printf("\r"); break;
+ default:
+ if (c >= 32 && c < 127)
+ logprintf("%c", c);
+ else
+ logprintf("\\x%02X", c);
+ }
+ }
+ logprintf("\"");
+ logprintf(" (length %d)\n", q == NULL ? -1 : (int)strlen(q));
+}
+
+/* Verify two strings are equal, dump them if not. */
+int
+assertion_equal_string(const char *file, int line,
+ const char *v1, const char *e1,
+ const char *v2, const char *e2,
+ void *extra)
+{
+ assertion_count(file, line);
+ if (v1 == v2 || (v1 != NULL && v2 != NULL && strcmp(v1, v2) == 0))
+ return (1);
+ failure_start(file, line, "%s != %s", e1, e2);
+ strdump(e1, v1);
+ strdump(e2, v2);
+ failure_finish(extra);
+ return (0);
+}
+
+static void
+wcsdump(const char *e, const wchar_t *w)
+{
+ logprintf(" %s = ", e);
+ if (w == NULL) {
+ logprintf("(null)");
+ return;
+ }
+ logprintf("\"");
+ while (*w != L'\0') {
+ unsigned int c = *w++;
+ if (c >= 32 && c < 127)
+ logprintf("%c", c);
+ else if (c < 256)
+ logprintf("\\x%02X", c);
+ else if (c < 0x10000)
+ logprintf("\\u%04X", c);
+ else
+ logprintf("\\U%08X", c);
+ }
+ logprintf("\"\n");
+}
+
+/* Verify that two wide strings are equal, dump them if not. */
+int
+assertion_equal_wstring(const char *file, int line,
+ const wchar_t *v1, const char *e1,
+ const wchar_t *v2, const char *e2,
+ void *extra)
+{
+ assertion_count(file, line);
+ if (v1 == v2 || wcscmp(v1, v2) == 0)
+ return (1);
+ failure_start(file, line, "%s != %s", e1, e2);
+ wcsdump(e1, v1);
+ wcsdump(e2, v2);
+ failure_finish(extra);
+ return (0);
+}
+
+/*
+ * Pretty standard hexdump routine. As a bonus, if ref != NULL, then
+ * any bytes in p that differ from ref will be highlighted with '_'
+ * before and after the hex value.
+ */
+static void
+hexdump(const char *p, const char *ref, size_t l, size_t offset)
+{
+ size_t i, j;
+ char sep;
+
+ if (p == NULL) {
+ logprintf("(null)\n");
+ return;
+ }
+ for(i=0; i < l; i+=16) {
+ logprintf("%04x", (unsigned)(i + offset));
+ sep = ' ';
+ for (j = 0; j < 16 && i + j < l; j++) {
+ if (ref != NULL && p[i + j] != ref[i + j])
+ sep = '_';
+ logprintf("%c%02x", sep, 0xff & (int)p[i+j]);
+ if (ref != NULL && p[i + j] == ref[i + j])
+ sep = ' ';
+ }
+ for (; j < 16; j++) {
+ logprintf("%c ", sep);
+ sep = ' ';
+ }
+ logprintf("%c", sep);
+ for (j=0; j < 16 && i + j < l; j++) {
+ int c = p[i + j];
+ if (c >= ' ' && c <= 126)
+ logprintf("%c", c);
+ else
+ logprintf(".");
+ }
+ logprintf("\n");
+ }
+}
+
+/* Verify that two blocks of memory are the same, display the first
+ * block of differences if they're not. */
+int
+assertion_equal_mem(const char *file, int line,
+ const void *_v1, const char *e1,
+ const void *_v2, const char *e2,
+ size_t l, const char *ld, void *extra)
+{
+ const char *v1 = (const char *)_v1;
+ const char *v2 = (const char *)_v2;
+ size_t offset;
+
+ assertion_count(file, line);
+ if (v1 == v2 || (v1 != NULL && v2 != NULL && memcmp(v1, v2, l) == 0))
+ return (1);
+
+ failure_start(file, line, "%s != %s", e1, e2);
+ logprintf(" size %s = %d\n", ld, (int)l);
+ /* Dump 48 bytes (3 lines) so that the first difference is
+ * in the second line. */
+ offset = 0;
+ while (l > 64 && memcmp(v1, v2, 32) == 0) {
+ /* Two lines agree, so step forward one line. */
+ v1 += 16;
+ v2 += 16;
+ l -= 16;
+ offset += 16;
+ }
+ logprintf(" Dump of %s\n", e1);
+ hexdump(v1, v2, l < 64 ? l : 64, offset);
+ logprintf(" Dump of %s\n", e2);
+ hexdump(v2, v1, l < 64 ? l : 64, offset);
+ logprintf("\n");
+ failure_finish(extra);
+ return (0);
+}
+
+/* Verify that the named file exists and is empty. */
+int
+assertion_empty_file(const char *f1fmt, ...)
+{
+ char buff[1024];
+ char f1[1024];
+ struct stat st;
+ va_list ap;
+ ssize_t s;
+ FILE *f;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, f1fmt);
+ vsprintf(f1, f1fmt, ap);
+ va_end(ap);
+
+ if (stat(f1, &st) != 0) {
+ failure_start(test_filename, test_line, "Stat failed: %s", f1);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (st.st_size == 0)
+ return (1);
+
+ failure_start(test_filename, test_line, "File should be empty: %s", f1);
+ logprintf(" File size: %d\n", (int)st.st_size);
+ logprintf(" Contents:\n");
+ f = fopen(f1, "rb");
+ if (f == NULL) {
+ logprintf(" Unable to open %s\n", f1);
+ } else {
+ s = ((off_t)sizeof(buff) < st.st_size) ?
+ (ssize_t)sizeof(buff) : (ssize_t)st.st_size;
+ s = fread(buff, 1, s, f);
+ hexdump(buff, NULL, s, 0);
+ fclose(f);
+ }
+ failure_finish(NULL);
+ return (0);
+}
+
+/* Verify that the named file exists and is not empty. */
+int
+assertion_non_empty_file(const char *f1fmt, ...)
+{
+ char f1[1024];
+ struct stat st;
+ va_list ap;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, f1fmt);
+ vsprintf(f1, f1fmt, ap);
+ va_end(ap);
+
+ if (stat(f1, &st) != 0) {
+ failure_start(test_filename, test_line, "Stat failed: %s", f1);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (st.st_size == 0) {
+ failure_start(test_filename, test_line, "File empty: %s", f1);
+ failure_finish(NULL);
+ return (0);
+ }
+ return (1);
+}
+
+/* Verify that two files have the same contents. */
+/* TODO: hexdump the first bytes that actually differ. */
+int
+assertion_equal_file(const char *fn1, const char *f2pattern, ...)
+{
+ char fn2[1024];
+ va_list ap;
+ char buff1[1024];
+ char buff2[1024];
+ FILE *f1, *f2;
+ int n1, n2;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, f2pattern);
+ vsprintf(fn2, f2pattern, ap);
+ va_end(ap);
+
+ f1 = fopen(fn1, "rb");
+ f2 = fopen(fn2, "rb");
+ for (;;) {
+ n1 = fread(buff1, 1, sizeof(buff1), f1);
+ n2 = fread(buff2, 1, sizeof(buff2), f2);
+ if (n1 != n2)
+ break;
+ if (n1 == 0 && n2 == 0) {
+ fclose(f1);
+ fclose(f2);
+ return (1);
+ }
+ if (memcmp(buff1, buff2, n1) != 0)
+ break;
+ }
+ fclose(f1);
+ fclose(f2);
+ failure_start(test_filename, test_line, "Files not identical");
+ logprintf(" file1=\"%s\"\n", fn1);
+ logprintf(" file2=\"%s\"\n", fn2);
+ failure_finish(test_extra);
+ return (0);
+}
+
+/* Verify that the named file does exist. */
+int
+assertion_file_exists(const char *fpattern, ...)
+{
+ char f[1024];
+ va_list ap;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, fpattern);
+ vsprintf(f, fpattern, ap);
+ va_end(ap);
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ if (!_access(f, 0))
+ return (1);
+#else
+ if (!access(f, F_OK))
+ return (1);
+#endif
+ failure_start(test_filename, test_line, "File should exist: %s", f);
+ failure_finish(test_extra);
+ return (0);
+}
+
+/* Verify that the named file doesn't exist. */
+int
+assertion_file_not_exists(const char *fpattern, ...)
+{
+ char f[1024];
+ va_list ap;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, fpattern);
+ vsprintf(f, fpattern, ap);
+ va_end(ap);
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ if (_access(f, 0))
+ return (1);
+#else
+ if (access(f, F_OK))
+ return (1);
+#endif
+ failure_start(test_filename, test_line, "File should not exist: %s", f);
+ failure_finish(test_extra);
+ return (0);
+}
+
+/* Compare the contents of a file to a block of memory. */
+int
+assertion_file_contents(const void *buff, int s, const char *fpattern, ...)
+{
+ char fn[1024];
+ va_list ap;
+ char *contents;
+ FILE *f;
+ int n;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, fpattern);
+ vsprintf(fn, fpattern, ap);
+ va_end(ap);
+
+ f = fopen(fn, "rb");
+ if (f == NULL) {
+ failure_start(test_filename, test_line,
+ "File should exist: %s", fn);
+ failure_finish(test_extra);
+ return (0);
+ }
+ contents = malloc(s * 2);
+ n = fread(contents, 1, s * 2, f);
+ fclose(f);
+ if (n == s && memcmp(buff, contents, s) == 0) {
+ free(contents);
+ return (1);
+ }
+ failure_start(test_filename, test_line, "File contents don't match");
+ logprintf(" file=\"%s\"\n", fn);
+ if (n > 0)
+ hexdump(contents, buff, n > 512 ? 512 : n, 0);
+ else {
+ logprintf(" File empty, contents should be:\n");
+ hexdump(buff, NULL, s > 512 ? 512 : n, 0);
+ }
+ failure_finish(test_extra);
+ free(contents);
+ return (0);
+}
+
+/* Check the contents of a text file, being tolerant of line endings. */
+int
+assertion_text_file_contents(const char *buff, const char *fn)
+{
+ char *contents;
+ const char *btxt, *ftxt;
+ FILE *f;
+ int n, s;
+
+ assertion_count(test_filename, test_line);
+ f = fopen(fn, "r");
+ if (f == NULL) {
+ failure_start(test_filename, test_line,
+ "File doesn't exist: %s", fn);
+ failure_finish(test_extra);
+ return (0);
+ }
+ s = strlen(buff);
+ contents = malloc(s * 2 + 128);
+ n = fread(contents, 1, s * 2 + 128 - 1, f);
+ if (n >= 0)
+ contents[n] = '\0';
+ fclose(f);
+ /* Compare texts. */
+ btxt = buff;
+ ftxt = (const char *)contents;
+ while (*btxt != '\0' && *ftxt != '\0') {
+ if (*btxt == *ftxt) {
+ ++btxt;
+ ++ftxt;
+ continue;
+ }
+ if (btxt[0] == '\n' && ftxt[0] == '\r' && ftxt[1] == '\n') {
+ /* Pass over different new line characters. */
+ ++btxt;
+ ftxt += 2;
+ continue;
+ }
+ break;
+ }
+ if (*btxt == '\0' && *ftxt == '\0') {
+ free(contents);
+ return (1);
+ }
+ failure_start(test_filename, test_line, "Contents don't match");
+ logprintf(" file=\"%s\"\n", fn);
+ if (n > 0)
+ hexdump(contents, buff, n, 0);
+ else {
+ logprintf(" File empty, contents should be:\n");
+ hexdump(buff, NULL, s, 0);
+ }
+ failure_finish(test_extra);
+ free(contents);
+ return (0);
+}
+
+/* Test that two paths point to the same file. */
+/* As a side-effect, asserts that both files exist. */
+static int
+is_hardlink(const char *file, int line,
+ const char *path1, const char *path2)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ BY_HANDLE_FILE_INFORMATION bhfi1, bhfi2;
+ int r;
+
+ assertion_count(file, line);
+ r = my_GetFileInformationByName(path1, &bhfi1);
+ if (r == 0) {
+ failure_start(file, line, "File %s can't be inspected?", path1);
+ failure_finish(NULL);
+ return (0);
+ }
+ r = my_GetFileInformationByName(path2, &bhfi2);
+ if (r == 0) {
+ failure_start(file, line, "File %s can't be inspected?", path2);
+ failure_finish(NULL);
+ return (0);
+ }
+ return (bhfi1.dwVolumeSerialNumber == bhfi2.dwVolumeSerialNumber
+ && bhfi1.nFileIndexHigh == bhfi2.nFileIndexHigh
+ && bhfi1.nFileIndexLow == bhfi2.nFileIndexLow);
+#else
+ struct stat st1, st2;
+ int r;
+
+ assertion_count(file, line);
+ r = lstat(path1, &st1);
+ if (r != 0) {
+ failure_start(file, line, "File should exist: %s", path1);
+ failure_finish(NULL);
+ return (0);
+ }
+ r = lstat(path2, &st2);
+ if (r != 0) {
+ failure_start(file, line, "File should exist: %s", path2);
+ failure_finish(NULL);
+ return (0);
+ }
+ return (st1.st_ino == st2.st_ino && st1.st_dev == st2.st_dev);
+#endif
+}
+
+int
+assertion_is_hardlink(const char *file, int line,
+ const char *path1, const char *path2)
+{
+ if (is_hardlink(file, line, path1, path2))
+ return (1);
+ failure_start(file, line,
+ "Files %s and %s are not hardlinked", path1, path2);
+ failure_finish(NULL);
+ return (0);
+}
+
+int
+assertion_is_not_hardlink(const char *file, int line,
+ const char *path1, const char *path2)
+{
+ if (!is_hardlink(file, line, path1, path2))
+ return (1);
+ failure_start(file, line,
+ "Files %s and %s should not be hardlinked", path1, path2);
+ failure_finish(NULL);
+ return (0);
+}
+
+/* Verify a/b/mtime of 'pathname'. */
+/* If 'recent', verify that it's within last 10 seconds. */
+static int
+assertion_file_time(const char *file, int line,
+ const char *pathname, long t, long nsec, char type, int recent)
+{
+ long long filet, filet_nsec;
+ int r;
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define EPOC_TIME (116444736000000000ULL)
+ FILETIME ftime, fbirthtime, fatime, fmtime;
+ ULARGE_INTEGER wintm;
+ HANDLE h;
+ ftime.dwLowDateTime = 0;
+ ftime.dwHighDateTime = 0;
+
+ assertion_count(file, line);
+ h = CreateFile(pathname, FILE_READ_ATTRIBUTES, 0, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (h == INVALID_HANDLE_VALUE) {
+ failure_start(file, line, "Can't access %s\n", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ r = GetFileTime(h, &fbirthtime, &fatime, &fmtime);
+ switch (type) {
+ case 'a': ftime = fatime; break;
+ case 'b': ftime = fbirthtime; break;
+ case 'm': ftime = fmtime; break;
+ }
+ CloseHandle(h);
+ if (r == 0) {
+ failure_start(file, line, "Can't GetFileTime %s\n", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ wintm.LowPart = ftime.dwLowDateTime;
+ wintm.HighPart = ftime.dwHighDateTime;
+ filet = (wintm.QuadPart - EPOC_TIME) / 10000000;
+ filet_nsec = ((wintm.QuadPart - EPOC_TIME) % 10000000) * 100;
+ nsec = (nsec / 100) * 100; /* Round the request */
+#else
+ struct stat st;
+
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r != 0) {
+ failure_start(file, line, "Can't stat %s\n", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ switch (type) {
+ case 'a': filet = st.st_atime; break;
+ case 'm': filet = st.st_mtime; break;
+ case 'b': filet = 0; break;
+ default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type);
+ exit(1);
+ }
+#if defined(__FreeBSD__)
+ switch (type) {
+ case 'a': filet_nsec = st.st_atimespec.tv_nsec; break;
+ case 'b': filet = st.st_birthtime;
+ filet_nsec = st.st_birthtimespec.tv_nsec; break;
+ case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break;
+ default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type);
+ exit(1);
+ }
+ /* FreeBSD generally only stores to microsecond res, so round. */
+ filet_nsec = (filet_nsec / 1000) * 1000;
+ nsec = (nsec / 1000) * 1000;
+#else
+ filet_nsec = nsec = 0; /* Generic POSIX only has whole seconds. */
+ if (type == 'b') return (1); /* Generic POSIX doesn't have birthtime */
+#if defined(__HAIKU__)
+ if (type == 'a') return (1); /* Haiku doesn't have atime. */
+#endif
+#endif
+#endif
+ if (recent) {
+ /* Check that requested time is up-to-date. */
+ time_t now = time(NULL);
+ if (filet < now - 10 || filet > now + 1) {
+ failure_start(file, line,
+ "File %s has %ctime %ld, %ld seconds ago\n",
+ pathname, type, filet, now - filet);
+ failure_finish(NULL);
+ return (0);
+ }
+ } else if (filet != t || filet_nsec != nsec) {
+ failure_start(file, line,
+ "File %s has %ctime %ld.%09ld, expected %ld.%09ld",
+ pathname, type, filet, filet_nsec, t, nsec);
+ failure_finish(NULL);
+ return (0);
+ }
+ return (1);
+}
+
+/* Verify atime of 'pathname'. */
+int
+assertion_file_atime(const char *file, int line,
+ const char *pathname, long t, long nsec)
+{
+ return assertion_file_time(file, line, pathname, t, nsec, 'a', 0);
+}
+
+/* Verify atime of 'pathname' is up-to-date. */
+int
+assertion_file_atime_recent(const char *file, int line, const char *pathname)
+{
+ return assertion_file_time(file, line, pathname, 0, 0, 'a', 1);
+}
+
+/* Verify birthtime of 'pathname'. */
+int
+assertion_file_birthtime(const char *file, int line,
+ const char *pathname, long t, long nsec)
+{
+ return assertion_file_time(file, line, pathname, t, nsec, 'b', 0);
+}
+
+/* Verify birthtime of 'pathname' is up-to-date. */
+int
+assertion_file_birthtime_recent(const char *file, int line,
+ const char *pathname)
+{
+ return assertion_file_time(file, line, pathname, 0, 0, 'b', 1);
+}
+
+/* Verify mtime of 'pathname'. */
+int
+assertion_file_mtime(const char *file, int line,
+ const char *pathname, long t, long nsec)
+{
+ return assertion_file_time(file, line, pathname, t, nsec, 'm', 0);
+}
+
+/* Verify mtime of 'pathname' is up-to-date. */
+int
+assertion_file_mtime_recent(const char *file, int line, const char *pathname)
+{
+ return assertion_file_time(file, line, pathname, 0, 0, 'm', 1);
+}
+
+/* Verify number of links to 'pathname'. */
+int
+assertion_file_nlinks(const char *file, int line,
+ const char *pathname, int nlinks)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ BY_HANDLE_FILE_INFORMATION bhfi;
+ int r;
+
+ assertion_count(file, line);
+ r = my_GetFileInformationByName(pathname, &bhfi);
+ if (r != 0 && bhfi.nNumberOfLinks == (DWORD)nlinks)
+ return (1);
+ failure_start(file, line, "File %s has %d links, expected %d",
+ pathname, bhfi.nNumberOfLinks, nlinks);
+ failure_finish(NULL);
+ return (0);
+#else
+ struct stat st;
+ int r;
+
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r == 0 && st.st_nlink == nlinks)
+ return (1);
+ failure_start(file, line, "File %s has %d links, expected %d",
+ pathname, st.st_nlink, nlinks);
+ failure_finish(NULL);
+ return (0);
+#endif
+}
+
+/* Verify size of 'pathname'. */
+int
+assertion_file_size(const char *file, int line, const char *pathname, long size)
+{
+ int64_t filesize;
+ int r;
+
+ assertion_count(file, line);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ {
+ BY_HANDLE_FILE_INFORMATION bhfi;
+ r = !my_GetFileInformationByName(pathname, &bhfi);
+ filesize = ((int64_t)bhfi.nFileSizeHigh << 32) + bhfi.nFileSizeLow;
+ }
+#else
+ {
+ struct stat st;
+ r = lstat(pathname, &st);
+ filesize = st.st_size;
+ }
+#endif
+ if (r == 0 && filesize == size)
+ return (1);
+ failure_start(file, line, "File %s has size %ld, expected %ld",
+ pathname, (long)filesize, (long)size);
+ failure_finish(NULL);
+ return (0);
+}
+
+/* Assert that 'pathname' is a dir. If mode >= 0, verify that too. */
+int
+assertion_is_dir(const char *file, int line, const char *pathname, int mode)
+{
+ struct stat st;
+ int r;
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ (void)mode; /* UNUSED */
+#endif
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r != 0) {
+ failure_start(file, line, "Dir should exist: %s", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (!S_ISDIR(st.st_mode)) {
+ failure_start(file, line, "%s is not a dir", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ /* Windows doesn't handle permissions the same way as POSIX,
+ * so just ignore the mode tests. */
+ /* TODO: Can we do better here? */
+ if (mode >= 0 && mode != (st.st_mode & 07777)) {
+ failure_start(file, line, "Dir %s has wrong mode", pathname);
+ logprintf(" Expected: 0%3o\n", mode);
+ logprintf(" Found: 0%3o\n", st.st_mode & 07777);
+ failure_finish(NULL);
+ return (0);
+ }
+#endif
+ return (1);
+}
+
+/* Verify that 'pathname' is a regular file. If 'mode' is >= 0,
+ * verify that too. */
+int
+assertion_is_reg(const char *file, int line, const char *pathname, int mode)
+{
+ struct stat st;
+ int r;
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ (void)mode; /* UNUSED */
+#endif
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r != 0 || !S_ISREG(st.st_mode)) {
+ failure_start(file, line, "File should exist: %s", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ /* Windows doesn't handle permissions the same way as POSIX,
+ * so just ignore the mode tests. */
+ /* TODO: Can we do better here? */
+ if (mode >= 0 && mode != (st.st_mode & 07777)) {
+ failure_start(file, line, "File %s has wrong mode", pathname);
+ logprintf(" Expected: 0%3o\n", mode);
+ logprintf(" Found: 0%3o\n", st.st_mode & 07777);
+ failure_finish(NULL);
+ return (0);
+ }
+#endif
+ return (1);
+}
+
+/* Check whether 'pathname' is a symbolic link. If 'contents' is
+ * non-NULL, verify that the symlink has those contents. */
+static int
+is_symlink(const char *file, int line,
+ const char *pathname, const char *contents)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ (void)pathname; /* UNUSED */
+ (void)contents; /* UNUSED */
+ assertion_count(file, line);
+ /* Windows sort-of has real symlinks, but they're only usable
+ * by privileged users and are crippled even then, so there's
+ * really not much point in bothering with this. */
+ return (0);
+#else
+ char buff[300];
+ struct stat st;
+ ssize_t linklen;
+ int r;
+
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r != 0) {
+ failure_start(file, line,
+ "Symlink should exist: %s", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (!S_ISLNK(st.st_mode))
+ return (0);
+ if (contents == NULL)
+ return (1);
+ linklen = readlink(pathname, buff, sizeof(buff));
+ if (linklen < 0) {
+ failure_start(file, line, "Can't read symlink %s", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ buff[linklen] = '\0';
+ if (strcmp(buff, contents) != 0)
+ return (0);
+ return (1);
+#endif
+}
+
+/* Assert that path is a symlink that (optionally) contains contents. */
+int
+assertion_is_symlink(const char *file, int line,
+ const char *path, const char *contents)
+{
+ if (is_symlink(file, line, path, contents))
+ return (1);
+ if (contents)
+ failure_start(file, line, "File %s is not a symlink to %s",
+ path, contents);
+ else
+ failure_start(file, line, "File %s is not a symlink", path);
+ failure_finish(NULL);
+ return (0);
+}
+
+
+/* Create a directory and report any errors. */
+int
+assertion_make_dir(const char *file, int line, const char *dirname, int mode)
+{
+ assertion_count(file, line);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ (void)mode; /* UNUSED */
+ if (0 == _mkdir(dirname))
+ return (1);
+#else
+ if (0 == mkdir(dirname, mode))
+ return (1);
+#endif
+ failure_start(file, line, "Could not create directory %s", dirname);
+ failure_finish(NULL);
+ return(0);
+}
+
+/* Create a file with the specified contents and report any failures. */
+int
+assertion_make_file(const char *file, int line,
+ const char *path, int mode, const char *contents)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* TODO: Rework this to set file mode as well. */
+ FILE *f;
+ (void)mode; /* UNUSED */
+ assertion_count(file, line);
+ f = fopen(path, "wb");
+ if (f == NULL) {
+ failure_start(file, line, "Could not create file %s", path);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (contents != NULL) {
+ if (strlen(contents)
+ != fwrite(contents, 1, strlen(contents), f)) {
+ fclose(f);
+ failure_start(file, line,
+ "Could not write file %s", path);
+ failure_finish(NULL);
+ return (0);
+ }
+ }
+ fclose(f);
+ return (1);
+#else
+ int fd;
+ assertion_count(file, line);
+ fd = open(path, O_CREAT | O_WRONLY, mode >= 0 ? mode : 0644);
+ if (fd < 0) {
+ failure_start(file, line, "Could not create %s", path);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (contents != NULL) {
+ if ((ssize_t)strlen(contents)
+ != write(fd, contents, strlen(contents))) {
+ close(fd);
+ failure_start(file, line, "Could not write to %s", path);
+ failure_finish(NULL);
+ return (0);
+ }
+ }
+ close(fd);
+ return (1);
+#endif
+}
+
+/* Create a hardlink and report any failures. */
+int
+assertion_make_hardlink(const char *file, int line,
+ const char *newpath, const char *linkto)
+{
+ int succeeded;
+
+ assertion_count(file, line);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ succeeded = my_CreateHardLinkA(newpath, linkto);
+#elif HAVE_LINK
+ succeeded = !link(linkto, newpath);
+#else
+ succeeded = 0;
+#endif
+ if (succeeded)
+ return (1);
+ failure_start(file, line, "Could not create hardlink");
+ logprintf(" New link: %s\n", newpath);
+ logprintf(" Old name: %s\n", linkto);
+ failure_finish(NULL);
+ return(0);
+}
+
+/* Create a symlink and report any failures. */
+int
+assertion_make_symlink(const char *file, int line,
+ const char *newpath, const char *linkto)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ int targetIsDir = 0; /* TODO: Fix this */
+ assertion_count(file, line);
+ if (my_CreateSymbolicLinkA(newpath, linkto, targetIsDir))
+ return (1);
+#elif HAVE_SYMLINK
+ assertion_count(file, line);
+ if (0 == symlink(linkto, newpath))
+ return (1);
+#endif
+ failure_start(file, line, "Could not create symlink");
+ logprintf(" New link: %s\n", newpath);
+ logprintf(" Old name: %s\n", linkto);
+ failure_finish(NULL);
+ return(0);
+}
+
+/* Set umask, report failures. */
+int
+assertion_umask(const char *file, int line, int mask)
+{
+ assertion_count(file, line);
+ (void)file; /* UNUSED */
+ (void)line; /* UNUSED */
+ umask(mask);
+ return (1);
+}
+
+/*
+ *
+ * UTILITIES for use by tests.
+ *
+ */
+
+/*
+ * Check whether platform supports symlinks. This is intended
+ * for tests to use in deciding whether to bother testing symlink
+ * support; if the platform doesn't support symlinks, there's no point
+ * in checking whether the program being tested can create them.
+ *
+ * Note that the first time this test is called, we actually go out to
+ * disk to create and verify a symlink. This is necessary because
+ * symlink support is actually a property of a particular filesystem
+ * and can thus vary between directories on a single system. After
+ * the first call, this returns the cached result from memory, so it's
+ * safe to call it as often as you wish.
+ */
+int
+canSymlink(void)
+{
+ /* Remember the test result */
+ static int value = 0, tested = 0;
+ if (tested)
+ return (value);
+
+ ++tested;
+ assertion_make_file(__FILE__, __LINE__, "canSymlink.0", 0644, "a");
+ /* Note: Cygwin has its own symlink() emulation that does not
+ * use the Win32 CreateSymbolicLink() function. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ value = my_CreateSymbolicLinkA("canSymlink.1", "canSymlink.0", 0)
+ && is_symlink(__FILE__, __LINE__, "canSymlink.1", "canSymlink.0");
+#elif HAVE_SYMLINK
+ value = (0 == symlink("canSymlink.0", "canSymlink.1"))
+ && is_symlink(__FILE__, __LINE__, "canSymlink.1","canSymlink.0");
+#endif
+ return (value);
+}
+
+/*
+ * Can this platform run the gzip program?
+ */
+/* Platform-dependent options for hiding the output of a subcommand. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+static const char *redirectArgs = ">NUL 2>NUL"; /* Win32 cmd.exe */
+#else
+static const char *redirectArgs = ">/dev/null 2>/dev/null"; /* POSIX 'sh' */
+#endif
+int
+canGzip(void)
+{
+ static int tested = 0, value = 0;
+ if (!tested) {
+ tested = 1;
+ if (systemf("gzip -V %s", redirectArgs) == 0)
+ value = 1;
+ }
+ return (value);
+}
+
+/*
+ * Can this platform run the gunzip program?
+ */
+int
+canGunzip(void)
+{
+ static int tested = 0, value = 0;
+ if (!tested) {
+ tested = 1;
+ if (systemf("gunzip -V %s", redirectArgs) == 0)
+ value = 1;
+ }
+ return (value);
+}
+
+/*
+ * Sleep as needed; useful for verifying disk timestamp changes by
+ * ensuring that the wall-clock time has actually changed before we
+ * go back to re-read something from disk.
+ */
+void
+sleepUntilAfter(time_t t)
+{
+ while (t >= time(NULL))
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ Sleep(500);
+#else
+ sleep(1);
+#endif
+}
+
+/*
+ * Call standard system() call, but build up the command line using
+ * sprintf() conventions.
+ */
+int
+systemf(const char *fmt, ...)
+{
+ char buff[8192];
+ va_list ap;
+ int r;
+
+ va_start(ap, fmt);
+ vsprintf(buff, fmt, ap);
+ if (verbosity > VERBOSITY_FULL)
+ logprintf("Cmd: %s\n", buff);
+ r = system(buff);
+ va_end(ap);
+ return (r);
+}
+
+/*
+ * Slurp a file into memory for ease of comparison and testing.
+ * Returns size of file in 'sizep' if non-NULL, null-terminates
+ * data in memory for ease of use.
+ */
+char *
+slurpfile(size_t * sizep, const char *fmt, ...)
+{
+ char filename[8192];
+ struct stat st;
+ va_list ap;
+ char *p;
+ ssize_t bytes_read;
+ FILE *f;
+ int r;
+
+ va_start(ap, fmt);
+ vsprintf(filename, fmt, ap);
+ va_end(ap);
+
+ f = fopen(filename, "rb");
+ if (f == NULL) {
+ /* Note: No error; non-existent file is okay here. */
+ return (NULL);
+ }
+ r = fstat(fileno(f), &st);
+ if (r != 0) {
+ logprintf("Can't stat file %s\n", filename);
+ fclose(f);
+ return (NULL);
+ }
+ p = malloc((size_t)st.st_size + 1);
+ if (p == NULL) {
+ logprintf("Can't allocate %ld bytes of memory to read file %s\n",
+ (long int)st.st_size, filename);
+ fclose(f);
+ return (NULL);
+ }
+ bytes_read = fread(p, 1, (size_t)st.st_size, f);
+ if (bytes_read < st.st_size) {
+ logprintf("Can't read file %s\n", filename);
+ fclose(f);
+ free(p);
+ return (NULL);
+ }
+ p[st.st_size] = '\0';
+ if (sizep != NULL)
+ *sizep = (size_t)st.st_size;
+ fclose(f);
+ return (p);
+}
+
+/* Read a uuencoded file from the reference directory, decode, and
+ * write the result into the current directory. */
+#define UUDECODE(c) (((c) - 0x20) & 0x3f)
+void
+extract_reference_file(const char *name)
+{
+ char buff[1024];
+ FILE *in, *out;
+
+ sprintf(buff, "%s/%s.uu", refdir, name);
+ in = fopen(buff, "r");
+ failure("Couldn't open reference file %s", buff);
+ assert(in != NULL);
+ if (in == NULL)
+ return;
+ /* Read up to and including the 'begin' line. */
+ for (;;) {
+ if (fgets(buff, sizeof(buff), in) == NULL) {
+ /* TODO: This is a failure. */
+ return;
+ }
+ if (memcmp(buff, "begin ", 6) == 0)
+ break;
+ }
+ /* Now, decode the rest and write it. */
+ /* Not a lot of error checking here; the input better be right. */
+ out = fopen(name, "wb");
+ while (fgets(buff, sizeof(buff), in) != NULL) {
+ char *p = buff;
+ int bytes;
+
+ if (memcmp(buff, "end", 3) == 0)
+ break;
+
+ bytes = UUDECODE(*p++);
+ while (bytes > 0) {
+ int n = 0;
+ /* Write out 1-3 bytes from that. */
+ if (bytes > 0) {
+ n = UUDECODE(*p++) << 18;
+ n |= UUDECODE(*p++) << 12;
+ fputc(n >> 16, out);
+ --bytes;
+ }
+ if (bytes > 0) {
+ n |= UUDECODE(*p++) << 6;
+ fputc((n >> 8) & 0xFF, out);
+ --bytes;
+ }
+ if (bytes > 0) {
+ n |= UUDECODE(*p++);
+ fputc(n & 0xFF, out);
+ --bytes;
+ }
+ }
+ }
+ fclose(out);
+ fclose(in);
+}
+
+/*
+ *
+ * TEST management
+ *
+ */
+
+/*
+ * "list.h" is simply created by "grep DEFINE_TEST test_*.c"; it has
+ * a line like
+ * DEFINE_TEST(test_function)
+ * for each test.
+ */
+
+/* Use "list.h" to declare all of the test functions. */
+#undef DEFINE_TEST
+#define DEFINE_TEST(name) void name(void);
+#include "list.h"
+
+/* Use "list.h" to create a list of all tests (functions and names). */
+#undef DEFINE_TEST
+#define DEFINE_TEST(n) { n, #n, 0 },
+struct { void (*func)(void); const char *name; int failures; } tests[] = {
+ #include "list.h"
+};
+
+/*
+ * Summarize repeated failures in the just-completed test.
+ */
+static void
+test_summarize(const char *filename, int failed)
+{
+ unsigned int i;
+
+ switch (verbosity) {
+ case VERBOSITY_SUMMARY_ONLY:
+ printf(failed ? "E" : ".");
+ fflush(stdout);
+ break;
+ case VERBOSITY_PASSFAIL:
+ printf(failed ? "FAIL\n" : "ok\n");
+ break;
+ }
+
+ log_console = (verbosity == VERBOSITY_LIGHT_REPORT);
+
+ for (i = 0; i < sizeof(failed_lines)/sizeof(failed_lines[0]); i++) {
+ if (failed_lines[i].count > 1 && !failed_lines[i].skip)
+ logprintf("%s:%d: Summary: Failed %d times\n",
+ filename, i, failed_lines[i].count);
+ }
+ /* Clear the failure history for the next file. */
+ memset(failed_lines, 0, sizeof(failed_lines));
+}
+
+/*
+ * Actually run a single test, with appropriate setup and cleanup.
+ */
+static int
+test_run(int i, const char *tmpdir)
+{
+ char logfilename[64];
+ int failures_before = failures;
+ int oldumask;
+
+ switch (verbosity) {
+ case VERBOSITY_SUMMARY_ONLY: /* No per-test reports at all */
+ break;
+ case VERBOSITY_PASSFAIL: /* rest of line will include ok/FAIL marker */
+ printf("%3d: %-50s", i, tests[i].name);
+ fflush(stdout);
+ break;
+ default: /* Title of test, details will follow */
+ printf("%3d: %s\n", i, tests[i].name);
+ }
+
+ /* Chdir to the top-level work directory. */
+ if (!assertChdir(tmpdir)) {
+ fprintf(stderr,
+ "ERROR: Can't chdir to top work dir %s\n", tmpdir);
+ exit(1);
+ }
+ /* Create a log file for this test. */
+ sprintf(logfilename, "%s.log", tests[i].name);
+ logfile = fopen(logfilename, "w");
+ fprintf(logfile, "%s\n\n", tests[i].name);
+ /* Chdir() to a work dir for this specific test. */
+ if (!assertMakeDir(tests[i].name, 0755)
+ || !assertChdir(tests[i].name)) {
+ fprintf(stderr,
+ "ERROR: Can't chdir to work dir %s/%s\n",
+ tmpdir, tests[i].name);
+ exit(1);
+ }
+ /* Explicitly reset the locale before each test. */
+ setlocale(LC_ALL, "C");
+ /* Record the umask before we run the test. */
+ umask(oldumask = umask(0));
+ /*
+ * Run the actual test.
+ */
+ (*tests[i].func)();
+ /*
+ * Clean up and report afterwards.
+ */
+ /* Restore umask */
+ umask(oldumask);
+ /* Reset locale. */
+ setlocale(LC_ALL, "C");
+ /* Reset directory. */
+ if (!assertChdir(tmpdir)) {
+ fprintf(stderr, "ERROR: Couldn't chdir to temp dir %s\n",
+ tmpdir);
+ exit(1);
+ }
+ /* Report per-test summaries. */
+ tests[i].failures = failures - failures_before;
+ test_summarize(test_filename, tests[i].failures);
+ /* Close the per-test log file. */
+ fclose(logfile);
+ logfile = NULL;
+ /* If there were no failures, we can remove the work dir and logfile. */
+ if (tests[i].failures == 0) {
+ if (!keep_temp_files && assertChdir(tmpdir)) {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Make sure not to leave empty directories.
+ * Sometimes a processing of closing files used by tests
+ * is not done, then rmdir will be failed and it will
+ * leave a empty test directory. So we should wait a few
+ * seconds and retry rmdir. */
+ int r, t;
+ for (t = 0; t < 10; t++) {
+ if (t > 0)
+ Sleep(1000);
+ r = systemf("rmdir /S /Q %s", tests[i].name);
+ if (r == 0)
+ break;
+ }
+ systemf("del %s", logfilename);
+#else
+ systemf("rm -rf %s", tests[i].name);
+ systemf("rm %s", logfilename);
+#endif
+ }
+ }
+ /* Return appropriate status. */
+ return (tests[i].failures);
+}
+
+/*
+ *
+ *
+ * MAIN and support routines.
+ *
+ *
+ */
+
+static void
+usage(const char *program)
+{
+ static const int limit = sizeof(tests) / sizeof(tests[0]);
+ int i;
+
+ printf("Usage: %s [options] <test> <test> ...\n", program);
+ printf("Default is to run all tests.\n");
+ printf("Otherwise, specify the numbers of the tests you wish to run.\n");
+ printf("Options:\n");
+ printf(" -d Dump core after any failure, for debugging.\n");
+ printf(" -k Keep all temp files.\n");
+ printf(" Default: temp files for successful tests deleted.\n");
+#ifdef PROGRAM
+ printf(" -p <path> Path to executable to be tested.\n");
+ printf(" Default: path taken from " ENVBASE " environment variable.\n");
+#endif
+ printf(" -q Quiet.\n");
+ printf(" -r <dir> Path to dir containing reference files.\n");
+ printf(" Default: Current directory.\n");
+ printf(" -v Verbose.\n");
+ printf("Available tests:\n");
+ for (i = 0; i < limit; i++)
+ printf(" %d: %s\n", i, tests[i].name);
+ exit(1);
+}
+
+static char *
+get_refdir(const char *d)
+{
+ char tried[512] = { '\0' };
+ char buff[128];
+ char *pwd, *p;
+
+ /* If a dir was specified, try that */
+ if (d != NULL) {
+ pwd = NULL;
+ snprintf(buff, sizeof(buff), "%s", d);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+ goto failure;
+ }
+
+ /* Get the current dir. */
+ pwd = getcwd(NULL, 0);
+ while (pwd[strlen(pwd) - 1] == '\n')
+ pwd[strlen(pwd) - 1] = '\0';
+
+ /* Look for a known file. */
+ snprintf(buff, sizeof(buff), "%s", pwd);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+
+ snprintf(buff, sizeof(buff), "%s/test", pwd);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+
+#if defined(LIBRARY)
+ snprintf(buff, sizeof(buff), "%s/%s/test", pwd, LIBRARY);
+#else
+ snprintf(buff, sizeof(buff), "%s/%s/test", pwd, PROGRAM);
+#endif
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+
+ if (memcmp(pwd, "/usr/obj", 8) == 0) {
+ snprintf(buff, sizeof(buff), "%s", pwd + 8);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+
+ snprintf(buff, sizeof(buff), "%s/test", pwd + 8);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+ }
+
+failure:
+ printf("Unable to locate known reference file %s\n", KNOWNREF);
+ printf(" Checked following directories:\n%s\n", tried);
+#if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG)
+ DebugBreak();
+#endif
+ exit(1);
+
+success:
+ free(p);
+ free(pwd);
+ return strdup(buff);
+}
+
+int
+main(int argc, char **argv)
+{
+ static const int limit = sizeof(tests) / sizeof(tests[0]);
+ int i, tests_run = 0, tests_failed = 0, option;
+ time_t now;
+ char *refdir_alloc = NULL;
+ const char *progname;
+ const char *tmp, *option_arg, *p;
+ char tmpdir[256];
+ char tmpdir_timestamp[256];
+
+ (void)argc; /* UNUSED */
+
+#if defined(HAVE__CrtSetReportMode)
+ /* To stop to run the default invalid parameter handler. */
+ _set_invalid_parameter_handler(invalid_parameter_handler);
+ /* Disable annoying assertion message box. */
+ _CrtSetReportMode(_CRT_ASSERT, 0);
+#endif
+
+ /*
+ * Name of this program, used to build root of our temp directory
+ * tree.
+ */
+ progname = p = argv[0];
+ while (*p != '\0') {
+ /* Support \ or / dir separators for Windows compat. */
+ if (*p == '/' || *p == '\\')
+ progname = p + 1;
+ ++p;
+ }
+
+#ifdef PROGRAM
+ /* Get the target program from environment, if available. */
+ testprogfile = getenv(ENVBASE);
+#endif
+
+ if (getenv("TMPDIR") != NULL)
+ tmp = getenv("TMPDIR");
+ else if (getenv("TMP") != NULL)
+ tmp = getenv("TMP");
+ else if (getenv("TEMP") != NULL)
+ tmp = getenv("TEMP");
+ else if (getenv("TEMPDIR") != NULL)
+ tmp = getenv("TEMPDIR");
+ else
+ tmp = "/tmp";
+
+ /* Allow -d to be controlled through the environment. */
+ if (getenv(ENVBASE "_DEBUG") != NULL)
+ dump_on_failure = 1;
+
+ /* Get the directory holding test files from environment. */
+ refdir = getenv(ENVBASE "_TEST_FILES");
+
+ /*
+ * Parse options, without using getopt(), which isn't available
+ * on all platforms.
+ */
+ ++argv; /* Skip program name */
+ while (*argv != NULL) {
+ if (**argv != '-')
+ break;
+ p = *argv++;
+ ++p; /* Skip '-' */
+ while (*p != '\0') {
+ option = *p++;
+ option_arg = NULL;
+ /* If 'opt' takes an argument, parse that. */
+ if (option == 'p' || option == 'r') {
+ if (*p != '\0')
+ option_arg = p;
+ else if (*argv == NULL) {
+ fprintf(stderr,
+ "Option -%c requires argument.\n",
+ option);
+ usage(progname);
+ } else
+ option_arg = *argv++;
+ p = ""; /* End of this option word. */
+ }
+
+ /* Now, handle the option. */
+ switch (option) {
+ case 'd':
+ dump_on_failure = 1;
+ break;
+ case 'k':
+ keep_temp_files = 1;
+ break;
+ case 'p':
+#ifdef PROGRAM
+ testprogfile = option_arg;
+#else
+ usage(progname);
+#endif
+ break;
+ case 'q':
+ verbosity--;
+ break;
+ case 'r':
+ refdir = option_arg;
+ break;
+ case 'v':
+ verbosity++;
+ break;
+ default:
+ usage(progname);
+ }
+ }
+ }
+
+ /*
+ * Sanity-check that our options make sense.
+ */
+#ifdef PROGRAM
+ if (testprogfile == NULL)
+ usage(progname);
+ {
+ char *testprg;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Command.com sometimes rejects '/' separators. */
+ testprg = strdup(testprogfile);
+ for (i = 0; testprg[i] != '\0'; i++) {
+ if (testprg[i] == '/')
+ testprg[i] = '\\';
+ }
+ testprogfile = testprg;
+#endif
+ /* Quote the name that gets put into shell command lines. */
+ testprg = malloc(strlen(testprogfile) + 3);
+ strcpy(testprg, "\"");
+ strcat(testprg, testprogfile);
+ strcat(testprg, "\"");
+ testprog = testprg;
+ }
+#endif
+
+ /*
+ * Create a temp directory for the following tests.
+ * Include the time the tests started as part of the name,
+ * to make it easier to track the results of multiple tests.
+ */
+ now = time(NULL);
+ for (i = 0; ; i++) {
+ strftime(tmpdir_timestamp, sizeof(tmpdir_timestamp),
+ "%Y-%m-%dT%H.%M.%S",
+ localtime(&now));
+ sprintf(tmpdir, "%s/%s.%s-%03d", tmp, progname,
+ tmpdir_timestamp, i);
+ if (assertMakeDir(tmpdir,0755))
+ break;
+ if (i >= 999) {
+ fprintf(stderr,
+ "ERROR: Unable to create temp directory %s\n",
+ tmpdir);
+ exit(1);
+ }
+ }
+
+ /*
+ * If the user didn't specify a directory for locating
+ * reference files, try to find the reference files in
+ * the "usual places."
+ */
+ refdir = refdir_alloc = get_refdir(refdir);
+
+ /*
+ * Banner with basic information.
+ */
+ printf("\n");
+ printf("If tests fail or crash, details will be in:\n");
+ printf(" %s\n", tmpdir);
+ printf("\n");
+ if (verbosity > VERBOSITY_SUMMARY_ONLY) {
+ printf("Reference files will be read from: %s\n", refdir);
+#ifdef PROGRAM
+ printf("Running tests on: %s\n", testprog);
+#endif
+ printf("Exercising: ");
+ fflush(stdout);
+ printf("%s\n", EXTRA_VERSION);
+ } else {
+ printf("Running ");
+ fflush(stdout);
+ }
+
+ /*
+ * Run some or all of the individual tests.
+ */
+ if (*argv == NULL) {
+ /* Default: Run all tests. */
+ for (i = 0; i < limit; i++) {
+ if (test_run(i, tmpdir))
+ tests_failed++;
+ tests_run++;
+ }
+ } else {
+ while (*(argv) != NULL) {
+ if (**argv >= '0' && **argv <= '9') {
+ i = atoi(*argv);
+ if (i < 0 || i >= limit) {
+ printf("*** INVALID Test %s\n", *argv);
+ free(refdir_alloc);
+ usage(progname);
+ /* usage() never returns */
+ }
+ } else {
+ for (i = 0; i < limit; ++i) {
+ if (strcmp(*argv, tests[i].name) == 0)
+ break;
+ }
+ if (i >= limit) {
+ printf("*** INVALID Test ``%s''\n",
+ *argv);
+ free(refdir_alloc);
+ usage(progname);
+ /* usage() never returns */
+ }
+ }
+ if (test_run(i, tmpdir))
+ tests_failed++;
+ tests_run++;
+ argv++;
+ }
+ }
+
+ /*
+ * Report summary statistics.
+ */
+ if (verbosity > VERBOSITY_SUMMARY_ONLY) {
+ printf("\n");
+ printf("Totals:\n");
+ printf(" Tests run: %8d\n", tests_run);
+ printf(" Tests failed: %8d\n", tests_failed);
+ printf(" Assertions checked:%8d\n", assertions);
+ printf(" Assertions failed: %8d\n", failures);
+ printf(" Skips reported: %8d\n", skips);
+ }
+ if (failures) {
+ printf("\n");
+ printf("Failing tests:\n");
+ for (i = 0; i < limit; ++i) {
+ if (tests[i].failures)
+ printf(" %d: %s (%d failures)\n", i,
+ tests[i].name, tests[i].failures);
+ }
+ printf("\n");
+ printf("Details for failing tests: %s\n", tmpdir);
+ printf("\n");
+ } else {
+ if (verbosity == VERBOSITY_SUMMARY_ONLY)
+ printf("\n");
+ printf("%d tests passed, no failures\n", tests_run);
+ }
+
+ free(refdir_alloc);
+
+ /* If the final tmpdir is empty, we can remove it. */
+ /* This should be the usual case when all tests succeed. */
+ assertChdir("..");
+ rmdir(tmpdir);
+
+ return (tests_failed ? 1 : 0);
+}
diff --git a/archivers/libarchive/files/cpio/test/test.h b/archivers/libarchive/files/cpio/test/test.h
new file mode 100644
index 00000000000..c7515501ba7
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test.h
@@ -0,0 +1,286 @@
+/*
+ * 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: src/usr.bin/cpio/test/test.h,v 1.2 2008/06/21 02:17:18 kientzle Exp $
+ */
+
+/* Every test program should #include "test.h" as the first thing. */
+
+/*
+ * The goal of this file (and the matching test.c) is to
+ * simplify the very repetitive test-*.c test programs.
+ */
+#if defined(HAVE_CONFIG_H)
+/* Most POSIX platforms use the 'configure' script to build config.h */
+#include "config.h"
+#elif defined(__FreeBSD__)
+/* Building as part of FreeBSD system requires a pre-built config.h. */
+#include "config_freebsd.h"
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+/* Win32 can't run the 'configure' script. */
+#include "config_windows.h"
+#else
+/* Warn if the library hasn't been (automatically or manually) configured. */
+#error Oops: No config.h and no pre-built configuration in test.h.
+#endif
+
+#include <sys/types.h> /* Windows requires this before sys/stat.h */
+#include <sys/stat.h>
+
+#ifdef USE_DMALLOC
+#include <dmalloc.h>
+#endif
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+#ifdef HAVE_DIRECT_H
+#include <direct.h>
+#define dirent direct
+#endif
+#include <errno.h>
+#include <fcntl.h>
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <wchar.h>
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+
+/*
+ * System-specific tweaks. We really want to minimize these
+ * as much as possible, since they make it harder to understand
+ * the mainline code.
+ */
+
+/* Windows (including Visual Studio and MinGW but not Cygwin) */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#include "../cpio_windows.h"
+#if !defined(__BORLANDC__)
+#define strdup _strdup
+#endif
+#define LOCALE_DE "deu"
+#else
+#define LOCALE_DE "de_DE.UTF-8"
+#endif
+
+/* Visual Studio */
+#ifdef _MSC_VER
+#define snprintf sprintf_s
+#endif
+
+/* Cygwin */
+#if defined(__CYGWIN__)
+/* Cygwin-1.7.x is lazy about populating nlinks, so don't
+ * expect it to be accurate. */
+# define NLINKS_INACCURATE_FOR_DIRS
+#endif
+
+/* Haiku OS */
+#if defined(__HAIKU__)
+/* Haiku has typedefs in stdint.h (needed for int64_t) */
+#include <stdint.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
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+/*
+ * Redefine DEFINE_TEST for use in defining the test functions.
+ */
+#undef DEFINE_TEST
+#define DEFINE_TEST(name) void name(void); void name(void)
+
+/* An implementation of the standard assert() macro */
+#define assert(e) assertion_assert(__FILE__, __LINE__, (e), #e, NULL)
+/* chdir() and error if it fails */
+#define assertChdir(path) \
+ assertion_chdir(__FILE__, __LINE__, path)
+/* Assert two integers are the same. Reports value of each one if not. */
+#define assertEqualInt(v1,v2) \
+ assertion_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
+/* Assert two strings are the same. Reports value of each one if not. */
+#define assertEqualString(v1,v2) \
+ assertion_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
+/* As above, but v1 and v2 are wchar_t * */
+#define assertEqualWString(v1,v2) \
+ assertion_equal_wstring(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
+/* As above, but raw blocks of bytes. */
+#define assertEqualMem(v1, v2, l) \
+ assertion_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL)
+/* Assert two files are the same; allow printf-style expansion of second name.
+ * See below for comments about variable arguments here...
+ */
+#define assertEqualFile \
+ assertion_setup(__FILE__, __LINE__);assertion_equal_file
+/* Assert that a file is empty; supports printf-style arguments. */
+#define assertEmptyFile \
+ assertion_setup(__FILE__, __LINE__);assertion_empty_file
+/* Assert that a file is not empty; supports printf-style arguments. */
+#define assertNonEmptyFile \
+ assertion_setup(__FILE__, __LINE__);assertion_non_empty_file
+#define assertFileAtime(pathname, sec, nsec) \
+ assertion_file_atime(__FILE__, __LINE__, pathname, sec, nsec)
+#define assertFileAtimeRecent(pathname) \
+ assertion_file_atime_recent(__FILE__, __LINE__, pathname)
+#define assertFileBirthtime(pathname, sec, nsec) \
+ assertion_file_birthtime(__FILE__, __LINE__, pathname, sec, nsec)
+#define assertFileBirthtimeRecent(pathname) \
+ assertion_file_birthtime_recent(__FILE__, __LINE__, pathname)
+/* Assert that a file exists; supports printf-style arguments. */
+#define assertFileExists \
+ assertion_setup(__FILE__, __LINE__);assertion_file_exists
+/* Assert that a file exists; supports printf-style arguments. */
+#define assertFileNotExists \
+ assertion_setup(__FILE__, __LINE__);assertion_file_not_exists
+/* Assert that file contents match a string; supports printf-style arguments. */
+#define assertFileContents \
+ assertion_setup(__FILE__, __LINE__);assertion_file_contents
+#define assertFileMtime(pathname, sec, nsec) \
+ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec)
+#define assertFileMtimeRecent(pathname) \
+ assertion_file_mtime_recent(__FILE__, __LINE__, pathname)
+#define assertFileNLinks(pathname, nlinks) \
+ assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks)
+#define assertFileSize(pathname, size) \
+ assertion_file_size(__FILE__, __LINE__, pathname, size)
+#define assertTextFileContents \
+ assertion_setup(__FILE__, __LINE__);assertion_text_file_contents
+#define assertIsDir(pathname, mode) \
+ assertion_is_dir(__FILE__, __LINE__, pathname, mode)
+#define assertIsHardlink(path1, path2) \
+ assertion_is_hardlink(__FILE__, __LINE__, path1, path2)
+#define assertIsNotHardlink(path1, path2) \
+ assertion_is_not_hardlink(__FILE__, __LINE__, path1, path2)
+#define assertIsReg(pathname, mode) \
+ assertion_is_reg(__FILE__, __LINE__, pathname, mode)
+#define assertIsSymlink(pathname, contents) \
+ assertion_is_symlink(__FILE__, __LINE__, pathname, contents)
+/* Create a directory, report error if it fails. */
+#define assertMakeDir(dirname, mode) \
+ assertion_make_dir(__FILE__, __LINE__, dirname, mode)
+#define assertMakeFile(path, mode, contents) \
+ assertion_make_file(__FILE__, __LINE__, path, mode, contents)
+#define assertMakeHardlink(newfile, oldfile) \
+ assertion_make_hardlink(__FILE__, __LINE__, newfile, oldfile)
+#define assertMakeSymlink(newfile, linkto) \
+ assertion_make_symlink(__FILE__, __LINE__, newfile, linkto)
+#define assertUmask(mask) \
+ assertion_umask(__FILE__, __LINE__, mask)
+
+/*
+ * This would be simple with C99 variadic macros, but I don't want to
+ * require that. Instead, I insert a function call before each
+ * skipping() call to pass the file and line information down. Crude,
+ * but effective.
+ */
+#define skipping \
+ assertion_setup(__FILE__, __LINE__);test_skipping
+
+/* Function declarations. These are defined in test_utility.c. */
+void failure(const char *fmt, ...);
+int assertion_assert(const char *, int, int, const char *, void *);
+int assertion_chdir(const char *, int, const char *);
+int assertion_empty_file(const char *, ...);
+int assertion_equal_file(const char *, const char *, ...);
+int assertion_equal_int(const char *, int, long long, const char *, long long, const char *, void *);
+int assertion_equal_mem(const char *, int, const void *, const char *, const void *, const char *, size_t, const char *, void *);
+int assertion_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *);
+int assertion_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *);
+int assertion_file_atime(const char *, int, const char *, long, long);
+int assertion_file_atime_recent(const char *, int, const char *);
+int assertion_file_birthtime(const char *, int, const char *, long, long);
+int assertion_file_birthtime_recent(const char *, int, const char *);
+int assertion_file_contents(const void *, int, const char *, ...);
+int assertion_file_exists(const char *, ...);
+int assertion_file_mtime(const char *, int, const char *, long, long);
+int assertion_file_mtime_recent(const char *, int, const char *);
+int assertion_file_nlinks(const char *, int, const char *, int);
+int assertion_file_not_exists(const char *, ...);
+int assertion_file_size(const char *, int, const char *, long);
+int assertion_is_dir(const char *, int, const char *, int);
+int assertion_is_hardlink(const char *, int, const char *, const char *);
+int assertion_is_not_hardlink(const char *, int, const char *, const char *);
+int assertion_is_reg(const char *, int, const char *, int);
+int assertion_is_symlink(const char *, int, const char *, const char *);
+int assertion_make_dir(const char *, int, const char *, int);
+int assertion_make_file(const char *, int, const char *, int, const char *);
+int assertion_make_hardlink(const char *, int, const char *newpath, const char *);
+int assertion_make_symlink(const char *, int, const char *newpath, const char *);
+int assertion_non_empty_file(const char *, ...);
+int assertion_text_file_contents(const char *buff, const char *f);
+int assertion_umask(const char *, int, int);
+void assertion_setup(const char *, int);
+
+void test_skipping(const char *fmt, ...);
+
+/* Like sprintf, then system() */
+int systemf(const char * fmt, ...);
+
+/* Delay until time() returns a value after this. */
+void sleepUntilAfter(time_t);
+
+/* Return true if this platform can create symlinks. */
+int canSymlink(void);
+
+/* Return true if this platform can run the "gzip" program. */
+int canGzip(void);
+
+/* Return true if this platform can run the "gunzip" program. */
+int canGunzip(void);
+
+/* Suck file into string allocated via malloc(). Call free() when done. */
+/* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */
+char *slurpfile(size_t *, const char *fmt, ...);
+
+/* Extracts named reference file to the current directory. */
+void extract_reference_file(const char *);
+
+/*
+ * Special interfaces for program test harness.
+ */
+
+/* Pathname of exe to be tested. */
+const char *testprogfile;
+/* Name of exe to use in printf-formatted command strings. */
+/* On Windows, this includes leading/trailing quotes. */
+const char *testprog;
diff --git a/archivers/libarchive/files/cpio/test/test_0.c b/archivers/libarchive/files/cpio/test/test_0.c
new file mode 100644
index 00000000000..75a1437fd70
--- /dev/null
+++ b/archivers/libarchive/files/cpio/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"
+__FBSDID("$FreeBSD$");
+
+/*
+ * 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?!", testprogfile);
+ if (!assertEqualInt(0, stat(testprogfile, &st)))
+ exit(1);
+
+ failure("%s is not executable?!", testprogfile);
+ if (!assert((st.st_mode & 0111) != 0))
+ exit(1);
+
+ /*
+ * Try to succesfully run the program; this requires that
+ * we know some option that will succeed.
+ */
+ if (0 == systemf("%s --version >" DEV_NULL, testprog)) {
+ /* This worked. */
+ } else if (0 == systemf("%s -W version >" DEV_NULL, testprog)) {
+ /* This worked. */
+ } else {
+ failure("Unable to successfully run any of the following:\n"
+ " * %s --version\n"
+ " * %s -W version\n",
+ testprog, testprog);
+ assert(0);
+ }
+
+ /* TODO: Ensure that our reference files are available. */
+}
diff --git a/archivers/libarchive/files/cpio/test/test_basic.c b/archivers/libarchive/files/cpio/test/test_basic.c
new file mode 100644
index 00000000000..852b069a16e
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_basic.c
@@ -0,0 +1,173 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_basic.c,v 1.4 2008/08/25 06:39:29 kientzle Exp $");
+
+static void
+verify_files(const char *msg)
+{
+ /*
+ * Verify unpacked files.
+ */
+
+ /* Regular file with 2 links. */
+ assertIsReg("file", 0644);
+ failure(msg);
+ assertFileSize("file", 10);
+ assertFileNLinks("file", 2);
+
+ /* Another name for the same file. */
+ assertIsHardlink("linkfile", "file");
+
+ /* Symlink */
+ if (canSymlink())
+ assertIsSymlink("symlink", "file");
+
+ /* Another file with 1 link and different permissions. */
+ assertIsReg("file2", 0777);
+ assertFileSize("file2", 10);
+ assertFileNLinks("file2", 1);
+
+ /* dir */
+ assertIsDir("dir", 0775);
+}
+
+static void
+basic_cpio(const char *target,
+ const char *pack_options,
+ const char *unpack_options,
+ const char *se)
+{
+ int r;
+
+ if (!assertMakeDir(target, 0775))
+ return;
+
+ /* Use the cpio program to create an archive. */
+ r = systemf("%s -o %s < filelist >%s/archive 2>%s/pack.err",
+ testprog, pack_options, target, target);
+ failure("Error invoking %s -o %s", testprog, pack_options);
+ assertEqualInt(r, 0);
+
+ assertChdir(target);
+
+ /* Verify stderr. */
+ failure("Expected: %s, options=%s", se, pack_options);
+ assertTextFileContents(se, "pack.err");
+
+ /*
+ * Use cpio to unpack the archive into another directory.
+ */
+ r = systemf("%s -i %s< archive >unpack.out 2>unpack.err",
+ testprog, unpack_options);
+ failure("Error invoking %s -i %s", testprog, unpack_options);
+ assertEqualInt(r, 0);
+
+ /* Verify stderr. */
+ failure("Error invoking %s -i %s in dir %s", testprog, unpack_options, target);
+ assertTextFileContents(se, "unpack.err");
+
+ verify_files(pack_options);
+
+ assertChdir("..");
+}
+
+static void
+passthrough(const char *target)
+{
+ int r;
+
+ if (!assertMakeDir(target, 0775))
+ return;
+
+ /*
+ * Use cpio passthrough mode to copy files to another directory.
+ */
+ r = systemf("%s -p %s <filelist >%s/stdout 2>%s/stderr",
+ testprog, target, target, target);
+ failure("Error invoking %s -p", testprog);
+ assertEqualInt(r, 0);
+
+ assertChdir(target);
+
+ /* Verify stderr. */
+ failure("Error invoking %s -p in dir %s",
+ testprog, target);
+ assertTextFileContents("1 block\n", "stderr");
+
+ verify_files("passthrough");
+ assertChdir("..");
+}
+
+DEFINE_TEST(test_basic)
+{
+ FILE *filelist;
+ const char *msg;
+
+ assertUmask(0);
+
+ /*
+ * Create an assortment of files on disk.
+ */
+ filelist = fopen("filelist", "w");
+
+ /* File with 10 bytes content. */
+ assertMakeFile("file", 0644, "1234567890");
+ fprintf(filelist, "file\n");
+
+ /* hardlink to above file. */
+ assertMakeHardlink("linkfile", "file");
+ fprintf(filelist, "linkfile\n");
+
+ /* Symlink to above file. */
+ if (canSymlink()) {
+ assertMakeSymlink("symlink", "file");
+ fprintf(filelist, "symlink\n");
+ }
+
+ /* Another file with different permissions. */
+ assertMakeFile("file2", 0777, "1234567890");
+ fprintf(filelist, "file2\n");
+
+ /* Directory. */
+ assertMakeDir("dir", 0775);
+ fprintf(filelist, "dir\n");
+ /* All done. */
+ fclose(filelist);
+
+ assertUmask(022);
+
+ /* Archive/dearchive with a variety of options. */
+ msg = canSymlink() ? "2 blocks\n" : "1 block\n";
+ basic_cpio("copy", "", "", msg);
+ basic_cpio("copy_odc", "--format=odc", "", msg);
+ basic_cpio("copy_newc", "-H newc", "", "2 blocks\n");
+ basic_cpio("copy_cpio", "-H odc", "", msg);
+ msg = canSymlink() ? "9 blocks\n" : "8 blocks\n";
+ basic_cpio("copy_ustar", "-H ustar", "", msg);
+
+ /* Copy in one step using -p */
+ passthrough("passthrough");
+}
diff --git a/archivers/libarchive/files/cpio/test/test_format_newc.c b/archivers/libarchive/files/cpio/test/test_format_newc.c
new file mode 100644
index 00000000000..06749a2f9ca
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_format_newc.c
@@ -0,0 +1,294 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_format_newc.c,v 1.2 2008/08/22 02:09:10 kientzle Exp $");
+
+/* Number of bytes needed to pad 'n' to multiple of 'block', assuming
+ * that 'block' is a power of two. This trick can be more easily
+ * remembered as -n & (block - 1), but many compilers quite reasonably
+ * warn about "-n" when n is an unsigned value. (~(n) + 1) is the
+ * same thing, but written in a way that won't offend anyone. */
+#define PAD(n, block) ((~(n) + 1) & ((block) - 1))
+
+static int
+is_hex(const char *p, size_t l)
+{
+ while (l > 0) {
+ if ((*p >= '0' && *p <= '9')
+ || (*p >= 'a' && *p <= 'f')
+ || (*p >= 'A' && *p <= 'F'))
+ {
+ --l;
+ ++p;
+ } else
+ return (0);
+
+ }
+ return (1);
+}
+
+static int
+from_hex(const char *p, size_t l)
+{
+ int r = 0;
+
+ while (l > 0) {
+ r *= 16;
+ if (*p >= 'a' && *p <= 'f')
+ r += *p + 10 - 'a';
+ else if (*p >= 'A' && *p <= 'F')
+ r += *p + 10 - 'A';
+ else
+ r += *p - '0';
+ --l;
+ ++p;
+ }
+ return (r);
+}
+
+DEFINE_TEST(test_format_newc)
+{
+ FILE *list;
+ int r;
+ int devmajor, devminor, ino, gid;
+ int uid = -1;
+ time_t t, t2, now;
+ char *p, *e;
+ size_t s, fs, ns;
+
+ assertUmask(0);
+
+#if !defined(_WIN32)
+ uid = getuid();
+#endif
+
+ /*
+ * Create an assortment of files.
+ * TODO: Extend this to cover more filetypes.
+ */
+ list = fopen("list", "w");
+
+ /* "file1" */
+ assertMakeFile("file1", 0644, "1234567890");
+ fprintf(list, "file1\n");
+
+ /* "hardlink" */
+ assertMakeHardlink("hardlink", "file1");
+ fprintf(list, "hardlink\n");
+
+ /* Another hardlink, but this one won't be archived. */
+ assertMakeHardlink("hardlink2", "file1");
+
+ /* "symlink" */
+ if (canSymlink()) {
+ assertMakeSymlink("symlink", "file1");
+ fprintf(list, "symlink\n");
+ }
+
+ /* "dir" */
+ assertMakeDir("dir", 0775);
+ fprintf(list, "dir\n");
+
+ /* Record some facts about what we just created: */
+ now = time(NULL); /* They were all created w/in last two seconds. */
+
+ /* Use the cpio program to create an archive. */
+ fclose(list);
+ r = systemf("%s -o --format=newc <list >newc.out 2>newc.err",
+ testprog);
+ if (!assertEqualInt(r, 0))
+ return;
+
+ /* Verify that nothing went to stderr. */
+ if (canSymlink()) {
+ assertTextFileContents("2 blocks\n", "newc.err");
+ } else {
+ assertTextFileContents("1 block\n", "newc.err");
+ }
+
+ /* Verify that stdout is a well-formed cpio file in "newc" format. */
+ p = slurpfile(&s, "newc.out");
+ assertEqualInt(s, canSymlink() ? 1024 : 512);
+ e = p;
+
+ /*
+ * Some of these assertions could be stronger, but it's
+ * a little tricky because they depend on the local environment.
+ */
+
+ /* First entry is "file1" */
+ assert(is_hex(e, 110)); /* Entire header is octal digits. */
+ assertEqualMem(e + 0, "070701", 6); /* Magic */
+ ino = from_hex(e + 6, 8); /* ino */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Group members bits and others bits do not work. */
+ assertEqualInt(0x8180, from_hex(e + 14, 8) & 0xffc0); /* Mode */
+#else
+ assertEqualInt(0x81a4, from_hex(e + 14, 8)); /* Mode */
+#endif
+ if (uid < 0)
+ uid = from_hex(e + 22, 8);
+ assertEqualInt(from_hex(e + 22, 8), uid); /* uid */
+ gid = from_hex(e + 30, 8); /* gid */
+ assertEqualMem(e + 38, "00000003", 8); /* nlink */
+ t = from_hex(e + 46, 8); /* mtime */
+ failure("t=0x%08x now=0x%08x=%d", t, now, now);
+ assert(t <= now); /* File wasn't created in future. */
+ failure("t=0x%08x now - 2=0x%08x = %d", t, now - 2, now - 2);
+ assert(t >= now - 2); /* File was created w/in last 2 secs. */
+ failure("newc format stores body only with last appearance of a link\n"
+ " first appearance should be empty, so this file size\n"
+ " field should be zero");
+ assertEqualInt(0, from_hex(e + 54, 8)); /* File size */
+ fs = from_hex(e + 54, 8);
+ fs += PAD(fs, 4);
+ devmajor = from_hex(e + 62, 8); /* devmajor */
+ devminor = from_hex(e + 70, 8); /* devminor */
+ assert(is_hex(e + 78, 8)); /* rdevmajor */
+ assert(is_hex(e + 86, 8)); /* rdevminor */
+ assertEqualMem(e + 94, "00000006", 8); /* Name size */
+ ns = from_hex(e + 94, 8);
+ ns += PAD(ns + 2, 4);
+ assertEqualInt(0, from_hex(e + 102, 8)); /* check field */
+ assertEqualMem(e + 110, "file1\0", 6); /* Name contents */
+ /* Since there's another link, no file contents here. */
+ /* But add in file size so that an error here doesn't cascade. */
+ e += 110 + fs + ns;
+
+ if (canSymlink()) {
+ /* "symlink" pointing to "file1" */
+ assert(is_hex(e, 110));
+ assertEqualMem(e + 0, "070701", 6); /* Magic */
+ assert(is_hex(e + 6, 8)); /* ino */
+ assertEqualInt(0xa1ff, from_hex(e + 14, 8)); /* Mode */
+ assertEqualInt(from_hex(e + 22, 8), uid); /* uid */
+ assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
+ assertEqualMem(e + 38, "00000001", 8); /* nlink */
+ t2 = from_hex(e + 46, 8); /* mtime */
+ failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+ assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
+ assertEqualMem(e + 54, "00000005", 8); /* File size */
+ fs = from_hex(e + 54, 8);
+ fs += PAD(fs, 4);
+ assertEqualInt(devmajor, from_hex(e + 62, 8)); /* devmajor */
+ assertEqualInt(devminor, from_hex(e + 70, 8)); /* devminor */
+ assert(is_hex(e + 78, 8)); /* rdevmajor */
+ assert(is_hex(e + 86, 8)); /* rdevminor */
+ assertEqualMem(e + 94, "00000008", 8); /* Name size */
+ ns = from_hex(e + 94, 8);
+ ns += PAD(ns + 2, 4);
+ assertEqualInt(0, from_hex(e + 102, 8)); /* check field */
+ assertEqualMem(e + 110, "symlink\0\0\0", 10); /* Name contents */
+ assertEqualMem(e + 110 + ns, "file1\0\0\0", 8); /* symlink target */
+ e += 110 + fs + ns;
+ }
+
+ /* "dir" */
+ assert(is_hex(e, 110));
+ assertEqualMem(e + 0, "070701", 6); /* Magic */
+ assert(is_hex(e + 6, 8)); /* ino */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Group members bits and others bits do not work. */
+ assertEqualInt(0x41c0, from_hex(e + 14, 8) & 0xffc0); /* Mode */
+#else
+ /* Mode: sgid bit sometimes propagates from parent dirs, ignore it. */
+ assertEqualInt(040775, from_hex(e + 14, 8) & ~02000);
+#endif
+ assertEqualInt(from_hex(e + 22, 8), uid); /* uid */
+ assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
+#ifndef NLINKS_INACCURATE_FOR_DIRS
+ assertEqualMem(e + 38, "00000002", 8); /* nlink */
+#endif
+ t2 = from_hex(e + 46, 8); /* mtime */
+ failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+ assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
+ assertEqualMem(e + 54, "00000000", 8); /* File size */
+ fs = from_hex(e + 54, 8);
+ fs += PAD(fs, 4);
+ assertEqualInt(devmajor, from_hex(e + 62, 8)); /* devmajor */
+ assertEqualInt(devminor, from_hex(e + 70, 8)); /* devminor */
+ assert(is_hex(e + 78, 8)); /* rdevmajor */
+ assert(is_hex(e + 86, 8)); /* rdevminor */
+ assertEqualMem(e + 94, "00000004", 8); /* Name size */
+ ns = from_hex(e + 94, 8);
+ ns += PAD(ns + 2, 4);
+ assertEqualInt(0, from_hex(e + 102, 8)); /* check field */
+ assertEqualMem(e + 110, "dir\0\0\0", 6); /* Name contents */
+ e += 110 + fs + ns;
+
+ /* Hardlink identical to "file1" */
+ /* Since we only wrote two of the three links to this
+ * file, this link should get deferred by the hardlink logic. */
+ assert(is_hex(e, 110));
+ assertEqualMem(e + 0, "070701", 6); /* Magic */
+ failure("If these aren't the same, then the hardlink detection failed to match them.");
+ assertEqualInt(ino, from_hex(e + 6, 8)); /* ino */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Group members bits and others bits do not work. */
+ assertEqualInt(0x8180, from_hex(e + 14, 8) & 0xffc0); /* Mode */
+#else
+ assertEqualInt(0x81a4, from_hex(e + 14, 8)); /* Mode */
+#endif
+ assertEqualInt(from_hex(e + 22, 8), uid); /* uid */
+ assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
+ assertEqualMem(e + 38, "00000003", 8); /* nlink */
+ t2 = from_hex(e + 46, 8); /* mtime */
+ failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+ assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
+ assertEqualInt(10, from_hex(e + 54, 8)); /* File size */
+ fs = from_hex(e + 54, 8);
+ fs += PAD(fs, 4);
+ assertEqualInt(devmajor, from_hex(e + 62, 8)); /* devmajor */
+ assertEqualInt(devminor, from_hex(e + 70, 8)); /* devminor */
+ assert(is_hex(e + 78, 8)); /* rdevmajor */
+ assert(is_hex(e + 86, 8)); /* rdevminor */
+ assertEqualMem(e + 94, "00000009", 8); /* Name size */
+ ns = from_hex(e + 94, 8);
+ ns += PAD(ns + 2, 4);
+ assertEqualInt(0, from_hex(e + 102, 8)); /* check field */
+ assertEqualMem(e + 110, "hardlink\0\0", 10); /* Name contents */
+ assertEqualMem(e + 110 + ns, "1234567890\0\0", 12); /* File contents */
+ e += 110 + ns + fs;
+
+ /* Last entry is end-of-archive marker. */
+ assert(is_hex(e, 110));
+ assertEqualMem(e + 0, "070701", 6); /* Magic */
+ assertEqualMem(e + 8, "00000000", 8); /* ino */
+ assertEqualMem(e + 14, "00000000", 8); /* mode */
+ assertEqualMem(e + 22, "00000000", 8); /* uid */
+ assertEqualMem(e + 30, "00000000", 8); /* gid */
+ assertEqualMem(e + 38, "00000001", 8); /* nlink */
+ assertEqualMem(e + 46, "00000000", 8); /* mtime */
+ assertEqualMem(e + 54, "00000000", 8); /* size */
+ assertEqualMem(e + 62, "00000000", 8); /* devmajor */
+ assertEqualMem(e + 70, "00000000", 8); /* devminor */
+ assertEqualMem(e + 78, "00000000", 8); /* rdevmajor */
+ assertEqualMem(e + 86, "00000000", 8); /* rdevminor */
+ assertEqualInt(11, from_hex(e + 94, 8)); /* name size */
+ assertEqualMem(e + 102, "00000000", 8); /* check field */
+ assertEqualMem(e + 110, "TRAILER!!!\0\0", 12); /* Name */
+
+ free(p);
+}
diff --git a/archivers/libarchive/files/cpio/test/test_gcpio_compat.c b/archivers/libarchive/files/cpio/test/test_gcpio_compat.c
new file mode 100644
index 00000000000..461e427c2e8
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_gcpio_compat.c
@@ -0,0 +1,108 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_gcpio_compat.c,v 1.2 2008/08/22 02:27:06 kientzle Exp $");
+
+static void
+unpack_test(const char *from, const char *options, const char *se)
+{
+ int r;
+
+ /* Create a work dir named after the file we're unpacking. */
+ assertMakeDir(from, 0775);
+ assertChdir(from);
+
+ /*
+ * Use cpio to unpack the sample archive
+ */
+ extract_reference_file(from);
+ r = systemf("%s -i %s < %s >unpack.out 2>unpack.err",
+ testprog, options, from);
+ failure("Error invoking %s -i %s < %s",
+ testprog, options, from);
+ assertEqualInt(r, 0);
+
+ /* Verify that nothing went to stderr. */
+ if (canSymlink()) {
+ failure("Error invoking %s -i %s < %s",
+ testprog, options, from);
+ assertTextFileContents(se, "unpack.err");
+ }
+
+ /*
+ * Verify unpacked files.
+ */
+
+ /* Regular file with 2 links. */
+ assertIsReg("file", 0644);
+ failure("%s", from);
+ assertFileSize("file", 10);
+ assertFileSize("linkfile", 10);
+ failure("%s", from);
+ assertFileNLinks("file", 2);
+
+ /* Another name for the same file. */
+ failure("%s", from);
+ assertIsHardlink("linkfile", "file");
+ assertFileSize("file", 10);
+ assertFileSize("linkfile", 10);
+
+ /* Symlink */
+ if (canSymlink())
+ assertIsSymlink("symlink", "file");
+
+ /* dir */
+ assertIsDir("dir", 0775);
+
+ assertChdir("..");
+}
+
+DEFINE_TEST(test_gcpio_compat)
+{
+ assertUmask(0);
+
+ /* Dearchive sample files with a variety of options. */
+ if (canSymlink()) {
+ unpack_test("test_gcpio_compat_ref.bin",
+ "--no-preserve-owner", "1 block\n");
+ unpack_test("test_gcpio_compat_ref.crc",
+ "--no-preserve-owner", "2 blocks\n");
+ unpack_test("test_gcpio_compat_ref.newc",
+ "--no-preserve-owner", "2 blocks\n");
+ /* gcpio-2.9 only reads 6 blocks here */
+ unpack_test("test_gcpio_compat_ref.ustar",
+ "--no-preserve-owner", "7 blocks\n");
+ } else {
+ unpack_test("test_gcpio_compat_ref_nosym.bin",
+ "--no-preserve-owner", "1 block\n");
+ unpack_test("test_gcpio_compat_ref_nosym.crc",
+ "--no-preserve-owner", "2 blocks\n");
+ unpack_test("test_gcpio_compat_ref_nosym.newc",
+ "--no-preserve-owner", "2 blocks\n");
+ /* gcpio-2.9 only reads 6 blocks here */
+ unpack_test("test_gcpio_compat_ref_nosym.ustar",
+ "--no-preserve-owner", "7 blocks\n");
+ }
+}
diff --git a/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.bin.uu b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.bin.uu
new file mode 100644
index 00000000000..745d8ab7851
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.bin.uu
@@ -0,0 +1,16 @@
+$FreeBSD$
+begin 644 test_gcpio_compat_ref.bin
+MQW%9`*IWI('H`^@#`@````U'=YD%````"@!F:6QE```Q,C,T-38W.#D*QW%9
+M`*IWI('H`^@#`@````U'=YD)````"@!L:6YK9FEL90``,3(S-#4V-S@Y"L=Q
+M60"K=^VAZ`/H`P$````-1X29"`````0`<WEM;&EN:P!F:6QEQW%9`*YW_4'H
+M`^@#`@````U'A9D$``````!D:7(`QW$``````````````0`````````+````
+M``!44D%)3$52(2$A````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+1````````````````````````
+`
+end
diff --git a/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.crc.uu b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.crc.uu
new file mode 100644
index 00000000000..df8dde05bd8
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.crc.uu
@@ -0,0 +1,27 @@
+$FreeBSD$
+begin 644 test_gcpio_compat_ref.crc
+M,#<P-S`R,#`S,S<W86$P,#`P.#%A-#`P,#`P,V4X,#`P,#`S93@P,#`P,#`P
+M,C0W,&0Y.3<W,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#4Y,#`P,#`P,#`P,#`P
+M,#`P,#`P,#`P,#`U,#`P,#`P,#!F:6QE```P-S`W,#(P,#,S-S=A83`P,#`X
+M,6$T,#`P,#`S93@P,#`P,#-E.#`P,#`P,#`R-#<P9#DY-S<P,#`P,#`P83`P
+M,#`P,#`P,#`P,#`P-3DP,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#DP,#`P,#%E
+M-VQI;FMF:6QE```Q,C,T-38W.#D*```P-S`W,#(P,#,S-S=A8C`P,#!A,65D
+M,#`P,#`S93@P,#`P,#-E.#`P,#`P,#`Q-#<P9#DY.#0P,#`P,#`P-#`P,#`P
+M,#`P,#`P,#`P-3DP,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#@P,#`P,#`P,'-Y
+M;6QI;FL```!F:6QE,#<P-S`R,#`S,S<W864P,#`P-#%F9#`P,#`P,V4X,#`P
+M,#`S93@P,#`P,#`P,C0W,&0Y.3@U,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#4Y
+M,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`T,#`P,#`P,#!D:7(````P-S`W,#(P
+M,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`Q,#`P,#`P
+M,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P
+M,#`P,&(P,#`P,#`P,%1204E,15(A(2$`````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+B````````````````````````````````````````````````
+`
+end
diff --git a/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.newc.uu b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.newc.uu
new file mode 100644
index 00000000000..1e29ba907bb
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.newc.uu
@@ -0,0 +1,27 @@
+$FreeBSD$
+begin 644 test_gcpio_compat_ref.newc
+M,#<P-S`Q,#`S,S<W86$P,#`P.#%A-#`P,#`P,V4X,#`P,#`S93@P,#`P,#`P
+M,C0W,&0Y.3<W,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#4Y,#`P,#`P,#`P,#`P
+M,#`P,#`P,#`P,#`U,#`P,#`P,#!F:6QE```P-S`W,#$P,#,S-S=A83`P,#`X
+M,6$T,#`P,#`S93@P,#`P,#-E.#`P,#`P,#`R-#<P9#DY-S<P,#`P,#`P83`P
+M,#`P,#`P,#`P,#`P-3DP,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#DP,#`P,#`P
+M,&QI;FMF:6QE```Q,C,T-38W.#D*```P-S`W,#$P,#,S-S=A8C`P,#!A,65D
+M,#`P,#`S93@P,#`P,#-E.#`P,#`P,#`Q-#<P9#DY.#0P,#`P,#`P-#`P,#`P
+M,#`P,#`P,#`P-3DP,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#@P,#`P,#`P,'-Y
+M;6QI;FL```!F:6QE,#<P-S`Q,#`S,S<W864P,#`P-#%F9#`P,#`P,V4X,#`P
+M,#`S93@P,#`P,#`P,C0W,&0Y.3@U,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#4Y
+M,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`T,#`P,#`P,#!D:7(````P-S`W,#$P
+M,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`Q,#`P,#`P
+M,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P
+M,#`P,&(P,#`P,#`P,%1204E,15(A(2$`````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+B````````````````````````````````````````````````
+`
+end
diff --git a/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.ustar.uu b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.ustar.uu
new file mode 100644
index 00000000000..77989f4aed0
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_gcpio_compat_ref.ustar.uu
@@ -0,0 +1,84 @@
+$FreeBSD$
+begin 644 test_gcpio_compat_ref.ustar
+M9FEL90``````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````#`P,#`V-#0`,#`P,3<U,``P,#`Q-S4P`#`P,#`P,#`P,#$R
+M`#$P-S`S,S$T-38W`#`P,3$S-C,`,```````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````!U<W1A<@`P,'1I;0``
+M````````````````````````````````````=&EM````````````````````
+M```````````````````P,#`P,#`P`#`P,#`P,#``````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M```````````````````````Q,C,T-38W.#D*````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````&QI;FMF:6QE````
+M````````````````````````````````````````````````````````````
+M```````````````````````````````````````````````````````````P
+M,#`P-C0T`#`P,#$W-3``,#`P,3<U,``P,#`P,#`P,#`P,``Q,#<P,S,Q-#4V
+M-P`P,#$S,#<W`#%F:6QE````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````=7-T87(`,#!T:6T`````````````````
+M`````````````````````'1I;0``````````````````````````````````
+M````,#`P,#`P,``P,#`P,#`P````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````<WEM;&EN:P``````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````#`P,#`W-34`,#`P,3<U,``P,#`Q-S4P`#`P,#`P
+M,#`P,#`P`#$P-S`S,S$T-C`T`#`P,3(W-C0`,F9I;&4`````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````!U<W1A<@`P
+M,'1I;0``````````````````````````````````````=&EM````````````
+M```````````````````````````P,#`P,#`P`#`P,#`P,#``````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````!D:7(O````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````,#`P,#<W-0`P,#`Q
+M-S4P`#`P,#$W-3``,#`P,#`P,#`P,#``,3`W,#,S,30V,#4`,#`Q,3,P,0`U
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````'5S=&%R`#`P=&EM````````````````````````````````
+M``````!T:6T``````````````````````````````````````#`P,#`P,#``
+M,#`P,#`P,```````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+=````````````````````````````````````````
+`
+end
diff --git a/archivers/libarchive/files/cpio/test/test_option_a.c b/archivers/libarchive/files/cpio/test/test_option_a.c
new file mode 100644
index 00000000000..606de606e2c
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_a.c
@@ -0,0 +1,154 @@
+/*-
+ * 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.
+ */
+#include "test.h"
+#if defined(HAVE_UTIME_H)
+#include <utime.h>
+#elif defined(HAVE_SYS_UTIME_H)
+#include <sys/utime.h>
+#endif
+__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_a.c,v 1.3 2008/08/24 06:21:00 kientzle Exp $");
+
+static struct {
+ const char *name;
+ time_t atime_sec;
+} files[] = {
+ { "f0", 0 },
+ { "f1", 0 },
+ { "f2", 0 },
+ { "f3", 0 },
+ { "f4", 0 },
+ { "f5", 0 }
+};
+
+/*
+ * Create a bunch of test files and record their atimes.
+ * For the atime preserve/change tests, the files must have
+ * atimes in the past. We can accomplish this by explicitly invoking
+ * utime() on platforms that support it or by simply sleeping
+ * for a second after creating the files. (Creating all of the files
+ * at once means we only need to sleep once.)
+ */
+static void
+test_create(void)
+{
+ struct stat st;
+ struct utimbuf times;
+ static const int numfiles = sizeof(files) / sizeof(files[0]);
+ int i;
+
+ for (i = 0; i < numfiles; ++i) {
+ /*
+ * Note: Have to write at least one byte to the file.
+ * cpio doesn't bother reading the file if it's zero length,
+ * so the atime never gets changed in that case, which
+ * makes the tests below rather pointless.
+ */
+ assertMakeFile(files[i].name, 0644, "a");
+
+ /* If utime() isn't supported on your platform, just
+ * #ifdef this section out. Most of the test below is
+ * still valid. */
+ memset(&times, 0, sizeof(times));
+ times.actime = 1;
+ times.modtime = 3;
+ assertEqualInt(0, utime(files[i].name, &times));
+
+ /* Record whatever atime the file ended up with. */
+ /* If utime() is available, this should be 1, but there's
+ * no harm in being careful. */
+ assertEqualInt(0, stat(files[i].name, &st));
+ files[i].atime_sec = st.st_atime;
+ }
+
+ /* Wait until the atime on the last file is actually in the past. */
+ sleepUntilAfter(files[numfiles - 1].atime_sec);
+}
+
+DEFINE_TEST(test_option_a)
+{
+ struct stat st;
+ int r;
+ char *p;
+
+ /* Create all of the test files. */
+ test_create();
+
+ /* Sanity check; verify that atimes really do get modified. */
+ assert((p = slurpfile(NULL, "f0")) != NULL);
+ free(p);
+ assertEqualInt(0, stat("f0", &st));
+ if (st.st_atime == files[0].atime_sec) {
+ skipping("Cannot verify -a option\n"
+ " Your system appears to not support atime.");
+ }
+ else
+ {
+ /*
+ * If this disk is mounted noatime, then we can't
+ * verify correct operation without -a.
+ */
+
+ /* Copy the file without -a; should change the atime. */
+ r = systemf("echo %s | %s -pd copy-no-a > copy-no-a.out 2>copy-no-a.err", files[1].name, testprog);
+ assertEqualInt(r, 0);
+ assertTextFileContents("1 block\n", "copy-no-a.err");
+ assertEmptyFile("copy-no-a.out");
+ assertEqualInt(0, stat(files[1].name, &st));
+ failure("Copying file without -a should have changed atime.");
+ assert(st.st_atime != files[1].atime_sec);
+
+ /* Archive the file without -a; should change the atime. */
+ r = systemf("echo %s | %s -o > archive-no-a.out 2>archive-no-a.err", files[2].name, testprog);
+ assertEqualInt(r, 0);
+ assertTextFileContents("1 block\n", "copy-no-a.err");
+ assertEqualInt(0, stat(files[2].name, &st));
+ failure("Archiving file without -a should have changed atime.");
+ assert(st.st_atime != files[2].atime_sec);
+ }
+
+ /*
+ * We can, of course, still verify that the atime is unchanged
+ * when using the -a option.
+ */
+
+ /* Copy the file with -a; should not change the atime. */
+ r = systemf("echo %s | %s -pad copy-a > copy-a.out 2>copy-a.err",
+ files[3].name, testprog);
+ assertEqualInt(r, 0);
+ assertTextFileContents("1 block\n", "copy-a.err");
+ assertEmptyFile("copy-a.out");
+ assertEqualInt(0, stat(files[3].name, &st));
+ failure("Copying file with -a should not have changed atime.");
+ assertEqualInt(st.st_atime, files[3].atime_sec);
+
+ /* Archive the file with -a; should not change the atime. */
+ r = systemf("echo %s | %s -oa > archive-a.out 2>archive-a.err",
+ files[4].name, testprog);
+ assertEqualInt(r, 0);
+ assertTextFileContents("1 block\n", "copy-a.err");
+ assertEqualInt(0, stat(files[4].name, &st));
+ failure("Archiving file with -a should not have changed atime.");
+ assertEqualInt(st.st_atime, files[4].atime_sec);
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_c.c b/archivers/libarchive/files/cpio/test/test_option_c.c
new file mode 100644
index 00000000000..241bcf67bb1
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_c.c
@@ -0,0 +1,221 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD$");
+
+static int
+is_octal(const char *p, size_t l)
+{
+ while (l > 0) {
+ if (*p < '0' || *p > '7')
+ return (0);
+ --l;
+ ++p;
+ }
+ return (1);
+}
+
+static int
+from_octal(const char *p, size_t l)
+{
+ int r = 0;
+
+ while (l > 0) {
+ r *= 8;
+ r += *p - '0';
+ --l;
+ ++p;
+ }
+ return (r);
+}
+
+DEFINE_TEST(test_option_c)
+{
+ FILE *filelist;
+ int r;
+ int uid = -1;
+ int dev, ino, gid;
+ time_t t, now;
+ char *p, *e;
+ size_t s;
+
+ assertUmask(0);
+
+#if !defined(_WIN32)
+ uid = getuid();
+#endif
+
+ /*
+ * Create an assortment of files.
+ * TODO: Extend this to cover more filetypes.
+ */
+ filelist = fopen("filelist", "w");
+
+ /* "file" */
+ assertMakeFile("file", 0644, "1234567890");
+ fprintf(filelist, "file\n");
+
+ /* "symlink" */
+ if (canSymlink()) {
+ assertMakeSymlink("symlink", "file");
+ fprintf(filelist, "symlink\n");
+ }
+
+ /* "dir" */
+ assertMakeDir("dir", 0775);
+ /* Record some facts about what we just created: */
+ now = time(NULL); /* They were all created w/in last two seconds. */
+ fprintf(filelist, "dir\n");
+
+ /* Use the cpio program to create an archive. */
+ fclose(filelist);
+ r = systemf("%s -oc <filelist >basic.out 2>basic.err", testprog);
+ /* Verify that nothing went to stderr. */
+ assertTextFileContents("1 block\n", "basic.err");
+
+ /* Assert that the program finished. */
+ failure("%s -oc crashed", testprog);
+ if (!assertEqualInt(r, 0))
+ return;
+
+ /* Verify that stdout is a well-formed cpio file in "odc" format. */
+ p = slurpfile(&s, "basic.out");
+ assertEqualInt(s, 512);
+ e = p;
+
+ /*
+ * Some of these assertions could be stronger, but it's
+ * a little tricky because they depend on the local environment.
+ */
+
+ /* First entry is "file" */
+ assert(is_octal(e, 76)); /* Entire header is octal digits. */
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assert(is_octal(e + 6, 6)); /* dev */
+ dev = from_octal(e + 6, 6);
+ assert(is_octal(e + 12, 6)); /* ino */
+ ino = from_octal(e + 12, 6);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Group members bits and others bits do not work. */
+ assertEqualMem(e + 18, "100666", 6); /* Mode */
+#else
+ assertEqualMem(e + 18, "100644", 6); /* Mode */
+#endif
+ if (uid < 0)
+ uid = from_octal(e + 24, 6);
+ assertEqualInt(from_octal(e + 24, 6), uid); /* uid */
+ assert(is_octal(e + 30, 6)); /* gid */
+ gid = from_octal(e + 30, 6);
+ assertEqualMem(e + 36, "000001", 6); /* nlink */
+ failure("file entries should not have rdev set (dev field was 0%o)",
+ dev);
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ t = from_octal(e + 48, 11); /* mtime */
+ assert(t <= now); /* File wasn't created in future. */
+ assert(t >= now - 2); /* File was created w/in last 2 secs. */
+ assertEqualMem(e + 59, "000005", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000012", 11); /* File size */
+ assertEqualMem(e + 76, "file\0", 5); /* Name contents */
+ assertEqualMem(e + 81, "1234567890", 10); /* File contents */
+ e += 91;
+
+ /* "symlink" pointing to "file" */
+ if (canSymlink()) {
+ assert(is_octal(e, 76)); /* Entire header is octal digits. */
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assertEqualInt(dev, from_octal(e + 6, 6)); /* dev */
+ assert(ino != from_octal(e + 12, 6)); /* ino */
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ /* On Windows, symbolic link and group members bits and
+ * others bits do not work. */
+ assertEqualMem(e + 18, "120777", 6); /* Mode */
+#endif
+ assertEqualInt(from_octal(e + 24, 6), uid); /* uid */
+ assertEqualInt(gid, from_octal(e + 30, 6)); /* gid */
+ assertEqualMem(e + 36, "000001", 6); /* nlink */
+ failure("file entries should have rdev == 0 (dev was 0%o)",
+ from_octal(e + 6, 6));
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ t = from_octal(e + 48, 11); /* mtime */
+ assert(t <= now); /* File wasn't created in future. */
+ assert(t >= now - 2); /* File was created w/in last 2 secs. */
+ assertEqualMem(e + 59, "000010", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000004", 11); /* File size */
+ assertEqualMem(e + 76, "symlink\0", 8); /* Name contents */
+ assertEqualMem(e + 84, "file", 4); /* Symlink target. */
+ e += 88;
+ }
+
+ /* "dir" */
+ assert(is_octal(e, 76));
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ /* Dev should be same as first entry. */
+ assert(is_octal(e + 6, 6)); /* dev */
+ assertEqualInt(dev, from_octal(e + 6, 6));
+ /* Ino must be different from first entry. */
+ assert(is_octal(e + 12, 6)); /* ino */
+ assert(dev != from_octal(e + 12, 6));
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Group members bits and others bits do not work. */
+ assertEqualMem(e + 18, "040777", 6); /* Mode */
+#else
+ /* Accept 042775 to accomodate systems where sgid bit propagates. */
+ if (memcmp(e + 18, "042775", 6) != 0)
+ assertEqualMem(e + 18, "040775", 6); /* Mode */
+#endif
+ assertEqualInt(from_octal(e + 24, 6), uid); /* uid */
+ /* Gid should be same as first entry. */
+ assert(is_octal(e + 30, 6)); /* gid */
+ assertEqualInt(gid, from_octal(e + 30, 6));
+#ifndef NLINKS_INACCURATE_FOR_DIRS
+ assertEqualMem(e + 36, "000002", 6); /* Nlink */
+#endif
+ t = from_octal(e + 48, 11); /* mtime */
+ assert(t <= now); /* File wasn't created in future. */
+ assert(t >= now - 2); /* File was created w/in last 2 secs. */
+ assertEqualMem(e + 59, "000004", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000000", 11); /* File size */
+ assertEqualMem(e + 76, "dir\0", 4); /* name */
+ e += 80;
+
+ /* TODO: Verify other types of entries. */
+
+ /* Last entry is end-of-archive marker. */
+ assert(is_octal(e, 76));
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assertEqualMem(e + 6, "000000", 6); /* dev */
+ assertEqualMem(e + 12, "000000", 6); /* ino */
+ assertEqualMem(e + 18, "000000", 6); /* Mode */
+ assertEqualMem(e + 24, "000000", 6); /* uid */
+ assertEqualMem(e + 30, "000000", 6); /* gid */
+ assertEqualMem(e + 36, "000001", 6); /* Nlink */
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ assertEqualMem(e + 48, "00000000000", 11); /* mtime */
+ assertEqualMem(e + 59, "000013", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000000", 11); /* File size */
+ assertEqualMem(e + 76, "TRAILER!!!\0", 11); /* Name */
+
+ free(p);
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_d.c b/archivers/libarchive/files/cpio/test/test_option_d.c
new file mode 100644
index 00000000000..9ff14539698
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_d.c
@@ -0,0 +1,64 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD$");
+
+
+DEFINE_TEST(test_option_d)
+{
+ int r;
+
+ /*
+ * Create a file in a directory.
+ */
+ assertMakeDir("dir", 0755);
+ assertMakeFile("dir/file", 0644, NULL);
+
+ /* Create an archive. */
+ r = systemf("echo dir/file | %s -o > archive.cpio 2>archive.err", testprog);
+ assertEqualInt(r, 0);
+ assertTextFileContents("1 block\n", "archive.err");
+ assertFileSize("archive.cpio", 512);
+
+ /* Dearchive without -d, this should fail. */
+ assertMakeDir("without-d", 0755);
+ assertChdir("without-d");
+ r = systemf("%s -i < ../archive.cpio >out 2>err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("out");
+ /* And the file should not be restored. */
+ assertFileNotExists("dir/file");
+
+ /* Dearchive with -d, this should succeed. */
+ assertChdir("..");
+ assertMakeDir("with-d", 0755);
+ assertChdir("with-d");
+ r = systemf("%s -id < ../archive.cpio >out 2>err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("out");
+ assertTextFileContents("1 block\n", "err");
+ /* And the file should be restored. */
+ assertFileExists("dir/file");
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_f.c b/archivers/libarchive/files/cpio/test/test_option_f.c
new file mode 100644
index 00000000000..784e0858431
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_f.c
@@ -0,0 +1,76 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD$");
+
+/*
+ * Unpack the archive in a new dir.
+ */
+static void
+unpack(const char *dirname, const char *option)
+{
+ int r;
+
+ assertMakeDir(dirname, 0755);
+ assertChdir(dirname);
+ extract_reference_file("test_option_f.cpio");
+ r = systemf("%s -i %s < test_option_f.cpio > copy-no-a.out 2>copy-no-a.err", testprog, option);
+ assertEqualInt(0, r);
+ assertChdir("..");
+}
+
+DEFINE_TEST(test_option_f)
+{
+ /* Calibrate: No -f option, so everything should be extracted. */
+ unpack("t0", "--no-preserve-owner");
+ assertFileExists("t0/a123");
+ assertFileExists("t0/a234");
+ assertFileExists("t0/b123");
+ assertFileExists("t0/b234");
+
+ /* Don't extract 'a*' files. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Single quotes isn't used by command.exe. */
+ unpack("t1", "--no-preserve-owner -f a*");
+#else
+ unpack("t1", "--no-preserve-owner -f 'a*'");
+#endif
+ assertFileNotExists("t1/a123");
+ assertFileNotExists("t1/a234");
+ assertFileExists("t1/b123");
+ assertFileExists("t1/b234");
+
+ /* Don't extract 'b*' files. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Single quotes isn't used by command.exe. */
+ unpack("t2", "--no-preserve-owner -f b*");
+#else
+ unpack("t2", "--no-preserve-owner -f 'b*'");
+#endif
+ assertFileExists("t2/a123");
+ assertFileExists("t2/a234");
+ assertFileNotExists("t2/b123");
+ assertFileNotExists("t2/b234");
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_f.cpio.uu b/archivers/libarchive/files/cpio/test/test_option_f.cpio.uu
new file mode 100644
index 00000000000..42c63c39685
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_f.cpio.uu
@@ -0,0 +1,16 @@
+$FreeBSD$
+begin 644 test_option_f.cpio
+M,#<P-S`W,#`P,3,Q-C(Q-38Q,3`P-C0T,#`Q-S4P,#`Q-S4P,#`P,#`Q,#`P
+M,#`P,3`W,S4Q,3(U,C8P,#`P,#4P,#`P,#`P,#`P,&$Q,C,`,#<P-S`W,#`P
+M,3,Q-C(Q-38S,3`P-C0T,#`Q-S4P,#`Q-S4P,#`P,#`Q,#`P,#`P,3`W,S4Q
+M,3(U-#`P,#`P,#4P,#`P,#`P,#`P,&$R,S0`,#<P-S`W,#`P,3,Q-C(Q-38R
+M,3`P-C0T,#`Q-S4P,#`Q-S4P,#`P,#`Q,#`P,#`P,3`W,S4Q,3(U,S0P,#`P
+M,#4P,#`P,#`P,#`P,&(Q,C,`,#<P-S`W,#`P,3,Q-C(Q-38T,3`P-C0T,#`Q
+M-S4P,#`Q-S4P,#`P,#`Q,#`P,#`P,3`W,S4Q,3(U-#,P,#`P,#4P,#`P,#`P
+M,#`P,&(R,S0`,#<P-S`W,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P
+M,#`P,#`Q,#`P,#`P,#`P,#`P,#`P,#`P,#`P,3,P,#`P,#`P,#`P,%1204E,
+M15(A(2$`````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+1````````````````````````
+`
+end
diff --git a/archivers/libarchive/files/cpio/test/test_option_help.c b/archivers/libarchive/files/cpio/test/test_option_help.c
new file mode 100644
index 00000000000..56234306f53
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_help.c
@@ -0,0 +1,84 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD$");
+
+/*
+ * 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_option_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 >= 7);
+ failure("First line of help output should contain string 'bsdcpio'");
+ assert(in_first_line(p, "bsdcpio"));
+ /*
+ * 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");
+
+ /* -W help should be another synonym. */
+ r = systemf("%s -W help >Whelp.stdout 2>Whelp.stderr", testprog);
+ assertEqualInt(r, 0);
+ failure("-W help should generate nothing to stderr.");
+ assertEmptyFile("Whelp.stderr");
+ failure("stdout should be same for -W help and --help");
+ assertEqualFile("Whelp.stdout", "help.stdout");
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_m.c b/archivers/libarchive/files/cpio/test/test_option_m.c
new file mode 100644
index 00000000000..de880b2883e
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_m.c
@@ -0,0 +1,63 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD$");
+
+
+DEFINE_TEST(test_option_m)
+{
+ int r;
+
+ /*
+ * The reference archive has one file with an mtime in 1970, 1
+ * second after the start of the epoch.
+ */
+
+ /* Restored without -m, the result should have a current mtime. */
+ assertMakeDir("without-m", 0755);
+ assertChdir("without-m");
+ extract_reference_file("test_option_m.cpio");
+ r = systemf("%s --no-preserve-owner -i < test_option_m.cpio >out 2>err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("out");
+ assertTextFileContents("1 block\n", "err");
+ /* Should have been created within the last few seconds. */
+ assertFileMtimeRecent("file");
+
+ /* With -m, it should have an mtime in 1970. */
+ assertChdir("..");
+ assertMakeDir("with-m", 0755);
+ assertChdir("with-m");
+ extract_reference_file("test_option_m.cpio");
+ r = systemf("%s --no-preserve-owner -im < test_option_m.cpio >out 2>err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("out");
+ assertTextFileContents("1 block\n", "err");
+ /*
+ * mtime in reference archive is '1' == 1 second after
+ * midnight Jan 1, 1970 UTC.
+ */
+ assertFileMtime("file", 1, 0);
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_m.cpio.uu b/archivers/libarchive/files/cpio/test/test_option_m.cpio.uu
new file mode 100644
index 00000000000..3d2002355e5
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_m.cpio.uu
@@ -0,0 +1,16 @@
+$FreeBSD$
+begin 644 test_option_m.cpio
+M,#<P-S`W,#`P,3,Q-#4P,#8T,3`P-C0T,#`Q-S4P,#`Q-S4P,#`P,#`Q,#`P
+M,#`P,#`P,#`P,#`P,#$P,#`P,#4P,#`P,#`P,#`P,&9I;&4`,#<P-S`W,#`P
+M,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`Q,#`P,#`P,#`P,#`P
+M,#`P,#`P,#`P,3,P,#`P,#`P,#`P,%1204E,15(A(2$`````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+1````````````````````````
+`
+end
diff --git a/archivers/libarchive/files/cpio/test/test_option_t.c b/archivers/libarchive/files/cpio/test/test_option_t.c
new file mode 100644
index 00000000000..4427bb3a6cd
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_t.c
@@ -0,0 +1,95 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD$");
+
+
+DEFINE_TEST(test_option_t)
+{
+ char *p;
+ int r;
+
+ /* List reference archive, make sure the TOC is correct. */
+ extract_reference_file("test_option_t.cpio");
+ r = systemf("%s -it < test_option_t.cpio >it.out 2>it.err", testprog);
+ assertEqualInt(r, 0);
+ assertTextFileContents("1 block\n", "it.err");
+ extract_reference_file("test_option_t.stdout");
+ p = slurpfile(NULL, "test_option_t.stdout");
+ assertTextFileContents(p, "it.out");
+ free(p);
+
+ /* We accept plain "-t" as a synonym for "-it" */
+ r = systemf("%s -t < test_option_t.cpio >t.out 2>t.err", testprog);
+ assertEqualInt(r, 0);
+ assertTextFileContents("1 block\n", "t.err");
+ extract_reference_file("test_option_t.stdout");
+ p = slurpfile(NULL, "test_option_t.stdout");
+ assertTextFileContents(p, "t.out");
+ free(p);
+
+ /* But "-ot" is an error. */
+ assert(0 != systemf("%s -ot < test_option_t.cpio >ot.out 2>ot.err",
+ testprog));
+ assertEmptyFile("ot.out");
+
+ /* List reference archive verbosely, make sure the TOC is correct. */
+ r = systemf("%s -itv < test_option_t.cpio >tv.out 2>tv.err", testprog);
+ assertEqualInt(r, 0);
+ assertTextFileContents("1 block\n", "tv.err");
+ extract_reference_file("test_option_tv.stdout");
+
+ /* This doesn't work because the usernames on different systems
+ * are different and cpio now looks up numeric UIDs on
+ * the local system. */
+ /* assertEqualFile("tv.out", "test_option_tv.stdout"); */
+
+ /* List reference archive with numeric IDs, verify TOC is correct. */
+ r = systemf("%s -itnv < test_option_t.cpio >itnv.out 2>itnv.err",
+ testprog);
+ assertEqualInt(r, 0);
+ assertTextFileContents("1 block\n", "itnv.err");
+ p = slurpfile(NULL, "itnv.out");
+ /* Since -n uses numeric UID/GID, this part should be the
+ * same on every system. */
+ assertEqualMem(p, "-rw-r--r-- 1 1000 1000 0 ",42);
+ /* Date varies depending on local timezone. */
+ if (memcmp(p + 42, "Dec 31 1969", 12) == 0) {
+ /* East of Greenwich we get Dec 31, 1969. */
+ } else {
+ /* West of Greenwich get Jan 1, 1970 */
+ assertEqualMem(p + 42, "Jan ", 4);
+ /* Some systems format "Jan 01", some "Jan 1" */
+ assert(p[46] == ' ' || p[46] == '0');
+ assertEqualMem(p + 47, "1 1970 ", 8);
+ }
+ assertEqualMem(p + 54, " file", 5);
+ free(p);
+
+ /* But "-n" without "-t" is an error. */
+ assert(0 != systemf("%s -in < test_option_t.cpio >in.out 2>in.err",
+ testprog));
+ assertEmptyFile("in.out");
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_t.cpio.uu b/archivers/libarchive/files/cpio/test/test_option_t.cpio.uu
new file mode 100644
index 00000000000..055fe747d06
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_t.cpio.uu
@@ -0,0 +1,16 @@
+$FreeBSD$
+begin 644 test_option_t.cpio
+M,#<P-S`W,#`P,3,Q-#4P,#8T,3`P-C0T,#`Q-S4P,#`Q-S4P,#`P,#`Q,#`P
+M,#`P,#`P,#`P,#`P,#$P,#`P,#4P,#`P,#`P,#`P,&9I;&4`,#<P-S`W,#`P
+M,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`Q,#`P,#`P,#`P,#`P
+M,#`P,#`P,#`P,3,P,#`P,#`P,#`P,%1204E,15(A(2$`````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+1````````````````````````
+`
+end
diff --git a/archivers/libarchive/files/cpio/test/test_option_t.stdout.uu b/archivers/libarchive/files/cpio/test/test_option_t.stdout.uu
new file mode 100644
index 00000000000..2457706ecee
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_t.stdout.uu
@@ -0,0 +1,5 @@
+$FreeBSD$
+begin 644 test_option_t.stdout
+%9FEL90H`
+`
+end
diff --git a/archivers/libarchive/files/cpio/test/test_option_tv.stdout.uu b/archivers/libarchive/files/cpio/test/test_option_tv.stdout.uu
new file mode 100644
index 00000000000..e28888ac474
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_tv.stdout.uu
@@ -0,0 +1,6 @@
+$FreeBSD: src/usr.bin/cpio/test/test_option_tv.stdout.uu,v 1.2 2008/11/29 20:22:02 kientzle Exp $
+begin 644 test_option_tv.stdout
+M+7)W+7(M+7(M+2`@(#$@=&EM("`@("`@=&EM("`@("`@("`@("`@(#`@1&5C
+/(#,Q("`Q.38Y(&9I;&4*
+`
+end
diff --git a/archivers/libarchive/files/cpio/test/test_option_u.c b/archivers/libarchive/files/cpio/test/test_option_u.c
new file mode 100644
index 00000000000..08058aa4539
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_u.c
@@ -0,0 +1,81 @@
+/*-
+ * 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"
+#if defined(HAVE_UTIME_H)
+#include <utime.h>
+#elif defined(HAVE_SYS_UTIME_H)
+#include <sys/utime.h>
+#endif
+__FBSDID("$FreeBSD$");
+
+DEFINE_TEST(test_option_u)
+{
+ struct utimbuf times;
+ char *p;
+ size_t s;
+ int r;
+
+ /* Create a file. */
+ assertMakeFile("f", 0644, "a");
+
+ /* Copy the file to the "copy" dir. */
+ r = systemf("echo f | %s -pd copy >copy.out 2>copy.err",
+ testprog);
+ assertEqualInt(r, 0);
+
+ /* Check that the file contains only a single "a" */
+ p = slurpfile(&s, "copy/f");
+ assertEqualInt(s, 1);
+ assertEqualMem(p, "a", 1);
+
+ /* Recreate the file with a single "b" */
+ assertMakeFile("f", 0644, "b");
+
+ /* Set the mtime to the distant past. */
+ memset(&times, 0, sizeof(times));
+ times.actime = 1;
+ times.modtime = 3;
+ assertEqualInt(0, utime("f", &times));
+
+ /* Copy the file to the "copy" dir. */
+ r = systemf("echo f | %s -pd copy >copy.out 2>copy.err",
+ testprog);
+ assertEqualInt(r, 0);
+
+ /* Verify that the file hasn't changed (it wasn't overwritten) */
+ p = slurpfile(&s, "copy/f");
+ assertEqualInt(s, 1);
+ assertEqualMem(p, "a", 1);
+
+ /* Copy the file to the "copy" dir with -u (force) */
+ r = systemf("echo f | %s -pud copy >copy.out 2>copy.err",
+ testprog);
+ assertEqualInt(r, 0);
+
+ /* Verify that the file has changed (it was overwritten) */
+ p = slurpfile(&s, "copy/f");
+ assertEqualInt(s, 1);
+ assertEqualMem(p, "b", 1);
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_version.c b/archivers/libarchive/files/cpio/test/test_option_version.c
new file mode 100644
index 00000000000..7345da1e515
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_version.c
@@ -0,0 +1,109 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD$");
+
+/*
+ * Test that --version option works and generates reasonable output.
+ */
+
+static void
+verify(const char *p, size_t s)
+{
+ const char *q = p;
+
+ /* Version message should start with name of program, then space. */
+ failure("version message too short:", p);
+ if (!assert(s > 6))
+ return;
+ failure("Version message should begin with 'bsdcpio': %s", p);
+ if (!assertEqualMem(q, "bsdcpio ", 8))
+ /* If we're not testing bsdcpio, don't keep going. */
+ return;
+ q += 8; s -= 8;
+ /* Version number is a series of digits and periods. */
+ while (s > 0 && (*q == '.' || (*q >= '0' && *q <= '9'))) {
+ ++q;
+ --s;
+ }
+ /* Version number terminated by space. */
+ failure("Version: %s", p);
+ assert(s > 1);
+ /* Skip a single trailing a,b,c, or d. */
+ if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd')
+ ++q;
+ failure("Version: %s", p);
+ assert(*q == ' ');
+ ++q; --s;
+ /* Separator. */
+ failure("Version: %s", p);
+ assertEqualMem(q, "-- ", 3);
+ q += 3; s -= 3;
+ /* libarchive name and version number */
+ assert(s > 11);
+ failure("Version: %s", p);
+ assertEqualMem(q, "libarchive ", 11);
+ q += 11; s -= 11;
+ /* Version number is a series of digits and periods. */
+ while (s > 0 && (*q == '.' || (*q >= '0' && *q <= '9'))) {
+ ++q;
+ --s;
+ }
+ /* Skip a single trailing a,b,c, or d. */
+ if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd')
+ ++q;
+ /* All terminated by end-of-line: \r, \r\n, or \n */
+ assert(s >= 1);
+ failure("Version: %s", p);
+ if (*q == '\x0d') {
+ if (q[1] != '\0')
+ assertEqualMem(q, "\x0d\x0a", 2);
+ } else
+ assertEqualMem(q, "\x0a", 1);
+}
+
+
+DEFINE_TEST(test_option_version)
+{
+ int r;
+ char *p;
+ size_t s;
+
+ r = systemf("%s --version >version.stdout 2>version.stderr", testprog);
+ if (r != 0)
+ r = systemf("%s -W version >version.stdout 2>version.stderr",
+ testprog);
+ failure("Unable to run either %s --version or %s -W version",
+ testprog, testprog);
+ if (!assert(r == 0))
+ return;
+
+ /* --version should generate nothing to stderr. */
+ assertEmptyFile("version.stderr");
+ /* Verify format of version message. */
+ p = slurpfile(&s, "version.stdout");
+ verify(p, s);
+ free(p);
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_y.c b/archivers/libarchive/files/cpio/test/test_option_y.c
new file mode 100644
index 00000000000..58734966ce6
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_y.c
@@ -0,0 +1,57 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/usr.bin/cpio/test/test_option_y.c,v 1.2 2008/08/24 06:21:00 kientzle Exp $");
+
+DEFINE_TEST(test_option_y)
+{
+ char *p;
+ int r;
+ size_t s;
+
+ /* Create a file. */
+ assertMakeFile("f", 0644, "a");
+
+ /* Archive it with bzip2 compression. */
+ r = systemf("echo f | %s -oy >archive.out 2>archive.err",
+ testprog);
+ p = slurpfile(&s, "archive.err");
+ p[s] = '\0';
+ if (r != 0) {
+ if (strstr(p, "compression not available") != NULL) {
+ skipping("This version of bsdcpio was compiled "
+ "without bzip2 support");
+ return;
+ }
+ failure("-y option is broken");
+ assertEqualInt(r, 0);
+ return;
+ }
+ assertTextFileContents("1 block\n", "archive.err");
+ /* Check that the archive file has a bzip2 signature. */
+ p = slurpfile(&s, "archive.out");
+ assert(s > 2);
+ assertEqualMem(p, "BZh9", 4);
+}
diff --git a/archivers/libarchive/files/cpio/test/test_option_z.c b/archivers/libarchive/files/cpio/test/test_option_z.c
new file mode 100644
index 00000000000..91d37ac1983
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_option_z.c
@@ -0,0 +1,56 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD$");
+
+DEFINE_TEST(test_option_z)
+{
+ char *p;
+ int r;
+ size_t s;
+
+ /* Create a file. */
+ assertMakeFile("f", 0644, "a");
+
+ /* Archive it with gzip compression. */
+ r = systemf("echo f | %s -oz >archive.out 2>archive.err",
+ testprog);
+ p = slurpfile(&s, "archive.err");
+ p[s] = '\0';
+ if (r != 0) {
+ if (strstr(p, "compression not available") != NULL) {
+ skipping("This version of bsdcpio was compiled "
+ "without gzip support");
+ return;
+ }
+ failure("-z option is broken");
+ assertEqualInt(r, 0);
+ return;
+ }
+ /* Check that the archive file has a gzip signature. */
+ p = slurpfile(&s, "archive.out");
+ assert(s > 4);
+ assertEqualMem(p, "\x1f\x8b\x08\x00", 4);
+}
diff --git a/archivers/libarchive/files/cpio/test/test_owner_parse.c b/archivers/libarchive/files/cpio/test/test_owner_parse.c
new file mode 100644
index 00000000000..9875e91e4ad
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_owner_parse.c
@@ -0,0 +1,121 @@
+/*-
+ * Copyright (c) 2003-2009 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"
+__FBSDID("$FreeBSD$");
+
+#include "../cpio.h"
+#include "err.h"
+
+#if !defined(_WIN32)
+#define ROOT "root"
+static int root_uids[] = { 0 };
+static int root_gids[] = { 0 };
+#elif defined(__CYGWIN__)
+/* On cygwin, the Administrator user most likely exists (unless
+ * it has been renamed or is in a non-English localization), but
+ * its primary group membership depends on how the user set up
+ * their /etc/passwd. Likely values are 513 (None), 545 (Users),
+ * or 544 (Administrators). Just check for one of those...
+ * TODO: Handle non-English localizations...e.g. French 'Administrateur'
+ * Use CreateWellKnownSID() and LookupAccountName()?
+ */
+#define ROOT "Administrator"
+static int root_uids[] = { 500 };
+static int root_gids[] = { 513, 545, 544 };
+#endif
+
+#if defined(ROOT)
+static int
+int_in_list(int i, int *l, size_t n)
+{
+ while (n-- > 0)
+ if (*l++ == i)
+ return (1);
+ failure("%d", i);
+ return (0);
+}
+#endif
+
+DEFINE_TEST(test_owner_parse)
+{
+#if !defined(ROOT)
+ skipping("No uid/gid configuration for this OS");
+#else
+ int uid, gid;
+
+ assert(NULL == owner_parse(ROOT, &uid, &gid));
+ assert(int_in_list(uid, root_uids,
+ sizeof(root_uids)/sizeof(root_uids[0])));
+ assertEqualInt(-1, gid);
+
+
+ assert(NULL == owner_parse(ROOT ":", &uid, &gid));
+ assert(int_in_list(uid, root_uids,
+ sizeof(root_uids)/sizeof(root_uids[0])));
+ assert(int_in_list(gid, root_gids,
+ sizeof(root_gids)/sizeof(root_gids[0])));
+
+ assert(NULL == owner_parse(ROOT ".", &uid, &gid));
+ assert(int_in_list(uid, root_uids,
+ sizeof(root_uids)/sizeof(root_uids[0])));
+ assert(int_in_list(gid, root_gids,
+ sizeof(root_gids)/sizeof(root_gids[0])));
+
+ assert(NULL == owner_parse("111", &uid, &gid));
+ assertEqualInt(111, uid);
+ assertEqualInt(-1, gid);
+
+ assert(NULL == owner_parse("112:", &uid, &gid));
+ assertEqualInt(112, uid);
+ /* Can't assert gid, since we don't know gid for user #112. */
+
+ assert(NULL == owner_parse("113.", &uid, &gid));
+ assertEqualInt(113, uid);
+ /* Can't assert gid, since we don't know gid for user #113. */
+
+ assert(NULL == owner_parse(":114", &uid, &gid));
+ assertEqualInt(-1, uid);
+ assertEqualInt(114, gid);
+
+ assert(NULL == owner_parse(".115", &uid, &gid));
+ assertEqualInt(-1, uid);
+ assertEqualInt(115, gid);
+
+ assert(NULL == owner_parse("116:117", &uid, &gid));
+ assertEqualInt(116, uid);
+ assertEqualInt(117, gid);
+
+ /*
+ * TODO: Lookup current user/group name, build strings and
+ * use those to verify username/groupname lookups for ordinary
+ * users.
+ */
+
+ assert(NULL != owner_parse(":nonexistentgroup", &uid, &gid));
+ assert(NULL != owner_parse(ROOT ":nonexistentgroup", &uid, &gid));
+ assert(NULL !=
+ owner_parse("nonexistentuser:nonexistentgroup", &uid, &gid));
+#endif
+}
diff --git a/archivers/libarchive/files/cpio/test/test_pathmatch.c b/archivers/libarchive/files/cpio/test/test_pathmatch.c
new file mode 100644
index 00000000000..177c2bcc4af
--- /dev/null
+++ b/archivers/libarchive/files/cpio/test/test_pathmatch.c
@@ -0,0 +1,243 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD$");
+
+#include "pathmatch.h"
+
+/*
+ * Verify that the pattern matcher implements the wildcard logic specified
+ * in SUSv2 for the cpio command. This is essentially the
+ * shell glob syntax:
+ * * - matches any sequence of chars, including '/'
+ * ? - matches any single char, including '/'
+ * [...] - matches any of a set of chars, '-' specifies a range,
+ * initial '!' is undefined
+ *
+ * The specification in SUSv2 is a bit incomplete, I assume the following:
+ * Trailing '-' in [...] is not special.
+ *
+ * TODO: Figure out if there's a good way to extend this to handle
+ * Windows paths that use '\' as a path separator. <sigh>
+ */
+
+DEFINE_TEST(test_pathmatch)
+{
+ assertEqualInt(1, lafe_pathmatch("a/b/c", "a/b/c", 0));
+ assertEqualInt(0, lafe_pathmatch("a/b/", "a/b/c", 0));
+ assertEqualInt(0, lafe_pathmatch("a/b", "a/b/c", 0));
+ assertEqualInt(0, lafe_pathmatch("a/b/c", "a/b/", 0));
+ assertEqualInt(0, lafe_pathmatch("a/b/c", "a/b", 0));
+
+ /* Empty pattern only matches empty string. */
+ assertEqualInt(1, lafe_pathmatch("","", 0));
+ assertEqualInt(0, lafe_pathmatch("","a", 0));
+ assertEqualInt(1, lafe_pathmatch("*","", 0));
+ assertEqualInt(1, lafe_pathmatch("*","a", 0));
+ assertEqualInt(1, lafe_pathmatch("*","abcd", 0));
+ /* SUSv2: * matches / */
+ assertEqualInt(1, lafe_pathmatch("*","abcd/efgh/ijkl", 0));
+ assertEqualInt(1, lafe_pathmatch("abcd*efgh/ijkl","abcd/efgh/ijkl", 0));
+ assertEqualInt(1, lafe_pathmatch("abcd***efgh/ijkl","abcd/efgh/ijkl", 0));
+ assertEqualInt(1, lafe_pathmatch("abcd***/efgh/ijkl","abcd/efgh/ijkl", 0));
+ assertEqualInt(0, lafe_pathmatch("?", "", 0));
+ assertEqualInt(0, lafe_pathmatch("?", "\0", 0));
+ assertEqualInt(1, lafe_pathmatch("?", "a", 0));
+ assertEqualInt(0, lafe_pathmatch("?", "ab", 0));
+ assertEqualInt(1, lafe_pathmatch("?", ".", 0));
+ assertEqualInt(1, lafe_pathmatch("?", "?", 0));
+ assertEqualInt(1, lafe_pathmatch("a", "a", 0));
+ assertEqualInt(0, lafe_pathmatch("a", "ab", 0));
+ assertEqualInt(0, lafe_pathmatch("a", "ab", 0));
+ assertEqualInt(1, lafe_pathmatch("a?c", "abc", 0));
+ /* SUSv2: ? matches / */
+ assertEqualInt(1, lafe_pathmatch("a?c", "a/c", 0));
+ assertEqualInt(1, lafe_pathmatch("a?*c*", "a/c", 0));
+ assertEqualInt(1, lafe_pathmatch("*a*", "a/c", 0));
+ assertEqualInt(1, lafe_pathmatch("*a*", "/a/c", 0));
+ assertEqualInt(1, lafe_pathmatch("*a*", "defaaaaaaa", 0));
+ assertEqualInt(0, lafe_pathmatch("a*", "defghi", 0));
+ assertEqualInt(0, lafe_pathmatch("*a*", "defghi", 0));
+
+ /* Character classes */
+ assertEqualInt(1, lafe_pathmatch("abc[def", "abc[def", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[def]", "abc[def", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[def", "abcd", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[def]", "abcd", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[def]", "abce", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[def]", "abcf", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[def]", "abcg", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d*f]", "abcd", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d*f]", "abc*", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[d*f]", "abcdefghi", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[d*", "abcdefghi", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d*", "abc[defghi", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d-f]", "abcd", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d-f]", "abce", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d-f]", "abcf", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[d-f]", "abcg", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[d-fh-k]", "abca", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d-fh-k]", "abcd", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d-fh-k]", "abce", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d-fh-k]", "abcf", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[d-fh-k]", "abcg", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d-fh-k]", "abch", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d-fh-k]", "abci", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d-fh-k]", "abcj", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d-fh-k]", "abck", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[d-fh-k]", "abcl", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[d-fh-k]", "abc-", 0));
+
+ /* [] matches nothing, [!] is the same as ? */
+ assertEqualInt(0, lafe_pathmatch("abc[]efg", "abcdefg", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[]efg", "abcqefg", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[]efg", "abcefg", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[!]efg", "abcdefg", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[!]efg", "abcqefg", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[!]efg", "abcefg", 0));
+
+ /* I assume: Trailing '-' is non-special. */
+ assertEqualInt(0, lafe_pathmatch("abc[d-fh-]", "abcl", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d-fh-]", "abch", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d-fh-]", "abc-", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d-fh-]", "abc-", 0));
+
+ /* ']' can be backslash-quoted within a character class. */
+ assertEqualInt(1, lafe_pathmatch("abc[\\]]", "abc]", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[\\]d]", "abc]", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[\\]d]", "abcd", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d\\]]", "abc]", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d\\]]", "abcd", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d]e]", "abcde]", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d\\]e]", "abc]", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[d\\]e]", "abcd]e", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[d]e]", "abc]", 0));
+
+ /* backslash-quoted chars can appear as either end of a range. */
+ assertEqualInt(1, lafe_pathmatch("abc[\\d-f]gh", "abcegh", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[\\d-f]gh", "abcggh", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[\\d-f]gh", "abc\\gh", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d-\\f]gh", "abcegh", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[\\d-\\f]gh", "abcegh", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[\\d-\\f]gh", "abcegh", 0));
+ /* backslash-quoted '-' isn't special. */
+ assertEqualInt(0, lafe_pathmatch("abc[d\\-f]gh", "abcegh", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[d\\-f]gh", "abc-gh", 0));
+
+ /* Leading '!' negates a character class. */
+ assertEqualInt(0, lafe_pathmatch("abc[!d]", "abcd", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[!d]", "abce", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[!d]", "abcc", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[!d-z]", "abcq", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[!d-gi-z]", "abch", 0));
+ assertEqualInt(1, lafe_pathmatch("abc[!fgijkl]", "abch", 0));
+ assertEqualInt(0, lafe_pathmatch("abc[!fghijkl]", "abch", 0));
+
+ /* Backslash quotes next character. */
+ assertEqualInt(0, lafe_pathmatch("abc\\[def]", "abc\\d", 0));
+ assertEqualInt(1, lafe_pathmatch("abc\\[def]", "abc[def]", 0));
+ assertEqualInt(0, lafe_pathmatch("abc\\\\[def]", "abc[def]", 0));
+ assertEqualInt(0, lafe_pathmatch("abc\\\\[def]", "abc\\[def]", 0));
+ assertEqualInt(1, lafe_pathmatch("abc\\\\[def]", "abc\\d", 0));
+ assertEqualInt(1, lafe_pathmatch("abcd\\", "abcd\\", 0));
+ assertEqualInt(0, lafe_pathmatch("abcd\\", "abcd\\[", 0));
+ assertEqualInt(0, lafe_pathmatch("abcd\\", "abcde", 0));
+ assertEqualInt(0, lafe_pathmatch("abcd\\[", "abcd\\", 0));
+
+ /*
+ * Because '.' and '/' have special meanings, we can
+ * identify many equivalent paths even if they're expressed
+ * differently. (But quoting a character with '\\' suppresses
+ * special meanings!)
+ */
+ assertEqualInt(0, lafe_pathmatch("a/b/", "a/bc", 0));
+ assertEqualInt(1, lafe_pathmatch("a/./b", "a/b", 0));
+ assertEqualInt(0, lafe_pathmatch("a\\/./b", "a/b", 0));
+ assertEqualInt(0, lafe_pathmatch("a/\\./b", "a/b", 0));
+ assertEqualInt(0, lafe_pathmatch("a/.\\/b", "a/b", 0));
+ assertEqualInt(0, lafe_pathmatch("a\\/\\.\\/b", "a/b", 0));
+ assertEqualInt(1, lafe_pathmatch("./abc/./def/", "abc/def/", 0));
+ assertEqualInt(1, lafe_pathmatch("abc/def", "./././abc/./def", 0));
+ assertEqualInt(1, lafe_pathmatch("abc/def/././//", "./././abc/./def/", 0));
+ assertEqualInt(1, lafe_pathmatch(".////abc/.//def", "./././abc/./def", 0));
+ assertEqualInt(1, lafe_pathmatch("./abc?def/", "abc/def/", 0));
+ failure("\"?./\" is not the same as \"/./\"");
+ assertEqualInt(0, lafe_pathmatch("./abc?./def/", "abc/def/", 0));
+ failure("Trailing '/' should match no trailing '/'");
+ assertEqualInt(1, lafe_pathmatch("./abc/./def/", "abc/def", 0));
+ failure("Trailing '/./' is still the same directory.");
+ assertEqualInt(1, lafe_pathmatch("./abc/./def/./", "abc/def", 0));
+ failure("Trailing '/.' is still the same directory.");
+ assertEqualInt(1, lafe_pathmatch("./abc/./def/.", "abc/def", 0));
+ assertEqualInt(1, lafe_pathmatch("./abc/./def", "abc/def/", 0));
+ failure("Trailing '/./' is still the same directory.");
+ assertEqualInt(1, lafe_pathmatch("./abc/./def", "abc/def/./", 0));
+ failure("Trailing '/.' is still the same directory.");
+ assertEqualInt(1, lafe_pathmatch("./abc*/./def", "abc/def/.", 0));
+
+ /* Matches not anchored at beginning. */
+ assertEqualInt(0,
+ lafe_pathmatch("bcd", "abcd", PATHMATCH_NO_ANCHOR_START));
+ assertEqualInt(1,
+ lafe_pathmatch("abcd", "abcd", PATHMATCH_NO_ANCHOR_START));
+ assertEqualInt(0,
+ lafe_pathmatch("^bcd", "abcd", PATHMATCH_NO_ANCHOR_START));
+ assertEqualInt(1,
+ lafe_pathmatch("b/c/d", "a/b/c/d", PATHMATCH_NO_ANCHOR_START));
+ assertEqualInt(0,
+ lafe_pathmatch("b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_START));
+ assertEqualInt(0,
+ lafe_pathmatch("^b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_START));
+
+ /* Matches not anchored at end. */
+ assertEqualInt(0,
+ lafe_pathmatch("bcd", "abcd", PATHMATCH_NO_ANCHOR_END));
+ assertEqualInt(1,
+ lafe_pathmatch("abcd", "abcd", PATHMATCH_NO_ANCHOR_END));
+ assertEqualInt(1,
+ lafe_pathmatch("abcd", "abcd/", PATHMATCH_NO_ANCHOR_END));
+ assertEqualInt(1,
+ lafe_pathmatch("abcd", "abcd/.", PATHMATCH_NO_ANCHOR_END));
+ assertEqualInt(0,
+ lafe_pathmatch("abc", "abcd", PATHMATCH_NO_ANCHOR_END));
+ assertEqualInt(1,
+ lafe_pathmatch("a/b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_END));
+ assertEqualInt(0,
+ lafe_pathmatch("a/b/c$", "a/b/c/d", PATHMATCH_NO_ANCHOR_END));
+ assertEqualInt(1,
+ lafe_pathmatch("a/b/c$", "a/b/c", PATHMATCH_NO_ANCHOR_END));
+ assertEqualInt(1,
+ lafe_pathmatch("a/b/c$", "a/b/c/", PATHMATCH_NO_ANCHOR_END));
+ assertEqualInt(1,
+ lafe_pathmatch("a/b/c/", "a/b/c/d", PATHMATCH_NO_ANCHOR_END));
+ assertEqualInt(0,
+ lafe_pathmatch("a/b/c/$", "a/b/c/d", PATHMATCH_NO_ANCHOR_END));
+ assertEqualInt(1,
+ lafe_pathmatch("a/b/c/$", "a/b/c/", PATHMATCH_NO_ANCHOR_END));
+ assertEqualInt(1,
+ lafe_pathmatch("a/b/c/$", "a/b/c", PATHMATCH_NO_ANCHOR_END));
+ assertEqualInt(0,
+ lafe_pathmatch("b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_END));
+}
diff --git a/archivers/libarchive/files/doc/man/Makefile b/archivers/libarchive/files/doc/man/Makefile
new file mode 100644
index 00000000000..d3a90196331
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/Makefile
@@ -0,0 +1,46 @@
+
+default: all
+
+
+archive_entry.3: ../mdoc2man.awk ../../libarchive/archive_entry.3
+ awk -f ../mdoc2man.awk < ../../libarchive/archive_entry.3 > archive_entry.3
+
+archive_read.3: ../mdoc2man.awk ../../libarchive/archive_read.3
+ awk -f ../mdoc2man.awk < ../../libarchive/archive_read.3 > archive_read.3
+
+archive_read_disk.3: ../mdoc2man.awk ../../libarchive/archive_read_disk.3
+ awk -f ../mdoc2man.awk < ../../libarchive/archive_read_disk.3 > archive_read_disk.3
+
+archive_util.3: ../mdoc2man.awk ../../libarchive/archive_util.3
+ awk -f ../mdoc2man.awk < ../../libarchive/archive_util.3 > archive_util.3
+
+archive_write.3: ../mdoc2man.awk ../../libarchive/archive_write.3
+ awk -f ../mdoc2man.awk < ../../libarchive/archive_write.3 > archive_write.3
+
+archive_write_disk.3: ../mdoc2man.awk ../../libarchive/archive_write_disk.3
+ awk -f ../mdoc2man.awk < ../../libarchive/archive_write_disk.3 > archive_write_disk.3
+
+cpio.5: ../mdoc2man.awk ../../libarchive/cpio.5
+ awk -f ../mdoc2man.awk < ../../libarchive/cpio.5 > cpio.5
+
+libarchive-formats.5: ../mdoc2man.awk ../../libarchive/libarchive-formats.5
+ awk -f ../mdoc2man.awk < ../../libarchive/libarchive-formats.5 > libarchive-formats.5
+
+libarchive.3: ../mdoc2man.awk ../../libarchive/libarchive.3
+ awk -f ../mdoc2man.awk < ../../libarchive/libarchive.3 > libarchive.3
+
+libarchive_internals.3: ../mdoc2man.awk ../../libarchive/libarchive_internals.3
+ awk -f ../mdoc2man.awk < ../../libarchive/libarchive_internals.3 > libarchive_internals.3
+
+mtree.5: ../mdoc2man.awk ../../libarchive/mtree.5
+ awk -f ../mdoc2man.awk < ../../libarchive/mtree.5 > mtree.5
+
+tar.5: ../mdoc2man.awk ../../libarchive/tar.5
+ awk -f ../mdoc2man.awk < ../../libarchive/tar.5 > tar.5
+
+bsdtar.1: ../mdoc2man.awk ../../tar/bsdtar.1
+ awk -f ../mdoc2man.awk < ../../tar/bsdtar.1 > bsdtar.1
+
+bsdcpio.1: ../mdoc2man.awk ../../cpio/bsdcpio.1
+ awk -f ../mdoc2man.awk < ../../cpio/bsdcpio.1 > bsdcpio.1
+all: archive_entry.3 archive_read.3 archive_read_disk.3 archive_util.3 archive_write.3 archive_write_disk.3 cpio.5 libarchive-formats.5 libarchive.3 libarchive_internals.3 mtree.5 tar.5 bsdtar.1 bsdcpio.1
diff --git a/archivers/libarchive/files/doc/man/archive_entry.3 b/archivers/libarchive/files/doc/man/archive_entry.3
new file mode 100644
index 00000000000..d459f00af99
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/archive_entry.3
@@ -0,0 +1,519 @@
+.TH archive_entry 3 "May 12, 2008" ""
+.SH NAME
+.ad l
+\fB\%archive_entry_acl_add_entry\fP,
+\fB\%archive_entry_acl_add_entry_w\fP,
+\fB\%archive_entry_acl_clear\fP,
+\fB\%archive_entry_acl_count\fP,
+\fB\%archive_entry_acl_next\fP,
+\fB\%archive_entry_acl_next_w\fP,
+\fB\%archive_entry_acl_reset\fP,
+\fB\%archive_entry_acl_text_w\fP,
+\fB\%archive_entry_atime\fP,
+\fB\%archive_entry_atime_nsec\fP,
+\fB\%archive_entry_clear\fP,
+\fB\%archive_entry_clone\fP,
+\fB\%archive_entry_copy_fflags_text\fP,
+\fB\%archive_entry_copy_fflags_text_w\fP,
+\fB\%archive_entry_copy_gname\fP,
+\fB\%archive_entry_copy_gname_w\fP,
+\fB\%archive_entry_copy_hardlink\fP,
+\fB\%archive_entry_copy_hardlink_w\fP,
+\fB\%archive_entry_copy_link\fP,
+\fB\%archive_entry_copy_link_w\fP,
+\fB\%archive_entry_copy_pathname_w\fP,
+\fB\%archive_entry_copy_sourcepath\fP,
+\fB\%archive_entry_copy_stat\fP,
+\fB\%archive_entry_copy_symlink\fP,
+\fB\%archive_entry_copy_symlink_w\fP,
+\fB\%archive_entry_copy_uname\fP,
+\fB\%archive_entry_copy_uname_w\fP,
+\fB\%archive_entry_dev\fP,
+\fB\%archive_entry_devmajor\fP,
+\fB\%archive_entry_devminor\fP,
+\fB\%archive_entry_filetype\fP,
+\fB\%archive_entry_fflags\fP,
+\fB\%archive_entry_fflags_text\fP,
+\fB\%archive_entry_free\fP,
+\fB\%archive_entry_gid\fP,
+\fB\%archive_entry_gname\fP,
+\fB\%archive_entry_hardlink\fP,
+\fB\%archive_entry_ino\fP,
+\fB\%archive_entry_mode\fP,
+\fB\%archive_entry_mtime\fP,
+\fB\%archive_entry_mtime_nsec\fP,
+\fB\%archive_entry_nlink\fP,
+\fB\%archive_entry_new\fP,
+\fB\%archive_entry_pathname\fP,
+\fB\%archive_entry_pathname_w\fP,
+\fB\%archive_entry_rdev\fP,
+\fB\%archive_entry_rdevmajor\fP,
+\fB\%archive_entry_rdevminor\fP,
+\fB\%archive_entry_set_atime\fP,
+\fB\%archive_entry_set_ctime\fP,
+\fB\%archive_entry_set_dev\fP,
+\fB\%archive_entry_set_devmajor\fP,
+\fB\%archive_entry_set_devminor\fP,
+\fB\%archive_entry_set_filetype\fP,
+\fB\%archive_entry_set_fflags\fP,
+\fB\%archive_entry_set_gid\fP,
+\fB\%archive_entry_set_gname\fP,
+\fB\%archive_entry_set_hardlink\fP,
+\fB\%archive_entry_set_link\fP,
+\fB\%archive_entry_set_mode\fP,
+\fB\%archive_entry_set_mtime\fP,
+\fB\%archive_entry_set_pathname\fP,
+\fB\%archive_entry_set_rdevmajor\fP,
+\fB\%archive_entry_set_rdevminor\fP,
+\fB\%archive_entry_set_size\fP,
+\fB\%archive_entry_set_symlink\fP,
+\fB\%archive_entry_set_uid\fP,
+\fB\%archive_entry_set_uname\fP,
+\fB\%archive_entry_size\fP,
+\fB\%archive_entry_sourcepath\fP,
+\fB\%archive_entry_stat\fP,
+\fB\%archive_entry_symlink\fP,
+\fB\%archive_entry_uid\fP,
+\fB\%archive_entry_uname\fP
+\- functions for manipulating archive entry descriptions
+.SH SYNOPSIS
+.ad l
+\fB#include <archive_entry.h>\fP
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_acl_add_entry\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%int\ type\fP, \fI\%int\ permset\fP, \fI\%int\ tag\fP, \fI\%int\ qual\fP, \fI\%const\ char\ *name\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_acl_add_entry_w\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%int\ type\fP, \fI\%int\ permset\fP, \fI\%int\ tag\fP, \fI\%int\ qual\fP, \fI\%const\ wchar_t\ *name\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_acl_clear\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_entry_acl_count\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%int\ type\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_entry_acl_next\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%int\ want_type\fP, \fI\%int\ *type\fP, \fI\%int\ *permset\fP, \fI\%int\ *tag\fP, \fI\%int\ *qual\fP, \fI\%const\ char\ **name\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_entry_acl_next_w\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%int\ want_type\fP, \fI\%int\ *type\fP, \fI\%int\ *permset\fP, \fI\%int\ *tag\fP, \fI\%int\ *qual\fP, \fI\%const\ wchar_t\ **name\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_entry_acl_reset\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%int\ want_type\fP);
+.br
+\fIconst wchar_t *\fP
+.br
+\fB\%archive_entry_acl_text_w\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%int\ flags\fP);
+.br
+\fItime_t\fP
+.br
+\fB\%archive_entry_atime\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIlong\fP
+.br
+\fB\%archive_entry_atime_nsec\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIstruct archive_entry *\fP
+.br
+\fB\%archive_entry_clear\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIstruct archive_entry *\fP
+.br
+\fB\%archive_entry_clone\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIconst char * *\fP
+.br
+\fB\%archive_entry_copy_fflags_text_w\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIconst wchar_t *\fP
+.br
+\fB\%archive_entry_copy_fflags_text_w\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ wchar_t\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_copy_gname\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_copy_gname_w\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ wchar_t\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_copy_hardlink\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_copy_hardlink_w\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ wchar_t\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_copy_sourcepath\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_copy_pathname_w\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ wchar_t\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_copy_stat\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ struct\ stat\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_copy_symlink\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_copy_symlink_w\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ wchar_t\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_copy_uname\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_copy_uname_w\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ wchar_t\ *\fP);
+.br
+\fIdev_t\fP
+.br
+\fB\%archive_entry_dev\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIdev_t\fP
+.br
+\fB\%archive_entry_devmajor\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIdev_t\fP
+.br
+\fB\%archive_entry_devminor\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fImode_t\fP
+.br
+\fB\%archive_entry_filetype\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_fflags\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%unsigned\ long\ *set\fP, \fI\%unsigned\ long\ *clear\fP);
+.br
+\fIconst char *\fP
+.br
+\fB\%archive_entry_fflags_text\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_free\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIconst char *\fP
+.br
+\fB\%archive_entry_gname\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIconst char *\fP
+.br
+\fB\%archive_entry_hardlink\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIino_t\fP
+.br
+\fB\%archive_entry_ino\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fImode_t\fP
+.br
+\fB\%archive_entry_mode\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fItime_t\fP
+.br
+\fB\%archive_entry_mtime\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIlong\fP
+.br
+\fB\%archive_entry_mtime_nsec\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIunsigned int\fP
+.br
+\fB\%archive_entry_nlink\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIstruct archive_entry *\fP
+.br
+\fB\%archive_entry_new\fP(\fI\%void\fP);
+.br
+\fIconst char *\fP
+.br
+\fB\%archive_entry_pathname\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIconst wchar_t *\fP
+.br
+\fB\%archive_entry_pathname_w\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIdev_t\fP
+.br
+\fB\%archive_entry_rdev\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIdev_t\fP
+.br
+\fB\%archive_entry_rdevmajor\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIdev_t\fP
+.br
+\fB\%archive_entry_rdevminor\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_dev\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%dev_t\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_devmajor\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%dev_t\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_devminor\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%dev_t\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_filetype\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%unsigned\ int\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_fflags\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%unsigned\ long\ set\fP, \fI\%unsigned\ long\ clear\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_gid\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%gid_t\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_gname\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_hardlink\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_ino\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%unsigned\ long\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_link\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_mode\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%mode_t\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_mtime\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%time_t\fP, \fI\%long\ nanos\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_nlink\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%unsigned\ int\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_pathname\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_rdev\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%dev_t\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_rdevmajor\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%dev_t\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_rdevminor\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%dev_t\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_size\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%int64_t\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_symlink\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_uid\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%uid_t\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_entry_set_uname\fP(\fI\%struct\ archive_entry\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIint64_t\fP
+.br
+\fB\%archive_entry_size\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIconst char *\fP
+.br
+\fB\%archive_entry_sourcepath\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIconst struct stat *\fP
+.br
+\fB\%archive_entry_stat\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIconst char *\fP
+.br
+\fB\%archive_entry_symlink\fP(\fI\%struct\ archive_entry\ *\fP);
+.br
+\fIconst char *\fP
+.br
+\fB\%archive_entry_uname\fP(\fI\%struct\ archive_entry\ *\fP);
+.SH DESCRIPTION
+.ad l
+These functions create and manipulate data objects that
+represent entries within an archive.
+You can think of a
+Tn struct archive_entry
+as a heavy-duty version of
+Tn struct stat:
+it includes everything from
+Tn struct stat
+plus associated pathname, textual group and user names, etc.
+These objects are used by
+\fBlibarchive\fP(3)
+to represent the metadata associated with a particular
+entry in an archive.
+.SS Create and Destroy
+There are functions to allocate, destroy, clear, and copy
+\fIarchive_entry\fP
+objects:
+.RS 5
+.TP
+\fB\%archive_entry_clear\fP()
+Erases the object, resetting all internal fields to the
+same state as a newly-created object.
+This is provided to allow you to quickly recycle objects
+without thrashing the heap.
+.TP
+\fB\%archive_entry_clone\fP()
+A deep copy operation; all text fields are duplicated.
+.TP
+\fB\%archive_entry_free\fP()
+Releases the
+Tn struct archive_entry
+object.
+.TP
+\fB\%archive_entry_new\fP()
+Allocate and return a blank
+Tn struct archive_entry
+object.
+.RE
+.SS Set and Get Functions
+Most of the functions here set or read entries in an object.
+Such functions have one of the following forms:
+.RS 5
+.TP
+\fB\%archive_entry_set_XXXX\fP()
+Stores the provided data in the object.
+In particular, for strings, the pointer is stored,
+not the referenced string.
+.TP
+\fB\%archive_entry_copy_XXXX\fP()
+As above, except that the referenced data is copied
+into the object.
+.TP
+\fB\%archive_entry_XXXX\fP()
+Returns the specified data.
+In the case of strings, a const-qualified pointer to
+the string is returned.
+.RE
+String data can be set or accessed as wide character strings
+or normal
+\fIchar\fP
+strings.
+The functions that use wide character strings are suffixed with
+\fB_w\fP.
+Note that these are different representations of the same data:
+For example, if you store a narrow string and read the corresponding
+wide string, the object will transparently convert formats
+using the current locale.
+Similarly, if you store a wide string and then store a
+narrow string for the same data, the previously-set wide string will
+be discarded in favor of the new data.
+.PP
+There are a few set/get functions that merit additional description:
+.RS 5
+.TP
+\fB\%archive_entry_set_link\fP()
+This function sets the symlink field if it is already set.
+Otherwise, it sets the hardlink field.
+.RE
+.SS File Flags
+File flags are transparently converted between a bitmap
+representation and a textual format.
+For example, if you set the bitmap and ask for text, the library
+will build a canonical text format.
+However, if you set a text format and request a text format,
+you will get back the same text, even if it is ill-formed.
+If you need to canonicalize a textual flags string, you should first set the
+text form, then request the bitmap form, then use that to set the bitmap form.
+Setting the bitmap format will clear the internal text representation
+and force it to be reconstructed when you next request the text form.
+.PP
+The bitmap format consists of two integers, one containing bits
+that should be set, the other specifying bits that should be
+cleared.
+Bits not mentioned in either bitmap will be ignored.
+Usually, the bitmap of bits to be cleared will be set to zero.
+In unusual circumstances, you can force a fully-specified set
+of file flags by setting the bitmap of flags to clear to the complement
+of the bitmap of flags to set.
+(This differs from
+\fBfflagstostr\fP(3),
+which only includes names for set bits.)
+Converting a bitmap to a textual string is a platform-specific
+operation; bits that are not meaningful on the current platform
+will be ignored.
+.PP
+The canonical text format is a comma-separated list of flag names.
+The
+\fB\%archive_entry_copy_fflags_text\fP()
+and
+\fB\%archive_entry_copy_fflags_text_w\fP()
+functions parse the provided text and sets the internal bitmap values.
+This is a platform-specific operation; names that are not meaningful
+on the current platform will be ignored.
+The function returns a pointer to the start of the first name that was not
+recognized, or NULL if every name was recognized.
+Note that every name--including names that follow an unrecognized name--will
+be evaluated, and the bitmaps will be set to reflect every name that is
+recognized.
+(In particular, this differs from
+\fBstrtofflags\fP(3),
+which stops parsing at the first unrecognized name.)
+.SS ACL Handling
+XXX This needs serious help.
+XXX
+.PP
+An
+``Access Control List''
+(ACL) is a list of permissions that grant access to particular users or
+groups beyond what would normally be provided by standard POSIX mode bits.
+The ACL handling here addresses some deficiencies in the POSIX.1e draft 17 ACL
+specification.
+In particular, POSIX.1e draft 17 specifies several different formats, but
+none of those formats include both textual user/group names and numeric
+UIDs/GIDs.
+.PP
+XXX explain ACL stuff XXX
+.SH SEE ALSO
+.ad l
+\fBarchive\fP(3)
+.SH HISTORY
+.ad l
+The
+\fB\%libarchive\fP
+library first appeared in
+FreeBSD 5.3.
+.SH AUTHORS
+.ad l
+-nosplit
+The
+\fB\%libarchive\fP
+library was written by
+Tim Kientzle \%<kientzle@acm.org.>
diff --git a/archivers/libarchive/files/doc/man/archive_read.3 b/archivers/libarchive/files/doc/man/archive_read.3
new file mode 100644
index 00000000000..b1bd4f3dcca
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/archive_read.3
@@ -0,0 +1,733 @@
+.TH archive_read 3 "April 13, 2009" ""
+.SH NAME
+.ad l
+\fB\%archive_read_new\fP,
+\fB\%archive_read_set_filter_options\fP,
+\fB\%archive_read_set_format_options\fP,
+\fB\%archive_read_set_options\fP,
+\fB\%archive_read_support_compression_all\fP,
+\fB\%archive_read_support_compression_bzip2\fP,
+\fB\%archive_read_support_compression_compress\fP,
+\fB\%archive_read_support_compression_gzip\fP,
+\fB\%archive_read_support_compression_lzma\fP,
+\fB\%archive_read_support_compression_none\fP,
+\fB\%archive_read_support_compression_xz\fP,
+\fB\%archive_read_support_compression_program\fP,
+\fB\%archive_read_support_compression_program_signature\fP,
+\fB\%archive_read_support_format_all\fP,
+\fB\%archive_read_support_format_ar\fP,
+\fB\%archive_read_support_format_cpio\fP,
+\fB\%archive_read_support_format_empty\fP,
+\fB\%archive_read_support_format_iso9660\fP,
+\fB\%archive_read_support_format_mtree,\fP
+\fB\%archive_read_support_format_raw,\fP
+\fB\%archive_read_support_format_tar\fP,
+\fB\%archive_read_support_format_zip\fP,
+\fB\%archive_read_open\fP,
+\fB\%archive_read_open2\fP,
+\fB\%archive_read_open_fd\fP,
+\fB\%archive_read_open_FILE\fP,
+\fB\%archive_read_open_filename\fP,
+\fB\%archive_read_open_memory\fP,
+\fB\%archive_read_next_header\fP,
+\fB\%archive_read_next_header2\fP,
+\fB\%archive_read_data\fP,
+\fB\%archive_read_data_block\fP,
+\fB\%archive_read_data_skip\fP,
+\fB\%archive_read_data_into_buffer\fP,
+\fB\%archive_read_data_into_fd\fP,
+\fB\%archive_read_extract\fP,
+\fB\%archive_read_extract2\fP,
+\fB\%archive_read_extract_set_progress_callback\fP,
+\fB\%archive_read_close\fP,
+\fB\%archive_read_finish\fP
+\- functions for reading streaming archives
+.SH SYNOPSIS
+.ad l
+\fB#include <archive.h>\fP
+.br
+\fIstruct archive *\fP
+.br
+\fB\%archive_read_new\fP(\fI\%void\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_compression_all\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_compression_bzip2\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_compression_compress\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_compression_gzip\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_compression_lzma\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_compression_none\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_compression_xz\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_compression_program\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ char\ *cmd\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_compression_program_signature\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ char\ *cmd\fP, \fI\%const\ void\ *signature\fP, \fI\%size_t\ signature_length\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_format_all\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_format_ar\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_format_cpio\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_format_empty\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_format_iso9660\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_format_mtree\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_format_raw\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_format_tar\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_support_format_zip\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_set_filter_options\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_set_format_options\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_set_options\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_open\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *client_data\fP, \fI\%archive_open_callback\ *\fP, \fI\%archive_read_callback\ *\fP, \fI\%archive_close_callback\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_open2\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *client_data\fP, \fI\%archive_open_callback\ *\fP, \fI\%archive_read_callback\ *\fP, \fI\%archive_skip_callback\ *\fP, \fI\%archive_close_callback\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_open_FILE\fP(\fI\%struct\ archive\ *\fP, \fI\%FILE\ *file\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_open_fd\fP(\fI\%struct\ archive\ *\fP, \fI\%int\ fd\fP, \fI\%size_t\ block_size\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_open_filename\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ char\ *filename\fP, \fI\%size_t\ block_size\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_open_memory\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *buff\fP, \fI\%size_t\ size\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_next_header\fP(\fI\%struct\ archive\ *\fP, \fI\%struct\ archive_entry\ **\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_next_header2\fP(\fI\%struct\ archive\ *\fP, \fI\%struct\ archive_entry\ *\fP);
+.br
+\fIssize_t\fP
+.br
+\fB\%archive_read_data\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *buff\fP, \fI\%size_t\ len\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_data_block\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ void\ **buff\fP, \fI\%size_t\ *len\fP, \fI\%off_t\ *offset\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_data_skip\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_data_into_buffer\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *\fP, \fI\%ssize_t\ len\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_data_into_fd\fP(\fI\%struct\ archive\ *\fP, \fI\%int\ fd\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_extract\fP(\fI\%struct\ archive\ *\fP, \fI\%struct\ archive_entry\ *\fP, \fI\%int\ flags\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_extract2\fP(\fI\%struct\ archive\ *src\fP, \fI\%struct\ archive_entry\ *\fP, \fI\%struct\ archive\ *dest\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_read_extract_set_progress_callback\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ (*func)(void\ *)\fP, \fI\%void\ *user_data\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_close\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_read_finish\fP(\fI\%struct\ archive\ *\fP);
+.SH DESCRIPTION
+.ad l
+These functions provide a complete API for reading streaming archives.
+The general process is to first create the
+Tn struct archive
+object, set options, initialize the reader, iterate over the archive
+headers and associated data, then close the archive and release all
+resources.
+The following summary describes the functions in approximately the
+order they would be used:
+.RS 5
+.TP
+\fB\%archive_read_new\fP()
+Allocates and initializes a
+Tn struct archive
+object suitable for reading from an archive.
+.TP
+\fB\%archive_read_support_compression_bzip2\fP(),
+\fB\%archive_read_support_compression_compress\fP(),
+\fB\%archive_read_support_compression_gzip\fP(),
+\fB\%archive_read_support_compression_lzma\fP(),
+\fB\%archive_read_support_compression_none\fP(),
+\fB\%archive_read_support_compression_xz\fP()
+Enables auto-detection code and decompression support for the
+specified compression.
+Returns
+\fBARCHIVE_OK\fP
+if the compression is fully supported, or
+\fBARCHIVE_WARN\fP
+if the compression is supported only through an external program.
+Note that decompression using an external program is usually slower than
+decompression through built-in libraries.
+Note that
+``none''
+is always enabled by default.
+.TP
+\fB\%archive_read_support_compression_all\fP()
+Enables all available decompression filters.
+.TP
+\fB\%archive_read_support_compression_program\fP()
+Data is fed through the specified external program before being dearchived.
+Note that this disables automatic detection of the compression format,
+so it makes no sense to specify this in conjunction with any other
+decompression option.
+.TP
+\fB\%archive_read_support_compression_program_signature\fP()
+This feeds data through the specified external program
+but only if the initial bytes of the data match the specified
+signature value.
+.TP
+\fB\%archive_read_support_format_all\fP(),
+\fB\%archive_read_support_format_ar\fP(),
+\fB\%archive_read_support_format_cpio\fP(),
+\fB\%archive_read_support_format_empty\fP(),
+\fB\%archive_read_support_format_iso9660\fP(),
+\fB\%archive_read_support_format_mtree\fP(),
+\fB\%archive_read_support_format_tar\fP(),
+\fB\%archive_read_support_format_zip\fP()
+Enables support---including auto-detection code---for the
+specified archive format.
+For example,
+\fB\%archive_read_support_format_tar\fP()
+enables support for a variety of standard tar formats, old-style tar,
+ustar, pax interchange format, and many common variants.
+For convenience,
+\fB\%archive_read_support_format_all\fP()
+enables support for all available formats.
+Only empty archives are supported by default.
+.TP
+\fB\%archive_read_support_format_raw\fP()
+The
+``raw''
+format handler allows libarchive to be used to read arbitrary data.
+It treats any data stream as an archive with a single entry.
+The pathname of this entry is
+``data ;''
+all other entry fields are unset.
+This is not enabled by
+\fB\%archive_read_support_format_all\fP()
+in order to avoid erroneous handling of damaged archives.
+.TP
+\fB\%archive_read_set_filter_options\fP(),
+\fB\%archive_read_set_format_options\fP(),
+\fB\%archive_read_set_options\fP()
+Specifies options that will be passed to currently-registered
+filters (including decompression filters) and/or format readers.
+The argument is a comma-separated list of individual options.
+Individual options have one of the following forms:
+.RS 5
+.TP
+\fIoption=value\fP
+The option/value pair will be provided to every module.
+Modules that do not accept an option with this name will ignore it.
+.TP
+\fIoption\fP
+The option will be provided to every module with a value of
+``1''.
+.TP
+\fI!option\fP
+The option will be provided to every module with a NULL value.
+.TP
+\fImodule:option=value\fP, \fImodule:option\fP, \fImodule:!option\fP
+As above, but the corresponding option and value will be provided
+only to modules whose name matches
+\fImodule\fP.
+.RE
+The return value will be
+\fBARCHIVE_OK\fP
+if any module accepts the option, or
+\fBARCHIVE_WARN\fP
+if no module accepted the option, or
+\fBARCHIVE_FATAL\fP
+if there was a fatal error while attempting to process the option.
+.PP
+The currently supported options are:
+.RS 5
+.TP
+Format iso9660
+.RS 5
+.TP
+\fBjoliet\fP
+Support Joliet extensions.
+Defaults to enabled, use
+\fB!joliet\fP
+to disable.
+.RE
+.RE
+.TP
+\fB\%archive_read_open\fP()
+The same as
+\fB\%archive_read_open2\fP(),
+except that the skip callback is assumed to be
+.BR NULL.
+.TP
+\fB\%archive_read_open2\fP()
+Freeze the settings, open the archive, and prepare for reading entries.
+This is the most generic version of this call, which accepts
+four callback functions.
+Most clients will want to use
+\fB\%archive_read_open_filename\fP(),
+\fB\%archive_read_open_FILE\fP(),
+\fB\%archive_read_open_fd\fP(),
+or
+\fB\%archive_read_open_memory\fP()
+instead.
+The library invokes the client-provided functions to obtain
+raw bytes from the archive.
+.TP
+\fB\%archive_read_open_FILE\fP()
+Like
+\fB\%archive_read_open\fP(),
+except that it accepts a
+\fIFILE *\fP
+pointer.
+This function should not be used with tape drives or other devices
+that require strict I/O blocking.
+.TP
+\fB\%archive_read_open_fd\fP()
+Like
+\fB\%archive_read_open\fP(),
+except that it accepts a file descriptor and block size rather than
+a set of function pointers.
+Note that the file descriptor will not be automatically closed at
+end-of-archive.
+This function is safe for use with tape drives or other blocked devices.
+.TP
+\fB\%archive_read_open_file\fP()
+This is a deprecated synonym for
+\fB\%archive_read_open_filename\fP().
+.TP
+\fB\%archive_read_open_filename\fP()
+Like
+\fB\%archive_read_open\fP(),
+except that it accepts a simple filename and a block size.
+A NULL filename represents standard input.
+This function is safe for use with tape drives or other blocked devices.
+.TP
+\fB\%archive_read_open_memory\fP()
+Like
+\fB\%archive_read_open\fP(),
+except that it accepts a pointer and size of a block of
+memory containing the archive data.
+.TP
+\fB\%archive_read_next_header\fP()
+Read the header for the next entry and return a pointer to
+a
+Tn struct archive_entry.
+This is a convenience wrapper around
+\fB\%archive_read_next_header2\fP()
+that reuses an internal
+Tn struct archive_entry
+object for each request.
+.TP
+\fB\%archive_read_next_header2\fP()
+Read the header for the next entry and populate the provided
+Tn struct archive_entry.
+.TP
+\fB\%archive_read_data\fP()
+Read data associated with the header just read.
+Internally, this is a convenience function that calls
+\fB\%archive_read_data_block\fP()
+and fills any gaps with nulls so that callers see a single
+continuous stream of data.
+.TP
+\fB\%archive_read_data_block\fP()
+Return the next available block of data for this entry.
+Unlike
+\fB\%archive_read_data\fP(),
+the
+\fB\%archive_read_data_block\fP()
+function avoids copying data and allows you to correctly handle
+sparse files, as supported by some archive formats.
+The library guarantees that offsets will increase and that blocks
+will not overlap.
+Note that the blocks returned from this function can be much larger
+than the block size read from disk, due to compression
+and internal buffer optimizations.
+.TP
+\fB\%archive_read_data_skip\fP()
+A convenience function that repeatedly calls
+\fB\%archive_read_data_block\fP()
+to skip all of the data for this archive entry.
+.TP
+\fB\%archive_read_data_into_buffer\fP()
+This function is deprecated and will be removed.
+Use
+\fB\%archive_read_data\fP()
+instead.
+.TP
+\fB\%archive_read_data_into_fd\fP()
+A convenience function that repeatedly calls
+\fB\%archive_read_data_block\fP()
+to copy the entire entry to the provided file descriptor.
+.TP
+\fB\%archive_read_extract\fP(), \fB\%archive_read_extract_set_skip_file\fP()
+A convenience function that wraps the corresponding
+\fBarchive_write_disk\fP(3)
+interfaces.
+The first call to
+\fB\%archive_read_extract\fP()
+creates a restore object using
+\fBarchive_write_disk_new\fP(3)
+and
+\fBarchive_write_disk_set_standard_lookup\fP(3),
+then transparently invokes
+\fBarchive_write_disk_set_options\fP(3),
+\fBarchive_write_header\fP(3),
+\fBarchive_write_data\fP(3),
+and
+\fBarchive_write_finish_entry\fP(3)
+to create the entry on disk and copy data into it.
+The
+\fIflags\fP
+argument is passed unmodified to
+\fBarchive_write_disk_set_options\fP(3).
+.TP
+\fB\%archive_read_extract2\fP()
+This is another version of
+\fB\%archive_read_extract\fP()
+that allows you to provide your own restore object.
+In particular, this allows you to override the standard lookup functions
+using
+\fBarchive_write_disk_set_group_lookup\fP(3),
+and
+\fBarchive_write_disk_set_user_lookup\fP(3).
+Note that
+\fB\%archive_read_extract2\fP()
+does not accept a
+\fIflags\fP
+argument; you should use
+\fB\%archive_write_disk_set_options\fP()
+to set the restore options yourself.
+.TP
+\fB\%archive_read_extract_set_progress_callback\fP()
+Sets a pointer to a user-defined callback that can be used
+for updating progress displays during extraction.
+The progress function will be invoked during the extraction of large
+regular files.
+The progress function will be invoked with the pointer provided to this call.
+Generally, the data pointed to should include a reference to the archive
+object and the archive_entry object so that various statistics
+can be retrieved for the progress display.
+.TP
+\fB\%archive_read_close\fP()
+Complete the archive and invoke the close callback.
+.TP
+\fB\%archive_read_finish\fP()
+Invokes
+\fB\%archive_read_close\fP()
+if it was not invoked manually, then release all resources.
+Note: In libarchive 1.x, this function was declared to return
+\fIvoid ,\fP
+which made it impossible to detect certain errors when
+\fB\%archive_read_close\fP()
+was invoked implicitly from this function.
+The declaration is corrected beginning with libarchive 2.0.
+.RE
+.PP
+Note that the library determines most of the relevant information about
+the archive by inspection.
+In particular, it automatically detects
+\fBgzip\fP(1)
+or
+\fBbzip2\fP(1)
+compression and transparently performs the appropriate decompression.
+It also automatically detects the archive format.
+.PP
+A complete description of the
+Tn struct archive
+and
+Tn struct archive_entry
+objects can be found in the overview manual page for
+\fBlibarchive\fP(3).
+.SH CLIENT CALLBACKS
+.ad l
+The callback functions must match the following prototypes:
+.RS 5
+.IP
+\fItypedef ssize_t\fP
+\fB\%archive_read_callback\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *client_data\fP, \fI\%const\ void\ **buffer\fP)
+.IP
+\fItypedef int\fP
+\fB\%archive_skip_callback\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *client_data\fP, \fI\%size_t\ request\fP)
+.IP
+\fItypedef int\fP
+\fB\%archive_open_callback\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *client_data\fP)
+.IP
+\fItypedef int\fP
+\fB\%archive_close_callback\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *client_data\fP)
+.RE
+.PP
+The open callback is invoked by
+\fB\%archive_open\fP().
+It should return
+\fBARCHIVE_OK\fP
+if the underlying file or data source is successfully
+opened.
+If the open fails, it should call
+\fB\%archive_set_error\fP()
+to register an error code and message and return
+\fBARCHIVE_FATAL\fP.
+.PP
+The read callback is invoked whenever the library
+requires raw bytes from the archive.
+The read callback should read data into a buffer,
+set the
+.RS 4
+const void **buffer
+.RE
+argument to point to the available data, and
+return a count of the number of bytes available.
+The library will invoke the read callback again
+only after it has consumed this data.
+The library imposes no constraints on the size
+of the data blocks returned.
+On end-of-file, the read callback should
+return zero.
+On error, the read callback should invoke
+\fB\%archive_set_error\fP()
+to register an error code and message and
+return -1.
+.PP
+The skip callback is invoked when the
+library wants to ignore a block of data.
+The return value is the number of bytes actually
+skipped, which may differ from the request.
+If the callback cannot skip data, it should return
+zero.
+If the skip callback is not provided (the
+function pointer is
+.BR NULL ),
+the library will invoke the read function
+instead and simply discard the result.
+A skip callback can provide significant
+performance gains when reading uncompressed
+archives from slow disk drives or other media
+that can skip quickly.
+.PP
+The close callback is invoked by archive_close when
+the archive processing is complete.
+The callback should return
+\fBARCHIVE_OK\fP
+on success.
+On failure, the callback should invoke
+\fB\%archive_set_error\fP()
+to register an error code and message and
+return
+\fBARCHIVE_FATAL.\fP
+.SH EXAMPLE
+.ad l
+The following illustrates basic usage of the library.
+In this example,
+the callback functions are simply wrappers around the standard
+\fBopen\fP(2),
+\fBread\fP(2),
+and
+\fBclose\fP(2)
+system calls.
+.RS 4
+.nf
+void
+list_archive(const char *name)
+{
+ struct mydata *mydata;
+ struct archive *a;
+ struct archive_entry *entry;
+ mydata = malloc(sizeof(struct mydata));
+ a = archive_read_new();
+ mydata->name = name;
+ archive_read_support_compression_all(a);
+ archive_read_support_format_all(a);
+ archive_read_open(a, mydata, myopen, myread, myclose);
+ while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
+ printf("%s\\n",archive_entry_pathname(entry));
+ archive_read_data_skip(a);
+ }
+ archive_read_finish(a);
+ free(mydata);
+}
+ssize_t
+myread(struct archive *a, void *client_data, const void **buff)
+{
+ struct mydata *mydata = client_data;
+ *buff = mydata->buff;
+ return (read(mydata->fd, mydata->buff, 10240));
+}
+int
+myopen(struct archive *a, void *client_data)
+{
+ struct mydata *mydata = client_data;
+ mydata->fd = open(mydata->name, O_RDONLY);
+ return (mydata->fd >= 0 ? ARCHIVE_OK : ARCHIVE_FATAL);
+}
+int
+myclose(struct archive *a, void *client_data)
+{
+ struct mydata *mydata = client_data;
+ if (mydata->fd > 0)
+ close(mydata->fd);
+ return (ARCHIVE_OK);
+}
+.RE
+.SH RETURN VALUES
+.ad l
+Most functions return zero on success, non-zero on error.
+The possible return codes include:
+\fBARCHIVE_OK\fP
+(the operation succeeded),
+\fBARCHIVE_WARN\fP
+(the operation succeeded but a non-critical error was encountered),
+\fBARCHIVE_EOF\fP
+(end-of-archive was encountered),
+\fBARCHIVE_RETRY\fP
+(the operation failed but can be retried),
+and
+\fBARCHIVE_FATAL\fP
+(there was a fatal error; the archive should be closed immediately).
+Detailed error codes and textual descriptions are available from the
+\fB\%archive_errno\fP()
+and
+\fB\%archive_error_string\fP()
+functions.
+.PP
+\fB\%archive_read_new\fP()
+returns a pointer to a freshly allocated
+Tn struct archive
+object.
+It returns
+.BR NULL
+on error.
+.PP
+\fB\%archive_read_data\fP()
+returns a count of bytes actually read or zero at the end of the entry.
+On error, a value of
+\fBARCHIVE_FATAL\fP,
+\fBARCHIVE_WARN\fP,
+or
+\fBARCHIVE_RETRY\fP
+is returned and an error code and textual description can be retrieved from the
+\fB\%archive_errno\fP()
+and
+\fB\%archive_error_string\fP()
+functions.
+.PP
+The library expects the client callbacks to behave similarly.
+If there is an error, you can use
+\fB\%archive_set_error\fP()
+to set an appropriate error code and description,
+then return one of the non-zero values above.
+(Note that the value eventually returned to the client may
+not be the same; many errors that are not critical at the level
+of basic I/O can prevent the archive from being properly read,
+thus most I/O errors eventually cause
+\fBARCHIVE_FATAL\fP
+to be returned.)
+.SH SEE ALSO
+.ad l
+\fBtar\fP(1),
+\fBarchive\fP(3),
+\fBarchive_util\fP(3),
+\fBtar\fP(5)
+.SH HISTORY
+.ad l
+The
+\fB\%libarchive\fP
+library first appeared in
+FreeBSD 5.3.
+.SH AUTHORS
+.ad l
+-nosplit
+The
+\fB\%libarchive\fP
+library was written by
+Tim Kientzle \%<kientzle@acm.org.>
+.SH BUGS
+.ad l
+Many traditional archiver programs treat
+empty files as valid empty archives.
+For example, many implementations of
+\fBtar\fP(1)
+allow you to append entries to an empty file.
+Of course, it is impossible to determine the format of an empty file
+by inspecting the contents, so this library treats empty files as
+having a special
+``empty''
+format.
diff --git a/archivers/libarchive/files/doc/man/archive_util.3 b/archivers/libarchive/files/doc/man/archive_util.3
new file mode 100644
index 00000000000..60375aff195
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/archive_util.3
@@ -0,0 +1,163 @@
+.TH archive_util 3 "January 8, 2005" ""
+.SH NAME
+.ad l
+\fB\%archive_clear_error\fP,
+\fB\%archive_compression\fP,
+\fB\%archive_compression_name\fP,
+\fB\%archive_copy_error\fP,
+\fB\%archive_errno\fP,
+\fB\%archive_error_string\fP,
+\fB\%archive_file_count\fP,
+\fB\%archive_format\fP,
+\fB\%archive_format_name\fP,
+\fB\%archive_set_error\fP
+\- libarchive utility functions
+.SH SYNOPSIS
+.ad l
+\fB#include <archive.h>\fP
+.br
+\fIvoid\fP
+.br
+\fB\%archive_clear_error\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_compression\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIconst char *\fP
+.br
+\fB\%archive_compression_name\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_copy_error\fP(\fI\%struct\ archive\ *\fP, \fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_errno\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIconst char *\fP
+.br
+\fB\%archive_error_string\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_file_count\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_format\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIconst char *\fP
+.br
+\fB\%archive_format_name\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIvoid\fP
+.br
+\fB\%archive_set_error\fP(\fI\%struct\ archive\ *\fP, \fI\%int\ error_code\fP, \fI\%const\ char\ *fmt\fP, \fI\%...\fP);
+.SH DESCRIPTION
+.ad l
+These functions provide access to various information about the
+Tn struct archive
+object used in the
+\fBlibarchive\fP(3)
+library.
+.RS 5
+.TP
+\fB\%archive_clear_error\fP()
+Clears any error information left over from a previous call.
+Not generally used in client code.
+.TP
+\fB\%archive_compression\fP()
+Returns a numeric code indicating the current compression.
+This value is set by
+\fB\%archive_read_open\fP().
+.TP
+\fB\%archive_compression_name\fP()
+Returns a text description of the current compression suitable for display.
+.TP
+\fB\%archive_copy_error\fP()
+Copies error information from one archive to another.
+.TP
+\fB\%archive_errno\fP()
+Returns a numeric error code (see
+\fBerrno\fP(2))
+indicating the reason for the most recent error return.
+.TP
+\fB\%archive_error_string\fP()
+Returns a textual error message suitable for display.
+The error message here is usually more specific than that
+obtained from passing the result of
+\fB\%archive_errno\fP()
+to
+\fBstrerror\fP(3).
+.TP
+\fB\%archive_file_count\fP()
+Returns a count of the number of files processed by this archive object.
+The count is incremented by calls to
+\fBarchive_write_header\fP()
+or
+\fBarchive_read_next_header\fP(.)
+.TP
+\fB\%archive_format\fP()
+Returns a numeric code indicating the format of the current
+archive entry.
+This value is set by a successful call to
+\fB\%archive_read_next_header\fP().
+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.
+.TP
+\fB\%archive_format_name\fP()
+A textual description of the format of the current entry.
+.TP
+\fB\%archive_set_error\fP()
+Sets the numeric error code and error description that will be returned
+by
+\fB\%archive_errno\fP()
+and
+\fB\%archive_error_string\fP().
+This function should be used within I/O callbacks to set system-specific
+error codes and error descriptions.
+This function accepts a printf-like format string and arguments.
+However, you should be careful to use only the following printf
+format specifiers:
+``%c'',
+``%d'',
+``%jd'',
+``%jo'',
+``%ju'',
+``%jx'',
+``%ld'',
+``%lo'',
+``%lu'',
+``%lx'',
+``%o'',
+``%u'',
+``%s'',
+``%x'',
+``%%''.
+Field-width specifiers and other printf features are
+not uniformly supported and should not be used.
+.RE
+.SH SEE ALSO
+.ad l
+\fBarchive_read\fP(3),
+\fBarchive_write\fP(3),
+\fBlibarchive\fP(3),
+\fBprintf\fP(3)
+.SH HISTORY
+.ad l
+The
+\fB\%libarchive\fP
+library first appeared in
+FreeBSD 5.3.
+.SH AUTHORS
+.ad l
+-nosplit
+The
+\fB\%libarchive\fP
+library was written by
+Tim Kientzle \%<kientzle@acm.org.>
diff --git a/archivers/libarchive/files/doc/man/archive_write.3 b/archivers/libarchive/files/doc/man/archive_write.3
new file mode 100644
index 00000000000..b485dcf796a
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/archive_write.3
@@ -0,0 +1,670 @@
+.TH archive_write 3 "May 11, 2008" ""
+.SH NAME
+.ad l
+\fB\%archive_write_new\fP,
+\fB\%archive_write_set_format_cpio\fP,
+\fB\%archive_write_set_format_pax\fP,
+\fB\%archive_write_set_format_pax_restricted\fP,
+\fB\%archive_write_set_format_shar\fP,
+\fB\%archive_write_set_format_shar_binary\fP,
+\fB\%archive_write_set_format_ustar\fP,
+\fB\%archive_write_get_bytes_per_block\fP,
+\fB\%archive_write_set_bytes_per_block\fP,
+\fB\%archive_write_set_bytes_in_last_block\fP,
+\fB\%archive_write_set_compression_bzip2\fP,
+\fB\%archive_write_set_compression_compress\fP,
+\fB\%archive_write_set_compression_gzip\fP,
+\fB\%archive_write_set_compression_none\fP,
+\fB\%archive_write_set_compression_program\fP,
+\fB\%archive_write_set_compressor_options\fP,
+\fB\%archive_write_set_format_options\fP,
+\fB\%archive_write_set_options\fP,
+\fB\%archive_write_open\fP,
+\fB\%archive_write_open_fd\fP,
+\fB\%archive_write_open_FILE\fP,
+\fB\%archive_write_open_filename\fP,
+\fB\%archive_write_open_memory\fP,
+\fB\%archive_write_header\fP,
+\fB\%archive_write_data\fP,
+\fB\%archive_write_finish_entry\fP,
+\fB\%archive_write_close\fP,
+\fB\%archive_write_finish\fP
+\- functions for creating archives
+.SH SYNOPSIS
+.ad l
+\fB#include <archive.h>\fP
+.br
+\fIstruct archive *\fP
+.br
+\fB\%archive_write_new\fP(\fI\%void\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_get_bytes_per_block\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_bytes_per_block\fP(\fI\%struct\ archive\ *\fP, \fI\%int\ bytes_per_block\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_bytes_in_last_block\fP(\fI\%struct\ archive\ *\fP, \fI\%int\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_compression_bzip2\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_compression_compress\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_compression_gzip\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_compression_none\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_compression_program\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ char\ *\ cmd\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_format_cpio\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_format_pax\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_format_pax_restricted\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_format_shar\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_format_shar_binary\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_format_ustar\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_format_options\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_compressor_options\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_set_options\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ char\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_open\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *client_data\fP, \fI\%archive_open_callback\ *\fP, \fI\%archive_write_callback\ *\fP, \fI\%archive_close_callback\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_open_fd\fP(\fI\%struct\ archive\ *\fP, \fI\%int\ fd\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_open_FILE\fP(\fI\%struct\ archive\ *\fP, \fI\%FILE\ *file\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_open_filename\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ char\ *filename\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_open_memory\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *buffer\fP, \fI\%size_t\ bufferSize\fP, \fI\%size_t\ *outUsed\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_header\fP(\fI\%struct\ archive\ *\fP, \fI\%struct\ archive_entry\ *\fP);
+.br
+\fIssize_t\fP
+.br
+\fB\%archive_write_data\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ void\ *\fP, \fI\%size_t\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_finish_entry\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_close\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_finish\fP(\fI\%struct\ archive\ *\fP);
+.SH DESCRIPTION
+.ad l
+These functions provide a complete API for creating streaming
+archive files.
+The general process is to first create the
+Tn struct archive
+object, set any desired options, initialize the archive, append entries, then
+close the archive and release all resources.
+The following summary describes the functions in approximately
+the order they are ordinarily used:
+.RS 5
+.TP
+\fB\%archive_write_new\fP()
+Allocates and initializes a
+Tn struct archive
+object suitable for writing a tar archive.
+.TP
+\fB\%archive_write_set_bytes_per_block\fP()
+Sets the block size used for writing the archive data.
+Every call to the write callback function, except possibly the last one, will
+use this value for the length.
+The third parameter is a boolean that specifies whether or not the final block
+written will be padded to the full block size.
+If it is zero, the last block will not be padded.
+If it is non-zero, padding will be added both before and after compression.
+The default is to use a block size of 10240 bytes and to pad the last block.
+Note that a block size of zero will suppress internal blocking
+and cause writes to be sent directly to the write callback as they occur.
+.TP
+\fB\%archive_write_get_bytes_per_block\fP()
+Retrieve the block size to be used for writing.
+A value of -1 here indicates that the library should use default values.
+A value of zero indicates that internal blocking is suppressed.
+.TP
+\fB\%archive_write_set_bytes_in_last_block\fP()
+Sets the block size used for writing the last block.
+If this value is zero, the last block will be padded to the same size
+as the other blocks.
+Otherwise, the final block will be padded to a multiple of this size.
+In particular, setting it to 1 will cause the final block to not be padded.
+For compressed output, any padding generated by this option
+is applied only after the compression.
+The uncompressed data is always unpadded.
+The default is to pad the last block to the full block size (note that
+\fB\%archive_write_open_filename\fP()
+will set this based on the file type).
+Unlike the other
+``set''
+functions, this function can be called after the archive is opened.
+.TP
+\fB\%archive_write_get_bytes_in_last_block\fP()
+Retrieve the currently-set value for last block size.
+A value of -1 here indicates that the library should use default values.
+.TP
+\fB\%archive_write_set_format_cpio\fP(),
+\fB\%archive_write_set_format_pax\fP(),
+\fB\%archive_write_set_format_pax_restricted\fP(),
+\fB\%archive_write_set_format_shar\fP(),
+\fB\%archive_write_set_format_shar_binary\fP(),
+\fB\%archive_write_set_format_ustar\fP()
+Sets the format that will be used for the archive.
+The library can write
+POSIX octet-oriented cpio format archives,
+POSIX-standard
+``pax interchange''
+format archives,
+traditional
+``shar''
+archives,
+enhanced
+``binary''
+shar archives that store a variety of file attributes and handle binary files,
+and
+POSIX-standard
+``ustar''
+archives.
+The pax interchange format is a backwards-compatible tar format that
+adds key/value attributes to each entry and supports arbitrary
+filenames, linknames, uids, sizes, etc.
+``Restricted pax interchange format''
+is the library default; this is the same as pax format, but suppresses
+the pax extended header for most normal files.
+In most cases, this will result in ordinary ustar archives.
+.TP
+\fB\%archive_write_set_compression_bzip2\fP(),
+\fB\%archive_write_set_compression_compress\fP(),
+\fB\%archive_write_set_compression_gzip\fP(),
+\fB\%archive_write_set_compression_none\fP()
+The resulting archive will be compressed as specified.
+Note that the compressed output is always properly blocked.
+.TP
+\fB\%archive_write_set_compression_program\fP()
+The archive will be fed into the specified compression program.
+The output of that program is blocked and written to the client
+write callbacks.
+.TP
+\fB\%archive_write_set_compressor_options\fP(),
+\fB\%archive_write_set_format_options\fP(),
+\fB\%archive_write_set_options\fP()
+Specifies options that will be passed to the currently-enabled
+compressor and/or format writer.
+The argument is a comma-separated list of individual options.
+Individual options have one of the following forms:
+.RS 5
+.TP
+\fIoption=value\fP
+The option/value pair will be provided to every module.
+Modules that do not accept an option with this name will ignore it.
+.TP
+\fIoption\fP
+The option will be provided to every module with a value of
+``1''.
+.TP
+\fI!option\fP
+The option will be provided to every module with a NULL value.
+.TP
+\fImodule:option=value\fP, \fImodule:option\fP, \fImodule:!option\fP
+As above, but the corresponding option and value will be provided
+only to modules whose name matches
+\fImodule\fP.
+.RE
+The return value will be
+\fBARCHIVE_OK\fP
+if any module accepts the option, or
+\fBARCHIVE_WARN\fP
+if no module accepted the option, or
+\fBARCHIVE_FATAL\fP
+if there was a fatal error while attempting to process the option.
+.PP
+The currently supported options are:
+.RS 5
+.TP
+Compressor gzip
+.RS 5
+.TP
+\fBcompression-level\fP
+The value is interpreted as a decimal integer specifying the
+gzip compression level.
+.RE
+.TP
+Compressor xz
+.RS 5
+.TP
+\fBcompression-level\fP
+The value is interpreted as a decimal integer specifying the
+compression level.
+.RE
+.TP
+Format mtree
+.RS 5
+.TP
+\fBcksum\fP, \fBdevice\fP, \fBflags\fP, \fBgid\fP, \fBgname\fP, \fBindent\fP, \fBlink\fP, \fBmd5\fP, \fBmode\fP, \fBnlink\fP, \fBrmd160\fP, \fBsha1\fP, \fBsha256\fP, \fBsha384\fP, \fBsha512\fP, \fBsize\fP, \fBtime\fP, \fBuid\fP, \fBuname\fP
+Enable a particular keyword in the mtree output.
+Prefix with an exclamation mark to disable the corresponding keyword.
+The default is equivalent to
+``device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname''.
+.TP
+\fBall\fP
+Enables all of the above keywords.
+.TP
+\fBuse-set\fP
+Enables generation of
+\fB/set\fP
+lines that specify default values for the following files and/or directories.
+.TP
+\fBindent\fP
+XXX needs explanation XXX
+.RE
+.RE
+.TP
+\fB\%archive_write_open\fP()
+Freeze the settings, open the archive, and prepare for writing entries.
+This is the most generic form of this function, which accepts
+pointers to three callback functions which will be invoked by
+the compression layer to write the constructed archive.
+.TP
+\fB\%archive_write_open_fd\fP()
+A convenience form of
+\fB\%archive_write_open\fP()
+that accepts a file descriptor.
+The
+\fB\%archive_write_open_fd\fP()
+function is safe for use with tape drives or other
+block-oriented devices.
+.TP
+\fB\%archive_write_open_FILE\fP()
+A convenience form of
+\fB\%archive_write_open\fP()
+that accepts a
+\fIFILE *\fP
+pointer.
+Note that
+\fB\%archive_write_open_FILE\fP()
+is not safe for writing to tape drives or other devices
+that require correct blocking.
+.TP
+\fB\%archive_write_open_file\fP()
+A deprecated synonym for
+\fB\%archive_write_open_filename\fP().
+.TP
+\fB\%archive_write_open_filename\fP()
+A convenience form of
+\fB\%archive_write_open\fP()
+that accepts a filename.
+A NULL argument indicates that the output should be written to standard output;
+an argument of
+``-''
+will open a file with that name.
+If you have not invoked
+\fB\%archive_write_set_bytes_in_last_block\fP(),
+then
+\fB\%archive_write_open_filename\fP()
+will adjust the last-block padding depending on the file:
+it will enable padding when writing to standard output or
+to a character or block device node, it will disable padding otherwise.
+You can override this by manually invoking
+\fB\%archive_write_set_bytes_in_last_block\fP()
+before calling
+\fB\%archive_write_open\fP().
+The
+\fB\%archive_write_open_filename\fP()
+function is safe for use with tape drives or other
+block-oriented devices.
+.TP
+\fB\%archive_write_open_memory\fP()
+A convenience form of
+\fB\%archive_write_open\fP()
+that accepts a pointer to a block of memory that will receive
+the archive.
+The final
+\fIsize_t *\fP
+argument points to a variable that will be updated
+after each write to reflect how much of the buffer
+is currently in use.
+You should be careful to ensure that this variable
+remains allocated until after the archive is
+closed.
+.TP
+\fB\%archive_write_header\fP()
+Build and write a header using the data in the provided
+Tn struct archive_entry
+structure.
+See
+\fBarchive_entry\fP(3)
+for information on creating and populating
+Tn struct archive_entry
+objects.
+.TP
+\fB\%archive_write_data\fP()
+Write data corresponding to the header just written.
+Returns number of bytes written or -1 on error.
+.TP
+\fB\%archive_write_finish_entry\fP()
+Close out the entry just written.
+In particular, this writes out the final padding required by some formats.
+Ordinarily, clients never need to call this, as it
+is called automatically by
+\fB\%archive_write_next_header\fP()
+and
+\fB\%archive_write_close\fP()
+as needed.
+.TP
+\fB\%archive_write_close\fP()
+Complete the archive and invoke the close callback.
+.TP
+\fB\%archive_write_finish\fP()
+Invokes
+\fB\%archive_write_close\fP()
+if it was not invoked manually, then releases all resources.
+Note that this function was declared to return
+\fIvoid\fP
+in libarchive 1.x, which made it impossible to detect errors when
+\fB\%archive_write_close\fP()
+was invoked implicitly from this function.
+This is corrected beginning with libarchive 2.0.
+.RE
+More information about the
+\fIstruct\fP archive
+object and the overall design of the library can be found in the
+\fBlibarchive\fP(3)
+overview.
+.SH IMPLEMENTATION
+.ad l
+Compression support is built-in to libarchive, which uses zlib and bzlib
+to handle gzip and bzip2 compression, respectively.
+.SH CLIENT CALLBACKS
+.ad l
+To use this library, you will need to define and register
+callback functions that will be invoked to write data to the
+resulting archive.
+These functions are registered by calling
+\fB\%archive_write_open\fP():
+.RS 5
+.IP
+\fItypedef int\fP
+\fB\%archive_open_callback\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *client_data\fP)
+.RE
+.PP
+The open callback is invoked by
+\fB\%archive_write_open\fP().
+It should return
+\fBARCHIVE_OK\fP
+if the underlying file or data source is successfully
+opened.
+If the open fails, it should call
+\fB\%archive_set_error\fP()
+to register an error code and message and return
+\fBARCHIVE_FATAL\fP.
+.RS 5
+.IP
+\fItypedef ssize_t\fP
+\fB\%archive_write_callback\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *client_data\fP, \fI\%const\ void\ *buffer\fP, \fI\%size_t\ length\fP)
+.RE
+.PP
+The write callback is invoked whenever the library
+needs to write raw bytes to the archive.
+For correct blocking, each call to the write callback function
+should translate into a single
+\fBwrite\fP(2)
+system call.
+This is especially critical when writing archives to tape drives.
+On success, the write callback should return the
+number of bytes actually written.
+On error, the callback should invoke
+\fB\%archive_set_error\fP()
+to register an error code and message and return -1.
+.RS 5
+.IP
+\fItypedef int\fP
+\fB\%archive_close_callback\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *client_data\fP)
+.RE
+.PP
+The close callback is invoked by archive_close when
+the archive processing is complete.
+The callback should return
+\fBARCHIVE_OK\fP
+on success.
+On failure, the callback should invoke
+\fB\%archive_set_error\fP()
+to register an error code and message and
+return
+\fBARCHIVE_FATAL.\fP
+.SH EXAMPLE
+.ad l
+The following sketch illustrates basic usage of the library.
+In this example,
+the callback functions are simply wrappers around the standard
+\fBopen\fP(2),
+\fBwrite\fP(2),
+and
+\fBclose\fP(2)
+system calls.
+.RS 4
+.nf
+#ifdef __linux__
+#define _FILE_OFFSET_BITS 64
+#endif
+#include <sys/stat.h>
+#include <archive.h>
+#include <archive_entry.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+struct mydata {
+ const char *name;
+ int fd;
+};
+int
+myopen(struct archive *a, void *client_data)
+{
+ struct mydata *mydata = client_data;
+ mydata->fd = open(mydata->name, O_WRONLY | O_CREAT, 0644);
+ if (mydata->fd >= 0)
+ return (ARCHIVE_OK);
+ else
+ return (ARCHIVE_FATAL);
+}
+ssize_t
+mywrite(struct archive *a, void *client_data, const void *buff, size_t n)
+{
+ struct mydata *mydata = client_data;
+ return (write(mydata->fd, buff, n));
+}
+int
+myclose(struct archive *a, void *client_data)
+{
+ struct mydata *mydata = client_data;
+ if (mydata->fd > 0)
+ close(mydata->fd);
+ return (0);
+}
+void
+write_archive(const char *outname, const char **filename)
+{
+ struct mydata *mydata = malloc(sizeof(struct mydata));
+ struct archive *a;
+ struct archive_entry *entry;
+ struct stat st;
+ char buff[8192];
+ int len;
+ int fd;
+ a = archive_write_new();
+ mydata->name = outname;
+ archive_write_set_compression_gzip(a);
+ archive_write_set_format_ustar(a);
+ archive_write_open(a, mydata, myopen, mywrite, myclose);
+ while (*filename) {
+ stat(*filename, &st);
+ entry = archive_entry_new();
+ archive_entry_copy_stat(entry, &st);
+ archive_entry_set_pathname(entry, *filename);
+ archive_write_header(a, entry);
+ fd = open(*filename, O_RDONLY);
+ len = read(fd, buff, sizeof(buff));
+ while ( len > 0 ) {
+ archive_write_data(a, buff, len);
+ len = read(fd, buff, sizeof(buff));
+ }
+ archive_entry_free(entry);
+ filename++;
+ }
+ archive_write_finish(a);
+}
+int main(int argc, const char **argv)
+{
+ const char *outname;
+ argv++;
+ outname = argv++;
+ write_archive(outname, argv);
+ return 0;
+}
+.RE
+.SH RETURN VALUES
+.ad l
+Most functions return
+\fBARCHIVE_OK\fP
+(zero) on success, or one of several non-zero
+error codes for errors.
+Specific error codes include:
+\fBARCHIVE_RETRY\fP
+for operations that might succeed if retried,
+\fBARCHIVE_WARN\fP
+for unusual conditions that do not prevent further operations, and
+\fBARCHIVE_FATAL\fP
+for serious errors that make remaining operations impossible.
+The
+\fB\%archive_errno\fP()
+and
+\fB\%archive_error_string\fP()
+functions can be used to retrieve an appropriate error code and a
+textual error message.
+.PP
+\fB\%archive_write_new\fP()
+returns a pointer to a newly-allocated
+Tn struct archive
+object.
+.PP
+\fB\%archive_write_data\fP()
+returns a count of the number of bytes actually written.
+On error, -1 is returned and the
+\fB\%archive_errno\fP()
+and
+\fB\%archive_error_string\fP()
+functions will return appropriate values.
+Note that if the client-provided write callback function
+returns a non-zero value, that error will be propagated back to the caller
+through whatever API function resulted in that call, which
+may include
+\fB\%archive_write_header\fP(),
+\fB\%archive_write_data\fP(),
+\fB\%archive_write_close\fP(),
+or
+\fB\%archive_write_finish\fP().
+The client callback can call
+\fB\%archive_set_error\fP()
+to provide values that can then be retrieved by
+\fB\%archive_errno\fP()
+and
+\fB\%archive_error_string\fP().
+.SH SEE ALSO
+.ad l
+\fBtar\fP(1),
+\fBlibarchive\fP(3),
+\fBtar\fP(5)
+.SH HISTORY
+.ad l
+The
+\fB\%libarchive\fP
+library first appeared in
+FreeBSD 5.3.
+.SH AUTHORS
+.ad l
+-nosplit
+The
+\fB\%libarchive\fP
+library was written by
+Tim Kientzle \%<kientzle@acm.org.>
+.SH BUGS
+.ad l
+There are many peculiar bugs in historic tar implementations that may cause
+certain programs to reject archives written by this library.
+For example, several historic implementations calculated header checksums
+incorrectly and will thus reject valid archives; GNU tar does not fully support
+pax interchange format; some old tar implementations required specific
+field terminations.
+.PP
+The default pax interchange format eliminates most of the historic
+tar limitations and provides a generic key/value attribute facility
+for vendor-defined extensions.
+One oversight in POSIX is the failure to provide a standard attribute
+for large device numbers.
+This library uses
+``SCHILY.devminor''
+and
+``SCHILY.devmajor''
+for device numbers that exceed the range supported by the backwards-compatible
+ustar header.
+These keys are compatible with Joerg Schilling's
+\fB\%star\fP
+archiver.
+Other implementations may not recognize these keys and will thus be unable
+to correctly restore device nodes with large device numbers from archives
+created by this library.
diff --git a/archivers/libarchive/files/doc/man/archive_write_disk.3 b/archivers/libarchive/files/doc/man/archive_write_disk.3
new file mode 100644
index 00000000000..a58181e23d1
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/archive_write_disk.3
@@ -0,0 +1,386 @@
+.TH archive_write_disk 3 "August 5, 2008" ""
+.SH NAME
+.ad l
+\fB\%archive_write_disk_new\fP,
+\fB\%archive_write_disk_set_options\fP,
+\fB\%archive_write_disk_set_skip_file\fP,
+\fB\%archive_write_disk_set_group_lookup\fP,
+\fB\%archive_write_disk_set_standard_lookup\fP,
+\fB\%archive_write_disk_set_user_lookup\fP,
+\fB\%archive_write_header\fP,
+\fB\%archive_write_data\fP,
+\fB\%archive_write_finish_entry\fP,
+\fB\%archive_write_close\fP,
+\fB\%archive_write_finish\fP
+\- functions for creating objects on disk
+.SH SYNOPSIS
+.ad l
+\fB#include <archive.h>\fP
+.br
+\fIstruct archive *\fP
+.br
+\fB\%archive_write_disk_new\fP(\fI\%void\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_disk_set_options\fP(\fI\%struct\ archive\ *\fP, \fI\%int\ flags\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_disk_set_skip_file\fP(\fI\%struct\ archive\ *\fP, \fI\%dev_t\fP, \fI\%ino_t\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_disk_set_group_lookup\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *\fP, \fI\%gid_t\ (*)(void\ *,\ const\ char\ *gname,\ gid_t\ gid)\fP, \fI\%void\ (*cleanup)(void\ *)\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_disk_set_standard_lookup\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_disk_set_user_lookup\fP(\fI\%struct\ archive\ *\fP, \fI\%void\ *\fP, \fI\%uid_t\ (*)(void\ *,\ const\ char\ *uname,\ uid_t\ uid)\fP, \fI\%void\ (*cleanup)(void\ *)\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_header\fP(\fI\%struct\ archive\ *\fP, \fI\%struct\ archive_entry\ *\fP);
+.br
+\fIssize_t\fP
+.br
+\fB\%archive_write_data\fP(\fI\%struct\ archive\ *\fP, \fI\%const\ void\ *\fP, \fI\%size_t\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_finish_entry\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_close\fP(\fI\%struct\ archive\ *\fP);
+.br
+\fIint\fP
+.br
+\fB\%archive_write_finish\fP(\fI\%struct\ archive\ *\fP);
+.SH DESCRIPTION
+.ad l
+These functions provide a complete API for creating objects on
+disk from
+Tn struct archive_entry
+descriptions.
+They are most naturally used when extracting objects from an archive
+using the
+\fB\%archive_read\fP()
+interface.
+The general process is to read
+Tn struct archive_entry
+objects from an archive, then write those objects to a
+Tn struct archive
+object created using the
+\fB\%archive_write_disk\fP()
+family functions.
+This interface is deliberately very similar to the
+\fB\%archive_write\fP()
+interface used to write objects to a streaming archive.
+.RS 5
+.TP
+\fB\%archive_write_disk_new\fP()
+Allocates and initializes a
+Tn struct archive
+object suitable for writing objects to disk.
+.TP
+\fB\%archive_write_disk_set_skip_file\fP()
+Records the device and inode numbers of a file that should not be
+overwritten.
+This is typically used to ensure that an extraction process does not
+overwrite the archive from which objects are being read.
+This capability is technically unnecessary but can be a significant
+performance optimization in practice.
+.TP
+\fB\%archive_write_disk_set_options\fP()
+The options field consists of a bitwise OR of one or more of the
+following values:
+.RS 5
+.TP
+\fBARCHIVE_EXTRACT_OWNER\fP
+The user and group IDs should be set on the restored file.
+By default, the user and group IDs are not restored.
+.TP
+\fBARCHIVE_EXTRACT_PERM\fP
+Full permissions (including SGID, SUID, and sticky bits) should
+be restored exactly as specified, without obeying the
+current umask.
+Note that SUID and SGID bits can only be restored if the
+user and group ID of the object on disk are correct.
+If
+\fBARCHIVE_EXTRACT_OWNER\fP
+is not specified, then SUID and SGID bits will only be restored
+if the default user and group IDs of newly-created objects on disk
+happen to match those specified in the archive entry.
+By default, only basic permissions are restored, and umask is obeyed.
+.TP
+\fBARCHIVE_EXTRACT_TIME\fP
+The timestamps (mtime, ctime, and atime) should be restored.
+By default, they are ignored.
+Note that restoring of atime is not currently supported.
+.TP
+\fBARCHIVE_EXTRACT_NO_OVERWRITE\fP
+Existing files on disk will not be overwritten.
+By default, existing regular files are truncated and overwritten;
+existing directories will have their permissions updated;
+other pre-existing objects are unlinked and recreated from scratch.
+.TP
+\fBARCHIVE_EXTRACT_UNLINK\fP
+Existing files on disk will be unlinked before any attempt to
+create them.
+In some cases, this can prove to be a significant performance improvement.
+By default, existing files are truncated and rewritten, but
+the file is not recreated.
+In particular, the default behavior does not break existing hard links.
+.TP
+\fBARCHIVE_EXTRACT_ACL\fP
+Attempt to restore ACLs.
+By default, extended ACLs are ignored.
+.TP
+\fBARCHIVE_EXTRACT_FFLAGS\fP
+Attempt to restore extended file flags.
+By default, file flags are ignored.
+.TP
+\fBARCHIVE_EXTRACT_XATTR\fP
+Attempt to restore POSIX.1e extended attributes.
+By default, they are ignored.
+.TP
+\fBARCHIVE_EXTRACT_SECURE_SYMLINKS\fP
+Refuse to extract any object whose final location would be altered
+by a symlink on disk.
+This is intended to help guard against a variety of mischief
+caused by archives that (deliberately or otherwise) extract
+files outside of the current directory.
+The default is not to perform this check.
+If
+\fBARCHIVE_EXTRACT_UNLINK\fP
+is specified together with this option, the library will
+remove any intermediate symlinks it finds and return an
+error only if such symlink could not be removed.
+.TP
+\fBARCHIVE_EXTRACT_SECURE_NODOTDOT\fP
+Refuse to extract a path that contains a
+\fI\& ..\fP
+element anywhere within it.
+The default is to not refuse such paths.
+Note that paths ending in
+\fI\& ..\fP
+always cause an error, regardless of this flag.
+.TP
+\fBARCHIVE_EXTRACT_SPARSE\fP
+Scan data for blocks of NUL bytes and try to recreate them with holes.
+This results in sparse files, independent of whether the archive format
+supports or uses them.
+.RE
+.TP
+\fB\%archive_write_disk_set_group_lookup\fP(),
+\fB\%archive_write_disk_set_user_lookup\fP()
+The
+Tn struct archive_entry
+objects contain both names and ids that can be used to identify users
+and groups.
+These names and ids describe the ownership of the file itself and
+also appear in ACL lists.
+By default, the library uses the ids and ignores the names, but
+this can be overridden by registering user and group lookup functions.
+To register, you must provide a lookup function which
+accepts both a name and id and returns a suitable id.
+You may also provide a
+Tn void *
+pointer to a private data structure and a cleanup function for
+that data.
+The cleanup function will be invoked when the
+Tn struct archive
+object is destroyed.
+.TP
+\fB\%archive_write_disk_set_standard_lookup\fP()
+This convenience function installs a standard set of user
+and group lookup functions.
+These functions use
+\fBgetpwnam\fP(3)
+and
+\fBgetgrnam\fP(3)
+to convert names to ids, defaulting to the ids if the names cannot
+be looked up.
+These functions also implement a simple memory cache to reduce
+the number of calls to
+\fBgetpwnam\fP(3)
+and
+\fBgetgrnam\fP(3).
+.TP
+\fB\%archive_write_header\fP()
+Build and write a header using the data in the provided
+Tn struct archive_entry
+structure.
+See
+\fBarchive_entry\fP(3)
+for information on creating and populating
+Tn struct archive_entry
+objects.
+.TP
+\fB\%archive_write_data\fP()
+Write data corresponding to the header just written.
+Returns number of bytes written or -1 on error.
+.TP
+\fB\%archive_write_finish_entry\fP()
+Close out the entry just written.
+Ordinarily, clients never need to call this, as it
+is called automatically by
+\fB\%archive_write_next_header\fP()
+and
+\fB\%archive_write_close\fP()
+as needed.
+.TP
+\fB\%archive_write_close\fP()
+Set any attributes that could not be set during the initial restore.
+For example, directory timestamps are not restored initially because
+restoring a subsequent file would alter that timestamp.
+Similarly, non-writable directories are initially created with
+write permissions (so that their contents can be restored).
+The
+\fB\%archive_write_disk_new\fP
+library maintains a list of all such deferred attributes and
+sets them when this function is invoked.
+.TP
+\fB\%archive_write_finish\fP()
+Invokes
+\fB\%archive_write_close\fP()
+if it was not invoked manually, then releases all resources.
+.RE
+More information about the
+\fIstruct\fP archive
+object and the overall design of the library can be found in the
+\fBlibarchive\fP(3)
+overview.
+Many of these functions are also documented under
+\fBarchive_write\fP(3).
+.SH RETURN VALUES
+.ad l
+Most functions return
+\fBARCHIVE_OK\fP
+(zero) on success, or one of several non-zero
+error codes for errors.
+Specific error codes include:
+\fBARCHIVE_RETRY\fP
+for operations that might succeed if retried,
+\fBARCHIVE_WARN\fP
+for unusual conditions that do not prevent further operations, and
+\fBARCHIVE_FATAL\fP
+for serious errors that make remaining operations impossible.
+The
+\fB\%archive_errno\fP()
+and
+\fB\%archive_error_string\fP()
+functions can be used to retrieve an appropriate error code and a
+textual error message.
+.PP
+\fB\%archive_write_disk_new\fP()
+returns a pointer to a newly-allocated
+Tn struct archive
+object.
+.PP
+\fB\%archive_write_data\fP()
+returns a count of the number of bytes actually written.
+On error, -1 is returned and the
+\fB\%archive_errno\fP()
+and
+\fB\%archive_error_string\fP()
+functions will return appropriate values.
+.SH SEE ALSO
+.ad l
+\fBarchive_read\fP(3),
+\fBarchive_write\fP(3),
+\fBtar\fP(1),
+\fBlibarchive\fP(3)
+.SH HISTORY
+.ad l
+The
+\fB\%libarchive\fP
+library first appeared in
+FreeBSD 5.3.
+The
+\fB\%archive_write_disk\fP
+interface was added to
+\fB\%libarchive\fP 2.0
+and first appeared in
+FreeBSD 6.3.
+.SH AUTHORS
+.ad l
+-nosplit
+The
+\fB\%libarchive\fP
+library was written by
+Tim Kientzle \%<kientzle@acm.org.>
+.SH BUGS
+.ad l
+Directories are actually extracted in two distinct phases.
+Directories are created during
+\fB\%archive_write_header\fP(),
+but final permissions are not set until
+\fB\%archive_write_close\fP().
+This separation is necessary to correctly handle borderline
+cases such as a non-writable directory containing
+files, but can cause unexpected results.
+In particular, directory permissions are not fully
+restored until the archive is closed.
+If you use
+\fBchdir\fP(2)
+to change the current directory between calls to
+\fB\%archive_read_extract\fP()
+or before calling
+\fB\%archive_read_close\fP(),
+you may confuse the permission-setting logic with
+the result that directory permissions are restored
+incorrectly.
+.PP
+The library attempts to create objects with filenames longer than
+\fBPATH_MAX\fP
+by creating prefixes of the full path and changing the current directory.
+Currently, this logic is limited in scope; the fixup pass does
+not work correctly for such objects and the symlink security check
+option disables the support for very long pathnames.
+.PP
+Restoring the path
+\fIaa/../bb\fP
+does create each intermediate directory.
+In particular, the directory
+\fIaa\fP
+is created as well as the final object
+\fIbb\fP.
+In theory, this can be exploited to create an entire directory heirarchy
+with a single request.
+Of course, this does not work if the
+\fBARCHIVE_EXTRACT_NODOTDOT\fP
+option is specified.
+.PP
+Implicit directories are always created obeying the current umask.
+Explicit objects are created obeying the current umask unless
+\fBARCHIVE_EXTRACT_PERM\fP
+is specified, in which case they current umask is ignored.
+.PP
+SGID and SUID bits are restored only if the correct user and
+group could be set.
+If
+\fBARCHIVE_EXTRACT_OWNER\fP
+is not specified, then no attempt is made to set the ownership.
+In this case, SGID and SUID bits are restored only if the
+user and group of the final object happen to match those specified
+in the entry.
+.PP
+The
+``standard''
+user-id and group-id lookup functions are not the defaults because
+\fBgetgrnam\fP(3)
+and
+\fBgetpwnam\fP(3)
+are sometimes too large for particular applications.
+The current design allows the application author to use a more
+compact implementation when appropriate.
+.PP
+There should be a corresponding
+\fB\%archive_read_disk\fP
+interface that walks a directory heirarchy and returns archive
+entry objects.
diff --git a/archivers/libarchive/files/doc/man/bsdcpio.1 b/archivers/libarchive/files/doc/man/bsdcpio.1
new file mode 100644
index 00000000000..76217b457c5
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/bsdcpio.1
@@ -0,0 +1,446 @@
+.TH BSDCPIO 1 "December 21, 2007" ""
+.SH NAME
+.ad l
+\fB\%cpio\fP
+\- copy files to and from archives
+.SH SYNOPSIS
+.ad l
+.br
+\fB\%cpio\fP
+{\fB\-i\fP}
+[\fIoptions\fP]
+[\fIpattern\fP ...]
+[\fI<\fP archive]
+.br
+\fB\%cpio\fP
+{\fB\-o\fP}
+[\fIoptions\fP]
+\fI<\fP name-list
+[\fI>\fP archive]
+.br
+\fB\%cpio\fP
+{\fB\-p\fP}
+[\fIoptions\fP]
+\fIdest-dir\fP
+\fI<\fP name-list
+.SH DESCRIPTION
+.ad l
+\fB\%cpio\fP
+copies files between archives and directories.
+This implementation can extract from tar, pax, cpio, zip, jar, ar,
+and ISO 9660 cdrom images and can create tar, pax, cpio, ar,
+and shar archives.
+.PP
+The first option to
+\fB\%cpio\fP
+is a mode indicator from the following list:
+.RS 5
+.TP
+\fB\-i\fP
+Input.
+Read an archive from standard input (unless overriden) and extract the
+contents to disk or (if the
+\fB\-t\fP
+option is specified)
+list the contents to standard output.
+If one or more file patterns are specified, only files matching
+one of the patterns will be extracted.
+.TP
+\fB\-o\fP
+Output.
+Read a list of filenames from standard input and produce a new archive
+on standard output (unless overriden) containing the specified items.
+.TP
+\fB\-p\fP
+Pass-through.
+Read a list of filenames from standard input and copy the files to the
+specified directory.
+.RE
+.PP
+.SH OPTIONS
+.ad l
+Unless specifically stated otherwise, options are applicable in
+all operating modes.
+.RS 5
+.TP
+\fB\-0\fP
+Read filenames separated by NUL characters instead of newlines.
+This is necessary if any of the filenames being read might contain newlines.
+.TP
+\fB\-A\fP
+(o mode only)
+Append to the specified archive.
+(Not yet implemented.)
+.TP
+\fB\-a\fP
+(o and p modes)
+Reset access times on files after they are read.
+.TP
+\fB\-B\fP
+(o mode only)
+Block output to records of 5120 bytes.
+.TP
+\fB\-C\fP \fIsize\fP
+(o mode only)
+Block output to records of
+\fIsize\fP
+bytes.
+.TP
+\fB\-c\fP
+(o mode only)
+Use the old POSIX portable character format.
+Equivalent to
+\fB\--format\fP \fIodc\fP.
+.TP
+\fB\-d\fP
+(i and p modes)
+Create directories as necessary.
+.TP
+\fB\-E\fP \fIfile\fP
+(i mode only)
+Read list of file name patterns from
+\fIfile\fP
+to list and extract.
+.TP
+\fB\-F\fP \fIfile\fP
+Read archive from or write archive to
+\fIfile\fP.
+.TP
+\fB\-f\fP \fIpattern\fP
+(i mode only)
+Ignore files that match
+\fIpattern\fP.
+.TP
+\fB\--format\fP \fIformat\fP
+(o mode only)
+Produce the output archive in the specified format.
+Supported formats include:
+.PP
+.RS 5
+.TP
+\fIcpio\fP
+Synonym for
+\fIodc\fP.
+.TP
+\fInewc\fP
+The SVR4 portable cpio format.
+.TP
+\fIodc\fP
+The old POSIX.1 portable octet-oriented cpio format.
+.TP
+\fIpax\fP
+The POSIX.1 pax format, an extension of the ustar format.
+.TP
+\fIustar\fP
+The POSIX.1 tar format.
+.RE
+.PP
+The default format is
+\fIodc\fP.
+See
+\fBlibarchive_formats\fP(5)
+for more complete information about the
+formats currently supported by the underlying
+\fBlibarchive\fP(3)
+library.
+.TP
+\fB\-H\fP \fIformat\fP
+Synonym for
+\fB\--format\fP.
+.TP
+\fB\-h\fP, \fB\--help\fP
+Print usage information.
+.TP
+\fB\-I\fP \fIfile\fP
+Read archive from
+\fIfile\fP.
+.TP
+\fB\-i\fP
+Input mode.
+See above for description.
+.TP
+\fB\--insecure\fP
+(i and p mode only)
+Disable security checks during extraction or copying.
+This allows extraction via symbolic links and path names containing
+Sq ..
+in the name.
+.TP
+\fB\-J\fP
+(o mode only)
+Compress the file with xz-compatible compression before writing it.
+In input mode, this option is ignored; xz compression is recognized
+automatically on input.
+.TP
+\fB\-j\fP
+Synonym for
+\fB\-y\fP.
+.TP
+\fB\-L\fP
+(o and p modes)
+All symbolic links will be followed.
+Normally, symbolic links are archived and copied as symbolic links.
+With this option, the target of the link will be archived or copied instead.
+.TP
+\fB\-l\fP
+(p mode only)
+Create links from the target directory to the original files,
+instead of copying.
+.TP
+\fB\-lzma\fP
+(o mode only)
+Compress the file with lzma-compatible compression before writing it.
+In input mode, this option is ignored; lzma compression is recognized
+automatically on input.
+.TP
+\fB\-m\fP
+(i and p modes)
+Set file modification time on created files to match
+those in the source.
+.TP
+\fB\-n\fP
+(i mode, only with
+\fB\-t\fP)
+Display numeric uid and gid.
+By default,
+\fB\%cpio\fP
+displays the user and group names when they are provided in the
+archive, or looks up the user and group names in the system
+password database.
+.TP
+\fB\-no-preserve-owner\fP
+(i mode only)
+Do not attempt to restore file ownership.
+This is the default when run by non-root users.
+.TP
+\fB\-O\fP \fIfile\fP
+Write archive to
+\fIfile\fP.
+.TP
+\fB\-o\fP
+Output mode.
+See above for description.
+.TP
+\fB\-p\fP
+Pass-through mode.
+See above for description.
+.TP
+\fB\-preserve-owner\fP
+(i mode only)
+Restore file ownership.
+This is the default when run by the root user.
+.TP
+\fB\--quiet\fP
+Suppress unnecessary messages.
+.TP
+\fB\-R\fP [user] [:] [group]
+Set the owner and/or group on files in the output.
+If group is specified with no user
+(for example,
+\fB\-R\fP \fI:wheel\fP)
+then the group will be set but not the user.
+If the user is specified with a trailing colon and no group
+(for example,
+\fB\-R\fP \fIroot:\fP)
+then the group will be set to the user's default group.
+If the user is specified with no trailing colon, then
+the user will be set but not the group.
+In
+\fB\-i\fP
+and
+\fB\-p\fP
+modes, this option can only be used by the super-user.
+(For compatibility, a period can be used in place of the colon.)
+.TP
+\fB\-r\fP
+(All modes.)
+Rename files interactively.
+For each file, a prompt is written to
+\fI/dev/tty\fP
+containing the name of the file and a line is read from
+\fI/dev/tty\fP.
+If the line read is blank, the file is skipped.
+If the line contains a single period, the file is processed normally.
+Otherwise, the line is taken to be the new name of the file.
+.TP
+\fB\-t\fP
+(i mode only)
+List the contents of the archive to stdout;
+do not restore the contents to disk.
+.TP
+\fB\-u\fP
+(i and p modes)
+Unconditionally overwrite existing files.
+Ordinarily, an older file will not overwrite a newer file on disk.
+.TP
+\fB\-v\fP
+Print the name of each file to stderr as it is processed.
+With
+\fB\-t\fP,
+provide a detailed listing of each file.
+.TP
+\fB\--version\fP
+Print the program version information and exit.
+.TP
+\fB\-y\fP
+(o mode only)
+Compress the archive with bzip2-compatible compression before writing it.
+In input mode, this option is ignored;
+bzip2 compression is recognized automatically on input.
+.TP
+\fB\-Z\fP
+(o mode only)
+Compress the archive with compress-compatible compression before writing it.
+In input mode, this option is ignored;
+compression is recognized automatically on input.
+.TP
+\fB\-z\fP
+(o mode only)
+Compress the archive with gzip-compatible compression before writing it.
+In input mode, this option is ignored;
+gzip compression is recognized automatically on input.
+.RE
+.SH ENVIRONMENT
+.ad l
+The following environment variables affect the execution of
+\fB\%cpio\fP:
+.RS 5
+.TP
+.B LANG
+The locale to use.
+See
+\fBenviron\fP(7)
+for more information.
+.TP
+.B TZ
+The timezone to use when displaying dates.
+See
+\fBenviron\fP(7)
+for more information.
+.RE
+.SH EXIT STATUS
+.ad l
+The \fBcpio\fP utility exits 0 on success, and >0 if an error occurs.
+.SH EXAMPLES
+.ad l
+The
+\fB\%cpio\fP
+command is traditionally used to copy file heirarchies in conjunction
+with the
+\fBfind\fP(1)
+command.
+The first example here simply copies all files from
+\fIsrc\fP
+to
+\fIdest\fP:
+.RS 4
+\fB\%find\fP \fIsrc\fP | \fB\%cpio\fP \fB\-pmud\fP \fIdest\fP
+.RE
+.PP
+By carefully selecting options to the
+\fBfind\fP(1)
+command and combining it with other standard utilities,
+it is possible to exercise very fine control over which files are copied.
+This next example copies files from
+\fIsrc\fP
+to
+\fIdest\fP
+that are more than 2 days old and whose names match a particular pattern:
+.RS 4
+\fB\%find\fP \fIsrc\fP \fB\-mtime\fP \fI+2\fP | \fB\%grep\fP foo[bar] | \fB\%cpio\fP \fB\-pdmu\fP \fIdest\fP
+.RE
+.PP
+This example copies files from
+\fIsrc\fP
+to
+\fIdest\fP
+that are more than 2 days old and which contain the word
+``foobar'':
+.RS 4
+\fB\%find\fP \fIsrc\fP \fB\-mtime\fP \fI+2\fP | \fB\%xargs\fP \fB\%grep\fP -l foobar | \fB\%cpio\fP \fB\-pdmu\fP \fIdest\fP
+.RE
+.SH COMPATIBILITY
+.ad l
+The mode options i, o, and p and the options
+a, B, c, d, f, l, m, r, t, u, and v comply with SUSv2.
+.PP
+The old POSIX.1 standard specified that only
+\fB\-i\fP,
+\fB\-o\fP,
+and
+\fB\-p\fP
+were interpreted as command-line options.
+Each took a single argument of a list of modifier
+characters.
+For example, the standard syntax allows
+\fB\-imu\fP
+but does not support
+\fB\-miu\fP
+or
+\fB\-i\fP \fB\-m\fP \fB\-u\fP,
+since
+\fIm\fP
+and
+\fIu\fP
+are only modifiers to
+\fB\-i\fP,
+they are not command-line options in their own right.
+The syntax supported by this implementation is backwards-compatible
+with the standard.
+For best compatibility, scripts should limit themselves to the
+standard syntax.
+.SH SEE ALSO
+.ad l
+\fBbzip2\fP(1),
+\fBtar\fP(1),
+\fBgzip\fP(1),
+\fBmt\fP(1),
+\fBpax\fP(1),
+\fBlibarchive\fP(3),
+\fBcpio\fP(5),
+\fBlibarchive-formats\fP(5),
+\fBtar\fP(5)
+.SH STANDARDS
+.ad l
+There is no current POSIX standard for the cpio command; it appeared
+in
+ISO/IEC 9945-1:1996 (``POSIX.1'')
+but was dropped from
+IEEE Std 1003.1-2001 (``POSIX.1'').
+.PP
+The cpio, ustar, and pax interchange file formats are defined by
+IEEE Std 1003.1-2001 (``POSIX.1'')
+for the pax command.
+.SH HISTORY
+.ad l
+The original
+\fB\%cpio\fP
+and
+\fB\%find\fP
+utilities were written by Dick Haight
+while working in AT&T's Unix Support Group.
+They first appeared in 1977 in PWB/UNIX 1.0, the
+``Programmer's Work Bench''
+system developed for use within AT&T.
+They were first released outside of AT&T as part of System III Unix in 1981.
+As a result,
+\fB\%cpio\fP
+actually predates
+\fB\%tar\fP,
+even though it was not well-known outside of AT&T until some time later.
+.PP
+This is a complete re-implementation based on the
+\fBlibarchive\fP(3)
+library.
+.SH BUGS
+.ad l
+The cpio archive format has several basic limitations:
+It does not store user and group names, only numbers.
+As a result, it cannot be reliably used to transfer
+files between systems with dissimilar user and group numbering.
+Older cpio formats limit the user and group numbers to
+16 or 18 bits, which is insufficient for modern systems.
+The cpio archive formats cannot support files over 4 gigabytes,
+except for the
+``odc''
+variant, which can support files up to 8 gigabytes.
diff --git a/archivers/libarchive/files/doc/man/bsdtar.1 b/archivers/libarchive/files/doc/man/bsdtar.1
new file mode 100644
index 00000000000..bd9f6189829
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/bsdtar.1
@@ -0,0 +1,1024 @@
+.TH BSDTAR 1 "Oct 12, 2009" ""
+.SH NAME
+.ad l
+\fB\%tar\fP
+\- manipulate tape archives
+.SH SYNOPSIS
+.ad l
+.br
+\fB\%tar\fP
+[\fIbundled-flags\fP <args>]
+[<\fIfile\fP> | <\fIpattern\fP> ...]
+.br
+\fB\%tar\fP
+{\fB\-c\fP}
+[\fIoptions\fP]
+[\fIfiles\fP | \fIdirectories\fP]
+.br
+\fB\%tar\fP
+{\fB\-r\fP | \fB\-u\fP}
+\fB\-f\fP \fIarchive-file\fP
+[\fIoptions\fP]
+[\fIfiles\fP | \fIdirectories\fP]
+.br
+\fB\%tar\fP
+{\fB\-t\fP | \fB\-x\fP}
+[\fIoptions\fP]
+[\fIpatterns\fP]
+.SH DESCRIPTION
+.ad l
+\fB\%tar\fP
+creates and manipulates streaming archive files.
+This implementation can extract from tar, pax, cpio, zip, jar, ar,
+and ISO 9660 cdrom images and can create tar, pax, cpio, ar,
+and shar archives.
+.PP
+The first synopsis form shows a
+``bundled''
+option word.
+This usage is provided for compatibility with historical implementations.
+See COMPATIBILITY below for details.
+.PP
+The other synopsis forms show the preferred usage.
+The first option to
+\fB\%tar\fP
+is a mode indicator from the following list:
+.RS 5
+.TP
+\fB\-c\fP
+Create a new archive containing the specified items.
+.TP
+\fB\-r\fP
+Like
+\fB\-c\fP,
+but new entries are appended to the archive.
+Note that this only works on uncompressed archives stored in regular files.
+The
+\fB\-f\fP
+option is required.
+.TP
+\fB\-t\fP
+List archive contents to stdout.
+.TP
+\fB\-u\fP
+Like
+\fB\-r\fP,
+but new entries are added only if they have a modification date
+newer than the corresponding entry in the archive.
+Note that this only works on uncompressed archives stored in regular files.
+The
+\fB\-f\fP
+option is required.
+.TP
+\fB\-x\fP
+Extract to disk from the archive.
+If a file with the same name appears more than once in the archive,
+each copy will be extracted, with later copies overwriting (replacing)
+earlier copies.
+.RE
+.PP
+In
+\fB\-c\fP,
+\fB\-r\fP,
+or
+\fB\-u\fP
+mode, each specified file or directory is added to the
+archive in the order specified on the command line.
+By default, the contents of each directory are also archived.
+.PP
+In extract or list mode, the entire command line
+is read and parsed before the archive is opened.
+The pathnames or patterns on the command line indicate
+which items in the archive should be processed.
+Patterns are shell-style globbing patterns as
+documented in
+\fBtcsh\fP(1).
+.SH OPTIONS
+.ad l
+Unless specifically stated otherwise, options are applicable in
+all operating modes.
+.RS 5
+.TP
+\fB@\fP \fIarchive\fP
+(c and r mode only)
+The specified archive is opened and the entries
+in it will be appended to the current archive.
+As a simple example,
+.RS 4
+\fB\%tar\fP \fB\-c\fP \fB\-f\fP \fI-\fP \fInewfile\fP \fB@\fP \fIoriginal.tar\fP
+.RE
+writes a new archive to standard output containing a file
+\fInewfile\fP
+and all of the entries from
+\fIoriginal.tar\fP.
+In contrast,
+.RS 4
+\fB\%tar\fP \fB\-c\fP \fB\-f\fP \fI-\fP \fInewfile\fP \fIoriginal.tar\fP
+.RE
+creates a new archive with only two entries.
+Similarly,
+.RS 4
+\fB\%tar\fP \fB\-czf\fP \fI-\fP \fB\--format\fP \fBpax\fP \fB@\fP \fI-\fP
+.RE
+reads an archive from standard input (whose format will be determined
+automatically) and converts it into a gzip-compressed
+pax-format archive on stdout.
+In this way,
+\fB\%tar\fP
+can be used to convert archives from one format to another.
+.TP
+\fB\-b\fP \fIblocksize\fP
+Specify the block size, in 512-byte records, for tape drive I/O.
+As a rule, this argument is only needed when reading from or writing
+to tape drives, and usually not even then as the default block size of
+20 records (10240 bytes) is very common.
+.TP
+\fB\-C\fP \fIdirectory\fP
+In c and r mode, this changes the directory before adding
+the following files.
+In x mode, change directories after opening the archive
+but before extracting entries from the archive.
+.TP
+\fB\--check-links\fP
+(c and r modes only)
+Issue a warning message unless all links to each file are archived.
+.TP
+\fB\--chroot\fP
+(x mode only)
+\fB\%chroot\fP()
+to the current directory after processing any
+\fB\-C\fP
+options and before extracting any files.
+.TP
+\fB\--exclude\fP \fIpattern\fP
+Do not process files or directories that match the
+specified pattern.
+Note that exclusions take precedence over patterns or filenames
+specified on the command line.
+.TP
+\fB\--format\fP \fIformat\fP
+(c, r, u mode only)
+Use the specified format for the created archive.
+Supported formats include
+``cpio'',
+``pax'',
+``shar'',
+and
+``ustar''.
+Other formats may also be supported; see
+\fBlibarchive-formats\fP(5)
+for more information about currently-supported formats.
+In r and u modes, when extending an existing archive, the format specified
+here must be compatible with the format of the existing archive on disk.
+.TP
+\fB\-f\fP \fIfile\fP
+Read the archive from or write the archive to the specified file.
+The filename can be
+\fI-\fP
+for standard input or standard output.
+If not specified, the default tape device will be used.
+(On
+FreeBSD,
+the default tape device is
+\fI/dev/sa0\fP.)
+.TP
+\fB\-H\fP
+(c and r mode only)
+Symbolic links named on the command line will be followed; the
+target of the link will be archived, not the link itself.
+.TP
+\fB\-h\fP
+(c and r mode only)
+Synonym for
+\fB\-L\fP.
+.TP
+\fB\-I\fP
+Synonym for
+\fB\-T\fP.
+.TP
+\fB\--include\fP \fIpattern\fP
+Process only files or directories that match the specified pattern.
+Note that exclusions specified with
+\fB\--exclude\fP
+take precedence over inclusions.
+If no inclusions are explicitly specified, all entries are processed by
+default.
+The
+\fB\--include\fP
+option is especially useful when filtering archives.
+For example, the command
+.RS 4
+\fB\%tar\fP \fB\-c\fP \fB\-f\fP \fInew.tar\fP \fB\--include='*foo*'\fP \fB@\fP \fIold.tgz\fP
+.RE
+creates a new archive
+\fInew.tar\fP
+containing only the entries from
+\fIold.tgz\fP
+containing the string
+Sq foo.
+.TP
+\fB\-j\fP
+(c mode only)
+Compress the resulting archive with
+\fBbzip2\fP(1).
+In extract or list modes, this option is ignored.
+Note that, unlike other
+\fB\%tar\fP
+implementations, this implementation recognizes bzip2 compression
+automatically when reading archives.
+.TP
+\fB\-k\fP
+(x mode only)
+Do not overwrite existing files.
+In particular, if a file appears more than once in an archive,
+later copies will not overwrite earlier copies.
+.TP
+\fB\--keep-newer-files\fP
+(x mode only)
+Do not overwrite existing files that are newer than the
+versions appearing in the archive being extracted.
+.TP
+\fB\-L\fP
+(c and r mode only)
+All symbolic links will be followed.
+Normally, symbolic links are archived as such.
+With this option, the target of the link will be archived instead.
+.TP
+\fB\-l\fP
+This is a synonym for the
+\fB\--check-links\fP
+option.
+.TP
+\fB\-m\fP
+(x mode only)
+Do not extract modification time.
+By default, the modification time is set to the time stored in the archive.
+.TP
+\fB\-n\fP
+(c, r, u modes only)
+Do not recursively archive the contents of directories.
+.TP
+\fB\--newer\fP \fIdate\fP
+(c, r, u modes only)
+Only include files and directories newer than the specified date.
+This compares ctime entries.
+.TP
+\fB\--newer-mtime\fP \fIdate\fP
+(c, r, u modes only)
+Like
+\fB\--newer\fP,
+except it compares mtime entries instead of ctime entries.
+.TP
+\fB\--newer-than\fP \fIfile\fP
+(c, r, u modes only)
+Only include files and directories newer than the specified file.
+This compares ctime entries.
+.TP
+\fB\--newer-mtime-than\fP \fIfile\fP
+(c, r, u modes only)
+Like
+\fB\--newer-than\fP,
+except it compares mtime entries instead of ctime entries.
+.TP
+\fB\--nodump\fP
+(c and r modes only)
+Honor the nodump file flag by skipping this file.
+.TP
+\fB\--null\fP
+(use with
+\fB\-I\fP,
+\fB\-T\fP,
+or
+\fB\-X\fP)
+Filenames or patterns are separated by null characters,
+not by newlines.
+This is often used to read filenames output by the
+\fB\-print0\fP
+option to
+\fBfind\fP(1).
+.TP
+\fB\--numeric-owner\fP
+(x mode only)
+Ignore symbolic user and group names when restoring archives to disk,
+only numeric uid and gid values will be obeyed.
+.TP
+\fB\-O\fP
+(x, t modes only)
+In extract (-x) mode, files will be written to standard out rather than
+being extracted to disk.
+In list (-t) mode, the file listing will be written to stderr rather than
+the usual stdout.
+.TP
+\fB\-o\fP
+(x mode)
+Use the user and group of the user running the program rather
+than those specified in the archive.
+Note that this has no significance unless
+\fB\-p\fP
+is specified, and the program is being run by the root user.
+In this case, the file modes and flags from
+the archive will be restored, but ACLs or owner information in
+the archive will be discarded.
+.TP
+\fB\-o\fP
+(c, r, u mode)
+A synonym for
+\fB\--format\fP \fIustar\fP
+.TP
+\fB\--one-file-system\fP
+(c, r, and u modes)
+Do not cross mount points.
+.TP
+\fB\--options\fP \fIoptions\fP
+Select optional behaviors for particular modules.
+The argument is a text string containing comma-separated
+keywords and values.
+These are passed to the modules that handle particular
+formats to control how those formats will behave.
+Each option has one of the following forms:
+.RS 5
+.TP
+\fIkey=value\fP
+The key will be set to the specified value in every module that supports it.
+Modules that do not support this key will ignore it.
+.TP
+\fIkey\fP
+The key will be enabled in every module that supports it.
+This is equivalent to
+\fIkey\fP \fB=1\fP.
+.TP
+\fI!key\fP
+The key will be disabled in every module that supports it.
+.TP
+\fImodule:key=value\fP, \fImodule:key\fP, \fImodule:!key\fP
+As above, but the corresponding key and value will be provided
+only to modules whose name matches
+\fImodule\fP.
+.RE
+The currently supported modules and keys are:
+.RS 5
+.TP
+\fBiso9660:joliet\fP
+Support Joliet extensions.
+This is enabled by default, use
+\fB!joliet\fP
+or
+\fBiso9660:!joliet\fP
+to disable.
+.TP
+\fBiso9660:rockridge\fP
+Support Rock Ridge extensions.
+This is enabled by default, use
+\fB!rockridge\fP
+or
+\fBiso9660:!rockridge\fP
+to disable.
+.TP
+\fBgzip:compression-level\fP
+A decimal integer from 0 to 9 specifying the gzip compression level.
+.TP
+\fBxz:compression-level\fP
+A decimal integer from 0 to 9 specifying the xz compression level.
+.TP
+\fBmtree:\fP \fIkeyword\fP
+The mtree writer module allows you to specify which mtree keywords
+will be included in the output.
+Supported keywords include:
+\fBcksum\fP, \fBdevice\fP, \fBflags\fP, \fBgid\fP, \fBgname\fP, \fBindent\fP,
+\fBlink\fP, \fBmd5\fP, \fBmode\fP, \fBnlink\fP, \fBrmd160\fP, \fBsha1\fP, \fBsha256\fP,
+\fBsha384\fP, \fBsha512\fP, \fBsize\fP, \fBtime\fP, \fBuid\fP, \fBuname\fP.
+The default is equivalent to:
+``device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname''.
+.TP
+\fBmtree:all\fP
+Enables all of the above keywords.
+You can also use
+\fBmtree:!all\fP
+to disable all keywords.
+.TP
+\fBmtree:use-set\fP
+Enable generation of
+\fB/set\fP
+lines in the output.
+.TP
+\fBmtree:indent\fP
+Produce human-readable output by indenting options and splitting lines
+to fit into 80 columns.
+.TP
+\fBzip:compression\fP=\fItype\fP
+Use
+\fItype\fP
+as compression method.
+Supported values are store (uncompressed) and deflate (gzip algorithm).
+.RE
+If a provided option is not supported by any module, that
+is a fatal error.
+.TP
+\fB\-P\fP
+Preserve pathnames.
+By default, absolute pathnames (those that begin with a /
+character) have the leading slash removed both when creating archives
+and extracting from them.
+Also,
+\fB\%tar\fP
+will refuse to extract archive entries whose pathnames contain
+\fI\& ..\fP
+or whose target directory would be altered by a symlink.
+This option suppresses these behaviors.
+.TP
+\fB\-p\fP
+(x mode only)
+Preserve file permissions.
+Attempt to restore the full permissions, including owner, file modes, file
+flags and ACLs, if available, for each item extracted from the archive.
+By default, newly-created files are owned by the user running
+\fB\%tar\fP,
+the file mode is restored for newly-created regular files, and
+all other types of entries receive default permissions.
+If
+\fB\%tar\fP
+is being run by root, the default is to restore the owner unless the
+\fB\-o\fP
+option is also specified.
+.TP
+\fB\-q\fP (\fB\--fast-read\fP)
+(x and t mode only)
+Extract or list only the first archive entry that matches each pattern
+or filename operand.
+Exit as soon as each specified pattern or filename has been matched.
+By default, the archive is always read to the very end, since
+there can be multiple entries with the same name and, by convention,
+later entries overwrite earlier entries.
+This option is provided as a performance optimization.
+.TP
+\fB\-S\fP
+(x mode only)
+Extract files as sparse files.
+For every block on disk, check first if it contains only NULL bytes and seek
+over it otherwise.
+This works similiar to the conv=sparse option of dd.
+.TP
+\fB\--strip-components\fP \fIcount\fP
+(x mode only)
+Remove the specified number of leading path elements.
+Pathnames with fewer elements will be silently skipped.
+Note that the pathname is edited after checking inclusion/exclusion patterns
+but before security checks.
+.TP
+\fB\-s\fP \fIpattern\fP
+Modify file or archive member names according to
+\fIpattern\fP.
+The pattern has the format
+\fI/old/new/\fP [gps]
+where
+\fIold\fP
+is a basic regular expression,
+\fInew\fP
+is the replacement string of the matched part,
+and the optional trailing letters modify
+how the replacement is handled.
+If
+\fIold\fP
+is not matched, the pattern is skipped.
+Within
+\fInew\fP,
+~ is substituted with the match, \1 to \9 with the content of
+the corresponding captured group.
+The optional trailing g specifies that matching should continue
+after the matched part and stopped on the first unmatched pattern.
+The optional trailing s specifies that the pattern applies to the value
+of symbolic links.
+The optional trailing p specifies that after a successful substitution
+the original path name and the new path name should be printed to
+standard error.
+.TP
+\fB\-T\fP \fIfilename\fP
+In x or t mode,
+\fB\%tar\fP
+will read the list of names to be extracted from
+\fIfilename\fP.
+In c mode,
+\fB\%tar\fP
+will read names to be archived from
+\fIfilename\fP.
+The special name
+``-C''
+on a line by itself will cause the current directory to be changed to
+the directory specified on the following line.
+Names are terminated by newlines unless
+\fB\--null\fP
+is specified.
+Note that
+\fB\--null\fP
+also disables the special handling of lines containing
+``-C''.
+.TP
+\fB\-U\fP
+(x mode only)
+Unlink files before creating them.
+Without this option,
+\fB\%tar\fP
+overwrites existing files, which preserves existing hardlinks.
+With this option, existing hardlinks will be broken, as will any
+symlink that would affect the location of an extracted file.
+.TP
+\fB\--use-compress-program\fP \fIprogram\fP
+Pipe the input (in x or t mode) or the output (in c mode) through
+\fIprogram\fP
+instead of using the builtin compression support.
+.TP
+\fB\-v\fP
+Produce verbose output.
+In create and extract modes,
+\fB\%tar\fP
+will list each file name as it is read from or written to
+the archive.
+In list mode,
+\fB\%tar\fP
+will produce output similar to that of
+\fBls\fP(1).
+Additional
+\fB\-v\fP
+options will provide additional detail.
+.TP
+\fB\--version\fP
+Print version of
+\fB\%tar\fP
+and
+\fB\%libarchive\fP,
+and exit.
+.TP
+\fB\-w\fP
+Ask for confirmation for every action.
+.TP
+\fB\-X\fP \fIfilename\fP
+Read a list of exclusion patterns from the specified file.
+See
+\fB\--exclude\fP
+for more information about the handling of exclusions.
+.TP
+\fB\-y\fP
+(c mode only)
+Compress the resulting archive with
+\fBbzip2\fP(1).
+In extract or list modes, this option is ignored.
+Note that, unlike other
+\fB\%tar\fP
+implementations, this implementation recognizes bzip2 compression
+automatically when reading archives.
+.TP
+\fB\-z\fP
+(c mode only)
+Compress the resulting archive with
+\fBgzip\fP(1).
+In extract or list modes, this option is ignored.
+Note that, unlike other
+\fB\%tar\fP
+implementations, this implementation recognizes gzip compression
+automatically when reading archives.
+.TP
+\fB\-Z\fP
+(c mode only)
+Compress the resulting archive with
+\fBcompress\fP(1).
+In extract or list modes, this option is ignored.
+Note that, unlike other
+\fB\%tar\fP
+implementations, this implementation recognizes compress compression
+automatically when reading archives.
+.RE
+.SH ENVIRONMENT
+.ad l
+The following environment variables affect the execution of
+\fB\%tar\fP:
+.RS 5
+.TP
+.B LANG
+The locale to use.
+See
+\fBenviron\fP(7)
+for more information.
+.TP
+.B TAPE
+The default tape device.
+The
+\fB\-f\fP
+option overrides this.
+.TP
+.B TZ
+The timezone to use when displaying dates.
+See
+\fBenviron\fP(7)
+for more information.
+.RE
+.SH FILES
+.ad l
+.RS 5
+.TP
+.B /dev/sa0
+The default tape device, if not overridden by the
+.IR TAPE
+environment variable or the
+\fB\-f\fP
+option.
+.RE
+.SH EXIT STATUS
+.ad l
+The \fBtar\fP utility exits 0 on success, and >0 if an error occurs.
+.SH EXAMPLES
+.ad l
+The following creates a new archive
+called
+\fIfile.tar.gz\fP
+that contains two files
+\fIsource.c\fP
+and
+\fIsource.h\fP:
+.RS 4
+\fB\%tar\fP \fB\-czf\fP \fIfile.tar.gz\fP \fIsource.c\fP \fIsource.h\fP
+.RE
+.PP
+To view a detailed table of contents for this
+archive:
+.RS 4
+\fB\%tar\fP \fB\-tvf\fP \fIfile.tar.gz\fP
+.RE
+.PP
+To extract all entries from the archive on
+the default tape drive:
+.RS 4
+\fB\%tar\fP \fB\-x\fP
+.RE
+.PP
+To examine the contents of an ISO 9660 cdrom image:
+.RS 4
+\fB\%tar\fP \fB\-tf\fP \fIimage.iso\fP
+.RE
+.PP
+To move file hierarchies, invoke
+\fB\%tar\fP
+as
+.RS 4
+\fB\%tar\fP \fB\-cf\fP \fI-\fP \fB\-C\fP \fIsrcdir\\fP. | \fB\%tar\fP \fB\-xpf\fP \fI-\fP \fB\-C\fP \fIdestdir\fP
+.RE
+or more traditionally
+.RS 4
+cd srcdir \&; \fB\%tar\fP \fB\-cf\fP \fI-\\fP. | (cd destdir \&; \fB\%tar\fP \fB\-xpf\fP \fI-\fP)
+.RE
+.PP
+In create mode, the list of files and directories to be archived
+can also include directory change instructions of the form
+\fB-C\fP \fIfoo/baz\fP
+and archive inclusions of the form
+\fB@\fP \fIarchive-file\fP.
+For example, the command line
+.RS 4
+\fB\%tar\fP \fB\-c\fP \fB\-f\fP \fInew.tar\fP \fIfoo1\fP \fB@\fP \fIold.tgz\fP \fB-C\fP \fI/tmp\fP \fIfoo2\fP
+.RE
+will create a new archive
+\fInew.tar\fP.
+\fB\%tar\fP
+will read the file
+\fIfoo1\fP
+from the current directory and add it to the output archive.
+It will then read each entry from
+\fIold.tgz\fP
+and add those entries to the output archive.
+Finally, it will switch to the
+\fI/tmp\fP
+directory and add
+\fIfoo2\fP
+to the output archive.
+.PP
+An input file in
+\fBmtree\fP(5)
+format can be used to create an output archive with arbitrary ownership,
+permissions, or names that differ from existing data on disk:
+.PP
+.RS 4
+$ cat input.mtree
+.RE
+.RS 4
+#mtree
+.RE
+.RS 4
+usr/bin uid=0 gid=0 mode=0755 type=dir
+.RE
+.RS 4
+usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls
+.RE
+.RS 4
+$ tar -cvf output.tar @input.mtree
+.RE
+.PP
+The
+\fB\--newer\fP
+and
+\fB\--newer-mtime\fP
+switches accept a variety of common date and time specifications, including
+``12 Mar 2005 7:14:29pm'',
+``2005-03-12 19:14'',
+``5 minutes ago'',
+and
+``19:14 PST May 1''.
+.PP
+The
+\fB\--options\fP
+argument can be used to control various details of archive generation
+or reading.
+For example, you can generate mtree output which only contains
+\fBtype\fP, \fBtime\fP,
+and
+\fBuid\fP
+keywords:
+.RS 4
+\fB\%tar\fP \fB\-cf\fP \fIfile.tar\fP \fB\--format=mtree\fP \fB\--options='!all,type,time,uid'\fP \fIdir\fP
+.RE
+or you can set the compression level used by gzip or xz compression:
+.RS 4
+\fB\%tar\fP \fB\-czf\fP \fIfile.tar\fP \fB\--options='compression-level=9'\fP.
+.RE
+For more details, see the explanation of the
+\fB\%archive_read_set_options\fP()
+and
+\fB\%archive_write_set_options\fP()
+API calls that are described in
+\fBarchive_read\fP(3)
+and
+\fBarchive_write\fP(3).
+.SH COMPATIBILITY
+.ad l
+The bundled-arguments format is supported for compatibility
+with historic implementations.
+It consists of an initial word (with no leading - character) in which
+each character indicates an option.
+Arguments follow as separate words.
+The order of the arguments must match the order
+of the corresponding characters in the bundled command word.
+For example,
+.RS 4
+\fB\%tar\fP \fBtbf\fP 32 \fIfile.tar\fP
+.RE
+specifies three flags
+\fBt\fP,
+\fBb\fP,
+and
+\fBf\fP.
+The
+\fBb\fP
+and
+\fBf\fP
+flags both require arguments,
+so there must be two additional items
+on the command line.
+The
+\fI32\fP
+is the argument to the
+\fBb\fP
+flag, and
+\fIfile.tar\fP
+is the argument to the
+\fBf\fP
+flag.
+.PP
+The mode options c, r, t, u, and x and the options
+b, f, l, m, o, v, and w comply with SUSv2.
+.PP
+For maximum portability, scripts that invoke
+\fB\%tar\fP
+should use the bundled-argument format above, should limit
+themselves to the
+\fBc\fP,
+\fBt\fP,
+and
+\fBx\fP
+modes, and the
+\fBb\fP,
+\fBf\fP,
+\fBm\fP,
+\fBv\fP,
+and
+\fBw\fP
+options.
+.PP
+Additional long options are provided to improve compatibility with other
+tar implementations.
+.SH SECURITY
+.ad l
+Certain security issues are common to many archiving programs, including
+\fB\%tar\fP.
+In particular, carefully-crafted archives can request that
+\fB\%tar\fP
+extract files to locations outside of the target directory.
+This can potentially be used to cause unwitting users to overwrite
+files they did not intend to overwrite.
+If the archive is being extracted by the superuser, any file
+on the system can potentially be overwritten.
+There are three ways this can happen.
+Although
+\fB\%tar\fP
+has mechanisms to protect against each one,
+savvy users should be aware of the implications:
+.RS 5
+.IP \(bu
+Archive entries can have absolute pathnames.
+By default,
+\fB\%tar\fP
+removes the leading
+\fI/\fP
+character from filenames before restoring them to guard against this problem.
+.IP \(bu
+Archive entries can have pathnames that include
+\fI\& ..\fP
+components.
+By default,
+\fB\%tar\fP
+will not extract files containing
+\fI\& ..\fP
+components in their pathname.
+.IP \(bu
+Archive entries can exploit symbolic links to restore
+files to other directories.
+An archive can restore a symbolic link to another directory,
+then use that link to restore a file into that directory.
+To guard against this,
+\fB\%tar\fP
+checks each extracted path for symlinks.
+If the final path element is a symlink, it will be removed
+and replaced with the archive entry.
+If
+\fB\-U\fP
+is specified, any intermediate symlink will also be unconditionally removed.
+If neither
+\fB\-U\fP
+nor
+\fB\-P\fP
+is specified,
+\fB\%tar\fP
+will refuse to extract the entry.
+.RE
+To protect yourself, you should be wary of any archives that
+come from untrusted sources.
+You should examine the contents of an archive with
+.RS 4
+\fB\%tar\fP \fB\-tf\fP \fIfilename\fP
+.RE
+before extraction.
+You should use the
+\fB\-k\fP
+option to ensure that
+\fB\%tar\fP
+will not overwrite any existing files or the
+\fB\-U\fP
+option to remove any pre-existing files.
+You should generally not extract archives while running with super-user
+privileges.
+Note that the
+\fB\-P\fP
+option to
+\fB\%tar\fP
+disables the security checks above and allows you to extract
+an archive while preserving any absolute pathnames,
+\fI\& ..\fP
+components, or symlinks to other directories.
+.SH SEE ALSO
+.ad l
+\fBbzip2\fP(1),
+\fBcompress\fP(1),
+\fBcpio\fP(1),
+\fBgzip\fP(1),
+\fBmt\fP(1),
+\fBpax\fP(1),
+\fBshar\fP(1),
+\fBlibarchive\fP(3),
+\fBlibarchive-formats\fP(5),
+\fBtar\fP(5)
+.SH STANDARDS
+.ad l
+There is no current POSIX standard for the tar command; it appeared
+in
+ISO/IEC 9945-1:1996 (``POSIX.1'')
+but was dropped from
+IEEE Std 1003.1-2001 (``POSIX.1'').
+The options used by this implementation were developed by surveying a
+number of existing tar implementations as well as the old POSIX specification
+for tar and the current POSIX specification for pax.
+.PP
+The ustar and pax interchange file formats are defined by
+IEEE Std 1003.1-2001 (``POSIX.1'')
+for the pax command.
+.SH HISTORY
+.ad l
+A
+\fB\%tar\fP
+command appeared in Seventh Edition Unix, which was released in January, 1979.
+There have been numerous other implementations,
+many of which extended the file format.
+John Gilmore's
+\fB\%pdtar\fP
+public-domain implementation (circa November, 1987)
+was quite influential, and formed the basis of GNU tar.
+GNU tar was included as the standard system tar
+in
+FreeBSD
+beginning with
+FreeBSD 1.0.
+.PP
+This is a complete re-implementation based on the
+\fBlibarchive\fP(3)
+library.
+.SH BUGS
+.ad l
+This program follows
+ISO/IEC 9945-1:1996 (``POSIX.1'')
+for the definition of the
+\fB\-l\fP
+option.
+Note that GNU tar prior to version 1.15 treated
+\fB\-l\fP
+as a synonym for the
+\fB\--one-file-system\fP
+option.
+.PP
+The
+\fB\-C\fP \fIdir\fP
+option may differ from historic implementations.
+.PP
+All archive output is written in correctly-sized blocks, even
+if the output is being compressed.
+Whether or not the last output block is padded to a full
+block size varies depending on the format and the
+output device.
+For tar and cpio formats, the last block of output is padded
+to a full block size if the output is being
+written to standard output or to a character or block device such as
+a tape drive.
+If the output is being written to a regular file, the last block
+will not be padded.
+Many compressors, including
+\fBgzip\fP(1)
+and
+\fBbzip2\fP(1),
+complain about the null padding when decompressing an archive created by
+\fB\%tar\fP,
+although they still extract it correctly.
+.PP
+The compression and decompression is implemented internally, so
+there may be insignificant differences between the compressed output
+generated by
+.RS 4
+\fB\%tar\fP \fB\-czf\fP \fI-\fP file
+.RE
+and that generated by
+.RS 4
+\fB\%tar\fP \fB\-cf\fP \fI-\fP file | \fB\%gzip\fP
+.RE
+.PP
+The default should be to read and write archives to the standard I/O paths,
+but tradition (and POSIX) dictates otherwise.
+.PP
+The
+\fBr\fP
+and
+\fBu\fP
+modes require that the archive be uncompressed
+and located in a regular file on disk.
+Other archives can be modified using
+\fBc\fP
+mode with the
+\fI@archive-file\fP
+extension.
+.PP
+To archive a file called
+\fI@foo\fP
+or
+\fI-foo\fP
+you must specify it as
+\fI\& ./@foo\fP
+or
+\fI\& ./-foo\fP,
+respectively.
+.PP
+In create mode, a leading
+\fI\& ./\fP
+is always removed.
+A leading
+\fI/\fP
+is stripped unless the
+\fB\-P\fP
+option is specified.
+.PP
+There needs to be better support for file selection on both create
+and extract.
+.PP
+There is not yet any support for multi-volume archives or for archiving
+sparse files.
+.PP
+Converting between dissimilar archive formats (such as tar and cpio) using the
+\fB@\fP \fI-\fP
+convention can cause hard link information to be lost.
+(This is a consequence of the incompatible ways that different archive
+formats store hardlink information.)
+.PP
+There are alternative long options for many of the short options that
+are deliberately not documented.
diff --git a/archivers/libarchive/files/doc/man/cpio.5 b/archivers/libarchive/files/doc/man/cpio.5
new file mode 100644
index 00000000000..922df018ff9
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/cpio.5
@@ -0,0 +1,329 @@
+.TH CPIO 5 "October 5, 2007" ""
+.SH NAME
+.ad l
+\fB\%cpio\fP
+\- format of cpio archive files
+.SH DESCRIPTION
+.ad l
+The
+\fB\%cpio\fP
+archive format collects any number of files, directories, and other
+file system objects (symbolic links, device nodes, etc.) into a single
+stream of bytes.
+.SS General Format
+Each file system object in a
+\fB\%cpio\fP
+archive comprises a header record with basic numeric metadata
+followed by the full pathname of the entry and the file data.
+The header record stores a series of integer values that generally
+follow the fields in
+\fIstruct\fP stat.
+(See
+\fBstat\fP(2)
+for details.)
+The variants differ primarily in how they store those integers
+(binary, octal, or hexadecimal).
+The header is followed by the pathname of the
+entry (the length of the pathname is stored in the header)
+and any file data.
+The end of the archive is indicated by a special record with
+the pathname
+``TRAILER!!!''.
+.SS PWB format
+XXX Any documentation of the original PWB/UNIX 1.0 format? XXX
+.SS Old Binary Format
+The old binary
+\fB\%cpio\fP
+format stores numbers as 2-byte and 4-byte binary values.
+Each entry begins with a header in the following format:
+.RS 4
+.nf
+struct header_old_cpio {
+ unsigned short c_magic;
+ unsigned short c_dev;
+ unsigned short c_ino;
+ unsigned short c_mode;
+ unsigned short c_uid;
+ unsigned short c_gid;
+ unsigned short c_nlink;
+ unsigned short c_rdev;
+ unsigned short c_mtime[2];
+ unsigned short c_namesize;
+ unsigned short c_filesize[2];
+};
+.RE
+.PP
+The
+\fIunsigned\fP short
+fields here are 16-bit integer values; the
+\fIunsigned\fP int
+fields are 32-bit integer values.
+The fields are as follows
+.RS 5
+.TP
+\fImagic\fP
+The integer value octal 070707.
+This value can be used to determine whether this archive is
+written with little-endian or big-endian integers.
+.TP
+\fIdev\fP, \fIino\fP
+The device and inode numbers from the disk.
+These are used by programs that read
+\fB\%cpio\fP
+archives to determine when two entries refer to the same file.
+Programs that synthesize
+\fB\%cpio\fP
+archives should be careful to set these to distinct values for each entry.
+.TP
+\fImode\fP
+The mode specifies both the regular permissions and the file type.
+It consists of several bit fields as follows:
+.RS 5
+.TP
+0170000
+This masks the file type bits.
+.TP
+0140000
+File type value for sockets.
+.TP
+0120000
+File type value for symbolic links.
+For symbolic links, the link body is stored as file data.
+.TP
+0100000
+File type value for regular files.
+.TP
+0060000
+File type value for block special devices.
+.TP
+0040000
+File type value for directories.
+.TP
+0020000
+File type value for character special devices.
+.TP
+0010000
+File type value for named pipes or FIFOs.
+.TP
+0004000
+SUID bit.
+.TP
+0002000
+SGID bit.
+.TP
+0001000
+Sticky bit.
+On some systems, this modifies the behavior of executables and/or directories.
+.TP
+0000777
+The lower 9 bits specify read/write/execute permissions
+for world, group, and user following standard POSIX conventions.
+.RE
+.TP
+\fIuid\fP, \fIgid\fP
+The numeric user id and group id of the owner.
+.TP
+\fInlink\fP
+The number of links to this file.
+Directories always have a value of at least two here.
+Note that hardlinked files include file data with every copy in the archive.
+.TP
+\fIrdev\fP
+For block special and character special entries,
+this field contains the associated device number.
+For all other entry types, it should be set to zero by writers
+and ignored by readers.
+.TP
+\fImtime\fP
+Modification time of the file, indicated as the number
+of seconds since the start of the epoch,
+00:00:00 UTC January 1, 1970.
+The four-byte integer is stored with the most-significant 16 bits first
+followed by the least-significant 16 bits.
+Each of the two 16 bit values are stored in machine-native byte order.
+.TP
+\fInamesize\fP
+The number of bytes in the pathname that follows the header.
+This count includes the trailing NUL byte.
+.TP
+\fIfilesize\fP
+The size of the file.
+Note that this archive format is limited to
+four gigabyte file sizes.
+See
+\fImtime\fP
+above for a description of the storage of four-byte integers.
+.RE
+.PP
+The pathname immediately follows the fixed header.
+If the
+\fBnamesize\fP
+is odd, an additional NUL byte is added after the pathname.
+The file data is then appended, padded with NUL
+bytes to an even length.
+.PP
+Hardlinked files are not given special treatment;
+the full file contents are included with each copy of the
+file.
+.SS Portable ASCII Format
+Version 2 of the Single UNIX Specification (``SUSv2'')
+standardized an ASCII variant that is portable across all
+platforms.
+It is commonly known as the
+``old character''
+format or as the
+``odc''
+format.
+It stores the same numeric fields as the old binary format, but
+represents them as 6-character or 11-character octal values.
+.RS 4
+.nf
+struct cpio_odc_header {
+ char c_magic[6];
+ char c_dev[6];
+ char c_ino[6];
+ char c_mode[6];
+ char c_uid[6];
+ char c_gid[6];
+ char c_nlink[6];
+ char c_rdev[6];
+ char c_mtime[11];
+ char c_namesize[6];
+ char c_filesize[11];
+};
+.RE
+.PP
+The fields are identical to those in the old binary format.
+The name and file body follow the fixed header.
+Unlike the old binary format, there is no additional padding
+after the pathname or file contents.
+If the files being archived are themselves entirely ASCII, then
+the resulting archive will be entirely ASCII, except for the
+NUL byte that terminates the name field.
+.SS New ASCII Format
+The "new" ASCII format uses 8-byte hexadecimal fields for
+all numbers and separates device numbers into separate fields
+for major and minor numbers.
+.RS 4
+.nf
+struct cpio_newc_header {
+ char c_magic[6];
+ char c_ino[8];
+ char c_mode[8];
+ char c_uid[8];
+ char c_gid[8];
+ char c_nlink[8];
+ char c_mtime[8];
+ char c_filesize[8];
+ char c_devmajor[8];
+ char c_devminor[8];
+ char c_rdevmajor[8];
+ char c_rdevminor[8];
+ char c_namesize[8];
+ char c_check[8];
+};
+.RE
+.PP
+Except as specified below, the fields here match those specified
+for the old binary format above.
+.RS 5
+.TP
+\fImagic\fP
+The string
+``070701''.
+.TP
+\fIcheck\fP
+This field is always set to zero by writers and ignored by readers.
+See the next section for more details.
+.RE
+.PP
+The pathname is followed by NUL bytes so that the total size
+of the fixed header plus pathname is a multiple of four.
+Likewise, the file data is padded to a multiple of four bytes.
+Note that this format supports only 4 gigabyte files (unlike the
+older ASCII format, which supports 8 gigabyte files).
+.PP
+In this format, hardlinked files are handled by setting the
+filesize to zero for each entry except the last one that
+appears in the archive.
+.SS New CRC Format
+The CRC format is identical to the new ASCII format described
+in the previous section except that the magic field is set
+to
+``070702''
+and the
+\fIcheck\fP
+field is set to the sum of all bytes in the file data.
+This sum is computed treating all bytes as unsigned values
+and using unsigned arithmetic.
+Only the least-significant 32 bits of the sum are stored.
+.SS HP variants
+The
+\fB\%cpio\fP
+implementation distributed with HPUX used XXXX but stored
+device numbers differently XXX.
+.SS Other Extensions and Variants
+Sun Solaris uses additional file types to store extended file
+data, including ACLs and extended attributes, as special
+entries in cpio archives.
+.PP
+XXX Others? XXX
+.SH BUGS
+.ad l
+The
+``CRC''
+format is mis-named, as it uses a simple checksum and
+not a cyclic redundancy check.
+.PP
+The old binary format is limited to 16 bits for user id,
+group id, device, and inode numbers.
+It is limited to 4 gigabyte file sizes.
+.PP
+The old ASCII format is limited to 18 bits for
+the user id, group id, device, and inode numbers.
+It is limited to 8 gigabyte file sizes.
+.PP
+The new ASCII format is limited to 4 gigabyte file sizes.
+.PP
+None of the cpio formats store user or group names,
+which are essential when moving files between systems with
+dissimilar user or group numbering.
+.PP
+Especially when writing older cpio variants, it may be necessary
+to map actual device/inode values to synthesized values that
+fit the available fields.
+With very large filesystems, this may be necessary even for
+the newer formats.
+.SH SEE ALSO
+.ad l
+\fBcpio\fP(1),
+\fBtar\fP(5)
+.SH STANDARDS
+.ad l
+The
+\fB\%cpio\fP
+utility is no longer a part of POSIX or the Single Unix Standard.
+It last appeared in
+Version 2 of the Single UNIX Specification (``SUSv2'').
+It has been supplanted in subsequent standards by
+\fBpax\fP(1).
+The portable ASCII format is currently part of the specification for the
+\fBpax\fP(1)
+utility.
+.SH HISTORY
+.ad l
+The original cpio utility was written by Dick Haight
+while working in AT&T's Unix Support Group.
+It appeared in 1977 as part of PWB/UNIX 1.0, the
+``Programmer's Work Bench''
+derived from
+At v6
+that was used internally at AT&T.
+Both the old binary and old character formats were in use
+by 1980, according to the System III source released
+by SCO under their
+``Ancient Unix''
+license.
+The character format was adopted as part of
+IEEE Std 1003.1-1988 (``POSIX.1'').
+XXX when did "newc" appear? Who invented it? When did HP come out with their variant? When did Sun introduce ACLs and extended attributes? XXX
diff --git a/archivers/libarchive/files/doc/man/libarchive-formats.5 b/archivers/libarchive/files/doc/man/libarchive-formats.5
new file mode 100644
index 00000000000..ff87c8ba860
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/libarchive-formats.5
@@ -0,0 +1,341 @@
+.TH libarchive-formats 5 "December 27, 2009" ""
+.SH NAME
+.ad l
+\fB\%libarchive-formats\fP
+\- archive formats supported by the libarchive library
+.SH DESCRIPTION
+.ad l
+The
+\fBlibarchive\fP(3)
+library reads and writes a variety of streaming archive formats.
+Generally speaking, all of these archive formats consist of a series of
+``entries''.
+Each entry stores a single file system object, such as a file, directory,
+or symbolic link.
+.PP
+The following provides a brief description of each format supported
+by libarchive, with some information about recognized extensions or
+limitations of the current library support.
+Note that just because a format is supported by libarchive does not
+imply that a program that uses libarchive will support that format.
+Applications that use libarchive specify which formats they wish
+to support, though many programs do use libarchive convenience
+functions to enable all supported formats.
+.SS Tar Formats
+The
+\fBlibarchive\fP(3)
+library can read most tar archives.
+However, it only writes POSIX-standard
+``ustar''
+and
+``pax interchange''
+formats.
+.PP
+All tar formats store each entry in one or more 512-byte records.
+The first record is used for file metadata, including filename,
+timestamp, and mode information, and the file data is stored in
+subsequent records.
+Later variants have extended this by either appropriating undefined
+areas of the header record, extending the header to multiple records,
+or by storing special entries that modify the interpretation of
+subsequent entries.
+.PP
+.RS 5
+.TP
+\fBgnutar\fP
+The
+\fBlibarchive\fP(3)
+library can read GNU-format tar archives.
+It currently supports the most popular GNU extensions, including
+modern long filename and linkname support, as well as atime and ctime data.
+The libarchive library does not support multi-volume
+archives, nor the old GNU long filename format.
+It can read GNU sparse file entries, including the new POSIX-based
+formats, but cannot write GNU sparse file entries.
+.TP
+\fBpax\fP
+The
+\fBlibarchive\fP(3)
+library can read and write POSIX-compliant pax interchange format
+archives.
+Pax interchange format archives are an extension of the older ustar
+format that adds a separate entry with additional attributes stored
+as key/value pairs immediately before each regular entry.
+The presence of these additional entries is the only difference between
+pax interchange format and the older ustar format.
+The extended attributes are of unlimited length and are stored
+as UTF-8 Unicode strings.
+Keywords defined in the standard are in all lowercase; vendors are allowed
+to define custom keys by preceding them with the vendor name in all uppercase.
+When writing pax archives, libarchive uses many of the SCHILY keys
+defined by Joerg Schilling's
+``star''
+archiver and a few LIBARCHIVE keys.
+The libarchive library can read most of the SCHILY keys
+and most of the GNU keys introduced by GNU tar.
+It silently ignores any keywords that it does not understand.
+.TP
+\fBrestricted\fP pax
+The libarchive library can also write pax archives in which it
+attempts to suppress the extended attributes entry whenever
+possible.
+The result will be identical to a ustar archive unless the
+extended attributes entry is required to store a long file
+name, long linkname, extended ACL, file flags, or if any of the standard
+ustar data (user name, group name, UID, GID, etc) cannot be fully
+represented in the ustar header.
+In all cases, the result can be dearchived by any program that
+can read POSIX-compliant pax interchange format archives.
+Programs that correctly read ustar format (see below) will also be
+able to read this format; any extended attributes will be extracted as
+separate files stored in
+\fIPaxHeader\fP
+directories.
+.TP
+\fBustar\fP
+The libarchive library can both read and write this format.
+This format has the following limitations:
+.RS 5
+.IP \(bu
+Device major and minor numbers are limited to 21 bits.
+Nodes with larger numbers will not be added to the archive.
+.IP \(bu
+Path names in the archive are limited to 255 bytes.
+(Shorter if there is no / character in exactly the right place.)
+.IP \(bu
+Symbolic links and hard links are stored in the archive with
+the name of the referenced file.
+This name is limited to 100 bytes.
+.IP \(bu
+Extended attributes, file flags, and other extended
+security information cannot be stored.
+.IP \(bu
+Archive entries are limited to 8 gigabytes in size.
+.RE
+Note that the pax interchange format has none of these restrictions.
+.RE
+.PP
+The libarchive library also reads a variety of commonly-used extensions to
+the basic tar format.
+These extensions are recognized automatically whenever they appear.
+.RS 5
+.TP
+Numeric extensions.
+The POSIX standards require fixed-length numeric fields to be written with
+some character position reserved for terminators.
+Libarchive allows these fields to be written without terminator characters.
+This extends the allowable range; in particular, ustar archives with this
+extension can support entries up to 64 gigabytes in size.
+Libarchive also recognizes base-256 values in most numeric fields.
+This essentially removes all limitations on file size, modification time,
+and device numbers.
+.TP
+Solaris extensions
+Libarchive recognizes ACL and extended attribute records written
+by Solaris tar.
+Currently, libarchive only has support for old-style ACLs; the
+newer NFSv4 ACLs are recognized but discarded.
+.RE
+.PP
+The first tar program appeared in Seventh Edition Unix in 1979.
+The first official standard for the tar file format was the
+``ustar''
+(Unix Standard Tar) format defined by POSIX in 1988.
+POSIX.1-2001 extended the ustar format to create the
+``pax interchange''
+format.
+.SS Cpio Formats
+The libarchive library can read a number of common cpio variants and can write
+``odc''
+and
+``newc''
+format archives.
+A cpio archive stores each entry as a fixed-size header followed
+by a variable-length filename and variable-length data.
+Unlike the tar format, the cpio format does only minimal padding
+of the header or file data.
+There are several cpio variants, which differ primarily in
+how they store the initial header: some store the values as
+octal or hexadecimal numbers in ASCII, others as binary values of
+varying byte order and length.
+.RS 5
+.TP
+\fBbinary\fP
+The libarchive library transparently reads both big-endian and little-endian
+variants of the original binary cpio format.
+This format used 32-bit binary values for file size and mtime,
+and 16-bit binary values for the other fields.
+.TP
+\fBodc\fP
+The libarchive library can both read and write this
+POSIX-standard format, which is officially known as the
+``cpio interchange format''
+or the
+``octet-oriented cpio archive format''
+and sometimes unofficially referred to as the
+``old character format''.
+This format stores the header contents as octal values in ASCII.
+It is standard, portable, and immune from byte-order confusion.
+File sizes and mtime are limited to 33 bits (8GB file size),
+other fields are limited to 18 bits.
+.TP
+\fBSVR4\fP
+The libarchive library can read both CRC and non-CRC variants of
+this format.
+The SVR4 format uses eight-digit hexadecimal values for
+all header fields.
+This limits file size to 4GB, and also limits the mtime and
+other fields to 32 bits.
+The SVR4 format can optionally include a CRC of the file
+contents, although libarchive does not currently verify this CRC.
+.RE
+.PP
+Cpio first appeared in PWB/UNIX 1.0, which was released within
+AT&T in 1977.
+PWB/UNIX 1.0 formed the basis of System III Unix, released outside
+of AT&T in 1981.
+This makes cpio older than tar, although cpio was not included
+in Version 7 AT&T Unix.
+As a result, the tar command became much better known in universities
+and research groups that used Version 7.
+The combination of the
+\fB\%find\fP
+and
+\fB\%cpio\fP
+utilities provided very precise control over file selection.
+Unfortunately, the format has many limitations that make it unsuitable
+for widespread use.
+Only the POSIX format permits files over 4GB, and its 18-bit
+limit for most other fields makes it unsuitable for modern systems.
+In addition, cpio formats only store numeric UID/GID values (not
+usernames and group names), which can make it very difficult to correctly
+transfer archives across systems with dissimilar user numbering.
+.SS Shar Formats
+A
+``shell archive''
+is a shell script that, when executed on a POSIX-compliant
+system, will recreate a collection of file system objects.
+The libarchive library can write two different kinds of shar archives:
+.RS 5
+.TP
+\fBshar\fP
+The traditional shar format uses a limited set of POSIX
+commands, including
+\fBecho\fP(1),
+\fBmkdir\fP(1),
+and
+\fBsed\fP(1).
+It is suitable for portably archiving small collections of plain text files.
+However, it is not generally well-suited for large archives
+(many implementations of
+\fBsh\fP(1)
+have limits on the size of a script) nor should it be used with non-text files.
+.TP
+\fBshardump\fP
+This format is similar to shar but encodes files using
+\fBuuencode\fP(1)
+so that the result will be a plain text file regardless of the file contents.
+It also includes additional shell commands that attempt to reproduce as
+many file attributes as possible, including owner, mode, and flags.
+The additional commands used to restore file attributes make
+shardump archives less portable than plain shar archives.
+.RE
+.SS ISO9660 format
+Libarchive can read and extract from files containing ISO9660-compliant
+CDROM images.
+In many cases, this can remove the need to burn a physical CDROM
+just in order to read the files contained in an ISO9660 image.
+It also avoids security and complexity issues that come with
+virtual mounts and loopback devices.
+Libarchive supports the most common Rockridge extensions and has partial
+support for Joliet extensions.
+If both extensions are present, the Joliet extensions will be
+used and the Rockridge extensions will be ignored.
+In particular, this can create problems with hardlinks and symlinks,
+which are supported by Rockridge but not by Joliet.
+.SS Zip format
+Libarchive can read and write zip format archives that have
+uncompressed entries and entries compressed with the
+``deflate''
+algorithm.
+Older zip compression algorithms are not supported.
+It can extract jar archives, archives that use Zip64 extensions and many
+self-extracting zip archives.
+Libarchive reads Zip archives as they are being streamed,
+which allows it to read archives of arbitrary size.
+It currently does not use the central directory; this
+limits libarchive's ability to support some self-extracting
+archives and ones that have been modified in certain ways.
+.SS Archive (library) file format
+The Unix archive format (commonly created by the
+\fBar\fP(1)
+archiver) is a general-purpose format which is
+used almost exclusively for object files to be
+read by the link editor
+\fBld\fP(1).
+The ar format has never been standardised.
+There are two common variants:
+the GNU format derived from SVR4,
+and the BSD format, which first appeared in 4.4BSD.
+The two differ primarily in their handling of filenames
+longer than 15 characters:
+the GNU/SVR4 variant writes a filename table at the beginning of the archive;
+the BSD format stores each long filename in an extension
+area adjacent to the entry.
+Libarchive can read both extensions,
+including archives that may include both types of long filenames.
+Programs using libarchive can write GNU/SVR4 format
+if they provide a filename table to be written into
+the archive before any of the entries.
+Any entries whose names are not in the filename table
+will be written using BSD-style long filenames.
+This can cause problems for programs such as
+GNU ld that do not support the BSD-style long filenames.
+.SS mtree
+Libarchive can read and write files in
+\fBmtree\fP(5)
+format.
+This format is not a true archive format, but rather a textual description
+of a file hierarchy in which each line specifies the name of a file and
+provides specific metadata about that file.
+Libarchive can read all of the keywords supported by both
+the NetBSD and FreeBSD versions of
+\fBmtree\fP(1),
+although many of the keywords cannot currently be stored in an
+Tn archive_entry
+object.
+When writing, libarchive supports use of the
+\fBarchive_write_set_options\fP(3)
+interface to specify which keywords should be included in the
+output.
+If libarchive was compiled with access to suitable
+cryptographic libraries (such as the OpenSSL libraries),
+it can compute hash entries such as
+\fBsha512\fP
+or
+\fBmd5\fP
+from file data being written to the mtree writer.
+.PP
+When reading an mtree file, libarchive will locate the corresponding
+files on disk using the
+\fBcontents\fP
+keyword if present or the regular filename.
+If it can locate and open the file on disk, it will use that
+to fill in any metadata that is missing from the mtree file
+and will read the file contents and return those to the program
+using libarchive.
+If it cannot locate and open the file on disk, libarchive
+will return an error for any attempt to read the entry
+body.
+.SH SEE ALSO
+.ad l
+\fBar\fP(1),
+\fBcpio\fP(1),
+\fBmkisofs\fP(1),
+\fBshar\fP(1),
+\fBtar\fP(1),
+\fBzip\fP(1),
+\fBzlib\fP(3),
+\fBcpio\fP(5),
+\fBmtree\fP(5),
+\fBtar\fP(5)
diff --git a/archivers/libarchive/files/doc/man/libarchive.3 b/archivers/libarchive/files/doc/man/libarchive.3
new file mode 100644
index 00000000000..1af1861fcae
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/libarchive.3
@@ -0,0 +1,315 @@
+.TH LIBARCHIVE 3 "August 19, 2006" ""
+.SH NAME
+.ad l
+\fB\%libarchive\fP
+\- functions for reading and writing streaming archives
+.SH LIBRARY
+.ad l
+Lb libarchive
+.SH OVERVIEW
+.ad l
+The
+\fB\%libarchive\fP
+library provides a flexible interface for reading and writing
+streaming archive files such as tar and cpio.
+The library is inherently stream-oriented; readers serially iterate through
+the archive, writers serially add things to the archive.
+In particular, note that there is no built-in support for
+random access nor for in-place modification.
+.PP
+When reading an archive, the library automatically detects the
+format and the compression.
+The library currently has read support for:
+.RS 5
+.IP \(bu
+old-style tar archives,
+.IP \(bu
+most variants of the POSIX
+``ustar''
+format,
+.IP \(bu
+the POSIX
+``pax interchange''
+format,
+.IP \(bu
+GNU-format tar archives,
+.IP \(bu
+most common cpio archive formats,
+.IP \(bu
+ISO9660 CD images (with or without RockRidge extensions),
+.IP \(bu
+Zip archives.
+.RE
+The library automatically detects archives compressed with
+\fBgzip\fP(1),
+\fBbzip2\fP(1),
+or
+\fBcompress\fP(1)
+and decompresses them transparently.
+.PP
+When writing an archive, you can specify the compression
+to be used and the format to use.
+The library can write
+.RS 5
+.IP \(bu
+POSIX-standard
+``ustar''
+archives,
+.IP \(bu
+POSIX
+``pax interchange format''
+archives,
+.IP \(bu
+POSIX octet-oriented cpio archives,
+.IP \(bu
+two different variants of shar archives.
+.RE
+Pax interchange format is an extension of the tar archive format that
+eliminates essentially all of the limitations of historic tar formats
+in a standard fashion that is supported
+by POSIX-compliant
+\fBpax\fP(1)
+implementations on many systems as well as several newer implementations of
+\fBtar\fP(1).
+Note that the default write format will suppress the pax extended
+attributes for most entries; explicitly requesting pax format will
+enable those attributes for all entries.
+.PP
+The read and write APIs are accessed through the
+\fB\%archive_read_XXX\fP()
+functions and the
+\fB\%archive_write_XXX\fP()
+functions, respectively, and either can be used independently
+of the other.
+.PP
+The rest of this manual page provides an overview of the library
+operation.
+More detailed information can be found in the individual manual
+pages for each API or utility function.
+.SH READING AN ARCHIVE
+.ad l
+To read an archive, you must first obtain an initialized
+Tn struct archive
+object from
+\fB\%archive_read_new\fP().
+You can then modify this object for the desired operations with the
+various
+\fB\%archive_read_set_XXX\fP()
+and
+\fB\%archive_read_support_XXX\fP()
+functions.
+In particular, you will need to invoke appropriate
+\fB\%archive_read_support_XXX\fP()
+functions to enable the corresponding compression and format
+support.
+Note that these latter functions perform two distinct operations:
+they cause the corresponding support code to be linked into your
+program, and they enable the corresponding auto-detect code.
+Unless you have specific constraints, you will generally want
+to invoke
+\fB\%archive_read_support_compression_all\fP()
+and
+\fB\%archive_read_support_format_all\fP()
+to enable auto-detect for all formats and compression types
+currently supported by the library.
+.PP
+Once you have prepared the
+Tn struct archive
+object, you call
+\fB\%archive_read_open\fP()
+to actually open the archive and prepare it for reading.
+There are several variants of this function;
+the most basic expects you to provide pointers to several
+functions that can provide blocks of bytes from the archive.
+There are convenience forms that allow you to
+specify a filename, file descriptor,
+\fIFILE *\fP
+object, or a block of memory from which to read the archive data.
+Note that the core library makes no assumptions about the
+size of the blocks read;
+callback functions are free to read whatever block size is
+most appropriate for the medium.
+.PP
+Each archive entry consists of a header followed by a certain
+amount of data.
+You can obtain the next header with
+\fB\%archive_read_next_header\fP(),
+which returns a pointer to an
+Tn struct archive_entry
+structure with information about the current archive element.
+If the entry is a regular file, then the header will be followed
+by the file data.
+You can use
+\fB\%archive_read_data\fP()
+(which works much like the
+\fBread\fP(2)
+system call)
+to read this data from the archive.
+You may prefer to use the higher-level
+\fB\%archive_read_data_skip\fP(),
+which reads and discards the data for this entry,
+\fB\%archive_read_data_to_buffer\fP(),
+which reads the data into an in-memory buffer,
+\fB\%archive_read_data_to_file\fP(),
+which copies the data to the provided file descriptor, or
+\fB\%archive_read_extract\fP(),
+which recreates the specified entry on disk and copies data
+from the archive.
+In particular, note that
+\fB\%archive_read_extract\fP()
+uses the
+Tn struct archive_entry
+structure that you provide it, which may differ from the
+entry just read from the archive.
+In particular, many applications will want to override the
+pathname, file permissions, or ownership.
+.PP
+Once you have finished reading data from the archive, you
+should call
+\fB\%archive_read_close\fP()
+to close the archive, then call
+\fB\%archive_read_finish\fP()
+to release all resources, including all memory allocated by the library.
+.PP
+The
+\fBarchive_read\fP(3)
+manual page provides more detailed calling information for this API.
+.SH WRITING AN ARCHIVE
+.ad l
+You use a similar process to write an archive.
+The
+\fB\%archive_write_new\fP()
+function creates an archive object useful for writing,
+the various
+\fB\%archive_write_set_XXX\fP()
+functions are used to set parameters for writing the archive, and
+\fB\%archive_write_open\fP()
+completes the setup and opens the archive for writing.
+.PP
+Individual archive entries are written in a three-step
+process:
+You first initialize a
+Tn struct archive_entry
+structure with information about the new entry.
+At a minimum, you should set the pathname of the
+entry and provide a
+\fIstruct\fP stat
+with a valid
+\fIst_mode\fP
+field, which specifies the type of object and
+\fIst_size\fP
+field, which specifies the size of the data portion of the object.
+The
+\fB\%archive_write_header\fP()
+function actually writes the header data to the archive.
+You can then use
+\fB\%archive_write_data\fP()
+to write the actual data.
+.PP
+After all entries have been written, use the
+\fB\%archive_write_finish\fP()
+function to release all resources.
+.PP
+The
+\fBarchive_write\fP(3)
+manual page provides more detailed calling information for this API.
+.SH DESCRIPTION
+.ad l
+Detailed descriptions of each function are provided by the
+corresponding manual pages.
+.PP
+All of the functions utilize an opaque
+Tn struct archive
+datatype that provides access to the archive contents.
+.PP
+The
+Tn struct archive_entry
+structure contains a complete description of a single archive
+entry.
+It uses an opaque interface that is fully documented in
+\fBarchive_entry\fP(3).
+.PP
+Users familiar with historic formats should be aware that the newer
+variants have eliminated most restrictions on the length of textual fields.
+Clients should not assume that filenames, link names, user names, or
+group names are limited in length.
+In particular, pax interchange format can easily accommodate pathnames
+in arbitrary character sets that exceed
+\fIPATH_MAX\fP.
+.SH RETURN VALUES
+.ad l
+Most functions return zero on success, non-zero on error.
+The return value indicates the general severity of the error, ranging
+from
+\fBARCHIVE_WARN\fP,
+which indicates a minor problem that should probably be reported
+to the user, to
+\fBARCHIVE_FATAL\fP,
+which indicates a serious problem that will prevent any further
+operations on this archive.
+On error, the
+\fB\%archive_errno\fP()
+function can be used to retrieve a numeric error code (see
+\fBerrno\fP(2)).
+The
+\fB\%archive_error_string\fP()
+returns a textual error message suitable for display.
+.PP
+\fB\%archive_read_new\fP()
+and
+\fB\%archive_write_new\fP()
+return pointers to an allocated and initialized
+Tn struct archive
+object.
+.PP
+\fB\%archive_read_data\fP()
+and
+\fB\%archive_write_data\fP()
+return a count of the number of bytes actually read or written.
+A value of zero indicates the end of the data for this entry.
+A negative value indicates an error, in which case the
+\fB\%archive_errno\fP()
+and
+\fB\%archive_error_string\fP()
+functions can be used to obtain more information.
+.SH ENVIRONMENT
+.ad l
+There are character set conversions within the
+\fBarchive_entry\fP(3)
+functions that are impacted by the currently-selected locale.
+.SH SEE ALSO
+.ad l
+\fBtar\fP(1),
+\fBarchive_entry\fP(3),
+\fBarchive_read\fP(3),
+\fBarchive_util\fP(3),
+\fBarchive_write\fP(3),
+\fBtar\fP(5)
+.SH HISTORY
+.ad l
+The
+\fB\%libarchive\fP
+library first appeared in
+FreeBSD 5.3.
+.SH AUTHORS
+.ad l
+-nosplit
+The
+\fB\%libarchive\fP
+library was written by
+Tim Kientzle \%<kientzle@acm.org.>
+.SH BUGS
+.ad l
+Some archive formats support information that is not supported by
+Tn struct archive_entry.
+Such information cannot be fully archived or restored using this library.
+This includes, for example, comments, character sets,
+or the arbitrary key/value pairs that can appear in
+pax interchange format archives.
+.PP
+Conversely, of course, not all of the information that can be
+stored in an
+Tn struct archive_entry
+is supported by all formats.
+For example, cpio formats do not support nanosecond timestamps;
+old tar formats do not support large device numbers.
diff --git a/archivers/libarchive/files/doc/man/libarchive_internals.3 b/archivers/libarchive/files/doc/man/libarchive_internals.3
new file mode 100644
index 00000000000..98b99a3a9ce
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/libarchive_internals.3
@@ -0,0 +1,361 @@
+.TH LIBARCHIVE 3 "April 16, 2007" ""
+.SH NAME
+.ad l
+\fB\%libarchive_internals\fP
+\- description of libarchive internal interfaces
+.SH OVERVIEW
+.ad l
+The
+\fB\%libarchive\fP
+library provides a flexible interface for reading and writing
+streaming archive files such as tar and cpio.
+Internally, it follows a modular layered design that should
+make it easy to add new archive and compression formats.
+.SH GENERAL ARCHITECTURE
+.ad l
+Externally, libarchive exposes most operations through an
+opaque, object-style interface.
+The
+\fBarchive_entry\fP(1)
+objects store information about a single filesystem object.
+The rest of the library provides facilities to write
+\fBarchive_entry\fP(1)
+objects to archive files,
+read them from archive files,
+and write them to disk.
+(There are plans to add a facility to read
+\fBarchive_entry\fP(1)
+objects from disk as well.)
+.PP
+The read and write APIs each have four layers: a public API
+layer, a format layer that understands the archive file format,
+a compression layer, and an I/O layer.
+The I/O layer is completely exposed to clients who can replace
+it entirely with their own functions.
+.PP
+In order to provide as much consistency as possible for clients,
+some public functions are virtualized.
+Eventually, it should be possible for clients to open
+an archive or disk writer, and then use a single set of
+code to select and write entries, regardless of the target.
+.SH READ ARCHITECTURE
+.ad l
+From the outside, clients use the
+\fBarchive_read\fP(3)
+API to manipulate an
+\fB\%archive\fP
+object to read entries and bodies from an archive stream.
+Internally, the
+\fB\%archive\fP
+object is cast to an
+\fB\%archive_read\fP
+object, which holds all read-specific data.
+The API has four layers:
+The lowest layer is the I/O layer.
+This layer can be overridden by clients, but most clients use
+the packaged I/O callbacks provided, for example, by
+\fBarchive_read_open_memory\fP(3),
+and
+\fBarchive_read_open_fd\fP(3).
+The compression layer calls the I/O layer to
+read bytes and decompresses them for the format layer.
+The format layer unpacks a stream of uncompressed bytes and
+creates
+\fB\%archive_entry\fP
+objects from the incoming data.
+The API layer tracks overall state
+(for example, it prevents clients from reading data before reading a header)
+and invokes the format and compression layer operations
+through registered function pointers.
+In particular, the API layer drives the format-detection process:
+When opening the archive, it reads an initial block of data
+and offers it to each registered compression handler.
+The one with the highest bid is initialized with the first block.
+Similarly, the format handlers are polled to see which handler
+is the best for each archive.
+(Prior to 2.4.0, the format bidders were invoked for each
+entry, but this design hindered error recovery.)
+.SS I/O Layer and Client Callbacks
+The read API goes to some lengths to be nice to clients.
+As a result, there are few restrictions on the behavior of
+the client callbacks.
+.PP
+The client read callback is expected to provide a block
+of data on each call.
+A zero-length return does indicate end of file, but otherwise
+blocks may be as small as one byte or as large as the entire file.
+In particular, blocks may be of different sizes.
+.PP
+The client skip callback returns the number of bytes actually
+skipped, which may be much smaller than the skip requested.
+The only requirement is that the skip not be larger.
+In particular, clients are allowed to return zero for any
+skip that they don't want to handle.
+The skip callback must never be invoked with a negative value.
+.PP
+Keep in mind that not all clients are reading from disk:
+clients reading from networks may provide different-sized
+blocks on every request and cannot skip at all;
+advanced clients may use
+\fBmmap\fP(2)
+to read the entire file into memory at once and return the
+entire file to libarchive as a single block;
+other clients may begin asynchronous I/O operations for the
+next block on each request.
+.SS Decompresssion Layer
+The decompression layer not only handles decompression,
+it also buffers data so that the format handlers see a
+much nicer I/O model.
+The decompression API is a two stage peek/consume model.
+A read_ahead request specifies a minimum read amount;
+the decompression layer must provide a pointer to at least
+that much data.
+If more data is immediately available, it should return more:
+the format layer handles bulk data reads by asking for a minimum
+of one byte and then copying as much data as is available.
+.PP
+A subsequent call to the
+\fB\%consume\fP()
+function advances the read pointer.
+Note that data returned from a
+\fB\%read_ahead\fP()
+call is guaranteed to remain in place until
+the next call to
+\fB\%read_ahead\fP().
+Intervening calls to
+\fB\%consume\fP()
+should not cause the data to move.
+.PP
+Skip requests must always be handled exactly.
+Decompression handlers that cannot seek forward should
+not register a skip handler;
+the API layer fills in a generic skip handler that reads and discards data.
+.PP
+A decompression handler has a specific lifecycle:
+.RS 5
+.TP
+Registration/Configuration
+When the client invokes the public support function,
+the decompression handler invokes the internal
+\fB\%__archive_read_register_compression\fP()
+function to provide bid and initialization functions.
+This function returns
+\fBNULL\fP
+on error or else a pointer to a
+\fBstruct\fP decompressor_t.
+This structure contains a
+\fIvoid\fP * config
+slot that can be used for storing any customization information.
+.TP
+Bid
+The bid function is invoked with a pointer and size of a block of data.
+The decompressor can access its config data
+through the
+\fIdecompressor\fP
+element of the
+\fBarchive_read\fP
+object.
+The bid function is otherwise stateless.
+In particular, it must not perform any I/O operations.
+.PP
+The value returned by the bid function indicates its suitability
+for handling this data stream.
+A bid of zero will ensure that this decompressor is never invoked.
+Return zero if magic number checks fail.
+Otherwise, your initial implementation should return the number of bits
+actually checked.
+For example, if you verify two full bytes and three bits of another
+byte, bid 19.
+Note that the initial block may be very short;
+be careful to only inspect the data you are given.
+(The current decompressors require two bytes for correct bidding.)
+.TP
+Initialize
+The winning bidder will have its init function called.
+This function should initialize the remaining slots of the
+\fIstruct\fP decompressor_t
+object pointed to by the
+\fIdecompressor\fP
+element of the
+\fIarchive_read\fP
+object.
+In particular, it should allocate any working data it needs
+in the
+\fIdata\fP
+slot of that structure.
+The init function is called with the block of data that
+was used for tasting.
+At this point, the decompressor is responsible for all I/O
+requests to the client callbacks.
+The decompressor is free to read more data as and when
+necessary.
+.TP
+Satisfy I/O requests
+The format handler will invoke the
+\fIread_ahead\fP,
+\fIconsume\fP,
+and
+\fIskip\fP
+functions as needed.
+.TP
+Finish
+The finish method is called only once when the archive is closed.
+It should release anything stored in the
+\fIdata\fP
+and
+\fIconfig\fP
+slots of the
+\fIdecompressor\fP
+object.
+It should not invoke the client close callback.
+.RE
+.SS Format Layer
+The read formats have a similar lifecycle to the decompression handlers:
+.RS 5
+.TP
+Registration
+Allocate your private data and initialize your pointers.
+.TP
+Bid
+Formats bid by invoking the
+\fB\%read_ahead\fP()
+decompression method but not calling the
+\fB\%consume\fP()
+method.
+This allows each bidder to look ahead in the input stream.
+Bidders should not look further ahead than necessary, as long
+look aheads put pressure on the decompression layer to buffer
+lots of data.
+Most formats only require a few hundred bytes of look ahead;
+look aheads of a few kilobytes are reasonable.
+(The ISO9660 reader sometimes looks ahead by 48k, which
+should be considered an upper limit.)
+.TP
+Read header
+The header read is usually the most complex part of any format.
+There are a few strategies worth mentioning:
+For formats such as tar or cpio, reading and parsing the header is
+straightforward since headers alternate with data.
+For formats that store all header data at the beginning of the file,
+the first header read request may have to read all headers into
+memory and store that data, sorted by the location of the file
+data.
+Subsequent header read requests will skip forward to the
+beginning of the file data and return the corresponding header.
+.TP
+Read Data
+The read data interface supports sparse files; this requires that
+each call return a block of data specifying the file offset and
+size.
+This may require you to carefully track the location so that you
+can return accurate file offsets for each read.
+Remember that the decompressor will return as much data as it has.
+Generally, you will want to request one byte,
+examine the return value to see how much data is available, and
+possibly trim that to the amount you can use.
+You should invoke consume for each block just before you return it.
+.TP
+Skip All Data
+The skip data call should skip over all file data and trailing padding.
+This is called automatically by the API layer just before each
+header read.
+It is also called in response to the client calling the public
+\fB\%data_skip\fP()
+function.
+.TP
+Cleanup
+On cleanup, the format should release all of its allocated memory.
+.RE
+.SS API Layer
+XXX to do XXX
+.SH WRITE ARCHITECTURE
+.ad l
+The write API has a similar set of four layers:
+an API layer, a format layer, a compression layer, and an I/O layer.
+The registration here is much simpler because only
+one format and one compression can be registered at a time.
+.SS I/O Layer and Client Callbacks
+XXX To be written XXX
+.SS Compression Layer
+XXX To be written XXX
+.SS Format Layer
+XXX To be written XXX
+.SS API Layer
+XXX To be written XXX
+.SH WRITE_DISK ARCHITECTURE
+.ad l
+The write_disk API is intended to look just like the write API
+to clients.
+Since it does not handle multiple formats or compression, it
+is not layered internally.
+.SH GENERAL SERVICES
+.ad l
+The
+\fB\%archive_read\fP,
+\fB\%archive_write\fP,
+and
+\fB\%archive_write_disk\fP
+objects all contain an initial
+\fB\%archive\fP
+object which provides common support for a set of standard services.
+(Recall that ANSI/ISO C90 guarantees that you can cast freely between
+a pointer to a structure and a pointer to the first element of that
+structure.)
+The
+\fB\%archive\fP
+object has a magic value that indicates which API this object
+is associated with,
+slots for storing error information,
+and function pointers for virtualized API functions.
+.SH MISCELLANEOUS NOTES
+.ad l
+Connecting existing archiving libraries into libarchive is generally
+quite difficult.
+In particular, many existing libraries strongly assume that you
+are reading from a file; they seek forwards and backwards as necessary
+to locate various pieces of information.
+In contrast, libarchive never seeks backwards in its input, which
+sometimes requires very different approaches.
+.PP
+For example, libarchive's ISO9660 support operates very differently
+from most ISO9660 readers.
+The libarchive support utilizes a work-queue design that
+keeps a list of known entries sorted by their location in the input.
+Whenever libarchive's ISO9660 implementation is asked for the next
+header, checks this list to find the next item on the disk.
+Directories are parsed when they are encountered and new
+items are added to the list.
+This design relies heavily on the ISO9660 image being optimized so that
+directories always occur earlier on the disk than the files they
+describe.
+.PP
+Depending on the specific format, such approaches may not be possible.
+The ZIP format specification, for example, allows archivers to store
+key information only at the end of the file.
+In theory, it is possible to create ZIP archives that cannot
+be read without seeking.
+Fortunately, such archives are very rare, and libarchive can read
+most ZIP archives, though it cannot always extract as much information
+as a dedicated ZIP program.
+.SH SEE ALSO
+.ad l
+\fBarchive\fP(3),
+\fBarchive_entry\fP(3),
+\fBarchive_read\fP(3),
+\fBarchive_write\fP(3),
+\fBarchive_write_disk\fP(3)
+.SH HISTORY
+.ad l
+The
+\fB\%libarchive\fP
+library first appeared in
+FreeBSD 5.3.
+.SH AUTHORS
+.ad l
+-nosplit
+The
+\fB\%libarchive\fP
+library was written by
+Tim Kientzle \%<kientzle@acm.org.>
+.SH BUGS
+.ad l
diff --git a/archivers/libarchive/files/doc/man/mtree.5 b/archivers/libarchive/files/doc/man/mtree.5
new file mode 100644
index 00000000000..2cf2e3a1191
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/mtree.5
@@ -0,0 +1,282 @@
+.TH MTREE 5 "August 20, 2007" ""
+.SH NAME
+.ad l
+\fB\%mtree\fP
+\- format of mtree dir hierarchy files
+.SH DESCRIPTION
+.ad l
+The
+\fB\%mtree\fP
+format is a textual format that describes a collection of filesystem objects.
+Such files are typically used to create or verify directory hierarchies.
+.SS General Format
+An
+\fB\%mtree\fP
+file consists of a series of lines, each providing information
+about a single filesystem object.
+Leading whitespace is always ignored.
+.PP
+When encoding file or pathnames, any backslash character or
+character outside of the 95 printable ASCII characters must be
+encoded as a a backslash followed by three
+octal digits.
+When reading mtree files, any appearance of a backslash
+followed by three octal digits should be converted into the
+corresponding character.
+.PP
+Each line is interpreted independently as one of the following types:
+.RS 5
+.TP
+Signature
+The first line of any mtree file must begin with
+``#mtree''.
+If a file contains any full path entries, the first line should
+begin with
+``#mtree v2.0'',
+otherwise, the first line should begin with
+``#mtree v1.0''.
+.TP
+Blank
+Blank lines are ignored.
+.TP
+Comment
+Lines beginning with
+\fB#\fP
+are ignored.
+.TP
+Special
+Lines beginning with
+\fB/\fP
+are special commands that influence
+the interpretation of later lines.
+.TP
+Relative
+If the first whitespace-delimited word has no
+\fB/\fP
+characters,
+it is the name of a file in the current directory.
+Any relative entry that describes a directory changes the
+current directory.
+.TP
+dot-dot
+As a special case, a relative entry with the filename
+\fI\& ..\fP
+changes the current directory to the parent directory.
+Options on dot-dot entries are always ignored.
+.TP
+Full
+If the first whitespace-delimited word has a
+\fB/\fP
+character after
+the first character, it is the pathname of a file relative to the
+starting directory.
+There can be multiple full entries describing the same file.
+.RE
+.PP
+Some tools that process
+\fB\%mtree\fP
+files may require that multiple lines describing the same file
+occur consecutively.
+It is not permitted for the same file to be mentioned using
+both a relative and a full file specification.
+.SS Special commands
+Two special commands are currently defined:
+.RS 5
+.TP
+\fB/set\fP
+This command defines default values for one or more keywords.
+It is followed on the same line by one or more whitespace-separated
+keyword definitions.
+These definitions apply to all following files that do not specify
+a value for that keyword.
+.TP
+\fB/unset\fP
+This command removes any default value set by a previous
+\fB/set\fP
+command.
+It is followed on the same line by one or more keywords
+separated by whitespace.
+.RE
+.SS Keywords
+After the filename, a full or relative entry consists of zero
+or more whitespace-separated keyword definitions.
+Each such definition consists of a key from the following
+list immediately followed by an '=' sign
+and a value.
+Software programs reading mtree files should warn about
+unrecognized keywords.
+.PP
+Currently supported keywords are as follows:
+.RS 5
+.TP
+\fBcksum\fP
+The checksum of the file using the default algorithm specified by
+the
+\fBcksum\fP(1)
+utility.
+.TP
+\fBcontents\fP
+The full pathname of a file that holds the contents of this file.
+.TP
+\fBflags\fP
+The file flags as a symbolic name.
+See
+\fBchflags\fP(1)
+for information on these names.
+If no flags are to be set the string
+``none''
+may be used to override the current default.
+.TP
+\fBgid\fP
+The file group as a numeric value.
+.TP
+\fBgname\fP
+The file group as a symbolic name.
+.TP
+\fBignore\fP
+Ignore any file hierarchy below this file.
+.TP
+\fBlink\fP
+The target of the symbolic link when type=link.
+.TP
+\fBmd5\fP
+The MD5 message digest of the file.
+.TP
+\fBmd5digest\fP
+A synonym for
+\fBmd5\fP.
+.TP
+\fBmode\fP
+The current file's permissions as a numeric (octal) or symbolic
+value.
+.TP
+\fBnlink\fP
+The number of hard links the file is expected to have.
+.TP
+\fBnochange\fP
+Make sure this file or directory exists but otherwise ignore all attributes.
+.TP
+\fBripemd160digest\fP
+The
+Tn RIPEMD160
+message digest of the file.
+.TP
+\fBrmd160\fP
+A synonym for
+\fBripemd160digest\fP.
+.TP
+\fBrmd160digest\fP
+A synonym for
+\fBripemd160digest\fP.
+.TP
+\fBsha1\fP
+The
+Tn FIPS
+160-1
+(``Tn SHA-1'')
+message digest of the file.
+.TP
+\fBsha1digest\fP
+A synonym for
+\fBsha1\fP.
+.TP
+\fBsha256\fP
+The
+Tn FIPS
+180-2
+(``Tn SHA-256'')
+message digest of the file.
+.TP
+\fBsha256digest\fP
+A synonym for
+\fBsha256\fP.
+.TP
+\fBsize\fP
+The size, in bytes, of the file.
+.TP
+\fBtime\fP
+The last modification time of the file.
+.TP
+\fBtype\fP
+The type of the file; may be set to any one of the following:
+.PP
+.RS 5
+.TP
+\fBblock\fP
+block special device
+.TP
+\fBchar\fP
+character special device
+.TP
+\fBdir\fP
+directory
+.TP
+\fBfifo\fP
+fifo
+.TP
+\fBfile\fP
+regular file
+.TP
+\fBlink\fP
+symbolic link
+.TP
+\fBsocket\fP
+socket
+.RE
+.TP
+\fBuid\fP
+The file owner as a numeric value.
+.TP
+\fBuname\fP
+The file owner as a symbolic name.
+.RE
+.PP
+.SH SEE ALSO
+.ad l
+\fBcksum\fP(1),
+\fBfind\fP(1),
+\fBmtree\fP(8)
+.SH BUGS
+.ad l
+The
+FreeBSD
+implementation of mtree does not currently support
+the
+\fB\%mtree\fP
+2.0
+format.
+The requirement for a
+``#mtree''
+signature line is new and not yet widely implemented.
+.SH HISTORY
+.ad l
+The
+\fB\%mtree\fP
+utility appeared in
+Bx 4.3 Reno.
+The
+Tn MD5
+digest capability was added in
+FreeBSD 2.1,
+in response to the widespread use of programs which can spoof
+\fBcksum\fP(1).
+The
+Tn SHA-1
+and
+Tn RIPEMD160
+digests were added in
+FreeBSD 4.0,
+as new attacks have demonstrated weaknesses in
+Tn MD5.
+The
+Tn SHA-256
+digest was added in
+FreeBSD 6.0.
+Support for file flags was added in
+FreeBSD 4.0,
+and mostly comes from
+NetBSD.
+The
+``full''
+entry format was added by
+NetBSD.
diff --git a/archivers/libarchive/files/doc/man/tar.5 b/archivers/libarchive/files/doc/man/tar.5
new file mode 100644
index 00000000000..ab1995880ee
--- /dev/null
+++ b/archivers/libarchive/files/doc/man/tar.5
@@ -0,0 +1,869 @@
+.TH tar 5 "December 27, 2009" ""
+.SH NAME
+.ad l
+\fB\%tar\fP
+\- format of tape archive files
+.SH DESCRIPTION
+.ad l
+The
+\fB\%tar\fP
+archive format collects any number of files, directories, and other
+file system objects (symbolic links, device nodes, etc.) into a single
+stream of bytes.
+The format was originally designed to be used with
+tape drives that operate with fixed-size blocks, but is widely used as
+a general packaging mechanism.
+.SS General Format
+A
+\fB\%tar\fP
+archive consists of a series of 512-byte records.
+Each file system object requires a header record which stores basic metadata
+(pathname, owner, permissions, etc.) and zero or more records containing any
+file data.
+The end of the archive is indicated by two records consisting
+entirely of zero bytes.
+.PP
+For compatibility with tape drives that use fixed block sizes,
+programs that read or write tar files always read or write a fixed
+number of records with each I/O operation.
+These
+``blocks''
+are always a multiple of the record size.
+The maximum block size supported by early
+implementations was 10240 bytes or 20 records.
+This is still the default for most implementations
+although block sizes of 1MiB (2048 records) or larger are
+commonly used with modern high-speed tape drives.
+(Note: the terms
+``block''
+and
+``record''
+here are not entirely standard; this document follows the
+convention established by John Gilmore in documenting
+\fB\%pdtar\fP.)
+.SS Old-Style Archive Format
+The original tar archive format has been extended many times to
+include additional information that various implementors found
+necessary.
+This section describes the variant implemented by the tar command
+included in
+At v7,
+which seems to be the earliest widely-used version of the tar program.
+.PP
+The header record for an old-style
+\fB\%tar\fP
+archive consists of the following:
+.RS 4
+.nf
+struct header_old_tar {
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char checksum[8];
+ char linkflag[1];
+ char linkname[100];
+ char pad[255];
+};
+.RE
+All unused bytes in the header record are filled with nulls.
+.RS 5
+.TP
+\fIname\fP
+Pathname, stored as a null-terminated string.
+Early tar implementations only stored regular files (including
+hardlinks to those files).
+One common early convention used a trailing "/" character to indicate
+a directory name, allowing directory permissions and owner information
+to be archived and restored.
+.TP
+\fImode\fP
+File mode, stored as an octal number in ASCII.
+.TP
+\fIuid\fP, \fIgid\fP
+User id and group id of owner, as octal numbers in ASCII.
+.TP
+\fIsize\fP
+Size of file, as octal number in ASCII.
+For regular files only, this indicates the amount of data
+that follows the header.
+In particular, this field was ignored by early tar implementations
+when extracting hardlinks.
+Modern writers should always store a zero length for hardlink entries.
+.TP
+\fImtime\fP
+Modification time of file, as an octal number in ASCII.
+This indicates the number of seconds since the start of the epoch,
+00:00:00 UTC January 1, 1970.
+Note that negative values should be avoided
+here, as they are handled inconsistently.
+.TP
+\fIchecksum\fP
+Header checksum, stored as an octal number in ASCII.
+To compute the checksum, set the checksum field to all spaces,
+then sum all bytes in the header using unsigned arithmetic.
+This field should be stored as six octal digits followed by a null and a space
+character.
+Note that many early implementations of tar used signed arithmetic
+for the checksum field, which can cause interoperability problems
+when transferring archives between systems.
+Modern robust readers compute the checksum both ways and accept the
+header if either computation matches.
+.TP
+\fIlinkflag\fP, \fIlinkname\fP
+In order to preserve hardlinks and conserve tape, a file
+with multiple links is only written to the archive the first
+time it is encountered.
+The next time it is encountered, the
+\fIlinkflag\fP
+is set to an ASCII
+Sq 1
+and the
+\fIlinkname\fP
+field holds the first name under which this file appears.
+(Note that regular files have a null value in the
+\fIlinkflag\fP
+field.)
+.RE
+.PP
+Early tar implementations varied in how they terminated these fields.
+The tar command in
+At v7
+used the following conventions (this is also documented in early BSD manpages):
+the pathname must be null-terminated;
+the mode, uid, and gid fields must end in a space and a null byte;
+the size and mtime fields must end in a space;
+the checksum is terminated by a null and a space.
+Early implementations filled the numeric fields with leading spaces.
+This seems to have been common practice until the
+IEEE Std 1003.1-1988 (``POSIX.1'')
+standard was released.
+For best portability, modern implementations should fill the numeric
+fields with leading zeros.
+.SS Pre-POSIX Archives
+An early draft of
+IEEE Std 1003.1-1988 (``POSIX.1'')
+served as the basis for John Gilmore's
+\fB\%pdtar\fP
+program and many system implementations from the late 1980s
+and early 1990s.
+These archives generally follow the POSIX ustar
+format described below with the following variations:
+.RS 5
+.IP \(bu
+The magic value is
+``ustar\ \&''
+(note the following space).
+The version field contains a space character followed by a null.
+.IP \(bu
+The numeric fields are generally filled with leading spaces
+(not leading zeros as recommended in the final standard).
+.IP \(bu
+The prefix field is often not used, limiting pathnames to
+the 100 characters of old-style archives.
+.RE
+.SS POSIX ustar Archives
+IEEE Std 1003.1-1988 (``POSIX.1'')
+defined a standard tar file format to be read and written
+by compliant implementations of
+\fBtar\fP(1).
+This format is often called the
+``ustar''
+format, after the magic value used
+in the header.
+(The name is an acronym for
+``Unix Standard TAR''.)
+It extends the historic format with new fields:
+.RS 4
+.nf
+struct header_posix_ustar {
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char checksum[8];
+ char typeflag[1];
+ char linkname[100];
+ char magic[6];
+ char version[2];
+ char uname[32];
+ char gname[32];
+ char devmajor[8];
+ char devminor[8];
+ char prefix[155];
+ char pad[12];
+};
+.RE
+.RS 5
+.TP
+\fItypeflag\fP
+Type of entry.
+POSIX extended the earlier
+\fIlinkflag\fP
+field with several new type values:
+.RS 5
+.TP
+``0''
+Regular file.
+NUL should be treated as a synonym, for compatibility purposes.
+.TP
+``1''
+Hard link.
+.TP
+``2''
+Symbolic link.
+.TP
+``3''
+Character device node.
+.TP
+``4''
+Block device node.
+.TP
+``5''
+Directory.
+.TP
+``6''
+FIFO node.
+.TP
+``7''
+Reserved.
+.TP
+Other
+A POSIX-compliant implementation must treat any unrecognized typeflag value
+as a regular file.
+In particular, writers should ensure that all entries
+have a valid filename so that they can be restored by readers that do not
+support the corresponding extension.
+Uppercase letters "A" through "Z" are reserved for custom extensions.
+Note that sockets and whiteout entries are not archivable.
+.RE
+It is worth noting that the
+\fIsize\fP
+field, in particular, has different meanings depending on the type.
+For regular files, of course, it indicates the amount of data
+following the header.
+For directories, it may be used to indicate the total size of all
+files in the directory, for use by operating systems that pre-allocate
+directory space.
+For all other types, it should be set to zero by writers and ignored
+by readers.
+.TP
+\fImagic\fP
+Contains the magic value
+``ustar''
+followed by a NUL byte to indicate that this is a POSIX standard archive.
+Full compliance requires the uname and gname fields be properly set.
+.TP
+\fIversion\fP
+Version.
+This should be
+``00''
+(two copies of the ASCII digit zero) for POSIX standard archives.
+.TP
+\fIuname\fP, \fIgname\fP
+User and group names, as null-terminated ASCII strings.
+These should be used in preference to the uid/gid values
+when they are set and the corresponding names exist on
+the system.
+.TP
+\fIdevmajor\fP, \fIdevminor\fP
+Major and minor numbers for character device or block device entry.
+.TP
+\fIname\fP, \fIprefix\fP
+If the pathname is too long to fit in the 100 bytes provided by the standard
+format, it can be split at any
+\fI/\fP
+character with the first portion going into the prefix field.
+If the prefix field is not empty, the reader will prepend
+the prefix value and a
+\fI/\fP
+character to the regular name field to obtain the full pathname.
+The standard does not require a trailing
+\fI/\fP
+character on directory names, though most implementations still
+include this for compatibility reasons.
+.RE
+.PP
+Note that all unused bytes must be set to
+.BR NUL.
+.PP
+Field termination is specified slightly differently by POSIX
+than by previous implementations.
+The
+\fImagic\fP,
+\fIuname\fP,
+and
+\fIgname\fP
+fields must have a trailing
+.BR NUL.
+The
+\fIpathname\fP,
+\fIlinkname\fP,
+and
+\fIprefix\fP
+fields must have a trailing
+.BR NUL
+unless they fill the entire field.
+(In particular, it is possible to store a 256-character pathname if it
+happens to have a
+\fI/\fP
+as the 156th character.)
+POSIX requires numeric fields to be zero-padded in the front, and requires
+them to be terminated with either space or
+.BR NUL
+characters.
+.PP
+Currently, most tar implementations comply with the ustar
+format, occasionally extending it by adding new fields to the
+blank area at the end of the header record.
+.SS Pax Interchange Format
+There are many attributes that cannot be portably stored in a
+POSIX ustar archive.
+IEEE Std 1003.1-2001 (``POSIX.1'')
+defined a
+``pax interchange format''
+that uses two new types of entries to hold text-formatted
+metadata that applies to following entries.
+Note that a pax interchange format archive is a ustar archive in every
+respect.
+The new data is stored in ustar-compatible archive entries that use the
+``x''
+or
+``g''
+typeflag.
+In particular, older implementations that do not fully support these
+extensions will extract the metadata into regular files, where the
+metadata can be examined as necessary.
+.PP
+An entry in a pax interchange format archive consists of one or
+two standard ustar entries, each with its own header and data.
+The first optional entry stores the extended attributes
+for the following entry.
+This optional first entry has an "x" typeflag and a size field that
+indicates the total size of the extended attributes.
+The extended attributes themselves are stored as a series of text-format
+lines encoded in the portable UTF-8 encoding.
+Each line consists of a decimal number, a space, a key string, an equals
+sign, a value string, and a new line.
+The decimal number indicates the length of the entire line, including the
+initial length field and the trailing newline.
+An example of such a field is:
+.RS 4
+25 ctime=1084839148.1212\en
+.RE
+Keys in all lowercase are standard keys.
+Vendors can add their own keys by prefixing them with an all uppercase
+vendor name and a period.
+Note that, unlike the historic header, numeric values are stored using
+decimal, not octal.
+A description of some common keys follows:
+.RS 5
+.TP
+\fBatime\fP, \fBctime\fP, \fBmtime\fP
+File access, inode change, and modification times.
+These fields can be negative or include a decimal point and a fractional value.
+.TP
+\fBuname\fP, \fBuid\fP, \fBgname\fP, \fBgid\fP
+User name, group name, and numeric UID and GID values.
+The user name and group name stored here are encoded in UTF8
+and can thus include non-ASCII characters.
+The UID and GID fields can be of arbitrary length.
+.TP
+\fBlinkpath\fP
+The full path of the linked-to file.
+Note that this is encoded in UTF8 and can thus include non-ASCII characters.
+.TP
+\fBpath\fP
+The full pathname of the entry.
+Note that this is encoded in UTF8 and can thus include non-ASCII characters.
+.TP
+\fBrealtime.*\fP, \fBsecurity.*\fP
+These keys are reserved and may be used for future standardization.
+.TP
+\fBsize\fP
+The size of the file.
+Note that there is no length limit on this field, allowing conforming
+archives to store files much larger than the historic 8GB limit.
+.TP
+\fBSCHILY.*\fP
+Vendor-specific attributes used by Joerg Schilling's
+\fB\%star\fP
+implementation.
+.TP
+\fBSCHILY.acl.access\fP, \fBSCHILY.acl.default\fP
+Stores the access and default ACLs as textual strings in a format
+that is an extension of the format specified by POSIX.1e draft 17.
+In particular, each user or group access specification can include a fourth
+colon-separated field with the numeric UID or GID.
+This allows ACLs to be restored on systems that may not have complete
+user or group information available (such as when NIS/YP or LDAP services
+are temporarily unavailable).
+.TP
+\fBSCHILY.devminor\fP, \fBSCHILY.devmajor\fP
+The full minor and major numbers for device nodes.
+.TP
+\fBSCHILY.fflags\fP
+The file flags.
+.TP
+\fBSCHILY.realsize\fP
+The full size of the file on disk.
+XXX explain? XXX
+.TP
+\fBSCHILY.dev,\fP \fBSCHILY.ino\fP, \fBSCHILY.nlinks\fP
+The device number, inode number, and link count for the entry.
+In particular, note that a pax interchange format archive using Joerg
+Schilling's
+\fBSCHILY.*\fP
+extensions can store all of the data from
+\fIstruct\fP stat.
+.TP
+\fBLIBARCHIVE.xattr.\fP \fInamespace\fP.\fIkey\fP
+Libarchive stores POSIX.1e-style extended attributes using
+keys of this form.
+The
+\fIkey\fP
+value is URL-encoded:
+All non-ASCII characters and the two special characters
+``=''
+and
+``%''
+are encoded as
+``%''
+followed by two uppercase hexadecimal digits.
+The value of this key is the extended attribute value
+encoded in base 64.
+XXX Detail the base-64 format here XXX
+.TP
+\fBVENDOR.*\fP
+XXX document other vendor-specific extensions XXX
+.RE
+.PP
+Any values stored in an extended attribute override the corresponding
+values in the regular tar header.
+Note that compliant readers should ignore the regular fields when they
+are overridden.
+This is important, as existing archivers are known to store non-compliant
+values in the standard header fields in this situation.
+There are no limits on length for any of these fields.
+In particular, numeric fields can be arbitrarily large.
+All text fields are encoded in UTF8.
+Compliant writers should store only portable 7-bit ASCII characters in
+the standard ustar header and use extended
+attributes whenever a text value contains non-ASCII characters.
+.PP
+In addition to the
+\fBx\fP
+entry described above, the pax interchange format
+also supports a
+\fBg\fP
+entry.
+The
+\fBg\fP
+entry is identical in format, but specifies attributes that serve as
+defaults for all subsequent archive entries.
+The
+\fBg\fP
+entry is not widely used.
+.PP
+Besides the new
+\fBx\fP
+and
+\fBg\fP
+entries, the pax interchange format has a few other minor variations
+from the earlier ustar format.
+The most troubling one is that hardlinks are permitted to have
+data following them.
+This allows readers to restore any hardlink to a file without
+having to rewind the archive to find an earlier entry.
+However, it creates complications for robust readers, as it is no longer
+clear whether or not they should ignore the size field for hardlink entries.
+.SS GNU Tar Archives
+The GNU tar program started with a pre-POSIX format similar to that
+described earlier and has extended it using several different mechanisms:
+It added new fields to the empty space in the header (some of which was later
+used by POSIX for conflicting purposes);
+it allowed the header to be continued over multiple records;
+and it defined new entries that modify following entries
+(similar in principle to the
+\fBx\fP
+entry described above, but each GNU special entry is single-purpose,
+unlike the general-purpose
+\fBx\fP
+entry).
+As a result, GNU tar archives are not POSIX compatible, although
+more lenient POSIX-compliant readers can successfully extract most
+GNU tar archives.
+.RS 4
+.nf
+struct header_gnu_tar {
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char checksum[8];
+ char typeflag[1];
+ char linkname[100];
+ char magic[6];
+ char version[2];
+ char uname[32];
+ char gname[32];
+ char devmajor[8];
+ char devminor[8];
+ char atime[12];
+ char ctime[12];
+ char offset[12];
+ char longnames[4];
+ char unused[1];
+ struct {
+ char offset[12];
+ char numbytes[12];
+ } sparse[4];
+ char isextended[1];
+ char realsize[12];
+ char pad[17];
+};
+.RE
+.RS 5
+.TP
+\fItypeflag\fP
+GNU tar uses the following special entry types, in addition to
+those defined by POSIX:
+.RS 5
+.TP
+7
+GNU tar treats type "7" records identically to type "0" records,
+except on one obscure RTOS where they are used to indicate the
+pre-allocation of a contiguous file on disk.
+.TP
+D
+This indicates a directory entry.
+Unlike the POSIX-standard "5"
+typeflag, the header is followed by data records listing the names
+of files in this directory.
+Each name is preceded by an ASCII "Y"
+if the file is stored in this archive or "N" if the file is not
+stored in this archive.
+Each name is terminated with a null, and
+an extra null marks the end of the name list.
+The purpose of this
+entry is to support incremental backups; a program restoring from
+such an archive may wish to delete files on disk that did not exist
+in the directory when the archive was made.
+.PP
+Note that the "D" typeflag specifically violates POSIX, which requires
+that unrecognized typeflags be restored as normal files.
+In this case, restoring the "D" entry as a file could interfere
+with subsequent creation of the like-named directory.
+.TP
+K
+The data for this entry is a long linkname for the following regular entry.
+.TP
+L
+The data for this entry is a long pathname for the following regular entry.
+.TP
+M
+This is a continuation of the last file on the previous volume.
+GNU multi-volume archives guarantee that each volume begins with a valid
+entry header.
+To ensure this, a file may be split, with part stored at the end of one volume,
+and part stored at the beginning of the next volume.
+The "M" typeflag indicates that this entry continues an existing file.
+Such entries can only occur as the first or second entry
+in an archive (the latter only if the first entry is a volume label).
+The
+\fIsize\fP
+field specifies the size of this entry.
+The
+\fIoffset\fP
+field at bytes 369-380 specifies the offset where this file fragment
+begins.
+The
+\fIrealsize\fP
+field specifies the total size of the file (which must equal
+\fIsize\fP
+plus
+\fIoffset\fP).
+When extracting, GNU tar checks that the header file name is the one it is
+expecting, that the header offset is in the correct sequence, and that
+the sum of offset and size is equal to realsize.
+.TP
+N
+Type "N" records are no longer generated by GNU tar.
+They contained a
+list of files to be renamed or symlinked after extraction; this was
+originally used to support long names.
+The contents of this record
+are a text description of the operations to be done, in the form
+``Rename %s to %s\en''
+or
+``Symlink %s to %s\en ;''
+in either case, both
+filenames are escaped using K&R C syntax.
+Due to security concerns, "N" records are now generally ignored
+when reading archives.
+.TP
+S
+This is a
+``sparse''
+regular file.
+Sparse files are stored as a series of fragments.
+The header contains a list of fragment offset/length pairs.
+If more than four such entries are required, the header is
+extended as necessary with
+``extra''
+header extensions (an older format that is no longer used), or
+``sparse''
+extensions.
+.TP
+V
+The
+\fIname\fP
+field should be interpreted as a tape/volume header name.
+This entry should generally be ignored on extraction.
+.RE
+.TP
+\fImagic\fP
+The magic field holds the five characters
+``ustar''
+followed by a space.
+Note that POSIX ustar archives have a trailing null.
+.TP
+\fIversion\fP
+The version field holds a space character followed by a null.
+Note that POSIX ustar archives use two copies of the ASCII digit
+``0''.
+.TP
+\fIatime\fP, \fIctime\fP
+The time the file was last accessed and the time of
+last change of file information, stored in octal as with
+\fImtime\fP.
+.TP
+\fIlongnames\fP
+This field is apparently no longer used.
+.TP
+Sparse \fIoffset\fP / \fInumbytes\fP
+Each such structure specifies a single fragment of a sparse
+file.
+The two fields store values as octal numbers.
+The fragments are each padded to a multiple of 512 bytes
+in the archive.
+On extraction, the list of fragments is collected from the
+header (including any extension headers), and the data
+is then read and written to the file at appropriate offsets.
+.TP
+\fIisextended\fP
+If this is set to non-zero, the header will be followed by additional
+``sparse header''
+records.
+Each such record contains information about as many as 21 additional
+sparse blocks as shown here:
+.RS 4
+.nf
+struct gnu_sparse_header {
+ struct {
+ char offset[12];
+ char numbytes[12];
+ } sparse[21];
+ char isextended[1];
+ char padding[7];
+};
+.RE
+.TP
+\fIrealsize\fP
+A binary representation of the file's complete size, with a much larger range
+than the POSIX file size.
+In particular, with
+\fBM\fP
+type files, the current entry is only a portion of the file.
+In that case, the POSIX size field will indicate the size of this
+entry; the
+\fIrealsize\fP
+field will indicate the total size of the file.
+.RE
+.SS GNU tar pax archives
+GNU tar 1.14 (XXX check this XXX) and later will write
+pax interchange format archives when you specify the
+\fB\--posix\fP
+flag.
+This format uses custom keywords to store sparse file information.
+There have been three iterations of this support, referred to
+as
+``0.0'',
+``0.1'',
+and
+``1.0''.
+.RS 5
+.TP
+\fBGNU.sparse.numblocks\fP, \fBGNU.sparse.offset\fP, \fBGNU.sparse.numbytes\fP, \fBGNU.sparse.size\fP
+The
+``0.0''
+format used an initial
+\fBGNU.sparse.numblocks\fP
+attribute to indicate the number of blocks in the file, a pair of
+\fBGNU.sparse.offset\fP
+and
+\fBGNU.sparse.numbytes\fP
+to indicate the offset and size of each block,
+and a single
+\fBGNU.sparse.size\fP
+to indicate the full size of the file.
+This is not the same as the size in the tar header because the
+latter value does not include the size of any holes.
+This format required that the order of attributes be preserved and
+relied on readers accepting multiple appearances of the same attribute
+names, which is not officially permitted by the standards.
+.TP
+\fBGNU.sparse.map\fP
+The
+``0.1''
+format used a single attribute that stored a comma-separated
+list of decimal numbers.
+Each pair of numbers indicated the offset and size, respectively,
+of a block of data.
+This does not work well if the archive is extracted by an archiver
+that does not recognize this extension, since many pax implementations
+simply discard unrecognized attributes.
+.TP
+\fBGNU.sparse.major\fP, \fBGNU.sparse.minor\fP, \fBGNU.sparse.name\fP, \fBGNU.sparse.realsize\fP
+The
+``1.0''
+format stores the sparse block map in one or more 512-byte blocks
+prepended to the file data in the entry body.
+The pax attributes indicate the existence of this map
+(via the
+\fBGNU.sparse.major\fP
+and
+\fBGNU.sparse.minor\fP
+fields)
+and the full size of the file.
+The
+\fBGNU.sparse.name\fP
+holds the true name of the file.
+To avoid confusion, the name stored in the regular tar header
+is a modified name so that extraction errors will be apparent
+to users.
+.RE
+.SS Solaris Tar
+XXX More Details Needed XXX
+.PP
+Solaris tar (beginning with SunOS XXX 5.7 ?? XXX) supports an
+``extended''
+format that is fundamentally similar to pax interchange format,
+with the following differences:
+.RS 5
+.IP \(bu
+Extended attributes are stored in an entry whose type is
+\fBX\fP,
+not
+\fBx\fP,
+as used by pax interchange format.
+The detailed format of this entry appears to be the same
+as detailed above for the
+\fBx\fP
+entry.
+.IP \(bu
+An additional
+\fBA\fP
+entry is used to store an ACL for the following regular entry.
+The body of this entry contains a seven-digit octal number
+followed by a zero byte, followed by the
+textual ACL description.
+The octal value is the number of ACL entries
+plus a constant that indicates the ACL type: 01000000
+for POSIX.1e ACLs and 03000000 for NFSv4 ACLs.
+.RE
+.SS AIX Tar
+XXX More details needed XXX
+.SS Mac OS X Tar
+The tar distributed with Apple's Mac OS X stores most regular files
+as two separate entries in the tar archive.
+The two entries have the same name except that the first
+one has
+``._''
+added to the beginning of the name.
+This first entry stores the
+``resource fork''
+with additional attributes for the file.
+The Mac OS X
+\fB\%CopyFile\fP()
+API is used to separate a file on disk into separate
+resource and data streams and to reassemble those separate
+streams when the file is restored to disk.
+.SS Other Extensions
+One obvious extension to increase the size of files is to
+eliminate the terminating characters from the various
+numeric fields.
+For example, the standard only allows the size field to contain
+11 octal digits, reserving the twelfth byte for a trailing
+NUL character.
+Allowing 12 octal digits allows file sizes up to 64 GB.
+.PP
+Another extension, utilized by GNU tar, star, and other newer
+\fB\%tar\fP
+implementations, permits binary numbers in the standard numeric fields.
+This is flagged by setting the high bit of the first byte.
+This permits 95-bit values for the length and time fields
+and 63-bit values for the uid, gid, and device numbers.
+GNU tar supports this extension for the
+length, mtime, ctime, and atime fields.
+Joerg Schilling's star program supports this extension for
+all numeric fields.
+Note that this extension is largely obsoleted by the extended attribute
+record provided by the pax interchange format.
+.PP
+Another early GNU extension allowed base-64 values rather than octal.
+This extension was short-lived and is no longer supported by any
+implementation.
+.SH SEE ALSO
+.ad l
+\fBar\fP(1),
+\fBpax\fP(1),
+\fBtar\fP(1)
+.SH STANDARDS
+.ad l
+The
+\fB\%tar\fP
+utility is no longer a part of POSIX or the Single Unix Standard.
+It last appeared in
+Version 2 of the Single UNIX Specification (``SUSv2'').
+It has been supplanted in subsequent standards by
+\fBpax\fP(1).
+The ustar format is currently part of the specification for the
+\fBpax\fP(1)
+utility.
+The pax interchange file format is new with
+IEEE Std 1003.1-2001 (``POSIX.1'').
+.SH HISTORY
+.ad l
+A
+\fB\%tar\fP
+command appeared in Seventh Edition Unix, which was released in January, 1979.
+It replaced the
+\fB\%tp\fP
+program from Fourth Edition Unix which in turn replaced the
+\fB\%tap\fP
+program from First Edition Unix.
+John Gilmore's
+\fB\%pdtar\fP
+public-domain implementation (circa 1987) was highly influential
+and formed the basis of
+\fB\%GNU\fP tar
+(circa 1988).
+Joerg Shilling's
+\fB\%star\fP
+archiver is another open-source (GPL) archiver (originally developed
+circa 1985) which features complete support for pax interchange
+format.
+.PP
+This documentation was written as part of the
+\fB\%libarchive\fP
+and
+\fB\%bsdtar\fP
+project by
+Tim Kientzle \%<kientzle@FreeBSD.org.>
diff --git a/archivers/libarchive/files/doc/mdoc2man.awk b/archivers/libarchive/files/doc/mdoc2man.awk
new file mode 100644
index 00000000000..c55b953ee60
--- /dev/null
+++ b/archivers/libarchive/files/doc/mdoc2man.awk
@@ -0,0 +1,391 @@
+#!/usr/bin/awk
+#
+# Copyright (c) 2003 Peter Stuge <stuge-mdoc2man@cdy.org>
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+# Dramatically overhauled by Tim Kientzle. This version almost
+# handles library-style pages with Fn, Ft, etc commands. Still
+# a lot of problems...
+
+BEGIN {
+ displaylines = 0
+ trailer = ""
+ out = ""
+ sep = ""
+ nextsep = " "
+}
+
+# Add a word with appropriate preceding whitespace
+# Maintain a short queue of the expected upcoming word separators.
+function add(str) {
+ out=out sep str
+ sep = nextsep
+ nextsep = " "
+}
+
+# Add a word with no following whitespace
+# Use for opening punctuation such as '('
+function addopen(str) {
+ add(str)
+ sep = ""
+}
+
+# Add a word with no preceding whitespace
+# Use for closing punctuation such as ')' or '.'
+function addclose(str) {
+ sep = ""
+ add(str)
+}
+
+# Add a word with no space before or after
+# Use for separating punctuation such as '='
+function addpunct(str) {
+ sep = ""
+ add(str)
+ sep = ""
+}
+
+# Emit the current line so far
+function endline() {
+ addclose(trailer)
+ trailer = ""
+ if(length(out) > 0) {
+ print out
+ out=""
+ }
+ if(displaylines > 0) {
+ displaylines = displaylines - 1
+ if (displaylines == 0)
+ dispend()
+ }
+ # First word on next line has no preceding whitespace
+ sep = ""
+}
+
+function linecmd(cmd) {
+ endline()
+ add(cmd)
+ endline()
+}
+
+function breakline() {
+ linecmd(".br")
+}
+
+# Start an indented display
+function dispstart() {
+ linecmd(".RS 4")
+}
+
+# End an indented display
+function dispend() {
+ linecmd(".RE")
+}
+
+# Collect rest of input line
+function wtail() {
+ retval=""
+ while(w<nwords) {
+ if(length(retval))
+ retval=retval " "
+ retval=retval words[++w]
+ }
+ return retval
+}
+
+function splitwords(l, dest, n, o, w) {
+ n = 1
+ delete dest
+ while (length(l) > 0) {
+ sub("^[ \t]*", "", l)
+ if (match(l, "^\"")) {
+ l = substr(l, 2)
+ o = index(l, "\"")
+ if (o > 0) {
+ w = substr(l, 1, o-1)
+ l = substr(l, o+1)
+ dest[n++] = w
+ } else {
+ dest[n++] = l
+ l = ""
+ }
+ } else {
+ o = match(l, "[ \t]")
+ if (o > 0) {
+ w = substr(l, 1, o-1)
+ l = substr(l, o+1)
+ dest[n++] = w
+ } else {
+ dest[n++] = l
+ l = ""
+ }
+ }
+ }
+ return n-1
+}
+
+! /^\./ {
+ out = $0
+ endline()
+ next
+}
+
+/^\.\\"/ { next }
+
+{
+ sub("^\\.","")
+ nwords=splitwords($0, words)
+ # TODO: Instead of iterating 'w' over the array, have a separate
+ # function that returns 'next word' and use that. This will allow
+ # proper handling of double-quoted arguments as well.
+ for(w=1;w<=nwords;w++) {
+ if(match(words[w],"^Li$")) { # Literal; rest of line is unformatted
+ dispstart()
+ displaylines = 1
+ } else if(match(words[w],"^Dl$")) { # Display literal
+ dispstart()
+ displaylines = 1
+ } else if(match(words[w],"^Bd$")) { # Begin display
+ if(match(words[w+1],"-literal")) {
+ dispstart()
+ linecmd(".nf")
+ displaylines=10000
+ w=nwords
+ }
+ } else if(match(words[w],"^Ed$")) { # End display
+ displaylines = 0
+ dispend()
+ } else if(match(words[w],"^Ns$")) { # Suppress space after next word
+ nextsep = ""
+ } else if(match(words[w],"^No$")) { # Normal text
+ add(words[++w])
+ } else if(match(words[w],"^Dq$")) { # Quote
+ addopen("``")
+ add(words[++w])
+ while(w<nwords&&!match(words[w+1],"^[\\.,]"))
+ add(words[++w])
+ addclose("''")
+ } else if(match(words[w],"^Do$")) {
+ addopen("``")
+ } else if(match(words[w],"^Dc$")) {
+ addclose("''")
+ } else if(match(words[w],"^Oo$")) {
+ addopen("[")
+ } else if(match(words[w],"^Oc$")) {
+ addclose("]")
+ } else if(match(words[w],"^Ao$")) {
+ addopen("<")
+ } else if(match(words[w],"^Ac$")) {
+ addclose(">")
+ } else if(match(words[w],"^Dd$")) {
+ date=wtail()
+ next
+ } else if(match(words[w],"^Dt$")) {
+ id=wtail()
+ next
+ } else if(match(words[w],"^Ox$")) {
+ add("OpenBSD")
+ } else if(match(words[w],"^Fx$")) {
+ add("FreeBSD")
+ } else if(match(words[w],"^Nx$")) {
+ add("NetBSD")
+ } else if(match(words[w],"^St$")) {
+ if (match(words[w+1], "^-p1003.1$")) {
+ w++
+ add("IEEE Std 1003.1 (``POSIX.1'')")
+ } else if(match(words[w+1], "^-p1003.1-96$")) {
+ w++
+ add("ISO/IEC 9945-1:1996 (``POSIX.1'')")
+ } else if(match(words[w+1], "^-p1003.1-88$")) {
+ w++
+ add("IEEE Std 1003.1-1988 (``POSIX.1'')")
+ } else if(match(words[w+1], "^-p1003.1-2001$")) {
+ w++
+ add("IEEE Std 1003.1-2001 (``POSIX.1'')")
+ } else if(match(words[w+1], "^-susv2$")) {
+ w++
+ add("Version 2 of the Single UNIX Specification (``SUSv2'')")
+ }
+ } else if(match(words[w],"^Ex$")) {
+ if (match(words[w+1], "^-std$")) {
+ w++
+ add("The \\fB" name "\\fP utility exits 0 on success, and >0 if an error occurs.")
+ }
+ } else if(match(words[w],"^Os$")) {
+ add(".TH " id " \"" date "\" \"" wtail() "\"")
+ } else if(match(words[w],"^Sh$")) {
+ section=wtail()
+ add(".SH " section)
+ linecmd(".ad l")
+ } else if(match(words[w],"^Xr$")) {
+ add("\\fB" words[++w] "\\fP(" words[++w] ")" words[++w])
+ } else if(match(words[w],"^Nm$")) {
+ if(match(section,"SYNOPSIS"))
+ breakline()
+ if(w >= nwords)
+ n=name
+ else if (match(words[w+1], "^[A-Z][a-z]$"))
+ n=name
+ else if (match(words[w+1], "^[.,;:]$"))
+ n=name
+ else {
+ n=words[++w]
+ if(!length(name))
+ name=n
+ }
+ if(!length(n))
+ n=name
+ add("\\fB\\%" n "\\fP")
+ } else if(match(words[w],"^Nd$")) {
+ add("\\- " wtail())
+ } else if(match(words[w],"^Fl$")) {
+ add("\\fB\\-" words[++w] "\\fP")
+ } else if(match(words[w],"^Ar$")) {
+ addopen("\\fI")
+ if(w==nwords)
+ add("file ...\\fP")
+ else
+ add(words[++w] "\\fP")
+ } else if(match(words[w],"^Cm$")) {
+ add("\\fB" words[++w] "\\fP")
+ } else if(match(words[w],"^Op$")) {
+ addopen("[")
+ option=1
+ trailer="]" trailer
+ } else if(match(words[w],"^Pp$")) {
+ linecmd(".PP")
+ } else if(match(words[w],"^An$")) {
+ endline()
+ } else if(match(words[w],"^Ss$")) {
+ add(".SS")
+ } else if(match(words[w],"^Ft$")) {
+ if (match(section, "SYNOPSIS")) {
+ breakline()
+ }
+ add("\\fI" wtail() "\\fP")
+ if (match(section, "SYNOPSIS")) {
+ breakline()
+ }
+ } else if(match(words[w],"^Fn$")) {
+ ++w
+ F = "\\fB\\%" words[w] "\\fP("
+ Fsep = ""
+ while(w<nwords) {
+ ++w
+ if (match(words[w], "^[.,:]$")) {
+ --w
+ break
+ }
+ gsub(" ", "\\ ", words[w])
+ F = F Fsep "\\fI\\%" words[w] "\\fP"
+ Fsep = ", "
+ }
+ add(F ")")
+ if (match(section, "SYNOPSIS")) {
+ addclose(";")
+ }
+ } else if(match(words[w],"^Fo$")) {
+ w++
+ F = "\\fB\\%" words[w] "\\fP("
+ Fsep = ""
+ } else if(match(words[w],"^Fa$")) {
+ w++
+ gsub(" ", "\\ ", words[w])
+ F = F Fsep "\\fI\\%" words[w] "\\fP"
+ Fsep = ", "
+ } else if(match(words[w],"^Fc$")) {
+ add(F ")")
+ if (match(section, "SYNOPSIS")) {
+ addclose(";")
+ }
+ } else if(match(words[w],"^Va$")) {
+ w++
+ add("\\fI" words[w] "\\fP")
+ } else if(match(words[w],"^In$")) {
+ w++
+ add("\\fB#include <" words[w] ">\\fP")
+ } else if(match(words[w],"^Pa$")) {
+ addopen("\\fI")
+ w++
+ if(match(words[w],"^\\."))
+ add("\\&")
+ add(words[w] "\\fP")
+ } else if(match(words[w],"^Dv$")) {
+ add(".BR")
+ } else if(match(words[w],"^Em|Ev$")) {
+ add(".IR")
+ } else if(match(words[w],"^Pq$")) {
+ addopen("(")
+ trailer=")" trailer
+ } else if(match(words[w],"^Aq$")) {
+ addopen("\\%<")
+ trailer=">" trailer
+ } else if(match(words[w],"^Brq$")) {
+ addopen("{")
+ trailer="}" trailer
+ } else if(match(words[w],"^S[xy]$")) {
+ add(".B " wtail())
+ } else if(match(words[w],"^Ic$")) {
+ add("\\fB")
+ trailer="\\fP" trailer
+ } else if(match(words[w],"^Bl$")) {
+ oldoptlist=optlist
+ linecmd(".RS 5")
+ if(match(words[w+1],"-bullet"))
+ optlist=1
+ else if(match(words[w+1],"-enum")) {
+ optlist=2
+ enum=0
+ } else if(match(words[w+1],"-tag"))
+ optlist=3
+ else if(match(words[w+1],"-item"))
+ optlist=4
+ else if(match(words[w+1],"-bullet"))
+ optlist=1
+ w=nwords
+ } else if(match(words[w],"^El$")) {
+ linecmd(".RE")
+ optlist=oldoptlist
+ } else if(match(words[w],"^It$")&&optlist) {
+ if(optlist==1)
+ add(".IP \\(bu")
+ else if(optlist==2)
+ add(".IP " ++enum ".")
+ else if(optlist==3) {
+ add(".TP")
+ endline()
+ if(match(words[w+1],"^Pa$|^Ev$")) {
+ add(".B")
+ w++
+ }
+ } else if(optlist==4)
+ add(".IP")
+ } else if(match(words[w],"^Xo$")) {
+ # TODO: Figure out how to handle this
+ } else if(match(words[w],"^Xc$")) {
+ # TODO: Figure out how to handle this
+ } else if(match(words[w],"^[=]$")) {
+ addpunct(words[w])
+ } else if(match(words[w],"^[\[{(]$")) {
+ addopen(words[w])
+ } else if(match(words[w],"^[\\\])}.,;:]$")) {
+ addclose(words[w])
+ } else {
+ add(words[w])
+ }
+ }
+ if(match(out,"^\\.[^a-zA-Z]"))
+ sub("^\\.","",out)
+ endline()
+}
diff --git a/archivers/libarchive/files/doc/text/Makefile b/archivers/libarchive/files/doc/text/Makefile
new file mode 100644
index 00000000000..2671acd4455
--- /dev/null
+++ b/archivers/libarchive/files/doc/text/Makefile
@@ -0,0 +1,46 @@
+
+default: all
+
+
+archive_entry.3.txt: ../../libarchive/archive_entry.3
+ nroff -mdoc ../../libarchive/archive_entry.3 | col -b > archive_entry.3.txt
+
+archive_read.3.txt: ../../libarchive/archive_read.3
+ nroff -mdoc ../../libarchive/archive_read.3 | col -b > archive_read.3.txt
+
+archive_read_disk.3.txt: ../../libarchive/archive_read_disk.3
+ nroff -mdoc ../../libarchive/archive_read_disk.3 | col -b > archive_read_disk.3.txt
+
+archive_util.3.txt: ../../libarchive/archive_util.3
+ nroff -mdoc ../../libarchive/archive_util.3 | col -b > archive_util.3.txt
+
+archive_write.3.txt: ../../libarchive/archive_write.3
+ nroff -mdoc ../../libarchive/archive_write.3 | col -b > archive_write.3.txt
+
+archive_write_disk.3.txt: ../../libarchive/archive_write_disk.3
+ nroff -mdoc ../../libarchive/archive_write_disk.3 | col -b > archive_write_disk.3.txt
+
+cpio.5.txt: ../../libarchive/cpio.5
+ nroff -mdoc ../../libarchive/cpio.5 | col -b > cpio.5.txt
+
+libarchive-formats.5.txt: ../../libarchive/libarchive-formats.5
+ nroff -mdoc ../../libarchive/libarchive-formats.5 | col -b > libarchive-formats.5.txt
+
+libarchive.3.txt: ../../libarchive/libarchive.3
+ nroff -mdoc ../../libarchive/libarchive.3 | col -b > libarchive.3.txt
+
+libarchive_internals.3.txt: ../../libarchive/libarchive_internals.3
+ nroff -mdoc ../../libarchive/libarchive_internals.3 | col -b > libarchive_internals.3.txt
+
+mtree.5.txt: ../../libarchive/mtree.5
+ nroff -mdoc ../../libarchive/mtree.5 | col -b > mtree.5.txt
+
+tar.5.txt: ../../libarchive/tar.5
+ nroff -mdoc ../../libarchive/tar.5 | col -b > tar.5.txt
+
+bsdtar.1.txt: ../../tar/bsdtar.1
+ nroff -mdoc ../../tar/bsdtar.1 | col -b > bsdtar.1.txt
+
+bsdcpio.1.txt: ../../cpio/bsdcpio.1
+ nroff -mdoc ../../cpio/bsdcpio.1 | col -b > bsdcpio.1.txt
+all: archive_entry.3.txt archive_read.3.txt archive_read_disk.3.txt archive_util.3.txt archive_write.3.txt archive_write_disk.3.txt cpio.5.txt libarchive-formats.5.txt libarchive.3.txt libarchive_internals.3.txt mtree.5.txt tar.5.txt bsdtar.1.txt bsdcpio.1.txt
diff --git a/archivers/libarchive/files/doc/update.sh b/archivers/libarchive/files/doc/update.sh
new file mode 100755
index 00000000000..1427d70e560
--- /dev/null
+++ b/archivers/libarchive/files/doc/update.sh
@@ -0,0 +1,107 @@
+#!/bin/sh
+
+#
+# Simple script to repopulate the 'doc' tree from
+# the mdoc man pages stored in each project.
+#
+
+# Collect list of man pages, relative to my subdirs
+cd man
+MANPAGES=`for d in libarchive tar cpio;do ls ../../$d/*.[135];done | grep -v '\.so\.'`
+cd ..
+
+# Build Makefile in 'man' directory
+cd man
+rm -f *.[135]
+echo > Makefile
+echo "default: all" >>Makefile
+echo >>Makefile
+all="all:"
+for f in $MANPAGES; do
+ outname="`basename $f`"
+ echo >> Makefile
+ echo $outname: ../mdoc2man.awk $f >> Makefile
+ echo " awk -f ../mdoc2man.awk < $f > $outname" >> Makefile
+ all="$all $outname"
+done
+echo $all >>Makefile
+cd ..
+
+# Rebuild Makefile in 'text' directory
+cd text
+rm -f *.txt
+echo > Makefile
+echo "default: all" >>Makefile
+echo >>Makefile
+all="all:"
+for f in $MANPAGES; do
+ outname="`basename $f`.txt"
+ echo >> Makefile
+ echo $outname: $f >> Makefile
+ echo " nroff -mdoc $f | col -b > $outname" >> Makefile
+ all="$all $outname"
+done
+echo $all >>Makefile
+cd ..
+
+# Rebuild Makefile in 'pdf' directory
+cd pdf
+rm -f *.pdf
+echo > Makefile
+echo "default: all" >>Makefile
+echo >>Makefile
+all="all:"
+for f in $MANPAGES; do
+ outname="`basename $f`.pdf"
+ echo >> Makefile
+ echo $outname: $f >> Makefile
+ echo " groff -mdoc -T ps $f | ps2pdf - - > $outname" >> Makefile
+ all="$all $outname"
+done
+echo $all >>Makefile
+cd ..
+
+# Build Makefile in 'html' directory
+cd html
+rm -f *.html
+echo > Makefile
+echo "default: all" >>Makefile
+echo >>Makefile
+all="all:"
+for f in $MANPAGES; do
+ outname="`basename $f`.html"
+ echo >> Makefile
+ echo $outname: ../mdoc2man.awk $f >> Makefile
+ echo " groff -mdoc -T html $f > $outname" >> Makefile
+ all="$all $outname"
+done
+echo $all >>Makefile
+cd ..
+
+# Build Makefile in 'wiki' directory
+cd wiki
+rm -f *.wiki
+echo > Makefile
+echo "default: all" >>Makefile
+echo >>Makefile
+all="all:"
+for f in $MANPAGES; do
+ outname="`basename $f | awk '{ac=split($0,a,"[_.-]");o="ManPage";for(w=0;w<=ac;++w){o=o toupper(substr(a[w],1,1)) substr(a[w],2)};print o}'`.wiki"
+ echo >> Makefile
+ echo $outname: ../mdoc2wiki.awk $f >> Makefile
+ echo " awk -f ../mdoc2wiki.awk < $f > $outname" >> Makefile
+ all="$all $outname"
+done
+echo $all >>Makefile
+cd ..
+
+# Convert all of the manpages to -man format
+(cd man && make)
+# Format all of the manpages to text
+(cd text && make)
+# Format all of the manpages to PDF
+(cd pdf && make)
+# Format all of the manpages to HTML
+(cd html && make)
+# Format all of the manpages to Google Wiki syntax
+(cd wiki && make)
diff --git a/archivers/libarchive/files/examples/minitar/README b/archivers/libarchive/files/examples/minitar/README
new file mode 100644
index 00000000000..83f646cdb31
--- /dev/null
+++ b/archivers/libarchive/files/examples/minitar/README
@@ -0,0 +1,12 @@
+"minitar" is a minimal example of a program that uses libarchive to
+read/write various archive formats. It's a more ambitious version of
+'untar.c' that includes compile-time options to enable/disable various
+features, including non-tar formats, archive creation, and automatic
+decompression support.
+
+I use this as a test bed to check for "link pollution," ensuring that
+a program using libarchive does not pull in unnecessary code.
+
+The "minitar" program is also a good starting point for anyone who
+wants to use libarchive for their own purposes, as it demonstrates
+basic usage of the library.
diff --git a/archivers/libarchive/files/examples/minitar/minitar.c b/archivers/libarchive/files/examples/minitar/minitar.c
new file mode 100644
index 00000000000..7e901118377
--- /dev/null
+++ b/archivers/libarchive/files/examples/minitar/minitar.c
@@ -0,0 +1,421 @@
+/*-
+ * This file is in the public domain.
+ * Do with it as you will.
+ */
+
+/*-
+ * This is a compact "tar" program whose primary goal is small size.
+ * Statically linked, it can be very small indeed. This serves a number
+ * of goals:
+ * o a testbed for libarchive (to check for link pollution),
+ * o a useful tool for space-constrained systems (boot floppies, etc),
+ * o a place to experiment with new implementation ideas for bsdtar,
+ * o a small program to demonstrate libarchive usage.
+ *
+ * Use the following macros to suppress features:
+ * NO_BZIP2 - Implies NO_BZIP2_CREATE and NO_BZIP2_EXTRACT
+ * NO_BZIP2_CREATE - Suppress bzip2 compression support.
+ * NO_BZIP2_EXTRACT - Suppress bzip2 auto-detection and decompression.
+ * NO_COMPRESS - Implies NO_COMPRESS_CREATE and NO_COMPRESS_EXTRACT
+ * NO_COMPRESS_CREATE - Suppress compress(1) compression support
+ * NO_COMPRESS_EXTRACT - Suppress compress(1) auto-detect and decompression.
+ * NO_CREATE - Suppress all archive creation support.
+ * NO_CPIO_EXTRACT - Suppress auto-detect and dearchiving of cpio archives.
+ * NO_GZIP - Implies NO_GZIP_CREATE and NO_GZIP_EXTRACT
+ * NO_GZIP_CREATE - Suppress gzip compression support.
+ * NO_GZIP_EXTRACT - Suppress gzip auto-detection and decompression.
+ * NO_LOOKUP - Try to avoid getpw/getgr routines, which can be very large
+ * NO_TAR_EXTRACT - Suppress tar extraction
+ *
+ * With all of the above macros defined (except NO_TAR_EXTRACT), you
+ * get a very small program that can recognize and extract essentially
+ * any uncompressed tar archive. On FreeBSD 5.1, this minimal program
+ * is under 64k, statically linked, which compares rather favorably to
+ * main(){printf("hello, world");}
+ * which is over 60k statically linked on the same operating system.
+ * Without any of the above macros, you get a static executable of
+ * about 180k with a lot of very sophisticated modern features.
+ * Obviously, it's trivial to add support for ISO, Zip, mtree,
+ * lzma/xz, etc. Just fill in the appropriate setup calls.
+ */
+
+#include <sys/types.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/stat.h>
+
+#include <archive.h>
+#include <archive_entry.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#ifndef NO_CREATE
+#include "tree.h"
+#endif
+
+/*
+ * NO_CREATE implies NO_BZIP2_CREATE and NO_GZIP_CREATE and NO_COMPRESS_CREATE.
+ */
+#ifdef NO_CREATE
+#undef NO_BZIP2_CREATE
+#define NO_BZIP2_CREATE
+#undef NO_COMPRESS_CREATE
+#define NO_COMPRESS_CREATE
+#undef NO_GZIP_CREATE
+#define NO_GZIP_CREATE
+#endif
+
+/*
+ * The combination of NO_BZIP2_CREATE and NO_BZIP2_EXTRACT is
+ * equivalent to NO_BZIP2.
+ */
+#ifdef NO_BZIP2_CREATE
+#ifdef NO_BZIP2_EXTRACT
+#undef NO_BZIP2
+#define NO_BZIP2
+#endif
+#endif
+
+#ifdef NO_BZIP2
+#undef NO_BZIP2_EXTRACT
+#define NO_BZIP2_EXTRACT
+#undef NO_BZIP2_CREATE
+#define NO_BZIP2_CREATE
+#endif
+
+/*
+ * The combination of NO_COMPRESS_CREATE and NO_COMPRESS_EXTRACT is
+ * equivalent to NO_COMPRESS.
+ */
+#ifdef NO_COMPRESS_CREATE
+#ifdef NO_COMPRESS_EXTRACT
+#undef NO_COMPRESS
+#define NO_COMPRESS
+#endif
+#endif
+
+#ifdef NO_COMPRESS
+#undef NO_COMPRESS_EXTRACT
+#define NO_COMPRESS_EXTRACT
+#undef NO_COMPRESS_CREATE
+#define NO_COMPRESS_CREATE
+#endif
+
+/*
+ * The combination of NO_GZIP_CREATE and NO_GZIP_EXTRACT is
+ * equivalent to NO_GZIP.
+ */
+#ifdef NO_GZIP_CREATE
+#ifdef NO_GZIP_EXTRACT
+#undef NO_GZIP
+#define NO_GZIP
+#endif
+#endif
+
+#ifdef NO_GZIP
+#undef NO_GZIP_EXTRACT
+#define NO_GZIP_EXTRACT
+#undef NO_GZIP_CREATE
+#define NO_GZIP_CREATE
+#endif
+
+#ifndef NO_CREATE
+static void create(const char *filename, int compress, const char **argv);
+#endif
+static void errmsg(const char *);
+static void extract(const char *filename, int do_extract, int flags);
+static int copy_data(struct archive *, struct archive *);
+static void msg(const char *);
+static void usage(void);
+
+static int verbose = 0;
+
+int
+main(int argc, const char **argv)
+{
+ const char *filename = NULL;
+ int compress, flags, mode, opt;
+
+ (void)argc;
+ mode = 'x';
+ verbose = 0;
+ compress = '\0';
+ flags = ARCHIVE_EXTRACT_TIME;
+
+ /* Among other sins, getopt(3) pulls in printf(3). */
+ while (*++argv != NULL && **argv == '-') {
+ const char *p = *argv + 1;
+
+ while ((opt = *p++) != '\0') {
+ switch (opt) {
+#ifndef NO_CREATE
+ case 'c':
+ mode = opt;
+ break;
+#endif
+ case 'f':
+ if (*p != '\0')
+ filename = p;
+ else
+ filename = *++argv;
+ p += strlen(p);
+ break;
+#ifndef NO_BZIP2_CREATE
+ case 'j':
+ compress = opt;
+ break;
+#endif
+ case 'p':
+ flags |= ARCHIVE_EXTRACT_PERM;
+ flags |= ARCHIVE_EXTRACT_ACL;
+ flags |= ARCHIVE_EXTRACT_FFLAGS;
+ break;
+ case 't':
+ mode = opt;
+ break;
+ case 'v':
+ verbose++;
+ break;
+ case 'x':
+ mode = opt;
+ break;
+#ifndef NO_BZIP2_CREATE
+ case 'y':
+ compress = opt;
+ break;
+#endif
+#ifndef NO_COMPRESS_CREATE
+ case 'Z':
+ compress = opt;
+ break;
+#endif
+#ifndef NO_GZIP_CREATE
+ case 'z':
+ compress = opt;
+ break;
+#endif
+ default:
+ usage();
+ }
+ }
+ }
+
+ switch (mode) {
+#ifndef NO_CREATE
+ case 'c':
+ create(filename, compress, argv);
+ break;
+#endif
+ case 't':
+ extract(filename, 0, flags);
+ break;
+ case 'x':
+ extract(filename, 1, flags);
+ break;
+ }
+
+ return (0);
+}
+
+
+#ifndef NO_CREATE
+static char buff[16384];
+
+static void
+create(const char *filename, int compress, const char **argv)
+{
+ struct archive *a;
+ struct archive *disk;
+ struct archive_entry *entry;
+ ssize_t len;
+ int fd;
+
+ a = archive_write_new();
+ switch (compress) {
+#ifndef NO_BZIP2_CREATE
+ case 'j': case 'y':
+ archive_write_set_compression_bzip2(a);
+ break;
+#endif
+#ifndef NO_COMPRESS_CREATE
+ case 'Z':
+ archive_write_set_compression_compress(a);
+ break;
+#endif
+#ifndef NO_GZIP_CREATE
+ case 'z':
+ archive_write_set_compression_gzip(a);
+ break;
+#endif
+ default:
+ archive_write_set_compression_none(a);
+ break;
+ }
+ archive_write_set_format_ustar(a);
+ if (strcmp(filename, "-") == 0)
+ filename = NULL;
+ archive_write_open_file(a, filename);
+
+ disk = archive_read_disk_new();
+#ifndef NO_LOOKUP
+ archive_read_disk_set_standard_lookup(disk);
+#endif
+ while (*argv != NULL) {
+ struct tree *t = tree_open(*argv);
+ while (tree_next(t)) {
+ entry = archive_entry_new();
+ archive_entry_set_pathname(entry, tree_current_path(t));
+ archive_read_disk_entry_from_file(disk, entry, -1,
+ tree_current_stat(t));
+ if (verbose) {
+ msg("a ");
+ msg(tree_current_path(t));
+ }
+ archive_write_header(a, entry);
+ fd = open(tree_current_access_path(t), O_RDONLY);
+ len = read(fd, buff, sizeof(buff));
+ while (len > 0) {
+ archive_write_data(a, buff, len);
+ len = read(fd, buff, sizeof(buff));
+ }
+ close(fd);
+ archive_entry_free(entry);
+ if (verbose)
+ msg("\n");
+ }
+ argv++;
+ }
+ archive_write_close(a);
+ archive_write_finish(a);
+}
+#endif
+
+static void
+extract(const char *filename, int do_extract, int flags)
+{
+ struct archive *a;
+ struct archive *ext;
+ struct archive_entry *entry;
+ int r;
+
+ a = archive_read_new();
+ ext = archive_write_disk_new();
+ archive_write_disk_set_options(ext, flags);
+#ifndef NO_BZIP2_EXTRACT
+ archive_read_support_compression_bzip2(a);
+#endif
+#ifndef NO_GZIP_EXTRACT
+ archive_read_support_compression_gzip(a);
+#endif
+#ifndef NO_COMPRESS_EXTRACT
+ archive_read_support_compression_compress(a);
+#endif
+#ifndef NO_TAR_EXTRACT
+ archive_read_support_format_tar(a);
+#endif
+#ifndef NO_CPIO_EXTRACT
+ archive_read_support_format_cpio(a);
+#endif
+#ifndef NO_LOOKUP
+ archive_write_disk_set_standard_lookup(ext);
+#endif
+ if (filename != NULL && strcmp(filename, "-") == 0)
+ filename = NULL;
+ if ((r = archive_read_open_file(a, filename, 10240))) {
+ errmsg(archive_error_string(a));
+ errmsg("\n");
+ exit(r);
+ }
+ for (;;) {
+ r = archive_read_next_header(a, &entry);
+ if (r == ARCHIVE_EOF)
+ break;
+ if (r != ARCHIVE_OK) {
+ errmsg(archive_error_string(a));
+ errmsg("\n");
+ exit(1);
+ }
+ if (verbose && do_extract)
+ msg("x ");
+ if (verbose || !do_extract)
+ msg(archive_entry_pathname(entry));
+ if (do_extract) {
+ r = archive_write_header(ext, entry);
+ if (r != ARCHIVE_OK)
+ errmsg(archive_error_string(a));
+ else
+ copy_data(a, ext);
+ }
+ if (verbose || !do_extract)
+ msg("\n");
+ }
+ archive_read_close(a);
+ archive_read_finish(a);
+ exit(0);
+}
+
+static int
+copy_data(struct archive *ar, struct archive *aw)
+{
+ int r;
+ const void *buff;
+ size_t size;
+ off_t offset;
+
+ for (;;) {
+ r = archive_read_data_block(ar, &buff, &size, &offset);
+ if (r == ARCHIVE_EOF) {
+ errmsg(archive_error_string(ar));
+ return (ARCHIVE_OK);
+ }
+ if (r != ARCHIVE_OK)
+ return (r);
+ r = archive_write_data_block(aw, buff, size, offset);
+ if (r != ARCHIVE_OK) {
+ errmsg(archive_error_string(ar));
+ return (r);
+ }
+ }
+}
+
+static void
+msg(const char *m)
+{
+ write(1, m, strlen(m));
+}
+
+static void
+errmsg(const char *m)
+{
+ write(2, m, strlen(m));
+}
+
+static void
+usage(void)
+{
+/* Many program options depend on compile options. */
+ const char *m = "Usage: minitar [-"
+#ifndef NO_CREATE
+ "c"
+#endif
+#ifndef NO_BZIP2
+ "j"
+#endif
+ "tvx"
+#ifndef NO_BZIP2
+ "y"
+#endif
+#ifndef NO_COMPRESS
+ "Z"
+#endif
+#ifndef NO_GZIP
+ "z"
+#endif
+ "] [-f file] [file]\n";
+
+ errmsg(m);
+ exit(1);
+}
diff --git a/archivers/libarchive/files/examples/minitar/tree.c b/archivers/libarchive/files/examples/minitar/tree.c
new file mode 100644
index 00000000000..8af0b4d88e7
--- /dev/null
+++ b/archivers/libarchive/files/examples/minitar/tree.c
@@ -0,0 +1,423 @@
+/*-
+ * Copyright (c) 2003-2004 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
+ * 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.
+ */
+
+/*-
+ * There is a single list of "tree_entry" items that represent
+ * filesystem objects that require further attention. Non-directories
+ * are not kept in memory: they are pulled from readdir(), returned to
+ * the client, then freed as soon as possible. Any directory entry to
+ * be traversed gets pushed onto the stack.
+ *
+ * There is surprisingly little information that needs to be kept for
+ * each item on the stack. Just the name, depth (represented here as the
+ * string length of the parent directory's pathname), and some markers
+ * indicating how to get back to the parent (via chdir("..") for a
+ * regular dir or via fchdir(2) for a symlink).
+ */
+
+#include <sys/stat.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "tree.h"
+
+/*
+ * TODO:
+ * 1) Loop checking.
+ * 3) Arbitrary logical traversals by closing/reopening intermediate fds.
+ */
+
+struct tree_entry {
+ struct tree_entry *next;
+ char *name;
+ size_t dirname_length;
+ int fd;
+ int flags;
+};
+
+/* Definitions for tree_entry.flags bitmap. */
+#define isDir 1 /* This entry is a regular directory. */
+#define isDirLink 2 /* This entry is a symbolic link to a directory. */
+#define needsTraversal 4 /* This entry hasn't yet been traversed. */
+
+/*
+ * Local data for this package.
+ */
+struct tree {
+ struct tree_entry *stack;
+ DIR *d;
+ int initialDirFd;
+ int flags;
+
+ char *buff;
+ char *basename;
+ size_t buff_length;
+ size_t path_length;
+ size_t dirname_length;
+
+ int depth;
+ int openCount;
+ int maxOpenCount;
+
+ struct stat lst;
+ struct stat st;
+};
+
+/* Definitions for tree.flags bitmap. */
+#define needsReturn 8 /* Marks first entry as not having been returned yet. */
+#define hasStat 16 /* The st entry is set. */
+#define hasLstat 32 /* The lst entry is set. */
+
+
+#define HAVE_DIRENT_D_NAMLEN 1
+#ifdef HAVE_DIRENT_D_NAMLEN
+/* BSD extension; avoids need for a strlen() call. */
+#define D_NAMELEN(dp) (dp)->d_namlen
+#else
+#define D_NAMELEN(dp) (strlen((dp)->d_name))
+#endif
+
+#if 0
+static void
+dumpStack(struct tree *t)
+{
+ struct tree_entry *te;
+
+ printf("\tbuff: %s\n", t->buff);
+ printf("\tpwd: "); fflush(stdout); system("pwd");
+ printf("\tstack:\n");
+ for (te = t->stack; te != NULL; te = te->next) {
+ printf("\t\tte->name: %s %s\n", te->name, te->flags & needsTraversal ? "" : "*");
+ }
+}
+#endif
+
+/*
+ * Add a directory path to the current stack.
+ */
+static void
+tree_add(struct tree *t, const char *path)
+{
+ struct tree_entry *te;
+
+ te = malloc(sizeof(*te));
+ memset(te, 0, sizeof(*te));
+ te->next = t->stack;
+ t->stack = te;
+ te->fd = -1;
+ te->name = strdup(path);
+ te->flags = needsTraversal;
+ te->dirname_length = t->dirname_length;
+}
+
+/*
+ * Append a name to the current path.
+ */
+static void
+tree_append(struct tree *t, const char *name, size_t name_length)
+{
+ if (t->buff != NULL)
+ t->buff[t->dirname_length] = '\0';
+
+ /* Resize pathname buffer as needed. */
+ while (name_length + 1 + t->dirname_length >= t->buff_length) {
+ t->buff_length *= 2;
+ if (t->buff_length < 1024)
+ t->buff_length = 1024;
+ t->buff = realloc(t->buff, t->buff_length);
+ }
+ t->basename = t->buff + t->dirname_length;
+ t->path_length = t->dirname_length + name_length;
+ if (t->dirname_length > 0) {
+ *t->basename++ = '/';
+ t->path_length ++;
+ }
+ strcpy(t->basename, name);
+}
+
+/*
+ * Open a directory tree for traversal.
+ */
+struct tree *
+tree_open(const char *path)
+{
+ struct tree *t;
+
+ t = malloc(sizeof(*t));
+ memset(t, 0, sizeof(*t));
+ tree_append(t, path, strlen(path));
+ t->initialDirFd = open(".", O_RDONLY);
+ /*
+ * During most of the traversal, items are set up and then
+ * returned immediately from tree_next(). That doesn't work
+ * for the very first entry, so we set a flag for this special
+ * case.
+ */
+ t->flags = needsReturn;
+ return (t);
+}
+
+/*
+ * We've finished a directory; ascend back to the parent.
+ */
+static void
+tree_ascend(struct tree *t)
+{
+ struct tree_entry *te;
+
+ te = t->stack;
+ t->depth--;
+ if (te->flags & isDirLink) {
+ fchdir(te->fd);
+ close(te->fd);
+ t->openCount--;
+ } else {
+ chdir("..");
+ }
+}
+
+/*
+ * Pop the working stack.
+ */
+static void
+tree_pop(struct tree *t)
+{
+ struct tree_entry *te;
+
+ te = t->stack;
+ t->stack = te->next;
+ t->dirname_length = te->dirname_length;
+ free(te->name);
+ free(te);
+}
+
+/*
+ * Get the next item in the tree traversal.
+ */
+int
+tree_next(struct tree *t)
+{
+ struct dirent *de = NULL;
+
+ /* Handle the startup case by returning the initial entry. */
+ if (t->flags & needsReturn) {
+ t->flags &= ~needsReturn;
+ return (1);
+ }
+
+ while (t->stack != NULL) {
+ /* If there's an open dir, get the next entry from there. */
+ while (t->d != NULL) {
+ de = readdir(t->d);
+ if (de == NULL) {
+ closedir(t->d);
+ t->d = NULL;
+ } else if (de->d_name[0] == '.'
+ && de->d_name[1] == '\0') {
+ /* Skip '.' */
+ } else if (de->d_name[0] == '.'
+ && de->d_name[1] == '.'
+ && de->d_name[2] == '\0') {
+ /* Skip '..' */
+ } else {
+ /*
+ * Append the path to the current path
+ * and return it.
+ */
+ tree_append(t, de->d_name, D_NAMELEN(de));
+ t->flags &= ~hasLstat;
+ t->flags &= ~hasStat;
+ return (1);
+ }
+ }
+
+ /* If the current dir needs to be traversed, set it up. */
+ if (t->stack->flags & needsTraversal) {
+ tree_append(t, t->stack->name, strlen(t->stack->name));
+ t->stack->flags &= ~needsTraversal;
+ /* If it is a link, set up fd for the ascent. */
+ if (t->stack->flags & isDirLink) {
+ t->stack->fd = open(".", O_RDONLY);
+ t->openCount++;
+ if (t->openCount > t->maxOpenCount)
+ t->maxOpenCount = t->openCount;
+ }
+ if (chdir(t->stack->name) == 0) {
+ t->depth++;
+ t->dirname_length = t->path_length;
+ t->d = opendir(".");
+ } else
+ tree_pop(t);
+ continue;
+ }
+
+ /* We've done everything necessary for the top stack entry. */
+ tree_ascend(t);
+ tree_pop(t);
+ }
+ return (0);
+}
+
+/*
+ * Called by the client to mark the directory just returned from
+ * tree_next() as needing to be visited.
+ */
+void
+tree_descend(struct tree *t)
+{
+ const struct stat *s = tree_current_lstat(t);
+
+ if (S_ISDIR(s->st_mode)) {
+ tree_add(t, t->basename);
+ t->stack->flags |= isDir;
+ }
+
+ if (S_ISLNK(s->st_mode) && S_ISDIR(tree_current_stat(t)->st_mode)) {
+ tree_add(t, t->basename);
+ t->stack->flags |= isDirLink;
+ }
+}
+
+/*
+ * Get the stat() data for the entry just returned from tree_next().
+ */
+const struct stat *
+tree_current_stat(struct tree *t)
+{
+ if (!(t->flags & hasStat)) {
+ stat(t->basename, &t->st);
+ t->flags |= hasStat;
+ }
+ return (&t->st);
+}
+
+/*
+ * Get the lstat() data for the entry just returned from tree_next().
+ */
+const struct stat *
+tree_current_lstat(struct tree *t)
+{
+ if (!(t->flags & hasLstat)) {
+ lstat(t->basename, &t->lst);
+ t->flags |= hasLstat;
+ }
+ return (&t->lst);
+}
+
+/*
+ * Return the access path for the entry just returned from tree_next().
+ */
+const char *
+tree_current_access_path(struct tree *t)
+{
+ return (t->basename);
+}
+
+/*
+ * Return the full path for the entry just returned from tree_next().
+ */
+const char *
+tree_current_path(struct tree *t)
+{
+ return (t->buff);
+}
+
+/*
+ * Return the length of the path for the entry just returned from tree_next().
+ */
+size_t
+tree_current_pathlen(struct tree *t)
+{
+ return (t->path_length);
+}
+
+/*
+ * Return the nesting depth of the entry just returned from tree_next().
+ */
+int
+tree_current_depth(struct tree *t)
+{
+ return (t->depth);
+}
+
+/*
+ * Terminate the traversal and release any resources.
+ */
+void
+tree_close(struct tree *t)
+{
+ /* Release anything remaining in the stack. */
+ while (t->stack != NULL)
+ tree_pop(t);
+ if (t->buff)
+ free(t->buff);
+ /* chdir() back to where we started. */
+ if (t->initialDirFd >= 0) {
+ fchdir(t->initialDirFd);
+ close(t->initialDirFd);
+ t->initialDirFd = -1;
+ }
+ free(t);
+}
+
+
+#if 0
+/* Main function for testing. */
+#include <stdio.h>
+
+int main(int argc, char **argv)
+{
+ size_t max_path_len = 0;
+ int max_depth = 0;
+
+ system("pwd");
+ while (*++argv) {
+ struct tree *t = tree_open(*argv);
+ while (tree_next(t)) {
+ size_t path_len = tree_current_pathlen(t);
+ int depth = tree_current_depth(t);
+ if (path_len > max_path_len)
+ max_path_len = path_len;
+ if (depth > max_depth)
+ max_depth = depth;
+ printf("%s\n", tree_current_path(t));
+ if (S_ISDIR(tree_current_lstat(t)->st_mode))
+ tree_descend(t); /* Descend into every dir. */
+ }
+ tree_close(t);
+ printf("Max path length: %d\n", max_path_len);
+ printf("Max depth: %d\n", max_depth);
+ printf("Final open count: %d\n", t->openCount);
+ printf("Max open count: %d\n", t->maxOpenCount);
+ fflush(stdout);
+ system("pwd");
+ }
+ return (0);
+}
+#endif
diff --git a/archivers/libarchive/files/examples/minitar/tree.h b/archivers/libarchive/files/examples/minitar/tree.h
new file mode 100644
index 00000000000..554e6c2da21
--- /dev/null
+++ b/archivers/libarchive/files/examples/minitar/tree.h
@@ -0,0 +1,78 @@
+/*-
+ * Copyright (c) 2003-2004 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
+ * 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.
+ */
+
+/*-
+ * A set of routines for traversing directory trees.
+ * Similar in concept to the fts library, but with a few
+ * important differences:
+ * * Uses less memory. In particular, fts stores an entire directory
+ * in memory at a time. This package only keeps enough subdirectory
+ * information in memory to track the traversal. Information
+ * about non-directories is discarded as soon as possible.
+ * * Supports very deep logical traversals. The fts package
+ * uses "non-chdir" approach for logical traversals. This
+ * package does use a chdir approach for logical traversals
+ * and can therefore handle pathnames much longer than
+ * PATH_MAX.
+ * * Supports deep physical traversals "out of the box."
+ * Due to the memory optimizations above, there's no need to
+ * limit dir names to 32k.
+ */
+
+#include <sys/stat.h>
+
+struct tree;
+
+struct tree *tree_open(const char *);
+/* Returns TRUE if there is a next entry. Zero if there is no next entry. */
+int tree_next(struct tree *);
+/* Return information about the current entry. */
+int tree_current_depth(struct tree *);
+/*
+ * The current full pathname, length of the full pathname,
+ * and a name that can be used to access the file.
+ * Because tree does use chdir extensively, the access path is
+ * almost never the same as the full current path.
+ */
+const char *tree_current_path(struct tree *);
+size_t tree_current_pathlen(struct tree *);
+const char *tree_current_access_path(struct tree *);
+/*
+ * Request the lstat() or stat() data for the current path.
+ * Since the tree package needs to do some of this anyway,
+ * you should take advantage of it here if you need it.
+ */
+const struct stat *tree_current_stat(struct tree *);
+const struct stat *tree_current_lstat(struct tree *);
+/*
+ * Request that current entry be visited. If you invoke it on every
+ * directory, you'll get a physical traversal. This is ignored if the
+ * current entry isn't a directory or a link to a directory. So, if
+ * you invoke this on every returned path, you'll get a full logical
+ * traversal.
+ */
+void tree_descend(struct tree *);
+void tree_close(struct tree *);
diff --git a/archivers/libarchive/files/examples/tarfilter.c b/archivers/libarchive/files/examples/tarfilter.c
new file mode 100644
index 00000000000..b7e08cfc1da
--- /dev/null
+++ b/archivers/libarchive/files/examples/tarfilter.c
@@ -0,0 +1,113 @@
+/*
+ * This file is in the public domain.
+ *
+ * Feel free to use it as you wish.
+ */
+
+/*
+ * This example program reads an archive from stdin (which can be in
+ * any format recognized by libarchive) and writes certain entries to
+ * an uncompressed ustar archive on stdout. This is a template for
+ * many kinds of archive manipulation: converting formats, resetting
+ * ownership, inserting entries, removing entries, etc.
+ *
+ * To compile:
+ * gcc -Wall -o tarfilter tarfilter.c -larchive -lz -lbz2
+ */
+
+#include <sys/stat.h>
+#include <archive.h>
+#include <archive_entry.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+static void
+die(char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fprintf(stderr, "\n");
+ exit(1);
+}
+
+int
+main(int argc, char **argv)
+{
+ char buff[8192];
+ ssize_t len;
+ int r;
+ mode_t m;
+ struct archive *ina;
+ struct archive *outa;
+ struct archive_entry *entry;
+
+ /* Read an archive from stdin, with automatic format detection. */
+ ina = archive_read_new();
+ if (ina == NULL)
+ die("Couldn't create archive reader.");
+ if (archive_read_support_compression_all(ina) != ARCHIVE_OK)
+ die("Couldn't enable decompression");
+ if (archive_read_support_format_all(ina) != ARCHIVE_OK)
+ die("Couldn't enable read formats");
+ if (archive_read_open_fd(ina, 0, 10240) != ARCHIVE_OK)
+ die("Couldn't open input archive");
+
+ /* Write an uncompressed ustar archive to stdout. */
+ outa = archive_write_new();
+ if (outa == NULL)
+ die("Couldn't create archive writer.");
+ if (archive_write_set_compression_none(outa) != ARCHIVE_OK)
+ die("Couldn't enable compression");
+ if (archive_write_set_format_ustar(outa) != ARCHIVE_OK)
+ die("Couldn't set output format");
+ if (archive_write_open_fd(outa, 1) != ARCHIVE_OK)
+ die("Couldn't open output archive");
+
+ /* Examine each entry in the input archive. */
+ while ((r = archive_read_next_header(ina, &entry)) == ARCHIVE_OK) {
+ fprintf(stderr, "%s: ", archive_entry_pathname(entry));
+
+ /* Skip anything that isn't a regular file. */
+ if (!S_ISREG(archive_entry_mode(entry))) {
+ fprintf(stderr, "skipped\n");
+ continue;
+ }
+
+ /* Make everything owned by root/wheel. */
+ archive_entry_set_uid(entry, 0);
+ archive_entry_set_uname(entry, "root");
+ archive_entry_set_gid(entry, 0);
+ archive_entry_set_gname(entry, "wheel");
+
+ /* Make everything permission 0744, strip SUID, etc. */
+ m = archive_entry_mode(entry);
+ archive_entry_set_mode(entry, (m & ~07777) | 0744);
+
+ /* Copy input entries to output archive. */
+ if (archive_write_header(outa, entry) != ARCHIVE_OK)
+ die("Error writing output archive");
+ if (archive_entry_size(entry) > 0) {
+ len = archive_read_data(ina, buff, sizeof(buff));
+ while (len > 0) {
+ if (archive_write_data(outa, buff, len) != len)
+ die("Error writing output archive");
+ len = archive_read_data(ina, buff, sizeof(buff));
+ }
+ if (len < 0)
+ die("Error reading input archive");
+ }
+ fprintf(stderr, "copied\n");
+ }
+ if (r != ARCHIVE_EOF)
+ die("Error reading archive");
+ /* Close the archives. */
+ if (archive_read_finish(ina) != ARCHIVE_OK)
+ die("Error closing input archive");
+ if (archive_write_finish(outa) != ARCHIVE_OK)
+ die("Error closing output archive");
+ return (0);
+}
diff --git a/archivers/libarchive/files/examples/untar.c b/archivers/libarchive/files/examples/untar.c
new file mode 100644
index 00000000000..e77adf70125
--- /dev/null
+++ b/archivers/libarchive/files/examples/untar.c
@@ -0,0 +1,262 @@
+/*
+ * This file is in the public domain.
+ * Use it as you wish.
+ */
+
+/*
+ * This is a compact tar extraction program using libarchive whose
+ * primary goal is small executable size. Statically linked, it can
+ * be very small, depending in large part on how cleanly factored your
+ * system libraries are. Note that this uses the standard libarchive,
+ * without any special recompilation. The only functional concession
+ * is that this program uses the uid/gid from the archive instead of
+ * doing uname/gname lookups. (Add a call to
+ * archive_write_disk_set_standard_lookup() to enable uname/gname
+ * lookups, but be aware that this can add 500k or more to a static
+ * executable, depending on the system libraries, since user/group
+ * lookups frequently pull in password, YP/LDAP, networking, and DNS
+ * resolver libraries.)
+ *
+ * To build:
+ * $ gcc -static -Wall -o untar untar.c -larchive
+ * $ strip untar
+ *
+ * NOTE: On some systems, you may need to add additional flags
+ * to ensure that untar.c is compiled the same way as libarchive
+ * was compiled. In particular, Linux users will probably
+ * have to add -D_FILE_OFFSET_BITS=64 to the command line above.
+ *
+ * For fun, statically compile the following simple hello.c program
+ * using the same flags as for untar and compare the size:
+ *
+ * #include <stdio.h>
+ * int main(int argc, char **argv) {
+ * printf("hello, world\n");
+ * return(0);
+ * }
+ *
+ * You may be even more surprised by the compiled size of true.c listed here:
+ *
+ * int main(int argc, char **argv) {
+ * return (0);
+ * }
+ *
+ * On a slightly customized FreeBSD 5 system that I used around
+ * 2005, hello above compiled to 89k compared to untar of 69k. So at
+ * that time, libarchive's tar reader and extract-to-disk routines
+ * compiled to less code than printf().
+ *
+ * On my FreeBSD development system today (August, 2009):
+ * hello: 195024 bytes
+ * true: 194912 bytes
+ * untar: 259924 bytes
+ */
+
+#include <sys/types.h>
+__FBSDID("$FreeBSD$");
+
+#include <sys/stat.h>
+
+#include <archive.h>
+#include <archive_entry.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+static void errmsg(const char *);
+static void extract(const char *filename, int do_extract, int flags);
+static void fail(const char *, const char *, int);
+static int copy_data(struct archive *, struct archive *);
+static void msg(const char *);
+static void usage(void);
+static void warn(const char *, const char *);
+
+static int verbose = 0;
+
+int
+main(int argc, const char **argv)
+{
+ const char *filename = NULL;
+ int compress, flags, mode, opt;
+
+ (void)argc;
+ mode = 'x';
+ verbose = 0;
+ compress = '\0';
+ flags = ARCHIVE_EXTRACT_TIME;
+
+ /* Among other sins, getopt(3) pulls in printf(3). */
+ while (*++argv != NULL && **argv == '-') {
+ const char *p = *argv + 1;
+
+ while ((opt = *p++) != '\0') {
+ switch (opt) {
+ case 'f':
+ if (*p != '\0')
+ filename = p;
+ else
+ filename = *++argv;
+ p += strlen(p);
+ break;
+ case 'p':
+ flags |= ARCHIVE_EXTRACT_PERM;
+ flags |= ARCHIVE_EXTRACT_ACL;
+ flags |= ARCHIVE_EXTRACT_FFLAGS;
+ break;
+ case 't':
+ mode = opt;
+ break;
+ case 'v':
+ verbose++;
+ break;
+ case 'x':
+ mode = opt;
+ break;
+ default:
+ usage();
+ }
+ }
+ }
+
+ switch (mode) {
+ case 't':
+ extract(filename, 0, flags);
+ break;
+ case 'x':
+ extract(filename, 1, flags);
+ break;
+ }
+
+ return (0);
+}
+
+
+static void
+extract(const char *filename, int do_extract, int flags)
+{
+ struct archive *a;
+ struct archive *ext;
+ struct archive_entry *entry;
+ int r;
+
+ a = archive_read_new();
+ ext = archive_write_disk_new();
+ archive_write_disk_set_options(ext, flags);
+ /*
+ * Note: archive_write_disk_set_standard_lookup() is useful
+ * here, but it requires library routines that can add 500k or
+ * more to a static executable.
+ */
+ archive_read_support_format_tar(a);
+ /*
+ * On my system, enabling other archive formats adds 20k-30k
+ * each. Enabling gzip decompression adds about 20k.
+ * Enabling bzip2 is more expensive because the libbz2 library
+ * isn't very well factored.
+ */
+ if (filename != NULL && strcmp(filename, "-") == 0)
+ filename = NULL;
+ if ((r = archive_read_open_file(a, filename, 10240)))
+ fail("archive_read_open_file()",
+ archive_error_string(a), r);
+ for (;;) {
+ r = archive_read_next_header(a, &entry);
+ if (r == ARCHIVE_EOF)
+ break;
+ if (r != ARCHIVE_OK)
+ fail("archive_read_next_header()",
+ archive_error_string(a), 1);
+ if (verbose && do_extract)
+ msg("x ");
+ if (verbose || !do_extract)
+ msg(archive_entry_pathname(entry));
+ if (do_extract) {
+ r = archive_write_header(ext, entry);
+ if (r != ARCHIVE_OK)
+ warn("archive_write_header()",
+ archive_error_string(ext));
+ else {
+ copy_data(a, ext);
+ r = archive_write_finish_entry(ext);
+ if (r != ARCHIVE_OK)
+ fail("archive_write_finish_entry()",
+ archive_error_string(ext), 1);
+ }
+
+ }
+ if (verbose || !do_extract)
+ msg("\n");
+ }
+ archive_read_close(a);
+ archive_read_finish(a);
+ exit(0);
+}
+
+static int
+copy_data(struct archive *ar, struct archive *aw)
+{
+ int r;
+ const void *buff;
+ size_t size;
+ off_t offset;
+
+ for (;;) {
+ r = archive_read_data_block(ar, &buff, &size, &offset);
+ if (r == ARCHIVE_EOF)
+ return (ARCHIVE_OK);
+ if (r != ARCHIVE_OK)
+ return (r);
+ r = archive_write_data_block(aw, buff, size, offset);
+ if (r != ARCHIVE_OK) {
+ warn("archive_write_data_block()",
+ archive_error_string(aw));
+ return (r);
+ }
+ }
+}
+
+/*
+ * These reporting functions use low-level I/O; on some systems, this
+ * is a significant code reduction. Of course, on many server and
+ * desktop operating systems, malloc() and even crt rely on printf(),
+ * which in turn pulls in most of the rest of stdio, so this is not an
+ * optimization at all there. (If you're going to pay 100k or more
+ * for printf() anyway, you may as well use it!)
+ */
+static void
+msg(const char *m)
+{
+ write(1, m, strlen(m));
+}
+
+static void
+errmsg(const char *m)
+{
+ write(2, m, strlen(m));
+}
+
+static void
+warn(const char *f, const char *m)
+{
+ errmsg(f);
+ errmsg(" failed: ");
+ errmsg(m);
+ errmsg("\n");
+}
+
+static void
+fail(const char *f, const char *m, int r)
+{
+ warn(f, m);
+ exit(r);
+}
+
+static void
+usage(void)
+{
+ const char *m = "Usage: untar [-tvx] [-f file] [file]\n";
+ errmsg(m);
+ exit(1);
+}
diff --git a/archivers/libarchive/files/libarchive/archive.h b/archivers/libarchive/files/libarchive/archive.h
new file mode 100644
index 00000000000..53851c6e149
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive.h
@@ -0,0 +1,741 @@
+/*-
+ * 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/lib/libarchive/archive.h.in,v 1.50 2008/05/26 17:00:22 kientzle Exp $
+ */
+
+#ifndef ARCHIVE_H_INCLUDED
+#define ARCHIVE_H_INCLUDED
+
+/*
+ * Note: archive.h is for use outside of libarchive; the configuration
+ * headers (config.h, archive_platform.h, etc.) are purely internal.
+ * Do NOT use HAVE_XXX configuration macros to control the behavior of
+ * this header! If you must conditionalize, use predefined compiler and/or
+ * platform macros.
+ */
+#if defined(__BORLANDC__) && __BORLANDC__ >= 0x560
+# define __LA_STDINT_H <stdint.h>
+#elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__)
+# define __LA_STDINT_H <inttypes.h>
+#endif
+
+#include <sys/stat.h>
+#include <sys/types.h> /* Linux requires this for off_t */
+#ifdef __LA_STDINT_H
+# include __LA_STDINT_H /* int64_t, etc. */
+#endif
+#include <stdio.h> /* For FILE * */
+
+/* Get appropriate definitions of standard POSIX-style types. */
+/* These should match the types used in 'struct stat' */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define __LA_INT64_T __int64
+# if defined(_SSIZE_T_DEFINED)
+# define __LA_SSIZE_T ssize_t
+# elif defined(_WIN64)
+# define __LA_SSIZE_T __int64
+# else
+# define __LA_SSIZE_T long
+# endif
+# if defined(__BORLANDC__)
+# define __LA_UID_T uid_t
+# define __LA_GID_T gid_t
+# else
+# define __LA_UID_T short
+# define __LA_GID_T short
+# endif
+#else
+#include <unistd.h> /* ssize_t, uid_t, and gid_t */
+#define __LA_INT64_T int64_t
+#define __LA_SSIZE_T ssize_t
+#define __LA_UID_T uid_t
+#define __LA_GID_T gid_t
+#endif
+
+/*
+ * On Windows, define LIBARCHIVE_STATIC if you're building or using a
+ * .lib. The default here assumes you're building a DLL. Only
+ * libarchive source should ever define __LIBARCHIVE_BUILD.
+ */
+#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)
+# ifdef __LIBARCHIVE_BUILD
+# ifdef __GNUC__
+# define __LA_DECL __attribute__((dllexport)) extern
+# else
+# define __LA_DECL __declspec(dllexport)
+# endif
+# else
+# ifdef __GNUC__
+# define __LA_DECL __attribute__((dllimport)) extern
+# else
+# define __LA_DECL __declspec(dllimport)
+# endif
+# endif
+#else
+/* Static libraries or non-Windows needs no special declaration. */
+# define __LA_DECL
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * The version number is provided as both a macro and a function.
+ * The macro identifies the installed header; the function identifies
+ * the library version (which may not be the same if you're using a
+ * dynamically-linked version of the library). Of course, if the
+ * header and library are very different, you should expect some
+ * strangeness. Don't do that.
+ */
+
+/*
+ * The version number is expressed as a single integer that makes it
+ * easy to compare versions at build time: for version a.b.c, the
+ * version number is printf("%d%03d%03d",a,b,c). For example, if you
+ * know your application requires version 2.12.108 or later, you can
+ * assert that ARCHIVE_VERSION >= 2012108.
+ *
+ * This single-number format was introduced with libarchive 1.9.0 in
+ * the libarchive 1.x family and libarchive 2.2.4 in the libarchive
+ * 2.x family. The following may be useful if you really want to do
+ * feature detection for earlier libarchive versions (which defined
+ * ARCHIVE_API_VERSION and ARCHIVE_API_FEATURE instead):
+ *
+ * #ifndef ARCHIVE_VERSION_NUMBER
+ * #define ARCHIVE_VERSION_NUMBER \
+ * (ARCHIVE_API_VERSION * 1000000 + ARCHIVE_API_FEATURE * 1000)
+ * #endif
+ */
+#define ARCHIVE_VERSION_NUMBER 2008000
+__LA_DECL int archive_version_number(void);
+
+/*
+ * Textual name/version of the library, useful for version displays.
+ */
+#define ARCHIVE_VERSION_STRING "libarchive 2.8.0"
+__LA_DECL const char * archive_version_string(void);
+
+#if ARCHIVE_VERSION_NUMBER < 3000000
+/*
+ * Deprecated; these are older names that will be removed in favor of
+ * the simpler definitions above.
+ */
+#define ARCHIVE_VERSION_STAMP ARCHIVE_VERSION_NUMBER
+__LA_DECL int archive_version_stamp(void);
+#define ARCHIVE_LIBRARY_VERSION ARCHIVE_VERSION_STRING
+__LA_DECL const char * archive_version(void);
+#define ARCHIVE_API_VERSION (ARCHIVE_VERSION_NUMBER / 1000000)
+__LA_DECL int archive_api_version(void);
+#define ARCHIVE_API_FEATURE ((ARCHIVE_VERSION_NUMBER / 1000) % 1000)
+__LA_DECL int archive_api_feature(void);
+#endif
+
+#if ARCHIVE_VERSION_NUMBER < 3000000
+/* This should never have been here in the first place. */
+/* Legacy of old tar assumptions, will be removed in libarchive 3.0. */
+#define ARCHIVE_BYTES_PER_RECORD 512
+#define ARCHIVE_DEFAULT_BYTES_PER_BLOCK 10240
+#endif
+
+/* Declare our basic types. */
+struct archive;
+struct archive_entry;
+
+/*
+ * Error codes: Use archive_errno() and archive_error_string()
+ * to retrieve details. Unless specified otherwise, all functions
+ * that return 'int' use these codes.
+ */
+#define ARCHIVE_EOF 1 /* Found end of archive. */
+#define ARCHIVE_OK 0 /* Operation was successful. */
+#define ARCHIVE_RETRY (-10) /* Retry might succeed. */
+#define ARCHIVE_WARN (-20) /* Partial success. */
+/* For example, if write_header "fails", then you can't push data. */
+#define ARCHIVE_FAILED (-25) /* Current operation cannot complete. */
+/* But if write_header is "fatal," then this archive is dead and useless. */
+#define ARCHIVE_FATAL (-30) /* No more operations are possible. */
+
+/*
+ * As far as possible, archive_errno returns standard platform errno codes.
+ * Of course, the details vary by platform, so the actual definitions
+ * here are stored in "archive_platform.h". The symbols are listed here
+ * for reference; as a rule, clients should not need to know the exact
+ * platform-dependent error code.
+ */
+/* Unrecognized or invalid file format. */
+/* #define ARCHIVE_ERRNO_FILE_FORMAT */
+/* Illegal usage of the library. */
+/* #define ARCHIVE_ERRNO_PROGRAMMER_ERROR */
+/* Unknown or unclassified error. */
+/* #define ARCHIVE_ERRNO_MISC */
+
+/*
+ * Callbacks are invoked to automatically read/skip/write/open/close the
+ * archive. You can provide your own for complex tasks (like breaking
+ * archives across multiple tapes) or use standard ones built into the
+ * library.
+ */
+
+/* Returns pointer and size of next block of data from archive. */
+typedef __LA_SSIZE_T archive_read_callback(struct archive *,
+ void *_client_data, const void **_buffer);
+
+/* Skips at most request bytes from archive and returns the skipped amount */
+#if ARCHIVE_VERSION_NUMBER < 2000000
+/* Libarchive 1.0 used ssize_t for the return, which is only 32 bits
+ * on most 32-bit platforms; not large enough. */
+typedef __LA_SSIZE_T archive_skip_callback(struct archive *,
+ void *_client_data, size_t request);
+#elif ARCHIVE_VERSION_NUMBER < 3000000
+/* Libarchive 2.0 used off_t here, but that is a bad idea on Linux and a
+ * few other platforms where off_t varies with build settings. */
+typedef off_t archive_skip_callback(struct archive *,
+ void *_client_data, off_t request);
+#else
+/* Libarchive 3.0 uses int64_t here, which is actually guaranteed to be
+ * 64 bits on every platform. */
+typedef __LA_INT64_T archive_skip_callback(struct archive *,
+ void *_client_data, __LA_INT64_T request);
+#endif
+
+/* Returns size actually written, zero on EOF, -1 on error. */
+typedef __LA_SSIZE_T archive_write_callback(struct archive *,
+ void *_client_data,
+ const void *_buffer, size_t _length);
+
+#if ARCHIVE_VERSION_NUMBER < 3000000
+/* Open callback is actually never needed; remove it in libarchive 3.0. */
+typedef int archive_open_callback(struct archive *, void *_client_data);
+#endif
+
+typedef int archive_close_callback(struct archive *, void *_client_data);
+
+/*
+ * Codes for archive_compression.
+ */
+#define ARCHIVE_COMPRESSION_NONE 0
+#define ARCHIVE_COMPRESSION_GZIP 1
+#define ARCHIVE_COMPRESSION_BZIP2 2
+#define ARCHIVE_COMPRESSION_COMPRESS 3
+#define ARCHIVE_COMPRESSION_PROGRAM 4
+#define ARCHIVE_COMPRESSION_LZMA 5
+#define ARCHIVE_COMPRESSION_XZ 6
+#define ARCHIVE_COMPRESSION_UU 7
+#define ARCHIVE_COMPRESSION_RPM 8
+
+/*
+ * Codes returned by archive_format.
+ *
+ * Top 16 bits identifies the format family (e.g., "tar"); lower
+ * 16 bits indicate the variant. This is updated by read_next_header.
+ * Note that the lower 16 bits will often vary from entry to entry.
+ * In some cases, this variation occurs as libarchive learns more about
+ * the archive (for example, later entries might utilize extensions that
+ * weren't necessary earlier in the archive; in this case, libarchive
+ * will change the format code to indicate the extended format that
+ * was used). In other cases, it's because different tools have
+ * modified the archive and so different parts of the archive
+ * actually have slightly different formts. (Both tar and cpio store
+ * format codes in each entry, so it is quite possible for each
+ * entry to be in a different format.)
+ */
+#define ARCHIVE_FORMAT_BASE_MASK 0xff0000
+#define ARCHIVE_FORMAT_CPIO 0x10000
+#define ARCHIVE_FORMAT_CPIO_POSIX (ARCHIVE_FORMAT_CPIO | 1)
+#define ARCHIVE_FORMAT_CPIO_BIN_LE (ARCHIVE_FORMAT_CPIO | 2)
+#define ARCHIVE_FORMAT_CPIO_BIN_BE (ARCHIVE_FORMAT_CPIO | 3)
+#define ARCHIVE_FORMAT_CPIO_SVR4_NOCRC (ARCHIVE_FORMAT_CPIO | 4)
+#define ARCHIVE_FORMAT_CPIO_SVR4_CRC (ARCHIVE_FORMAT_CPIO | 5)
+#define ARCHIVE_FORMAT_SHAR 0x20000
+#define ARCHIVE_FORMAT_SHAR_BASE (ARCHIVE_FORMAT_SHAR | 1)
+#define ARCHIVE_FORMAT_SHAR_DUMP (ARCHIVE_FORMAT_SHAR | 2)
+#define ARCHIVE_FORMAT_TAR 0x30000
+#define ARCHIVE_FORMAT_TAR_USTAR (ARCHIVE_FORMAT_TAR | 1)
+#define ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE (ARCHIVE_FORMAT_TAR | 2)
+#define ARCHIVE_FORMAT_TAR_PAX_RESTRICTED (ARCHIVE_FORMAT_TAR | 3)
+#define ARCHIVE_FORMAT_TAR_GNUTAR (ARCHIVE_FORMAT_TAR | 4)
+#define ARCHIVE_FORMAT_ISO9660 0x40000
+#define ARCHIVE_FORMAT_ISO9660_ROCKRIDGE (ARCHIVE_FORMAT_ISO9660 | 1)
+#define ARCHIVE_FORMAT_ZIP 0x50000
+#define ARCHIVE_FORMAT_EMPTY 0x60000
+#define ARCHIVE_FORMAT_AR 0x70000
+#define ARCHIVE_FORMAT_AR_GNU (ARCHIVE_FORMAT_AR | 1)
+#define ARCHIVE_FORMAT_AR_BSD (ARCHIVE_FORMAT_AR | 2)
+#define ARCHIVE_FORMAT_MTREE 0x80000
+#define ARCHIVE_FORMAT_RAW 0x90000
+#define ARCHIVE_FORMAT_XAR 0xA0000
+
+/*-
+ * Basic outline for reading an archive:
+ * 1) Ask archive_read_new for an archive reader object.
+ * 2) Update any global properties as appropriate.
+ * In particular, you'll certainly want to call appropriate
+ * archive_read_support_XXX functions.
+ * 3) Call archive_read_open_XXX to open the archive
+ * 4) Repeatedly call archive_read_next_header to get information about
+ * successive archive entries. Call archive_read_data to extract
+ * data for entries of interest.
+ * 5) Call archive_read_finish to end processing.
+ */
+__LA_DECL struct archive *archive_read_new(void);
+
+/*
+ * The archive_read_support_XXX calls enable auto-detect for this
+ * archive handle. They also link in the necessary support code.
+ * For example, if you don't want bzlib linked in, don't invoke
+ * support_compression_bzip2(). The "all" functions provide the
+ * obvious shorthand.
+ */
+__LA_DECL int archive_read_support_compression_all(struct archive *);
+__LA_DECL int archive_read_support_compression_bzip2(struct archive *);
+__LA_DECL int archive_read_support_compression_compress(struct archive *);
+__LA_DECL int archive_read_support_compression_gzip(struct archive *);
+__LA_DECL int archive_read_support_compression_lzma(struct archive *);
+__LA_DECL int archive_read_support_compression_none(struct archive *);
+__LA_DECL int archive_read_support_compression_program(struct archive *,
+ const char *command);
+__LA_DECL int archive_read_support_compression_program_signature
+ (struct archive *, const char *,
+ const void * /* match */, size_t);
+
+__LA_DECL int archive_read_support_compression_rpm(struct archive *);
+__LA_DECL int archive_read_support_compression_uu(struct archive *);
+__LA_DECL int archive_read_support_compression_xz(struct archive *);
+
+__LA_DECL int archive_read_support_format_all(struct archive *);
+__LA_DECL int archive_read_support_format_ar(struct archive *);
+__LA_DECL int archive_read_support_format_cpio(struct archive *);
+__LA_DECL int archive_read_support_format_empty(struct archive *);
+__LA_DECL int archive_read_support_format_gnutar(struct archive *);
+__LA_DECL int archive_read_support_format_iso9660(struct archive *);
+__LA_DECL int archive_read_support_format_mtree(struct archive *);
+__LA_DECL int archive_read_support_format_raw(struct archive *);
+__LA_DECL int archive_read_support_format_tar(struct archive *);
+__LA_DECL int archive_read_support_format_xar(struct archive *);
+__LA_DECL int archive_read_support_format_zip(struct archive *);
+
+
+/* Open the archive using callbacks for archive I/O. */
+__LA_DECL int archive_read_open(struct archive *, void *_client_data,
+ archive_open_callback *, archive_read_callback *,
+ archive_close_callback *);
+__LA_DECL int archive_read_open2(struct archive *, void *_client_data,
+ archive_open_callback *, archive_read_callback *,
+ archive_skip_callback *, archive_close_callback *);
+
+/*
+ * A variety of shortcuts that invoke archive_read_open() with
+ * canned callbacks suitable for common situations. The ones that
+ * accept a block size handle tape blocking correctly.
+ */
+/* Use this if you know the filename. Note: NULL indicates stdin. */
+__LA_DECL int archive_read_open_filename(struct archive *,
+ const char *_filename, size_t _block_size);
+/* archive_read_open_file() is a deprecated synonym for ..._open_filename(). */
+__LA_DECL int archive_read_open_file(struct archive *,
+ const char *_filename, size_t _block_size);
+/* Read an archive that's stored in memory. */
+__LA_DECL int archive_read_open_memory(struct archive *,
+ void * buff, size_t size);
+/* A more involved version that is only used for internal testing. */
+__LA_DECL int archive_read_open_memory2(struct archive *a, void *buff,
+ size_t size, size_t read_size);
+/* Read an archive that's already open, using the file descriptor. */
+__LA_DECL int archive_read_open_fd(struct archive *, int _fd,
+ size_t _block_size);
+/* Read an archive that's already open, using a FILE *. */
+/* Note: DO NOT use this with tape drives. */
+__LA_DECL int archive_read_open_FILE(struct archive *, FILE *_file);
+
+/* Parses and returns next entry header. */
+__LA_DECL int archive_read_next_header(struct archive *,
+ struct archive_entry **);
+
+/* Parses and returns next entry header using the archive_entry passed in */
+__LA_DECL int archive_read_next_header2(struct archive *,
+ struct archive_entry *);
+
+/*
+ * Retrieve the byte offset in UNCOMPRESSED data where last-read
+ * header started.
+ */
+__LA_DECL __LA_INT64_T archive_read_header_position(struct archive *);
+
+/* Read data from the body of an entry. Similar to read(2). */
+__LA_DECL __LA_SSIZE_T archive_read_data(struct archive *,
+ void *, size_t);
+
+/*
+ * A zero-copy version of archive_read_data that also exposes the file offset
+ * of each returned block. Note that the client has no way to specify
+ * the desired size of the block. The API does guarantee that offsets will
+ * be strictly increasing and that returned blocks will not overlap.
+ */
+#if ARCHIVE_VERSION_NUMBER < 3000000
+__LA_DECL int archive_read_data_block(struct archive *a,
+ const void **buff, size_t *size, off_t *offset);
+#else
+__LA_DECL int archive_read_data_block(struct archive *a,
+ const void **buff, size_t *size,
+ __LA_INT64_T *offset);
+#endif
+
+/*-
+ * Some convenience functions that are built on archive_read_data:
+ * 'skip': skips entire entry
+ * 'into_buffer': writes data into memory buffer that you provide
+ * 'into_fd': writes data to specified filedes
+ */
+__LA_DECL int archive_read_data_skip(struct archive *);
+__LA_DECL int archive_read_data_into_buffer(struct archive *,
+ void *buffer, __LA_SSIZE_T len);
+__LA_DECL int archive_read_data_into_fd(struct archive *, int fd);
+
+/*
+ * Set read options.
+ */
+/* Apply option string to the format only. */
+__LA_DECL int archive_read_set_format_options(struct archive *_a,
+ const char *s);
+/* Apply option string to the filter only. */
+__LA_DECL int archive_read_set_filter_options(struct archive *_a,
+ const char *s);
+/* Apply option string to both the format and the filter. */
+__LA_DECL int archive_read_set_options(struct archive *_a,
+ const char *s);
+
+/*-
+ * Convenience function to recreate the current entry (whose header
+ * has just been read) on disk.
+ *
+ * This does quite a bit more than just copy data to disk. It also:
+ * - Creates intermediate directories as required.
+ * - Manages directory permissions: non-writable directories will
+ * be initially created with write permission enabled; when the
+ * archive is closed, dir permissions are edited to the values specified
+ * in the archive.
+ * - Checks hardlinks: hardlinks will not be extracted unless the
+ * linked-to file was also extracted within the same session. (TODO)
+ */
+
+/* The "flags" argument selects optional behavior, 'OR' the flags you want. */
+
+/* Default: Do not try to set owner/group. */
+#define ARCHIVE_EXTRACT_OWNER (0x0001)
+/* Default: Do obey umask, do not restore SUID/SGID/SVTX bits. */
+#define ARCHIVE_EXTRACT_PERM (0x0002)
+/* Default: Do not restore mtime/atime. */
+#define ARCHIVE_EXTRACT_TIME (0x0004)
+/* Default: Replace existing files. */
+#define ARCHIVE_EXTRACT_NO_OVERWRITE (0x0008)
+/* Default: Try create first, unlink only if create fails with EEXIST. */
+#define ARCHIVE_EXTRACT_UNLINK (0x0010)
+/* Default: Do not restore ACLs. */
+#define ARCHIVE_EXTRACT_ACL (0x0020)
+/* Default: Do not restore fflags. */
+#define ARCHIVE_EXTRACT_FFLAGS (0x0040)
+/* Default: Do not restore xattrs. */
+#define ARCHIVE_EXTRACT_XATTR (0x0080)
+/* Default: Do not try to guard against extracts redirected by symlinks. */
+/* Note: With ARCHIVE_EXTRACT_UNLINK, will remove any intermediate symlink. */
+#define ARCHIVE_EXTRACT_SECURE_SYMLINKS (0x0100)
+/* Default: Do not reject entries with '..' as path elements. */
+#define ARCHIVE_EXTRACT_SECURE_NODOTDOT (0x0200)
+/* Default: Create parent directories as needed. */
+#define ARCHIVE_EXTRACT_NO_AUTODIR (0x0400)
+/* Default: Overwrite files, even if one on disk is newer. */
+#define ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER (0x0800)
+/* Detect blocks of 0 and write holes instead. */
+#define ARCHIVE_EXTRACT_SPARSE (0x1000)
+
+__LA_DECL int archive_read_extract(struct archive *, struct archive_entry *,
+ int flags);
+__LA_DECL int archive_read_extract2(struct archive *, struct archive_entry *,
+ struct archive * /* dest */);
+__LA_DECL void archive_read_extract_set_progress_callback(struct archive *,
+ void (*_progress_func)(void *), void *_user_data);
+
+/* Record the dev/ino of a file that will not be written. This is
+ * generally set to the dev/ino of the archive being read. */
+__LA_DECL void archive_read_extract_set_skip_file(struct archive *,
+ dev_t, ino_t);
+
+/* Close the file and release most resources. */
+__LA_DECL int archive_read_close(struct archive *);
+/* Release all resources and destroy the object. */
+/* Note that archive_read_finish will call archive_read_close for you. */
+#if ARCHIVE_VERSION_NUMBER < 2000000
+/* Erroneously declared to return void in libarchive 1.x */
+__LA_DECL void archive_read_finish(struct archive *);
+#else
+__LA_DECL int archive_read_finish(struct archive *);
+#endif
+
+/*-
+ * To create an archive:
+ * 1) Ask archive_write_new for a archive writer object.
+ * 2) Set any global properties. In particular, you should set
+ * the compression and format to use.
+ * 3) Call archive_write_open to open the file (most people
+ * will use archive_write_open_file or archive_write_open_fd,
+ * which provide convenient canned I/O callbacks for you).
+ * 4) For each entry:
+ * - construct an appropriate struct archive_entry structure
+ * - archive_write_header to write the header
+ * - archive_write_data to write the entry data
+ * 5) archive_write_close to close the output
+ * 6) archive_write_finish to cleanup the writer and release resources
+ */
+__LA_DECL struct archive *archive_write_new(void);
+__LA_DECL int archive_write_set_bytes_per_block(struct archive *,
+ int bytes_per_block);
+__LA_DECL int archive_write_get_bytes_per_block(struct archive *);
+/* XXX This is badly misnamed; suggestions appreciated. XXX */
+__LA_DECL int archive_write_set_bytes_in_last_block(struct archive *,
+ int bytes_in_last_block);
+__LA_DECL int archive_write_get_bytes_in_last_block(struct archive *);
+
+/* The dev/ino of a file that won't be archived. This is used
+ * to avoid recursively adding an archive to itself. */
+__LA_DECL int archive_write_set_skip_file(struct archive *, dev_t, ino_t);
+
+__LA_DECL int archive_write_set_compression_bzip2(struct archive *);
+__LA_DECL int archive_write_set_compression_compress(struct archive *);
+__LA_DECL int archive_write_set_compression_gzip(struct archive *);
+__LA_DECL int archive_write_set_compression_lzma(struct archive *);
+__LA_DECL int archive_write_set_compression_none(struct archive *);
+__LA_DECL int archive_write_set_compression_program(struct archive *,
+ const char *cmd);
+__LA_DECL int archive_write_set_compression_xz(struct archive *);
+/* A convenience function to set the format based on the code or name. */
+__LA_DECL int archive_write_set_format(struct archive *, int format_code);
+__LA_DECL int archive_write_set_format_by_name(struct archive *,
+ const char *name);
+/* To minimize link pollution, use one or more of the following. */
+__LA_DECL int archive_write_set_format_ar_bsd(struct archive *);
+__LA_DECL int archive_write_set_format_ar_svr4(struct archive *);
+__LA_DECL int archive_write_set_format_cpio(struct archive *);
+__LA_DECL int archive_write_set_format_cpio_newc(struct archive *);
+__LA_DECL int archive_write_set_format_mtree(struct archive *);
+/* TODO: int archive_write_set_format_old_tar(struct archive *); */
+__LA_DECL int archive_write_set_format_pax(struct archive *);
+__LA_DECL int archive_write_set_format_pax_restricted(struct archive *);
+__LA_DECL int archive_write_set_format_shar(struct archive *);
+__LA_DECL int archive_write_set_format_shar_dump(struct archive *);
+__LA_DECL int archive_write_set_format_ustar(struct archive *);
+__LA_DECL int archive_write_set_format_zip(struct archive *);
+__LA_DECL int archive_write_open(struct archive *, void *,
+ archive_open_callback *, archive_write_callback *,
+ archive_close_callback *);
+__LA_DECL int archive_write_open_fd(struct archive *, int _fd);
+__LA_DECL int archive_write_open_filename(struct archive *, const char *_file);
+/* A deprecated synonym for archive_write_open_filename() */
+__LA_DECL int archive_write_open_file(struct archive *, const char *_file);
+__LA_DECL int archive_write_open_FILE(struct archive *, FILE *);
+/* _buffSize is the size of the buffer, _used refers to a variable that
+ * will be updated after each write into the buffer. */
+__LA_DECL int archive_write_open_memory(struct archive *,
+ void *_buffer, size_t _buffSize, size_t *_used);
+
+/*
+ * Note that the library will truncate writes beyond the size provided
+ * to archive_write_header or pad if the provided data is short.
+ */
+__LA_DECL int archive_write_header(struct archive *,
+ struct archive_entry *);
+#if ARCHIVE_VERSION_NUMBER < 2000000
+/* This was erroneously declared to return "int" in libarchive 1.x. */
+__LA_DECL int archive_write_data(struct archive *,
+ const void *, size_t);
+#else
+/* Libarchive 2.0 and later return ssize_t here. */
+__LA_DECL __LA_SSIZE_T archive_write_data(struct archive *,
+ const void *, size_t);
+#endif
+
+#if ARCHIVE_VERSION_NUMBER < 3000000
+/* Libarchive 1.x and 2.x use off_t for the argument, but that's not
+ * stable on Linux. */
+__LA_DECL __LA_SSIZE_T archive_write_data_block(struct archive *,
+ const void *, size_t, off_t);
+#else
+/* Libarchive 3.0 uses explicit int64_t to ensure consistent 64-bit support. */
+__LA_DECL __LA_SSIZE_T archive_write_data_block(struct archive *,
+ const void *, size_t, __LA_INT64_T);
+#endif
+__LA_DECL int archive_write_finish_entry(struct archive *);
+__LA_DECL int archive_write_close(struct archive *);
+#if ARCHIVE_VERSION_NUMBER < 2000000
+/* Return value was incorrect in libarchive 1.x. */
+__LA_DECL void archive_write_finish(struct archive *);
+#else
+/* Libarchive 2.x and later returns an error if this fails. */
+/* It can fail if the archive wasn't already closed, in which case
+ * archive_write_finish() will implicitly call archive_write_close(). */
+__LA_DECL int archive_write_finish(struct archive *);
+#endif
+
+/*
+ * Set write options.
+ */
+/* Apply option string to the format only. */
+__LA_DECL int archive_write_set_format_options(struct archive *_a,
+ const char *s);
+/* Apply option string to the compressor only. */
+__LA_DECL int archive_write_set_compressor_options(struct archive *_a,
+ const char *s);
+/* Apply option string to both the format and the compressor. */
+__LA_DECL int archive_write_set_options(struct archive *_a,
+ const char *s);
+
+
+/*-
+ * ARCHIVE_WRITE_DISK API
+ *
+ * To create objects on disk:
+ * 1) Ask archive_write_disk_new for a new archive_write_disk object.
+ * 2) Set any global properties. In particular, you probably
+ * want to set the options.
+ * 3) For each entry:
+ * - construct an appropriate struct archive_entry structure
+ * - archive_write_header to create the file/dir/etc on disk
+ * - archive_write_data to write the entry data
+ * 4) archive_write_finish to cleanup the writer and release resources
+ *
+ * In particular, you can use this in conjunction with archive_read()
+ * to pull entries out of an archive and create them on disk.
+ */
+__LA_DECL struct archive *archive_write_disk_new(void);
+/* This file will not be overwritten. */
+__LA_DECL int archive_write_disk_set_skip_file(struct archive *,
+ dev_t, ino_t);
+/* Set flags to control how the next item gets created.
+ * This accepts a bitmask of ARCHIVE_EXTRACT_XXX flags defined above. */
+__LA_DECL int archive_write_disk_set_options(struct archive *,
+ int flags);
+/*
+ * The lookup functions are given uname/uid (or gname/gid) pairs and
+ * return a uid (gid) suitable for this system. These are used for
+ * restoring ownership and for setting ACLs. The default functions
+ * are naive, they just return the uid/gid. These are small, so reasonable
+ * for applications that don't need to preserve ownership; they
+ * are probably also appropriate for applications that are doing
+ * same-system backup and restore.
+ */
+/*
+ * The "standard" lookup functions use common system calls to lookup
+ * the uname/gname, falling back to the uid/gid if the names can't be
+ * found. They cache lookups and are reasonably fast, but can be very
+ * large, so they are not used unless you ask for them. In
+ * particular, these match the specifications of POSIX "pax" and old
+ * POSIX "tar".
+ */
+__LA_DECL int archive_write_disk_set_standard_lookup(struct archive *);
+/*
+ * If neither the default (naive) nor the standard (big) functions suit
+ * your needs, you can write your own and register them. Be sure to
+ * include a cleanup function if you have allocated private data.
+ */
+__LA_DECL int archive_write_disk_set_group_lookup(struct archive *,
+ void * /* private_data */,
+ __LA_GID_T (*)(void *, const char *, __LA_GID_T),
+ void (* /* cleanup */)(void *));
+__LA_DECL int archive_write_disk_set_user_lookup(struct archive *,
+ void * /* private_data */,
+ __LA_UID_T (*)(void *, const char *, __LA_UID_T),
+ void (* /* cleanup */)(void *));
+
+/*
+ * ARCHIVE_READ_DISK API
+ *
+ * This is still evolving and somewhat experimental.
+ */
+__LA_DECL struct archive *archive_read_disk_new(void);
+/* The names for symlink modes here correspond to an old BSD
+ * command-line argument convention: -L, -P, -H */
+/* Follow all symlinks. */
+__LA_DECL int archive_read_disk_set_symlink_logical(struct archive *);
+/* Follow no symlinks. */
+__LA_DECL int archive_read_disk_set_symlink_physical(struct archive *);
+/* Follow symlink initially, then not. */
+__LA_DECL int archive_read_disk_set_symlink_hybrid(struct archive *);
+/* TODO: Handle Linux stat32/stat64 ugliness. <sigh> */
+__LA_DECL int archive_read_disk_entry_from_file(struct archive *,
+ struct archive_entry *, int /* fd */, const struct stat *);
+/* Look up gname for gid or uname for uid. */
+/* Default implementations are very, very stupid. */
+__LA_DECL const char *archive_read_disk_gname(struct archive *, __LA_GID_T);
+__LA_DECL const char *archive_read_disk_uname(struct archive *, __LA_UID_T);
+/* "Standard" implementation uses getpwuid_r, getgrgid_r and caches the
+ * results for performance. */
+__LA_DECL int archive_read_disk_set_standard_lookup(struct archive *);
+/* You can install your own lookups if you like. */
+__LA_DECL int archive_read_disk_set_gname_lookup(struct archive *,
+ void * /* private_data */,
+ const char *(* /* lookup_fn */)(void *, __LA_GID_T),
+ void (* /* cleanup_fn */)(void *));
+__LA_DECL int archive_read_disk_set_uname_lookup(struct archive *,
+ void * /* private_data */,
+ const char *(* /* lookup_fn */)(void *, __LA_UID_T),
+ void (* /* cleanup_fn */)(void *));
+
+/*
+ * Accessor functions to read/set various information in
+ * the struct archive object:
+ */
+/* Bytes written after compression or read before decompression. */
+__LA_DECL __LA_INT64_T archive_position_compressed(struct archive *);
+/* Bytes written to compressor or read from decompressor. */
+__LA_DECL __LA_INT64_T archive_position_uncompressed(struct archive *);
+
+__LA_DECL const char *archive_compression_name(struct archive *);
+__LA_DECL int archive_compression(struct archive *);
+__LA_DECL int archive_errno(struct archive *);
+__LA_DECL const char *archive_error_string(struct archive *);
+__LA_DECL const char *archive_format_name(struct archive *);
+__LA_DECL int archive_format(struct archive *);
+__LA_DECL void archive_clear_error(struct archive *);
+__LA_DECL void archive_set_error(struct archive *, int _err,
+ const char *fmt, ...);
+__LA_DECL void archive_copy_error(struct archive *dest,
+ struct archive *src);
+__LA_DECL int archive_file_count(struct archive *);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* These are meaningless outside of this header. */
+#undef __LA_DECL
+#undef __LA_GID_T
+#undef __LA_UID_T
+
+/* These need to remain defined because they're used in the
+ * callback type definitions. XXX Fix this. This is ugly. XXX */
+/* #undef __LA_INT64_T */
+/* #undef __LA_SSIZE_T */
+
+#endif /* !ARCHIVE_H_INCLUDED */
diff --git a/archivers/libarchive/files/libarchive/archive_check_magic.c b/archivers/libarchive/files/libarchive/archive_check_magic.c
new file mode 100644
index 00000000000..e27e5d82708
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_check_magic.c
@@ -0,0 +1,134 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_check_magic.c 201089 2009-12-28 02:20:23Z kientzle $");
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#include <windows.h>
+#include <winbase.h>
+#endif
+
+#include "archive_private.h"
+
+static void
+errmsg(const char *m)
+{
+ size_t s = strlen(m);
+ ssize_t written;
+
+ while (s > 0) {
+ written = write(2, m, strlen(m));
+ if (written <= 0)
+ return;
+ m += written;
+ s -= written;
+ }
+}
+
+static void
+diediedie(void)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG)
+ /* Cause a breakpoint exception */
+ DebugBreak();
+#endif
+ abort(); /* Terminate the program abnormally. */
+}
+
+static const char *
+state_name(unsigned s)
+{
+ switch (s) {
+ case ARCHIVE_STATE_NEW: return ("new");
+ case ARCHIVE_STATE_HEADER: return ("header");
+ case ARCHIVE_STATE_DATA: return ("data");
+ case ARCHIVE_STATE_EOF: return ("eof");
+ case ARCHIVE_STATE_CLOSED: return ("closed");
+ case ARCHIVE_STATE_FATAL: return ("fatal");
+ default: return ("??");
+ }
+}
+
+
+static void
+write_all_states(unsigned int states)
+{
+ unsigned int lowbit;
+
+ /* A trick for computing the lowest set bit. */
+ while ((lowbit = states & (1 + ~states)) != 0) {
+ states &= ~lowbit; /* Clear the low bit. */
+ errmsg(state_name(lowbit));
+ if (states != 0)
+ errmsg("/");
+ }
+}
+
+/*
+ * Check magic value and current state; bail if it isn't valid.
+ *
+ * This is designed to catch serious programming errors that violate
+ * the libarchive API.
+ */
+void
+__archive_check_magic(struct archive *a, unsigned int magic,
+ unsigned int state, const char *function)
+{
+ if (a->magic != magic) {
+ errmsg("INTERNAL ERROR: Function ");
+ errmsg(function);
+ errmsg(" invoked with invalid struct archive structure.\n");
+ diediedie();
+ }
+
+ if (state == ARCHIVE_STATE_ANY)
+ return;
+
+ if ((a->state & state) == 0) {
+ errmsg("INTERNAL ERROR: Function '");
+ errmsg(function);
+ errmsg("' invoked with archive structure in state '");
+ write_all_states(a->state);
+ errmsg("', should be in state '");
+ write_all_states(state);
+ errmsg("'\n");
+ diediedie();
+ }
+}
diff --git a/archivers/libarchive/files/libarchive/archive_endian.h b/archivers/libarchive/files/libarchive/archive_endian.h
new file mode 100644
index 00000000000..edc90ee6a84
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_endian.h
@@ -0,0 +1,162 @@
+/*-
+ * Copyright (c) 2002 Thomas Moestl <tmm@FreeBSD.org>
+ * 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: head/lib/libarchive/archive_endian.h 201085 2009-12-28 02:17:15Z kientzle $
+ *
+ * Borrowed from FreeBSD's <sys/endian.h>
+ */
+
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
+
+/* Note: This is a purely internal header! */
+/* Do not use this outside of libarchive internal code! */
+
+#ifndef ARCHIVE_ENDIAN_H_INCLUDED
+#define ARCHIVE_ENDIAN_H_INCLUDED
+
+
+/*
+ * Disabling inline keyword for compilers known to choke on it:
+ * - Watcom C++ in C code. (For any version?)
+ * - SGI MIPSpro
+ * - Microsoft Visual C++ 6.0 (supposedly newer versions too)
+ */
+#if defined(__WATCOMC__) || defined(__sgi) || defined(__hpux) || defined(__BORLANDC__)
+#define inline
+#elif defined(_MSC_VER)
+#define inline __inline
+#endif
+
+/* Alignment-agnostic encode/decode bytestream to/from little/big endian. */
+
+static inline uint16_t
+archive_be16dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return ((p[0] << 8) | p[1]);
+}
+
+static inline uint32_t
+archive_be32dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
+}
+
+static inline uint64_t
+archive_be64dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return (((uint64_t)archive_be32dec(p) << 32) | archive_be32dec(p + 4));
+}
+
+static inline uint16_t
+archive_le16dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return ((p[1] << 8) | p[0]);
+}
+
+static inline uint32_t
+archive_le32dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
+}
+
+static inline uint64_t
+archive_le64dec(const void *pp)
+{
+ unsigned char const *p = (unsigned char const *)pp;
+
+ return (((uint64_t)archive_le32dec(p + 4) << 32) | archive_le32dec(p));
+}
+
+static inline void
+archive_be16enc(void *pp, uint16_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ p[0] = (u >> 8) & 0xff;
+ p[1] = u & 0xff;
+}
+
+static inline void
+archive_be32enc(void *pp, uint32_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ p[0] = (u >> 24) & 0xff;
+ p[1] = (u >> 16) & 0xff;
+ p[2] = (u >> 8) & 0xff;
+ p[3] = u & 0xff;
+}
+
+static inline void
+archive_be64enc(void *pp, uint64_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ archive_be32enc(p, u >> 32);
+ archive_be32enc(p + 4, u & 0xffffffff);
+}
+
+static inline void
+archive_le16enc(void *pp, uint16_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ p[0] = u & 0xff;
+ p[1] = (u >> 8) & 0xff;
+}
+
+static inline void
+archive_le32enc(void *pp, uint32_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ p[0] = u & 0xff;
+ p[1] = (u >> 8) & 0xff;
+ p[2] = (u >> 16) & 0xff;
+ p[3] = (u >> 24) & 0xff;
+}
+
+static inline void
+archive_le64enc(void *pp, uint64_t u)
+{
+ unsigned char *p = (unsigned char *)pp;
+
+ archive_le32enc(p, u & 0xffffffff);
+ archive_le32enc(p + 4, u >> 32);
+}
+
+#endif
diff --git a/archivers/libarchive/files/libarchive/archive_entry.3 b/archivers/libarchive/files/libarchive/archive_entry.3
new file mode 100644
index 00000000000..9ceb18b7aad
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_entry.3
@@ -0,0 +1,433 @@
+.\" 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 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: src/lib/libarchive/archive_entry.3,v 1.18 2008/05/26 17:00:22 kientzle Exp $
+.\"
+.Dd May 12, 2008
+.Dt archive_entry 3
+.Os
+.Sh NAME
+.Nm archive_entry_acl_add_entry ,
+.Nm archive_entry_acl_add_entry_w ,
+.Nm archive_entry_acl_clear ,
+.Nm archive_entry_acl_count ,
+.Nm archive_entry_acl_next ,
+.Nm archive_entry_acl_next_w ,
+.Nm archive_entry_acl_reset ,
+.Nm archive_entry_acl_text_w ,
+.Nm archive_entry_atime ,
+.Nm archive_entry_atime_nsec ,
+.Nm archive_entry_clear ,
+.Nm archive_entry_clone ,
+.Nm archive_entry_copy_fflags_text ,
+.Nm archive_entry_copy_fflags_text_w ,
+.Nm archive_entry_copy_gname ,
+.Nm archive_entry_copy_gname_w ,
+.Nm archive_entry_copy_hardlink ,
+.Nm archive_entry_copy_hardlink_w ,
+.Nm archive_entry_copy_link ,
+.Nm archive_entry_copy_link_w ,
+.Nm archive_entry_copy_pathname_w ,
+.Nm archive_entry_copy_sourcepath ,
+.Nm archive_entry_copy_stat ,
+.Nm archive_entry_copy_symlink ,
+.Nm archive_entry_copy_symlink_w ,
+.Nm archive_entry_copy_uname ,
+.Nm archive_entry_copy_uname_w ,
+.Nm archive_entry_dev ,
+.Nm archive_entry_devmajor ,
+.Nm archive_entry_devminor ,
+.Nm archive_entry_filetype ,
+.Nm archive_entry_fflags ,
+.Nm archive_entry_fflags_text ,
+.Nm archive_entry_free ,
+.Nm archive_entry_gid ,
+.Nm archive_entry_gname ,
+.Nm archive_entry_hardlink ,
+.Nm archive_entry_ino ,
+.Nm archive_entry_mode ,
+.Nm archive_entry_mtime ,
+.Nm archive_entry_mtime_nsec ,
+.Nm archive_entry_nlink ,
+.Nm archive_entry_new ,
+.Nm archive_entry_pathname ,
+.Nm archive_entry_pathname_w ,
+.Nm archive_entry_rdev ,
+.Nm archive_entry_rdevmajor ,
+.Nm archive_entry_rdevminor ,
+.Nm archive_entry_set_atime ,
+.Nm archive_entry_set_ctime ,
+.Nm archive_entry_set_dev ,
+.Nm archive_entry_set_devmajor ,
+.Nm archive_entry_set_devminor ,
+.Nm archive_entry_set_filetype ,
+.Nm archive_entry_set_fflags ,
+.Nm archive_entry_set_gid ,
+.Nm archive_entry_set_gname ,
+.Nm archive_entry_set_hardlink ,
+.Nm archive_entry_set_link ,
+.Nm archive_entry_set_mode ,
+.Nm archive_entry_set_mtime ,
+.Nm archive_entry_set_pathname ,
+.Nm archive_entry_set_rdevmajor ,
+.Nm archive_entry_set_rdevminor ,
+.Nm archive_entry_set_size ,
+.Nm archive_entry_set_symlink ,
+.Nm archive_entry_set_uid ,
+.Nm archive_entry_set_uname ,
+.Nm archive_entry_size ,
+.Nm archive_entry_sourcepath ,
+.Nm archive_entry_stat ,
+.Nm archive_entry_symlink ,
+.Nm archive_entry_uid ,
+.Nm archive_entry_uname
+.Nd functions for manipulating archive entry descriptions
+.Sh SYNOPSIS
+.In archive_entry.h
+.Ft void
+.Fo archive_entry_acl_add_entry
+.Fa "struct archive_entry *"
+.Fa "int type"
+.Fa "int permset"
+.Fa "int tag"
+.Fa "int qual"
+.Fa "const char *name"
+.Fc
+.Ft void
+.Fo archive_entry_acl_add_entry_w
+.Fa "struct archive_entry *"
+.Fa "int type"
+.Fa "int permset"
+.Fa "int tag"
+.Fa "int qual"
+.Fa "const wchar_t *name"
+.Fc
+.Ft void
+.Fn archive_entry_acl_clear "struct archive_entry *"
+.Ft int
+.Fn archive_entry_acl_count "struct archive_entry *" "int type"
+.Ft int
+.Fo archive_entry_acl_next
+.Fa "struct archive_entry *"
+.Fa "int want_type"
+.Fa "int *type"
+.Fa "int *permset"
+.Fa "int *tag"
+.Fa "int *qual"
+.Fa "const char **name"
+.Fc
+.Ft int
+.Fo archive_entry_acl_next_w
+.Fa "struct archive_entry *"
+.Fa "int want_type"
+.Fa "int *type"
+.Fa "int *permset"
+.Fa "int *tag"
+.Fa "int *qual"
+.Fa "const wchar_t **name"
+.Fc
+.Ft int
+.Fn archive_entry_acl_reset "struct archive_entry *" "int want_type"
+.Ft const wchar_t *
+.Fn archive_entry_acl_text_w "struct archive_entry *" "int flags"
+.Ft time_t
+.Fn archive_entry_atime "struct archive_entry *"
+.Ft long
+.Fn archive_entry_atime_nsec "struct archive_entry *"
+.Ft "struct archive_entry *"
+.Fn archive_entry_clear "struct archive_entry *"
+.Ft struct archive_entry *
+.Fn archive_entry_clone "struct archive_entry *"
+.Ft const char * *
+.Fn archive_entry_copy_fflags_text_w "struct archive_entry *" "const char *"
+.Ft const wchar_t *
+.Fn archive_entry_copy_fflags_text_w "struct archive_entry *" "const wchar_t *"
+.Ft void
+.Fn archive_entry_copy_gname "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_copy_gname_w "struct archive_entry *" "const wchar_t *"
+.Ft void
+.Fn archive_entry_copy_hardlink "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_copy_hardlink_w "struct archive_entry *" "const wchar_t *"
+.Ft void
+.Fn archive_entry_copy_sourcepath "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_copy_pathname_w "struct archive_entry *" "const wchar_t *"
+.Ft void
+.Fn archive_entry_copy_stat "struct archive_entry *" "const struct stat *"
+.Ft void
+.Fn archive_entry_copy_symlink "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_copy_symlink_w "struct archive_entry *" "const wchar_t *"
+.Ft void
+.Fn archive_entry_copy_uname "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_copy_uname_w "struct archive_entry *" "const wchar_t *"
+.Ft dev_t
+.Fn archive_entry_dev "struct archive_entry *"
+.Ft dev_t
+.Fn archive_entry_devmajor "struct archive_entry *"
+.Ft dev_t
+.Fn archive_entry_devminor "struct archive_entry *"
+.Ft mode_t
+.Fn archive_entry_filetype "struct archive_entry *"
+.Ft void
+.Fo archive_entry_fflags
+.Fa "struct archive_entry *"
+.Fa "unsigned long *set"
+.Fa "unsigned long *clear"
+.Fc
+.Ft const char *
+.Fn archive_entry_fflags_text "struct archive_entry *"
+.Ft void
+.Fn archive_entry_free "struct archive_entry *"
+.Ft const char *
+.Fn archive_entry_gname "struct archive_entry *"
+.Ft const char *
+.Fn archive_entry_hardlink "struct archive_entry *"
+.Ft ino_t
+.Fn archive_entry_ino "struct archive_entry *"
+.Ft mode_t
+.Fn archive_entry_mode "struct archive_entry *"
+.Ft time_t
+.Fn archive_entry_mtime "struct archive_entry *"
+.Ft long
+.Fn archive_entry_mtime_nsec "struct archive_entry *"
+.Ft unsigned int
+.Fn archive_entry_nlink "struct archive_entry *"
+.Ft struct archive_entry *
+.Fn archive_entry_new "void"
+.Ft const char *
+.Fn archive_entry_pathname "struct archive_entry *"
+.Ft const wchar_t *
+.Fn archive_entry_pathname_w "struct archive_entry *"
+.Ft dev_t
+.Fn archive_entry_rdev "struct archive_entry *"
+.Ft dev_t
+.Fn archive_entry_rdevmajor "struct archive_entry *"
+.Ft dev_t
+.Fn archive_entry_rdevminor "struct archive_entry *"
+.Ft void
+.Fn archive_entry_set_dev "struct archive_entry *" "dev_t"
+.Ft void
+.Fn archive_entry_set_devmajor "struct archive_entry *" "dev_t"
+.Ft void
+.Fn archive_entry_set_devminor "struct archive_entry *" "dev_t"
+.Ft void
+.Fn archive_entry_set_filetype "struct archive_entry *" "unsigned int"
+.Ft void
+.Fo archive_entry_set_fflags
+.Fa "struct archive_entry *"
+.Fa "unsigned long set"
+.Fa "unsigned long clear"
+.Fc
+.Ft void
+.Fn archive_entry_set_gid "struct archive_entry *" "gid_t"
+.Ft void
+.Fn archive_entry_set_gname "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_set_hardlink "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_set_ino "struct archive_entry *" "unsigned long"
+.Ft void
+.Fn archive_entry_set_link "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_set_mode "struct archive_entry *" "mode_t"
+.Ft void
+.Fn archive_entry_set_mtime "struct archive_entry *" "time_t" "long nanos"
+.Ft void
+.Fn archive_entry_set_nlink "struct archive_entry *" "unsigned int"
+.Ft void
+.Fn archive_entry_set_pathname "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_set_rdev "struct archive_entry *" "dev_t"
+.Ft void
+.Fn archive_entry_set_rdevmajor "struct archive_entry *" "dev_t"
+.Ft void
+.Fn archive_entry_set_rdevminor "struct archive_entry *" "dev_t"
+.Ft void
+.Fn archive_entry_set_size "struct archive_entry *" "int64_t"
+.Ft void
+.Fn archive_entry_set_symlink "struct archive_entry *" "const char *"
+.Ft void
+.Fn archive_entry_set_uid "struct archive_entry *" "uid_t"
+.Ft void
+.Fn archive_entry_set_uname "struct archive_entry *" "const char *"
+.Ft int64_t
+.Fn archive_entry_size "struct archive_entry *"
+.Ft const char *
+.Fn archive_entry_sourcepath "struct archive_entry *"
+.Ft const struct stat *
+.Fn archive_entry_stat "struct archive_entry *"
+.Ft const char *
+.Fn archive_entry_symlink "struct archive_entry *"
+.Ft const char *
+.Fn archive_entry_uname "struct archive_entry *"
+.Sh DESCRIPTION
+These functions create and manipulate data objects that
+represent entries within an archive.
+You can think of a
+.Tn struct archive_entry
+as a heavy-duty version of
+.Tn struct stat :
+it includes everything from
+.Tn struct stat
+plus associated pathname, textual group and user names, etc.
+These objects are used by
+.Xr libarchive 3
+to represent the metadata associated with a particular
+entry in an archive.
+.Ss Create and Destroy
+There are functions to allocate, destroy, clear, and copy
+.Va archive_entry
+objects:
+.Bl -tag -compact -width indent
+.It Fn archive_entry_clear
+Erases the object, resetting all internal fields to the
+same state as a newly-created object.
+This is provided to allow you to quickly recycle objects
+without thrashing the heap.
+.It Fn archive_entry_clone
+A deep copy operation; all text fields are duplicated.
+.It Fn archive_entry_free
+Releases the
+.Tn struct archive_entry
+object.
+.It Fn archive_entry_new
+Allocate and return a blank
+.Tn struct archive_entry
+object.
+.El
+.Ss Set and Get Functions
+Most of the functions here set or read entries in an object.
+Such functions have one of the following forms:
+.Bl -tag -compact -width indent
+.It Fn archive_entry_set_XXXX
+Stores the provided data in the object.
+In particular, for strings, the pointer is stored,
+not the referenced string.
+.It Fn archive_entry_copy_XXXX
+As above, except that the referenced data is copied
+into the object.
+.It Fn archive_entry_XXXX
+Returns the specified data.
+In the case of strings, a const-qualified pointer to
+the string is returned.
+.El
+String data can be set or accessed as wide character strings
+or normal
+.Va char
+strings.
+The functions that use wide character strings are suffixed with
+.Cm _w .
+Note that these are different representations of the same data:
+For example, if you store a narrow string and read the corresponding
+wide string, the object will transparently convert formats
+using the current locale.
+Similarly, if you store a wide string and then store a
+narrow string for the same data, the previously-set wide string will
+be discarded in favor of the new data.
+.Pp
+There are a few set/get functions that merit additional description:
+.Bl -tag -compact -width indent
+.It Fn archive_entry_set_link
+This function sets the symlink field if it is already set.
+Otherwise, it sets the hardlink field.
+.El
+.Ss File Flags
+File flags are transparently converted between a bitmap
+representation and a textual format.
+For example, if you set the bitmap and ask for text, the library
+will build a canonical text format.
+However, if you set a text format and request a text format,
+you will get back the same text, even if it is ill-formed.
+If you need to canonicalize a textual flags string, you should first set the
+text form, then request the bitmap form, then use that to set the bitmap form.
+Setting the bitmap format will clear the internal text representation
+and force it to be reconstructed when you next request the text form.
+.Pp
+The bitmap format consists of two integers, one containing bits
+that should be set, the other specifying bits that should be
+cleared.
+Bits not mentioned in either bitmap will be ignored.
+Usually, the bitmap of bits to be cleared will be set to zero.
+In unusual circumstances, you can force a fully-specified set
+of file flags by setting the bitmap of flags to clear to the complement
+of the bitmap of flags to set.
+(This differs from
+.Xr fflagstostr 3 ,
+which only includes names for set bits.)
+Converting a bitmap to a textual string is a platform-specific
+operation; bits that are not meaningful on the current platform
+will be ignored.
+.Pp
+The canonical text format is a comma-separated list of flag names.
+The
+.Fn archive_entry_copy_fflags_text
+and
+.Fn archive_entry_copy_fflags_text_w
+functions parse the provided text and sets the internal bitmap values.
+This is a platform-specific operation; names that are not meaningful
+on the current platform will be ignored.
+The function returns a pointer to the start of the first name that was not
+recognized, or NULL if every name was recognized.
+Note that every name--including names that follow an unrecognized name--will
+be evaluated, and the bitmaps will be set to reflect every name that is
+recognized.
+(In particular, this differs from
+.Xr strtofflags 3 ,
+which stops parsing at the first unrecognized name.)
+.Ss ACL Handling
+XXX This needs serious help.
+XXX
+.Pp
+An
+.Dq Access Control List
+(ACL) is a list of permissions that grant access to particular users or
+groups beyond what would normally be provided by standard POSIX mode bits.
+The ACL handling here addresses some deficiencies in the POSIX.1e draft 17 ACL
+specification.
+In particular, POSIX.1e draft 17 specifies several different formats, but
+none of those formats include both textual user/group names and numeric
+UIDs/GIDs.
+.Pp
+XXX explain ACL stuff XXX
+.\" .Sh EXAMPLE
+.\" .Sh RETURN VALUES
+.\" .Sh ERRORS
+.Sh SEE ALSO
+.Xr archive 3
+.Sh HISTORY
+The
+.Nm libarchive
+library first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm libarchive
+library was written by
+.An Tim Kientzle Aq kientzle@acm.org .
+.\" .Sh BUGS
diff --git a/archivers/libarchive/files/libarchive/archive_entry.c b/archivers/libarchive/files/libarchive/archive_entry.c
new file mode 100644
index 00000000000..f734b8c4f51
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_entry.c
@@ -0,0 +1,2202 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry.c 201096 2009-12-28 02:41:27Z kientzle $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#if MAJOR_IN_MKDEV
+#include <sys/mkdev.h>
+#define HAVE_MAJOR
+#elif MAJOR_IN_SYSMACROS
+#include <sys/sysmacros.h>
+#define HAVE_MAJOR
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_LINUX_FS_H
+#include <linux/fs.h> /* for Linux file flags */
+#endif
+/*
+ * Some Linux distributions have both linux/ext2_fs.h and ext2fs/ext2_fs.h.
+ * As the include guards don't agree, the order of include is important.
+ */
+#ifdef HAVE_LINUX_EXT2_FS_H
+#include <linux/ext2_fs.h> /* for Linux file flags */
+#endif
+#if defined(HAVE_EXT2FS_EXT2_FS_H) && !defined(__CYGWIN__)
+#include <ext2fs/ext2_fs.h> /* for Linux file flags */
+#endif
+#include <stddef.h>
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_entry_private.h"
+
+#undef max
+#define max(a, b) ((a)>(b)?(a):(b))
+
+#if !defined(HAVE_MAJOR) && !defined(major)
+/* Replacement for major/minor/makedev. */
+#define major(x) ((int)(0x00ff & ((x) >> 8)))
+#define minor(x) ((int)(0xffff00ff & (x)))
+#define makedev(maj,min) ((0xff00 & ((maj)<<8)) | (0xffff00ff & (min)))
+#endif
+
+/* Play games to come up with a suitable makedev() definition. */
+#ifdef __QNXNTO__
+/* QNX. <sigh> */
+#include <sys/netmgr.h>
+#define ae_makedev(maj, min) makedev(ND_LOCAL_NODE, (maj), (min))
+#elif defined makedev
+/* There's a "makedev" macro. */
+#define ae_makedev(maj, min) makedev((maj), (min))
+#elif defined mkdev || ((defined _WIN32 || defined __WIN32__) && !defined(__CYGWIN__))
+/* Windows. <sigh> */
+#define ae_makedev(maj, min) mkdev((maj), (min))
+#else
+/* There's a "makedev" function. */
+#define ae_makedev(maj, min) makedev((maj), (min))
+#endif
+
+static void aes_clean(struct aes *);
+static void aes_copy(struct aes *dest, struct aes *src);
+static const char * aes_get_mbs(struct aes *);
+static const wchar_t * aes_get_wcs(struct aes *);
+static int aes_set_mbs(struct aes *, const char *mbs);
+static int aes_copy_mbs(struct aes *, const char *mbs);
+/* static void aes_set_wcs(struct aes *, const wchar_t *wcs); */
+static int aes_copy_wcs(struct aes *, const wchar_t *wcs);
+static int aes_copy_wcs_len(struct aes *, const wchar_t *wcs, size_t);
+
+static char * ae_fflagstostr(unsigned long bitset, unsigned long bitclear);
+static const wchar_t *ae_wcstofflags(const wchar_t *stringp,
+ unsigned long *setp, unsigned long *clrp);
+static const char *ae_strtofflags(const char *stringp,
+ unsigned long *setp, unsigned long *clrp);
+static void append_entry_w(wchar_t **wp, const wchar_t *prefix, int tag,
+ const wchar_t *wname, int perm, int id);
+static void append_id_w(wchar_t **wp, int id);
+
+static int acl_special(struct archive_entry *entry,
+ int type, int permset, int tag);
+static struct ae_acl *acl_new_entry(struct archive_entry *entry,
+ int type, int permset, int tag, int id);
+static int isint_w(const wchar_t *start, const wchar_t *end, int *result);
+static int ismode_w(const wchar_t *start, const wchar_t *end, int *result);
+static void next_field_w(const wchar_t **wp, const wchar_t **start,
+ const wchar_t **end, wchar_t *sep);
+static int prefix_w(const wchar_t *start, const wchar_t *end,
+ const wchar_t *test);
+static void
+archive_entry_acl_add_entry_w_len(struct archive_entry *entry, int type,
+ int permset, int tag, int id, const wchar_t *name, size_t);
+
+
+#ifndef HAVE_WCSCPY
+static wchar_t * wcscpy(wchar_t *s1, const wchar_t *s2)
+{
+ wchar_t *dest = s1;
+ while ((*s1 = *s2) != L'\0')
+ ++s1, ++s2;
+ return dest;
+}
+#endif
+#ifndef HAVE_WCSLEN
+static size_t wcslen(const wchar_t *s)
+{
+ const wchar_t *p = s;
+ while (*p != L'\0')
+ ++p;
+ return p - s;
+}
+#endif
+#ifndef HAVE_WMEMCMP
+/* Good enough for simple equality testing, but not for sorting. */
+#define wmemcmp(a,b,i) memcmp((a), (b), (i) * sizeof(wchar_t))
+#endif
+#ifndef HAVE_WMEMCPY
+#define wmemcpy(a,b,i) (wchar_t *)memcpy((a), (b), (i) * sizeof(wchar_t))
+#endif
+
+static void
+aes_clean(struct aes *aes)
+{
+ if (aes->aes_wcs) {
+ free((wchar_t *)(uintptr_t)aes->aes_wcs);
+ aes->aes_wcs = NULL;
+ }
+ archive_string_free(&(aes->aes_mbs));
+ archive_string_free(&(aes->aes_utf8));
+ aes->aes_set = 0;
+}
+
+static void
+aes_copy(struct aes *dest, struct aes *src)
+{
+ wchar_t *wp;
+
+ dest->aes_set = src->aes_set;
+ archive_string_copy(&(dest->aes_mbs), &(src->aes_mbs));
+ archive_string_copy(&(dest->aes_utf8), &(src->aes_utf8));
+
+ if (src->aes_wcs != NULL) {
+ wp = (wchar_t *)malloc((wcslen(src->aes_wcs) + 1)
+ * sizeof(wchar_t));
+ if (wp == NULL)
+ __archive_errx(1, "No memory for aes_copy()");
+ wcscpy(wp, src->aes_wcs);
+ dest->aes_wcs = wp;
+ }
+}
+
+static const char *
+aes_get_utf8(struct aes *aes)
+{
+ if (aes->aes_set & AES_SET_UTF8)
+ return (aes->aes_utf8.s);
+ if ((aes->aes_set & AES_SET_WCS)
+ && archive_strappend_w_utf8(&(aes->aes_utf8), aes->aes_wcs) != NULL) {
+ aes->aes_set |= AES_SET_UTF8;
+ return (aes->aes_utf8.s);
+ }
+ return (NULL);
+}
+
+static const char *
+aes_get_mbs(struct aes *aes)
+{
+ /* If we already have an MBS form, return that immediately. */
+ if (aes->aes_set & AES_SET_MBS)
+ return (aes->aes_mbs.s);
+ /* If there's a WCS form, try converting with the native locale. */
+ if ((aes->aes_set & AES_SET_WCS)
+ && archive_strappend_w_mbs(&(aes->aes_mbs), aes->aes_wcs) != NULL) {
+ aes->aes_set |= AES_SET_MBS;
+ return (aes->aes_mbs.s);
+ }
+ /* We'll use UTF-8 for MBS if all else fails. */
+ return (aes_get_utf8(aes));
+}
+
+static const wchar_t *
+aes_get_wcs(struct aes *aes)
+{
+ wchar_t *w;
+ size_t r;
+
+ /* Return WCS form if we already have it. */
+ if (aes->aes_set & AES_SET_WCS)
+ return (aes->aes_wcs);
+
+ if (aes->aes_set & AES_SET_MBS) {
+ /* Try converting MBS to WCS using native locale. */
+ /*
+ * No single byte will be more than one wide character,
+ * so this length estimate will always be big enough.
+ */
+ size_t wcs_length = aes->aes_mbs.length;
+
+ w = (wchar_t *)malloc((wcs_length + 1) * sizeof(wchar_t));
+ if (w == NULL)
+ __archive_errx(1, "No memory for aes_get_wcs()");
+ r = mbstowcs(w, aes->aes_mbs.s, wcs_length);
+ if (r != (size_t)-1 && r != 0) {
+ w[r] = 0;
+ aes->aes_set |= AES_SET_WCS;
+ return (aes->aes_wcs = w);
+ }
+ free(w);
+ }
+
+ if (aes->aes_set & AES_SET_UTF8) {
+ /* Try converting UTF8 to WCS. */
+ aes->aes_wcs = __archive_string_utf8_w(&(aes->aes_utf8));
+ if (aes->aes_wcs != NULL)
+ aes->aes_set |= AES_SET_WCS;
+ return (aes->aes_wcs);
+ }
+ return (NULL);
+}
+
+static int
+aes_set_mbs(struct aes *aes, const char *mbs)
+{
+ return (aes_copy_mbs(aes, mbs));
+}
+
+static int
+aes_copy_mbs(struct aes *aes, const char *mbs)
+{
+ if (mbs == NULL) {
+ aes->aes_set = 0;
+ return (0);
+ }
+ aes->aes_set = AES_SET_MBS; /* Only MBS form is set now. */
+ archive_strcpy(&(aes->aes_mbs), mbs);
+ archive_string_empty(&(aes->aes_utf8));
+ if (aes->aes_wcs) {
+ free((wchar_t *)(uintptr_t)aes->aes_wcs);
+ aes->aes_wcs = NULL;
+ }
+ return (0);
+}
+
+/*
+ * The 'update' form tries to proactively update all forms of
+ * this string (WCS and MBS) and returns an error if any of
+ * them fail. This is used by the 'pax' handler, for instance,
+ * to detect and report character-conversion failures early while
+ * still allowing clients to get potentially useful values from
+ * the more tolerant lazy conversions. (get_mbs and get_wcs will
+ * strive to give the user something useful, so you can get hopefully
+ * usable values even if some of the character conversions are failing.)
+ */
+static int
+aes_update_utf8(struct aes *aes, const char *utf8)
+{
+ if (utf8 == NULL) {
+ aes->aes_set = 0;
+ return (1); /* Succeeded in clearing everything. */
+ }
+
+ /* Save the UTF8 string. */
+ archive_strcpy(&(aes->aes_utf8), utf8);
+
+ /* Empty the mbs and wcs strings. */
+ archive_string_empty(&(aes->aes_mbs));
+ if (aes->aes_wcs) {
+ free((wchar_t *)(uintptr_t)aes->aes_wcs);
+ aes->aes_wcs = NULL;
+ }
+
+ aes->aes_set = AES_SET_UTF8; /* Only UTF8 is set now. */
+
+ /* TODO: We should just do a direct UTF-8 to MBS conversion
+ * here. That would be faster, use less space, and give the
+ * same information. (If a UTF-8 to MBS conversion succeeds,
+ * then UTF-8->WCS and Unicode->MBS conversions will both
+ * succeed.) */
+
+ /* Try converting UTF8 to WCS, return false on failure. */
+ aes->aes_wcs = __archive_string_utf8_w(&(aes->aes_utf8));
+ if (aes->aes_wcs == NULL)
+ return (0);
+ aes->aes_set = AES_SET_UTF8 | AES_SET_WCS; /* Both UTF8 and WCS set. */
+
+ /* Try converting WCS to MBS, return false on failure. */
+ if (archive_strappend_w_mbs(&(aes->aes_mbs), aes->aes_wcs) == NULL)
+ return (0);
+ aes->aes_set = AES_SET_UTF8 | AES_SET_WCS | AES_SET_MBS;
+
+ /* All conversions succeeded. */
+ return (1);
+}
+
+static int
+aes_copy_wcs(struct aes *aes, const wchar_t *wcs)
+{
+ return aes_copy_wcs_len(aes, wcs, wcs == NULL ? 0 : wcslen(wcs));
+}
+
+static int
+aes_copy_wcs_len(struct aes *aes, const wchar_t *wcs, size_t len)
+{
+ wchar_t *w;
+
+ if (wcs == NULL) {
+ aes->aes_set = 0;
+ return (0);
+ }
+ aes->aes_set = AES_SET_WCS; /* Only WCS form set. */
+ archive_string_empty(&(aes->aes_mbs));
+ archive_string_empty(&(aes->aes_utf8));
+ if (aes->aes_wcs) {
+ free((wchar_t *)(uintptr_t)aes->aes_wcs);
+ aes->aes_wcs = NULL;
+ }
+ w = (wchar_t *)malloc((len + 1) * sizeof(wchar_t));
+ if (w == NULL)
+ __archive_errx(1, "No memory for aes_copy_wcs()");
+ wmemcpy(w, wcs, len);
+ w[len] = L'\0';
+ aes->aes_wcs = w;
+ return (0);
+}
+
+/****************************************************************************
+ *
+ * Public Interface
+ *
+ ****************************************************************************/
+
+struct archive_entry *
+archive_entry_clear(struct archive_entry *entry)
+{
+ if (entry == NULL)
+ return (NULL);
+ aes_clean(&entry->ae_fflags_text);
+ aes_clean(&entry->ae_gname);
+ aes_clean(&entry->ae_hardlink);
+ aes_clean(&entry->ae_pathname);
+ aes_clean(&entry->ae_sourcepath);
+ aes_clean(&entry->ae_symlink);
+ aes_clean(&entry->ae_uname);
+ archive_entry_acl_clear(entry);
+ archive_entry_xattr_clear(entry);
+ free(entry->stat);
+ memset(entry, 0, sizeof(*entry));
+ return entry;
+}
+
+struct archive_entry *
+archive_entry_clone(struct archive_entry *entry)
+{
+ struct archive_entry *entry2;
+ struct ae_acl *ap, *ap2;
+ struct ae_xattr *xp;
+
+ /* Allocate new structure and copy over all of the fields. */
+ entry2 = (struct archive_entry *)malloc(sizeof(*entry2));
+ if (entry2 == NULL)
+ return (NULL);
+ memset(entry2, 0, sizeof(*entry2));
+ entry2->ae_stat = entry->ae_stat;
+ entry2->ae_fflags_set = entry->ae_fflags_set;
+ entry2->ae_fflags_clear = entry->ae_fflags_clear;
+
+ aes_copy(&entry2->ae_fflags_text, &entry->ae_fflags_text);
+ aes_copy(&entry2->ae_gname, &entry->ae_gname);
+ aes_copy(&entry2->ae_hardlink, &entry->ae_hardlink);
+ aes_copy(&entry2->ae_pathname, &entry->ae_pathname);
+ aes_copy(&entry2->ae_sourcepath, &entry->ae_sourcepath);
+ aes_copy(&entry2->ae_symlink, &entry->ae_symlink);
+ entry2->ae_set = entry->ae_set;
+ aes_copy(&entry2->ae_uname, &entry->ae_uname);
+
+ /* Copy ACL data over. */
+ ap = entry->acl_head;
+ while (ap != NULL) {
+ ap2 = acl_new_entry(entry2,
+ ap->type, ap->permset, ap->tag, ap->id);
+ if (ap2 != NULL)
+ aes_copy(&ap2->name, &ap->name);
+ ap = ap->next;
+ }
+
+ /* Copy xattr data over. */
+ xp = entry->xattr_head;
+ while (xp != NULL) {
+ archive_entry_xattr_add_entry(entry2,
+ xp->name, xp->value, xp->size);
+ xp = xp->next;
+ }
+
+ return (entry2);
+}
+
+void
+archive_entry_free(struct archive_entry *entry)
+{
+ archive_entry_clear(entry);
+ free(entry);
+}
+
+struct archive_entry *
+archive_entry_new(void)
+{
+ struct archive_entry *entry;
+
+ entry = (struct archive_entry *)malloc(sizeof(*entry));
+ if (entry == NULL)
+ return (NULL);
+ memset(entry, 0, sizeof(*entry));
+ return (entry);
+}
+
+/*
+ * Functions for reading fields from an archive_entry.
+ */
+
+time_t
+archive_entry_atime(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_atime);
+}
+
+long
+archive_entry_atime_nsec(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_atime_nsec);
+}
+
+int
+archive_entry_atime_is_set(struct archive_entry *entry)
+{
+ return (entry->ae_set & AE_SET_ATIME);
+}
+
+time_t
+archive_entry_birthtime(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_birthtime);
+}
+
+long
+archive_entry_birthtime_nsec(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_birthtime_nsec);
+}
+
+int
+archive_entry_birthtime_is_set(struct archive_entry *entry)
+{
+ return (entry->ae_set & AE_SET_BIRTHTIME);
+}
+
+time_t
+archive_entry_ctime(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_ctime);
+}
+
+int
+archive_entry_ctime_is_set(struct archive_entry *entry)
+{
+ return (entry->ae_set & AE_SET_CTIME);
+}
+
+long
+archive_entry_ctime_nsec(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_ctime_nsec);
+}
+
+dev_t
+archive_entry_dev(struct archive_entry *entry)
+{
+ if (entry->ae_stat.aest_dev_is_broken_down)
+ return ae_makedev(entry->ae_stat.aest_devmajor,
+ entry->ae_stat.aest_devminor);
+ else
+ return (entry->ae_stat.aest_dev);
+}
+
+dev_t
+archive_entry_devmajor(struct archive_entry *entry)
+{
+ if (entry->ae_stat.aest_dev_is_broken_down)
+ return (entry->ae_stat.aest_devmajor);
+ else
+ return major(entry->ae_stat.aest_dev);
+}
+
+dev_t
+archive_entry_devminor(struct archive_entry *entry)
+{
+ if (entry->ae_stat.aest_dev_is_broken_down)
+ return (entry->ae_stat.aest_devminor);
+ else
+ return minor(entry->ae_stat.aest_dev);
+}
+
+mode_t
+archive_entry_filetype(struct archive_entry *entry)
+{
+ return (AE_IFMT & entry->ae_stat.aest_mode);
+}
+
+void
+archive_entry_fflags(struct archive_entry *entry,
+ unsigned long *set, unsigned long *clear)
+{
+ *set = entry->ae_fflags_set;
+ *clear = entry->ae_fflags_clear;
+}
+
+/*
+ * Note: if text was provided, this just returns that text. If you
+ * really need the text to be rebuilt in a canonical form, set the
+ * text, ask for the bitmaps, then set the bitmaps. (Setting the
+ * bitmaps clears any stored text.) This design is deliberate: if
+ * we're editing archives, we don't want to discard flags just because
+ * they aren't supported on the current system. The bitmap<->text
+ * conversions are platform-specific (see below).
+ */
+const char *
+archive_entry_fflags_text(struct archive_entry *entry)
+{
+ const char *f;
+ char *p;
+
+ f = aes_get_mbs(&entry->ae_fflags_text);
+ if (f != NULL)
+ return (f);
+
+ if (entry->ae_fflags_set == 0 && entry->ae_fflags_clear == 0)
+ return (NULL);
+
+ p = ae_fflagstostr(entry->ae_fflags_set, entry->ae_fflags_clear);
+ if (p == NULL)
+ return (NULL);
+
+ aes_copy_mbs(&entry->ae_fflags_text, p);
+ free(p);
+ f = aes_get_mbs(&entry->ae_fflags_text);
+ return (f);
+}
+
+gid_t
+archive_entry_gid(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_gid);
+}
+
+const char *
+archive_entry_gname(struct archive_entry *entry)
+{
+ return (aes_get_mbs(&entry->ae_gname));
+}
+
+const wchar_t *
+archive_entry_gname_w(struct archive_entry *entry)
+{
+ return (aes_get_wcs(&entry->ae_gname));
+}
+
+const char *
+archive_entry_hardlink(struct archive_entry *entry)
+{
+ if (entry->ae_set & AE_SET_HARDLINK)
+ return (aes_get_mbs(&entry->ae_hardlink));
+ return (NULL);
+}
+
+const wchar_t *
+archive_entry_hardlink_w(struct archive_entry *entry)
+{
+ if (entry->ae_set & AE_SET_HARDLINK)
+ return (aes_get_wcs(&entry->ae_hardlink));
+ return (NULL);
+}
+
+ino_t
+archive_entry_ino(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_ino);
+}
+
+int64_t
+archive_entry_ino64(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_ino);
+}
+
+mode_t
+archive_entry_mode(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_mode);
+}
+
+time_t
+archive_entry_mtime(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_mtime);
+}
+
+long
+archive_entry_mtime_nsec(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_mtime_nsec);
+}
+
+int
+archive_entry_mtime_is_set(struct archive_entry *entry)
+{
+ return (entry->ae_set & AE_SET_MTIME);
+}
+
+unsigned int
+archive_entry_nlink(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_nlink);
+}
+
+const char *
+archive_entry_pathname(struct archive_entry *entry)
+{
+ return (aes_get_mbs(&entry->ae_pathname));
+}
+
+const wchar_t *
+archive_entry_pathname_w(struct archive_entry *entry)
+{
+ return (aes_get_wcs(&entry->ae_pathname));
+}
+
+dev_t
+archive_entry_rdev(struct archive_entry *entry)
+{
+ if (entry->ae_stat.aest_rdev_is_broken_down)
+ return ae_makedev(entry->ae_stat.aest_rdevmajor,
+ entry->ae_stat.aest_rdevminor);
+ else
+ return (entry->ae_stat.aest_rdev);
+}
+
+dev_t
+archive_entry_rdevmajor(struct archive_entry *entry)
+{
+ if (entry->ae_stat.aest_rdev_is_broken_down)
+ return (entry->ae_stat.aest_rdevmajor);
+ else
+ return major(entry->ae_stat.aest_rdev);
+}
+
+dev_t
+archive_entry_rdevminor(struct archive_entry *entry)
+{
+ if (entry->ae_stat.aest_rdev_is_broken_down)
+ return (entry->ae_stat.aest_rdevminor);
+ else
+ return minor(entry->ae_stat.aest_rdev);
+}
+
+int64_t
+archive_entry_size(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_size);
+}
+
+int
+archive_entry_size_is_set(struct archive_entry *entry)
+{
+ return (entry->ae_set & AE_SET_SIZE);
+}
+
+const char *
+archive_entry_sourcepath(struct archive_entry *entry)
+{
+ return (aes_get_mbs(&entry->ae_sourcepath));
+}
+
+const char *
+archive_entry_symlink(struct archive_entry *entry)
+{
+ if (entry->ae_set & AE_SET_SYMLINK)
+ return (aes_get_mbs(&entry->ae_symlink));
+ return (NULL);
+}
+
+const wchar_t *
+archive_entry_symlink_w(struct archive_entry *entry)
+{
+ if (entry->ae_set & AE_SET_SYMLINK)
+ return (aes_get_wcs(&entry->ae_symlink));
+ return (NULL);
+}
+
+uid_t
+archive_entry_uid(struct archive_entry *entry)
+{
+ return (entry->ae_stat.aest_uid);
+}
+
+const char *
+archive_entry_uname(struct archive_entry *entry)
+{
+ return (aes_get_mbs(&entry->ae_uname));
+}
+
+const wchar_t *
+archive_entry_uname_w(struct archive_entry *entry)
+{
+ return (aes_get_wcs(&entry->ae_uname));
+}
+
+/*
+ * Functions to set archive_entry properties.
+ */
+
+void
+archive_entry_set_filetype(struct archive_entry *entry, unsigned int type)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_mode &= ~AE_IFMT;
+ entry->ae_stat.aest_mode |= AE_IFMT & type;
+}
+
+void
+archive_entry_set_fflags(struct archive_entry *entry,
+ unsigned long set, unsigned long clear)
+{
+ aes_clean(&entry->ae_fflags_text);
+ entry->ae_fflags_set = set;
+ entry->ae_fflags_clear = clear;
+}
+
+const char *
+archive_entry_copy_fflags_text(struct archive_entry *entry,
+ const char *flags)
+{
+ aes_copy_mbs(&entry->ae_fflags_text, flags);
+ return (ae_strtofflags(flags,
+ &entry->ae_fflags_set, &entry->ae_fflags_clear));
+}
+
+const wchar_t *
+archive_entry_copy_fflags_text_w(struct archive_entry *entry,
+ const wchar_t *flags)
+{
+ aes_copy_wcs(&entry->ae_fflags_text, flags);
+ return (ae_wcstofflags(flags,
+ &entry->ae_fflags_set, &entry->ae_fflags_clear));
+}
+
+void
+archive_entry_set_gid(struct archive_entry *entry, gid_t g)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_gid = g;
+}
+
+void
+archive_entry_set_gname(struct archive_entry *entry, const char *name)
+{
+ aes_set_mbs(&entry->ae_gname, name);
+}
+
+void
+archive_entry_copy_gname(struct archive_entry *entry, const char *name)
+{
+ aes_copy_mbs(&entry->ae_gname, name);
+}
+
+void
+archive_entry_copy_gname_w(struct archive_entry *entry, const wchar_t *name)
+{
+ aes_copy_wcs(&entry->ae_gname, name);
+}
+
+int
+archive_entry_update_gname_utf8(struct archive_entry *entry, const char *name)
+{
+ return (aes_update_utf8(&entry->ae_gname, name));
+}
+
+void
+archive_entry_set_ino(struct archive_entry *entry, unsigned long ino)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_ino = ino;
+}
+
+void
+archive_entry_set_ino64(struct archive_entry *entry, int64_t ino)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_ino = ino;
+}
+
+void
+archive_entry_set_hardlink(struct archive_entry *entry, const char *target)
+{
+ aes_set_mbs(&entry->ae_hardlink, target);
+ if (target != NULL)
+ entry->ae_set |= AE_SET_HARDLINK;
+ else
+ entry->ae_set &= ~AE_SET_HARDLINK;
+}
+
+void
+archive_entry_copy_hardlink(struct archive_entry *entry, const char *target)
+{
+ aes_copy_mbs(&entry->ae_hardlink, target);
+ if (target != NULL)
+ entry->ae_set |= AE_SET_HARDLINK;
+ else
+ entry->ae_set &= ~AE_SET_HARDLINK;
+}
+
+void
+archive_entry_copy_hardlink_w(struct archive_entry *entry, const wchar_t *target)
+{
+ aes_copy_wcs(&entry->ae_hardlink, target);
+ if (target != NULL)
+ entry->ae_set |= AE_SET_HARDLINK;
+ else
+ entry->ae_set &= ~AE_SET_HARDLINK;
+}
+
+int
+archive_entry_update_hardlink_utf8(struct archive_entry *entry, const char *target)
+{
+ if (target != NULL)
+ entry->ae_set |= AE_SET_HARDLINK;
+ else
+ entry->ae_set &= ~AE_SET_HARDLINK;
+ return (aes_update_utf8(&entry->ae_hardlink, target));
+}
+
+void
+archive_entry_set_atime(struct archive_entry *entry, time_t t, long ns)
+{
+ entry->stat_valid = 0;
+ entry->ae_set |= AE_SET_ATIME;
+ entry->ae_stat.aest_atime = t;
+ entry->ae_stat.aest_atime_nsec = ns;
+}
+
+void
+archive_entry_unset_atime(struct archive_entry *entry)
+{
+ archive_entry_set_atime(entry, 0, 0);
+ entry->ae_set &= ~AE_SET_ATIME;
+}
+
+void
+archive_entry_set_birthtime(struct archive_entry *entry, time_t m, long ns)
+{
+ entry->stat_valid = 0;
+ entry->ae_set |= AE_SET_BIRTHTIME;
+ entry->ae_stat.aest_birthtime = m;
+ entry->ae_stat.aest_birthtime_nsec = ns;
+}
+
+void
+archive_entry_unset_birthtime(struct archive_entry *entry)
+{
+ archive_entry_set_birthtime(entry, 0, 0);
+ entry->ae_set &= ~AE_SET_BIRTHTIME;
+}
+
+void
+archive_entry_set_ctime(struct archive_entry *entry, time_t t, long ns)
+{
+ entry->stat_valid = 0;
+ entry->ae_set |= AE_SET_CTIME;
+ entry->ae_stat.aest_ctime = t;
+ entry->ae_stat.aest_ctime_nsec = ns;
+}
+
+void
+archive_entry_unset_ctime(struct archive_entry *entry)
+{
+ archive_entry_set_ctime(entry, 0, 0);
+ entry->ae_set &= ~AE_SET_CTIME;
+}
+
+void
+archive_entry_set_dev(struct archive_entry *entry, dev_t d)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_dev_is_broken_down = 0;
+ entry->ae_stat.aest_dev = d;
+}
+
+void
+archive_entry_set_devmajor(struct archive_entry *entry, dev_t m)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_dev_is_broken_down = 1;
+ entry->ae_stat.aest_devmajor = m;
+}
+
+void
+archive_entry_set_devminor(struct archive_entry *entry, dev_t m)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_dev_is_broken_down = 1;
+ entry->ae_stat.aest_devminor = m;
+}
+
+/* Set symlink if symlink is already set, else set hardlink. */
+void
+archive_entry_set_link(struct archive_entry *entry, const char *target)
+{
+ if (entry->ae_set & AE_SET_SYMLINK)
+ aes_set_mbs(&entry->ae_symlink, target);
+ else
+ aes_set_mbs(&entry->ae_hardlink, target);
+}
+
+/* Set symlink if symlink is already set, else set hardlink. */
+void
+archive_entry_copy_link(struct archive_entry *entry, const char *target)
+{
+ if (entry->ae_set & AE_SET_SYMLINK)
+ aes_copy_mbs(&entry->ae_symlink, target);
+ else
+ aes_copy_mbs(&entry->ae_hardlink, target);
+}
+
+/* Set symlink if symlink is already set, else set hardlink. */
+void
+archive_entry_copy_link_w(struct archive_entry *entry, const wchar_t *target)
+{
+ if (entry->ae_set & AE_SET_SYMLINK)
+ aes_copy_wcs(&entry->ae_symlink, target);
+ else
+ aes_copy_wcs(&entry->ae_hardlink, target);
+}
+
+int
+archive_entry_update_link_utf8(struct archive_entry *entry, const char *target)
+{
+ if (entry->ae_set & AE_SET_SYMLINK)
+ return (aes_update_utf8(&entry->ae_symlink, target));
+ else
+ return (aes_update_utf8(&entry->ae_hardlink, target));
+}
+
+void
+archive_entry_set_mode(struct archive_entry *entry, mode_t m)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_mode = m;
+}
+
+void
+archive_entry_set_mtime(struct archive_entry *entry, time_t m, long ns)
+{
+ entry->stat_valid = 0;
+ entry->ae_set |= AE_SET_MTIME;
+ entry->ae_stat.aest_mtime = m;
+ entry->ae_stat.aest_mtime_nsec = ns;
+}
+
+void
+archive_entry_unset_mtime(struct archive_entry *entry)
+{
+ archive_entry_set_mtime(entry, 0, 0);
+ entry->ae_set &= ~AE_SET_MTIME;
+}
+
+void
+archive_entry_set_nlink(struct archive_entry *entry, unsigned int nlink)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_nlink = nlink;
+}
+
+void
+archive_entry_set_pathname(struct archive_entry *entry, const char *name)
+{
+ aes_set_mbs(&entry->ae_pathname, name);
+}
+
+void
+archive_entry_copy_pathname(struct archive_entry *entry, const char *name)
+{
+ aes_copy_mbs(&entry->ae_pathname, name);
+}
+
+void
+archive_entry_copy_pathname_w(struct archive_entry *entry, const wchar_t *name)
+{
+ aes_copy_wcs(&entry->ae_pathname, name);
+}
+
+int
+archive_entry_update_pathname_utf8(struct archive_entry *entry, const char *name)
+{
+ return (aes_update_utf8(&entry->ae_pathname, name));
+}
+
+void
+archive_entry_set_perm(struct archive_entry *entry, mode_t p)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_mode &= AE_IFMT;
+ entry->ae_stat.aest_mode |= ~AE_IFMT & p;
+}
+
+void
+archive_entry_set_rdev(struct archive_entry *entry, dev_t m)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_rdev = m;
+ entry->ae_stat.aest_rdev_is_broken_down = 0;
+}
+
+void
+archive_entry_set_rdevmajor(struct archive_entry *entry, dev_t m)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_rdev_is_broken_down = 1;
+ entry->ae_stat.aest_rdevmajor = m;
+}
+
+void
+archive_entry_set_rdevminor(struct archive_entry *entry, dev_t m)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_rdev_is_broken_down = 1;
+ entry->ae_stat.aest_rdevminor = m;
+}
+
+void
+archive_entry_set_size(struct archive_entry *entry, int64_t s)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_size = s;
+ entry->ae_set |= AE_SET_SIZE;
+}
+
+void
+archive_entry_unset_size(struct archive_entry *entry)
+{
+ archive_entry_set_size(entry, 0);
+ entry->ae_set &= ~AE_SET_SIZE;
+}
+
+void
+archive_entry_copy_sourcepath(struct archive_entry *entry, const char *path)
+{
+ aes_set_mbs(&entry->ae_sourcepath, path);
+}
+
+void
+archive_entry_set_symlink(struct archive_entry *entry, const char *linkname)
+{
+ aes_set_mbs(&entry->ae_symlink, linkname);
+ if (linkname != NULL)
+ entry->ae_set |= AE_SET_SYMLINK;
+ else
+ entry->ae_set &= ~AE_SET_SYMLINK;
+}
+
+void
+archive_entry_copy_symlink(struct archive_entry *entry, const char *linkname)
+{
+ aes_copy_mbs(&entry->ae_symlink, linkname);
+ if (linkname != NULL)
+ entry->ae_set |= AE_SET_SYMLINK;
+ else
+ entry->ae_set &= ~AE_SET_SYMLINK;
+}
+
+void
+archive_entry_copy_symlink_w(struct archive_entry *entry, const wchar_t *linkname)
+{
+ aes_copy_wcs(&entry->ae_symlink, linkname);
+ if (linkname != NULL)
+ entry->ae_set |= AE_SET_SYMLINK;
+ else
+ entry->ae_set &= ~AE_SET_SYMLINK;
+}
+
+int
+archive_entry_update_symlink_utf8(struct archive_entry *entry, const char *linkname)
+{
+ if (linkname != NULL)
+ entry->ae_set |= AE_SET_SYMLINK;
+ else
+ entry->ae_set &= ~AE_SET_SYMLINK;
+ return (aes_update_utf8(&entry->ae_symlink, linkname));
+}
+
+void
+archive_entry_set_uid(struct archive_entry *entry, uid_t u)
+{
+ entry->stat_valid = 0;
+ entry->ae_stat.aest_uid = u;
+}
+
+void
+archive_entry_set_uname(struct archive_entry *entry, const char *name)
+{
+ aes_set_mbs(&entry->ae_uname, name);
+}
+
+void
+archive_entry_copy_uname(struct archive_entry *entry, const char *name)
+{
+ aes_copy_mbs(&entry->ae_uname, name);
+}
+
+void
+archive_entry_copy_uname_w(struct archive_entry *entry, const wchar_t *name)
+{
+ aes_copy_wcs(&entry->ae_uname, name);
+}
+
+int
+archive_entry_update_uname_utf8(struct archive_entry *entry, const char *name)
+{
+ return (aes_update_utf8(&entry->ae_uname, name));
+}
+
+/*
+ * ACL management. The following would, of course, be a lot simpler
+ * if: 1) the last draft of POSIX.1e were a really thorough and
+ * complete standard that addressed the needs of ACL archiving and 2)
+ * everyone followed it faithfully. Alas, neither is true, so the
+ * following is a lot more complex than might seem necessary to the
+ * uninitiated.
+ */
+
+void
+archive_entry_acl_clear(struct archive_entry *entry)
+{
+ struct ae_acl *ap;
+
+ while (entry->acl_head != NULL) {
+ ap = entry->acl_head->next;
+ aes_clean(&entry->acl_head->name);
+ free(entry->acl_head);
+ entry->acl_head = ap;
+ }
+ if (entry->acl_text_w != NULL) {
+ free(entry->acl_text_w);
+ entry->acl_text_w = NULL;
+ }
+ entry->acl_p = NULL;
+ entry->acl_state = 0; /* Not counting. */
+}
+
+/*
+ * Add a single ACL entry to the internal list of ACL data.
+ */
+void
+archive_entry_acl_add_entry(struct archive_entry *entry,
+ int type, int permset, int tag, int id, const char *name)
+{
+ struct ae_acl *ap;
+
+ if (acl_special(entry, type, permset, tag) == 0)
+ return;
+ ap = acl_new_entry(entry, type, permset, tag, id);
+ if (ap == NULL) {
+ /* XXX Error XXX */
+ return;
+ }
+ if (name != NULL && *name != '\0')
+ aes_copy_mbs(&ap->name, name);
+ else
+ aes_clean(&ap->name);
+}
+
+/*
+ * As above, but with a wide-character name.
+ */
+void
+archive_entry_acl_add_entry_w(struct archive_entry *entry,
+ int type, int permset, int tag, int id, const wchar_t *name)
+{
+ archive_entry_acl_add_entry_w_len(entry, type, permset, tag, id, name, wcslen(name));
+}
+
+static void
+archive_entry_acl_add_entry_w_len(struct archive_entry *entry,
+ int type, int permset, int tag, int id, const wchar_t *name, size_t len)
+{
+ struct ae_acl *ap;
+
+ if (acl_special(entry, type, permset, tag) == 0)
+ return;
+ ap = acl_new_entry(entry, type, permset, tag, id);
+ if (ap == NULL) {
+ /* XXX Error XXX */
+ return;
+ }
+ if (name != NULL && *name != L'\0' && len > 0)
+ aes_copy_wcs_len(&ap->name, name, len);
+ else
+ aes_clean(&ap->name);
+}
+
+/*
+ * If this ACL entry is part of the standard POSIX permissions set,
+ * store the permissions in the stat structure and return zero.
+ */
+static int
+acl_special(struct archive_entry *entry, int type, int permset, int tag)
+{
+ if (type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS) {
+ switch (tag) {
+ case ARCHIVE_ENTRY_ACL_USER_OBJ:
+ entry->ae_stat.aest_mode &= ~0700;
+ entry->ae_stat.aest_mode |= (permset & 7) << 6;
+ return (0);
+ case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
+ entry->ae_stat.aest_mode &= ~0070;
+ entry->ae_stat.aest_mode |= (permset & 7) << 3;
+ return (0);
+ case ARCHIVE_ENTRY_ACL_OTHER:
+ entry->ae_stat.aest_mode &= ~0007;
+ entry->ae_stat.aest_mode |= permset & 7;
+ return (0);
+ }
+ }
+ return (1);
+}
+
+/*
+ * Allocate and populate a new ACL entry with everything but the
+ * name.
+ */
+static struct ae_acl *
+acl_new_entry(struct archive_entry *entry,
+ int type, int permset, int tag, int id)
+{
+ struct ae_acl *ap, *aq;
+
+ if (type != ARCHIVE_ENTRY_ACL_TYPE_ACCESS &&
+ type != ARCHIVE_ENTRY_ACL_TYPE_DEFAULT)
+ return (NULL);
+ if (entry->acl_text_w != NULL) {
+ free(entry->acl_text_w);
+ entry->acl_text_w = NULL;
+ }
+
+ /* XXX TODO: More sanity-checks on the arguments XXX */
+
+ /* If there's a matching entry already in the list, overwrite it. */
+ ap = entry->acl_head;
+ aq = NULL;
+ while (ap != NULL) {
+ if (ap->type == type && ap->tag == tag && ap->id == id) {
+ ap->permset = permset;
+ return (ap);
+ }
+ aq = ap;
+ ap = ap->next;
+ }
+
+ /* Add a new entry to the end of the list. */
+ ap = (struct ae_acl *)malloc(sizeof(*ap));
+ if (ap == NULL)
+ return (NULL);
+ memset(ap, 0, sizeof(*ap));
+ if (aq == NULL)
+ entry->acl_head = ap;
+ else
+ aq->next = ap;
+ ap->type = type;
+ ap->tag = tag;
+ ap->id = id;
+ ap->permset = permset;
+ return (ap);
+}
+
+/*
+ * Return a count of entries matching "want_type".
+ */
+int
+archive_entry_acl_count(struct archive_entry *entry, int want_type)
+{
+ int count;
+ struct ae_acl *ap;
+
+ count = 0;
+ ap = entry->acl_head;
+ while (ap != NULL) {
+ if ((ap->type & want_type) != 0)
+ count++;
+ ap = ap->next;
+ }
+
+ if (count > 0 && ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0))
+ count += 3;
+ return (count);
+}
+
+/*
+ * Prepare for reading entries from the ACL data. Returns a count
+ * of entries matching "want_type", or zero if there are no
+ * non-extended ACL entries of that type.
+ */
+int
+archive_entry_acl_reset(struct archive_entry *entry, int want_type)
+{
+ int count, cutoff;
+
+ count = archive_entry_acl_count(entry, want_type);
+
+ /*
+ * If the only entries are the three standard ones,
+ * then don't return any ACL data. (In this case,
+ * client can just use chmod(2) to set permissions.)
+ */
+ if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0)
+ cutoff = 3;
+ else
+ cutoff = 0;
+
+ if (count > cutoff)
+ entry->acl_state = ARCHIVE_ENTRY_ACL_USER_OBJ;
+ else
+ entry->acl_state = 0;
+ entry->acl_p = entry->acl_head;
+ return (count);
+}
+
+/*
+ * Return the next ACL entry in the list. Fake entries for the
+ * standard permissions and include them in the returned list.
+ */
+
+int
+archive_entry_acl_next(struct archive_entry *entry, int want_type, int *type,
+ int *permset, int *tag, int *id, const char **name)
+{
+ *name = NULL;
+ *id = -1;
+
+ /*
+ * The acl_state is either zero (no entries available), -1
+ * (reading from list), or an entry type (retrieve that type
+ * from ae_stat.aest_mode).
+ */
+ if (entry->acl_state == 0)
+ return (ARCHIVE_WARN);
+
+ /* The first three access entries are special. */
+ if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
+ switch (entry->acl_state) {
+ case ARCHIVE_ENTRY_ACL_USER_OBJ:
+ *permset = (entry->ae_stat.aest_mode >> 6) & 7;
+ *type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;
+ *tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
+ entry->acl_state = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
+ return (ARCHIVE_OK);
+ case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
+ *permset = (entry->ae_stat.aest_mode >> 3) & 7;
+ *type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;
+ *tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
+ entry->acl_state = ARCHIVE_ENTRY_ACL_OTHER;
+ return (ARCHIVE_OK);
+ case ARCHIVE_ENTRY_ACL_OTHER:
+ *permset = entry->ae_stat.aest_mode & 7;
+ *type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;
+ *tag = ARCHIVE_ENTRY_ACL_OTHER;
+ entry->acl_state = -1;
+ entry->acl_p = entry->acl_head;
+ return (ARCHIVE_OK);
+ default:
+ break;
+ }
+ }
+
+ while (entry->acl_p != NULL && (entry->acl_p->type & want_type) == 0)
+ entry->acl_p = entry->acl_p->next;
+ if (entry->acl_p == NULL) {
+ entry->acl_state = 0;
+ *type = 0;
+ *permset = 0;
+ *tag = 0;
+ *id = -1;
+ *name = NULL;
+ return (ARCHIVE_EOF); /* End of ACL entries. */
+ }
+ *type = entry->acl_p->type;
+ *permset = entry->acl_p->permset;
+ *tag = entry->acl_p->tag;
+ *id = entry->acl_p->id;
+ *name = aes_get_mbs(&entry->acl_p->name);
+ entry->acl_p = entry->acl_p->next;
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Generate a text version of the ACL. The flags parameter controls
+ * the style of the generated ACL.
+ */
+const wchar_t *
+archive_entry_acl_text_w(struct archive_entry *entry, int flags)
+{
+ int count;
+ size_t length;
+ const wchar_t *wname;
+ const wchar_t *prefix;
+ wchar_t separator;
+ struct ae_acl *ap;
+ int id;
+ wchar_t *wp;
+
+ if (entry->acl_text_w != NULL) {
+ free (entry->acl_text_w);
+ entry->acl_text_w = NULL;
+ }
+
+ separator = L',';
+ count = 0;
+ length = 0;
+ ap = entry->acl_head;
+ while (ap != NULL) {
+ if ((ap->type & flags) != 0) {
+ count++;
+ if ((flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) &&
+ (ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT))
+ length += 8; /* "default:" */
+ length += 5; /* tag name */
+ length += 1; /* colon */
+ wname = aes_get_wcs(&ap->name);
+ if (wname != NULL)
+ length += wcslen(wname);
+ else
+ length += sizeof(uid_t) * 3 + 1;
+ length ++; /* colon */
+ length += 3; /* rwx */
+ length += 1; /* colon */
+ length += max(sizeof(uid_t), sizeof(gid_t)) * 3 + 1;
+ length ++; /* newline */
+ }
+ ap = ap->next;
+ }
+
+ if (count > 0 && ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0)) {
+ length += 10; /* "user::rwx\n" */
+ length += 11; /* "group::rwx\n" */
+ length += 11; /* "other::rwx\n" */
+ }
+
+ if (count == 0)
+ return (NULL);
+
+ /* Now, allocate the string and actually populate it. */
+ wp = entry->acl_text_w = (wchar_t *)malloc(length * sizeof(wchar_t));
+ if (wp == NULL)
+ __archive_errx(1, "No memory to generate the text version of the ACL");
+ count = 0;
+ if ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
+ append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_USER_OBJ, NULL,
+ entry->ae_stat.aest_mode & 0700, -1);
+ *wp++ = ',';
+ append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_GROUP_OBJ, NULL,
+ entry->ae_stat.aest_mode & 0070, -1);
+ *wp++ = ',';
+ append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_OTHER, NULL,
+ entry->ae_stat.aest_mode & 0007, -1);
+ count += 3;
+
+ ap = entry->acl_head;
+ while (ap != NULL) {
+ if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
+ wname = aes_get_wcs(&ap->name);
+ *wp++ = separator;
+ if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)
+ id = ap->id;
+ else
+ id = -1;
+ append_entry_w(&wp, NULL, ap->tag, wname,
+ ap->permset, id);
+ count++;
+ }
+ ap = ap->next;
+ }
+ }
+
+
+ if ((flags & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) {
+ if (flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT)
+ prefix = L"default:";
+ else
+ prefix = NULL;
+ ap = entry->acl_head;
+ count = 0;
+ while (ap != NULL) {
+ if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) {
+ wname = aes_get_wcs(&ap->name);
+ if (count > 0)
+ *wp++ = separator;
+ if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)
+ id = ap->id;
+ else
+ id = -1;
+ append_entry_w(&wp, prefix, ap->tag,
+ wname, ap->permset, id);
+ count ++;
+ }
+ ap = ap->next;
+ }
+ }
+
+ return (entry->acl_text_w);
+}
+
+static void
+append_id_w(wchar_t **wp, int id)
+{
+ if (id < 0)
+ id = 0;
+ if (id > 9)
+ append_id_w(wp, id / 10);
+ *(*wp)++ = L"0123456789"[id % 10];
+}
+
+static void
+append_entry_w(wchar_t **wp, const wchar_t *prefix, int tag,
+ const wchar_t *wname, int perm, int id)
+{
+ if (prefix != NULL) {
+ wcscpy(*wp, prefix);
+ *wp += wcslen(*wp);
+ }
+ switch (tag) {
+ case ARCHIVE_ENTRY_ACL_USER_OBJ:
+ wname = NULL;
+ id = -1;
+ /* FALLTHROUGH */
+ case ARCHIVE_ENTRY_ACL_USER:
+ wcscpy(*wp, L"user");
+ break;
+ case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
+ wname = NULL;
+ id = -1;
+ /* FALLTHROUGH */
+ case ARCHIVE_ENTRY_ACL_GROUP:
+ wcscpy(*wp, L"group");
+ break;
+ case ARCHIVE_ENTRY_ACL_MASK:
+ wcscpy(*wp, L"mask");
+ wname = NULL;
+ id = -1;
+ break;
+ case ARCHIVE_ENTRY_ACL_OTHER:
+ wcscpy(*wp, L"other");
+ wname = NULL;
+ id = -1;
+ break;
+ }
+ *wp += wcslen(*wp);
+ *(*wp)++ = L':';
+ if (wname != NULL) {
+ wcscpy(*wp, wname);
+ *wp += wcslen(*wp);
+ } else if (tag == ARCHIVE_ENTRY_ACL_USER
+ || tag == ARCHIVE_ENTRY_ACL_GROUP) {
+ append_id_w(wp, id);
+ id = -1;
+ }
+ *(*wp)++ = L':';
+ *(*wp)++ = (perm & 0444) ? L'r' : L'-';
+ *(*wp)++ = (perm & 0222) ? L'w' : L'-';
+ *(*wp)++ = (perm & 0111) ? L'x' : L'-';
+ if (id != -1) {
+ *(*wp)++ = L':';
+ append_id_w(wp, id);
+ }
+ **wp = L'\0';
+}
+
+/*
+ * Parse a textual ACL. This automatically recognizes and supports
+ * extensions described above. The 'type' argument is used to
+ * indicate the type that should be used for any entries not
+ * explicitly marked as "default:".
+ */
+int
+__archive_entry_acl_parse_w(struct archive_entry *entry,
+ const wchar_t *text, int default_type)
+{
+ struct {
+ const wchar_t *start;
+ const wchar_t *end;
+ } field[4], name;
+
+ int fields, n;
+ int type, tag, permset, id;
+ wchar_t sep;
+
+ while (text != NULL && *text != L'\0') {
+ /*
+ * Parse the fields out of the next entry,
+ * advance 'text' to start of next entry.
+ */
+ fields = 0;
+ do {
+ const wchar_t *start, *end;
+ next_field_w(&text, &start, &end, &sep);
+ if (fields < 4) {
+ field[fields].start = start;
+ field[fields].end = end;
+ }
+ ++fields;
+ } while (sep == L':');
+
+ /* Set remaining fields to blank. */
+ for (n = fields; n < 4; ++n)
+ field[n].start = field[n].end = NULL;
+
+ /* Check for a numeric ID in field 1 or 3. */
+ id = -1;
+ isint_w(field[1].start, field[1].end, &id);
+ /* Field 3 is optional. */
+ if (id == -1 && fields > 3)
+ isint_w(field[3].start, field[3].end, &id);
+
+ /*
+ * Solaris extension: "defaultuser::rwx" is the
+ * default ACL corresponding to "user::rwx", etc.
+ */
+ if (field[0].end - field[0].start > 7
+ && wmemcmp(field[0].start, L"default", 7) == 0) {
+ type = ARCHIVE_ENTRY_ACL_TYPE_DEFAULT;
+ field[0].start += 7;
+ } else
+ type = default_type;
+
+ name.start = name.end = NULL;
+ if (prefix_w(field[0].start, field[0].end, L"user")) {
+ if (!ismode_w(field[2].start, field[2].end, &permset))
+ return (ARCHIVE_WARN);
+ if (id != -1 || field[1].start < field[1].end) {
+ tag = ARCHIVE_ENTRY_ACL_USER;
+ name = field[1];
+ } else
+ tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
+ } else if (prefix_w(field[0].start, field[0].end, L"group")) {
+ if (!ismode_w(field[2].start, field[2].end, &permset))
+ return (ARCHIVE_WARN);
+ if (id != -1 || field[1].start < field[1].end) {
+ tag = ARCHIVE_ENTRY_ACL_GROUP;
+ name = field[1];
+ } else
+ tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
+ } else if (prefix_w(field[0].start, field[0].end, L"other")) {
+ if (fields == 2
+ && field[1].start < field[1].end
+ && ismode_w(field[1].start, field[1].end, &permset)) {
+ /* This is Solaris-style "other:rwx" */
+ } else if (fields == 3
+ && field[1].start == field[1].end
+ && field[2].start < field[2].end
+ && ismode_w(field[2].start, field[2].end, &permset)) {
+ /* This is FreeBSD-style "other::rwx" */
+ } else
+ return (ARCHIVE_WARN);
+ tag = ARCHIVE_ENTRY_ACL_OTHER;
+ } else if (prefix_w(field[0].start, field[0].end, L"mask")) {
+ if (fields == 2
+ && field[1].start < field[1].end
+ && ismode_w(field[1].start, field[1].end, &permset)) {
+ /* This is Solaris-style "mask:rwx" */
+ } else if (fields == 3
+ && field[1].start == field[1].end
+ && field[2].start < field[2].end
+ && ismode_w(field[2].start, field[2].end, &permset)) {
+ /* This is FreeBSD-style "mask::rwx" */
+ } else
+ return (ARCHIVE_WARN);
+ tag = ARCHIVE_ENTRY_ACL_MASK;
+ } else
+ return (ARCHIVE_WARN);
+
+ /* Add entry to the internal list. */
+ archive_entry_acl_add_entry_w_len(entry, type, permset,
+ tag, id, name.start, name.end - name.start);
+ }
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Parse a string to a positive decimal integer. Returns true if
+ * the string is non-empty and consists only of decimal digits,
+ * false otherwise.
+ */
+static int
+isint_w(const wchar_t *start, const wchar_t *end, int *result)
+{
+ int n = 0;
+ if (start >= end)
+ return (0);
+ while (start < end) {
+ if (*start < '0' || *start > '9')
+ return (0);
+ if (n > (INT_MAX / 10))
+ n = INT_MAX;
+ else {
+ n *= 10;
+ n += *start - '0';
+ }
+ start++;
+ }
+ *result = n;
+ return (1);
+}
+
+/*
+ * Parse a string as a mode field. Returns true if
+ * the string is non-empty and consists only of mode characters,
+ * false otherwise.
+ */
+static int
+ismode_w(const wchar_t *start, const wchar_t *end, int *permset)
+{
+ const wchar_t *p;
+
+ if (start >= end)
+ return (0);
+ p = start;
+ *permset = 0;
+ while (p < end) {
+ switch (*p++) {
+ case 'r': case 'R':
+ *permset |= ARCHIVE_ENTRY_ACL_READ;
+ break;
+ case 'w': case 'W':
+ *permset |= ARCHIVE_ENTRY_ACL_WRITE;
+ break;
+ case 'x': case 'X':
+ *permset |= ARCHIVE_ENTRY_ACL_EXECUTE;
+ break;
+ case '-':
+ break;
+ default:
+ return (0);
+ }
+ }
+ return (1);
+}
+
+/*
+ * Match "[:whitespace:]*(.*)[:whitespace:]*[:,\n]". *wp is updated
+ * to point to just after the separator. *start points to the first
+ * character of the matched text and *end just after the last
+ * character of the matched identifier. In particular *end - *start
+ * is the length of the field body, not including leading or trailing
+ * whitespace.
+ */
+static void
+next_field_w(const wchar_t **wp, const wchar_t **start,
+ const wchar_t **end, wchar_t *sep)
+{
+ /* Skip leading whitespace to find start of field. */
+ while (**wp == L' ' || **wp == L'\t' || **wp == L'\n') {
+ (*wp)++;
+ }
+ *start = *wp;
+
+ /* Scan for the separator. */
+ while (**wp != L'\0' && **wp != L',' && **wp != L':' &&
+ **wp != L'\n') {
+ (*wp)++;
+ }
+ *sep = **wp;
+
+ /* Trim trailing whitespace to locate end of field. */
+ *end = *wp - 1;
+ while (**end == L' ' || **end == L'\t' || **end == L'\n') {
+ (*end)--;
+ }
+ (*end)++;
+
+ /* Adjust scanner location. */
+ if (**wp != L'\0')
+ (*wp)++;
+}
+
+/*
+ * Return true if the characters [start...end) are a prefix of 'test'.
+ * This makes it easy to handle the obvious abbreviations: 'u' for 'user', etc.
+ */
+static int
+prefix_w(const wchar_t *start, const wchar_t *end, const wchar_t *test)
+{
+ if (start == end)
+ return (0);
+
+ if (*start++ != *test++)
+ return (0);
+
+ while (start < end && *start++ == *test++)
+ ;
+
+ if (start < end)
+ return (0);
+
+ return (1);
+}
+
+
+/*
+ * Following code is modified from UC Berkeley sources, and
+ * is subject to the following copyright notice.
+ */
+
+/*-
+ * Copyright (c) 1993
+ * The Regents of the University of California. 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.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+static struct flag {
+ const char *name;
+ const wchar_t *wname;
+ unsigned long set;
+ unsigned long clear;
+} flags[] = {
+ /* Preferred (shorter) names per flag first, all prefixed by "no" */
+#ifdef SF_APPEND
+ { "nosappnd", L"nosappnd", SF_APPEND, 0 },
+ { "nosappend", L"nosappend", SF_APPEND, 0 },
+#endif
+#ifdef EXT2_APPEND_FL /* 'a' */
+ { "nosappnd", L"nosappnd", EXT2_APPEND_FL, 0 },
+ { "nosappend", L"nosappend", EXT2_APPEND_FL, 0 },
+#endif
+#ifdef SF_ARCHIVED
+ { "noarch", L"noarch", SF_ARCHIVED, 0 },
+ { "noarchived", L"noarchived", SF_ARCHIVED, 0 },
+#endif
+#ifdef SF_IMMUTABLE
+ { "noschg", L"noschg", SF_IMMUTABLE, 0 },
+ { "noschange", L"noschange", SF_IMMUTABLE, 0 },
+ { "nosimmutable", L"nosimmutable", SF_IMMUTABLE, 0 },
+#endif
+#ifdef EXT2_IMMUTABLE_FL /* 'i' */
+ { "noschg", L"noschg", EXT2_IMMUTABLE_FL, 0 },
+ { "noschange", L"noschange", EXT2_IMMUTABLE_FL, 0 },
+ { "nosimmutable", L"nosimmutable", EXT2_IMMUTABLE_FL, 0 },
+#endif
+#ifdef SF_NOUNLINK
+ { "nosunlnk", L"nosunlnk", SF_NOUNLINK, 0 },
+ { "nosunlink", L"nosunlink", SF_NOUNLINK, 0 },
+#endif
+#ifdef SF_SNAPSHOT
+ { "nosnapshot", L"nosnapshot", SF_SNAPSHOT, 0 },
+#endif
+#ifdef UF_APPEND
+ { "nouappnd", L"nouappnd", UF_APPEND, 0 },
+ { "nouappend", L"nouappend", UF_APPEND, 0 },
+#endif
+#ifdef UF_IMMUTABLE
+ { "nouchg", L"nouchg", UF_IMMUTABLE, 0 },
+ { "nouchange", L"nouchange", UF_IMMUTABLE, 0 },
+ { "nouimmutable", L"nouimmutable", UF_IMMUTABLE, 0 },
+#endif
+#ifdef UF_NODUMP
+ { "nodump", L"nodump", 0, UF_NODUMP},
+#endif
+#ifdef EXT2_NODUMP_FL /* 'd' */
+ { "nodump", L"nodump", 0, EXT2_NODUMP_FL},
+#endif
+#ifdef UF_OPAQUE
+ { "noopaque", L"noopaque", UF_OPAQUE, 0 },
+#endif
+#ifdef UF_NOUNLINK
+ { "nouunlnk", L"nouunlnk", UF_NOUNLINK, 0 },
+ { "nouunlink", L"nouunlink", UF_NOUNLINK, 0 },
+#endif
+#ifdef EXT2_UNRM_FL
+ { "nouunlink", L"nouunlink", EXT2_UNRM_FL, 0},
+#endif
+
+#ifdef EXT2_BTREE_FL
+ { "nobtree", L"nobtree", EXT2_BTREE_FL, 0 },
+#endif
+
+#ifdef EXT2_ECOMPR_FL
+ { "nocomperr", L"nocomperr", EXT2_ECOMPR_FL, 0 },
+#endif
+
+#ifdef EXT2_COMPR_FL /* 'c' */
+ { "nocompress", L"nocompress", EXT2_COMPR_FL, 0 },
+#endif
+
+#ifdef EXT2_NOATIME_FL /* 'A' */
+ { "noatime", L"noatime", 0, EXT2_NOATIME_FL},
+#endif
+
+#ifdef EXT2_DIRTY_FL
+ { "nocompdirty",L"nocompdirty", EXT2_DIRTY_FL, 0},
+#endif
+
+#ifdef EXT2_COMPRBLK_FL
+#ifdef EXT2_NOCOMPR_FL
+ { "nocomprblk", L"nocomprblk", EXT2_COMPRBLK_FL, EXT2_NOCOMPR_FL},
+#else
+ { "nocomprblk", L"nocomprblk", EXT2_COMPRBLK_FL, 0},
+#endif
+#endif
+#ifdef EXT2_DIRSYNC_FL
+ { "nodirsync", L"nodirsync", EXT2_DIRSYNC_FL, 0},
+#endif
+#ifdef EXT2_INDEX_FL
+ { "nohashidx", L"nohashidx", EXT2_INDEX_FL, 0},
+#endif
+#ifdef EXT2_IMAGIC_FL
+ { "noimagic", L"noimagic", EXT2_IMAGIC_FL, 0},
+#endif
+#ifdef EXT3_JOURNAL_DATA_FL
+ { "nojournal", L"nojournal", EXT3_JOURNAL_DATA_FL, 0},
+#endif
+#ifdef EXT2_SECRM_FL
+ { "nosecuredeletion",L"nosecuredeletion",EXT2_SECRM_FL, 0},
+#endif
+#ifdef EXT2_SYNC_FL
+ { "nosync", L"nosync", EXT2_SYNC_FL, 0},
+#endif
+#ifdef EXT2_NOTAIL_FL
+ { "notail", L"notail", 0, EXT2_NOTAIL_FL},
+#endif
+#ifdef EXT2_TOPDIR_FL
+ { "notopdir", L"notopdir", EXT2_TOPDIR_FL, 0},
+#endif
+#ifdef EXT2_RESERVED_FL
+ { "noreserved", L"noreserved", EXT2_RESERVED_FL, 0},
+#endif
+
+ { NULL, NULL, 0, 0 }
+};
+
+/*
+ * fflagstostr --
+ * Convert file flags to a comma-separated string. If no flags
+ * are set, return the empty string.
+ */
+static char *
+ae_fflagstostr(unsigned long bitset, unsigned long bitclear)
+{
+ char *string, *dp;
+ const char *sp;
+ unsigned long bits;
+ struct flag *flag;
+ size_t length;
+
+ bits = bitset | bitclear;
+ length = 0;
+ for (flag = flags; flag->name != NULL; flag++)
+ if (bits & (flag->set | flag->clear)) {
+ length += strlen(flag->name) + 1;
+ bits &= ~(flag->set | flag->clear);
+ }
+
+ if (length == 0)
+ return (NULL);
+ string = (char *)malloc(length);
+ if (string == NULL)
+ return (NULL);
+
+ dp = string;
+ for (flag = flags; flag->name != NULL; flag++) {
+ if (bitset & flag->set || bitclear & flag->clear) {
+ sp = flag->name + 2;
+ } else if (bitset & flag->clear || bitclear & flag->set) {
+ sp = flag->name;
+ } else
+ continue;
+ bitset &= ~(flag->set | flag->clear);
+ bitclear &= ~(flag->set | flag->clear);
+ if (dp > string)
+ *dp++ = ',';
+ while ((*dp++ = *sp++) != '\0')
+ ;
+ dp--;
+ }
+
+ *dp = '\0';
+ return (string);
+}
+
+/*
+ * strtofflags --
+ * Take string of arguments and return file flags. This
+ * version works a little differently than strtofflags(3).
+ * In particular, it always tests every token, skipping any
+ * unrecognized tokens. It returns a pointer to the first
+ * unrecognized token, or NULL if every token was recognized.
+ * This version is also const-correct and does not modify the
+ * provided string.
+ */
+static const char *
+ae_strtofflags(const char *s, unsigned long *setp, unsigned long *clrp)
+{
+ const char *start, *end;
+ struct flag *flag;
+ unsigned long set, clear;
+ const char *failed;
+
+ set = clear = 0;
+ start = s;
+ failed = NULL;
+ /* Find start of first token. */
+ while (*start == '\t' || *start == ' ' || *start == ',')
+ start++;
+ while (*start != '\0') {
+ /* Locate end of token. */
+ end = start;
+ while (*end != '\0' && *end != '\t' &&
+ *end != ' ' && *end != ',')
+ end++;
+ for (flag = flags; flag->name != NULL; flag++) {
+ if (memcmp(start, flag->name, end - start) == 0) {
+ /* Matched "noXXXX", so reverse the sense. */
+ clear |= flag->set;
+ set |= flag->clear;
+ break;
+ } else if (memcmp(start, flag->name + 2, end - start)
+ == 0) {
+ /* Matched "XXXX", so don't reverse. */
+ set |= flag->set;
+ clear |= flag->clear;
+ break;
+ }
+ }
+ /* Ignore unknown flag names. */
+ if (flag->name == NULL && failed == NULL)
+ failed = start;
+
+ /* Find start of next token. */
+ start = end;
+ while (*start == '\t' || *start == ' ' || *start == ',')
+ start++;
+
+ }
+
+ if (setp)
+ *setp = set;
+ if (clrp)
+ *clrp = clear;
+
+ /* Return location of first failure. */
+ return (failed);
+}
+
+/*
+ * wcstofflags --
+ * Take string of arguments and return file flags. This
+ * version works a little differently than strtofflags(3).
+ * In particular, it always tests every token, skipping any
+ * unrecognized tokens. It returns a pointer to the first
+ * unrecognized token, or NULL if every token was recognized.
+ * This version is also const-correct and does not modify the
+ * provided string.
+ */
+static const wchar_t *
+ae_wcstofflags(const wchar_t *s, unsigned long *setp, unsigned long *clrp)
+{
+ const wchar_t *start, *end;
+ struct flag *flag;
+ unsigned long set, clear;
+ const wchar_t *failed;
+
+ set = clear = 0;
+ start = s;
+ failed = NULL;
+ /* Find start of first token. */
+ while (*start == L'\t' || *start == L' ' || *start == L',')
+ start++;
+ while (*start != L'\0') {
+ /* Locate end of token. */
+ end = start;
+ while (*end != L'\0' && *end != L'\t' &&
+ *end != L' ' && *end != L',')
+ end++;
+ for (flag = flags; flag->wname != NULL; flag++) {
+ if (wmemcmp(start, flag->wname, end - start) == 0) {
+ /* Matched "noXXXX", so reverse the sense. */
+ clear |= flag->set;
+ set |= flag->clear;
+ break;
+ } else if (wmemcmp(start, flag->wname + 2, end - start)
+ == 0) {
+ /* Matched "XXXX", so don't reverse. */
+ set |= flag->set;
+ clear |= flag->clear;
+ break;
+ }
+ }
+ /* Ignore unknown flag names. */
+ if (flag->wname == NULL && failed == NULL)
+ failed = start;
+
+ /* Find start of next token. */
+ start = end;
+ while (*start == L'\t' || *start == L' ' || *start == L',')
+ start++;
+
+ }
+
+ if (setp)
+ *setp = set;
+ if (clrp)
+ *clrp = clear;
+
+ /* Return location of first failure. */
+ return (failed);
+}
+
+
+#ifdef TEST
+#include <stdio.h>
+int
+main(int argc, char **argv)
+{
+ struct archive_entry *entry = archive_entry_new();
+ unsigned long set, clear;
+ const wchar_t *remainder;
+
+ remainder = archive_entry_copy_fflags_text_w(entry, L"nosappnd dump archive,,,,,,,");
+ archive_entry_fflags(entry, &set, &clear);
+
+ wprintf(L"set=0x%lX clear=0x%lX remainder='%ls'\n", set, clear, remainder);
+
+ wprintf(L"new flags='%s'\n", archive_entry_fflags_text(entry));
+ return (0);
+}
+#endif
diff --git a/archivers/libarchive/files/libarchive/archive_entry.h b/archivers/libarchive/files/libarchive/archive_entry.h
new file mode 100644
index 00000000000..d5728179eb7
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_entry.h
@@ -0,0 +1,524 @@
+/*-
+ * 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.
+ *
+ * $FreeBSD: head/lib/libarchive/archive_entry.h 201096 2009-12-28 02:41:27Z kientzle $
+ */
+
+#ifndef ARCHIVE_ENTRY_H_INCLUDED
+#define ARCHIVE_ENTRY_H_INCLUDED
+
+/*
+ * Note: archive_entry.h is for use outside of libarchive; the
+ * configuration headers (config.h, archive_platform.h, etc.) are
+ * purely internal. Do NOT use HAVE_XXX configuration macros to
+ * control the behavior of this header! If you must conditionalize,
+ * use predefined compiler and/or platform macros.
+ */
+
+#include <sys/types.h>
+#include <stddef.h> /* for wchar_t */
+#include <time.h>
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#include <windows.h>
+#endif
+
+/* Get appropriate definitions of standard POSIX-style types. */
+/* These should match the types used in 'struct stat' */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define __LA_INT64_T __int64
+# if defined(__BORLANDC__)
+# define __LA_UID_T uid_t
+# define __LA_GID_T gid_t
+# define __LA_DEV_T dev_t
+# define __LA_MODE_T mode_t
+# else
+# define __LA_UID_T short
+# define __LA_GID_T short
+# define __LA_DEV_T unsigned int
+# define __LA_MODE_T unsigned short
+# endif
+#else
+#include <unistd.h>
+#define __LA_INT64_T int64_t
+#define __LA_UID_T uid_t
+#define __LA_GID_T gid_t
+#define __LA_DEV_T dev_t
+#define __LA_MODE_T mode_t
+#endif
+
+/*
+ * XXX Is this defined for all Windows compilers? If so, in what
+ * header? It would be nice to remove the __LA_INO_T indirection and
+ * just use plain ino_t everywhere. Likewise for the other types just
+ * above.
+ */
+#define __LA_INO_T ino_t
+
+
+/*
+ * On Windows, define LIBARCHIVE_STATIC if you're building or using a
+ * .lib. The default here assumes you're building a DLL. Only
+ * libarchive source should ever define __LIBARCHIVE_BUILD.
+ */
+#if ((defined __WIN32__) || (defined _WIN32) || defined(__CYGWIN__)) && (!defined LIBARCHIVE_STATIC)
+# ifdef __LIBARCHIVE_BUILD
+# ifdef __GNUC__
+# define __LA_DECL __attribute__((dllexport)) extern
+# else
+# define __LA_DECL __declspec(dllexport)
+# endif
+# else
+# ifdef __GNUC__
+# define __LA_DECL __attribute__((dllimport)) extern
+# else
+# define __LA_DECL __declspec(dllimport)
+# endif
+# endif
+#else
+/* Static libraries on all platforms and shared libraries on non-Windows. */
+# define __LA_DECL
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Description of an archive entry.
+ *
+ * You can think of this as "struct stat" with some text fields added in.
+ *
+ * TODO: Add "comment", "charset", and possibly other entries that are
+ * supported by "pax interchange" format. However, GNU, ustar, cpio,
+ * and other variants don't support these features, so they're not an
+ * excruciatingly high priority right now.
+ *
+ * TODO: "pax interchange" format allows essentially arbitrary
+ * key/value attributes to be attached to any entry. Supporting
+ * such extensions may make this library useful for special
+ * applications (e.g., a package manager could attach special
+ * package-management attributes to each entry).
+ */
+struct archive_entry;
+
+/*
+ * File-type constants. These are returned from archive_entry_filetype()
+ * and passed to archive_entry_set_filetype().
+ *
+ * These values match S_XXX defines on every platform I've checked,
+ * including Windows, AIX, Linux, Solaris, and BSD. They're
+ * (re)defined here because platforms generally don't define the ones
+ * they don't support. For example, Windows doesn't define S_IFLNK or
+ * S_IFBLK. Instead of having a mass of conditional logic and system
+ * checks to define any S_XXX values that aren't supported locally,
+ * I've just defined a new set of such constants so that
+ * libarchive-based applications can manipulate and identify archive
+ * entries properly even if the hosting platform can't store them on
+ * disk.
+ *
+ * These values are also used directly within some portable formats,
+ * such as cpio. If you find a platform that varies from these, the
+ * correct solution is to leave these alone and translate from these
+ * portable values to platform-native values when entries are read from
+ * or written to disk.
+ */
+#define AE_IFMT 0170000
+#define AE_IFREG 0100000
+#define AE_IFLNK 0120000
+#define AE_IFSOCK 0140000
+#define AE_IFCHR 0020000
+#define AE_IFBLK 0060000
+#define AE_IFDIR 0040000
+#define AE_IFIFO 0010000
+
+/*
+ * Basic object manipulation
+ */
+
+__LA_DECL struct archive_entry *archive_entry_clear(struct archive_entry *);
+/* The 'clone' function does a deep copy; all of the strings are copied too. */
+__LA_DECL struct archive_entry *archive_entry_clone(struct archive_entry *);
+__LA_DECL void archive_entry_free(struct archive_entry *);
+__LA_DECL struct archive_entry *archive_entry_new(void);
+
+/*
+ * Retrieve fields from an archive_entry.
+ *
+ * There are a number of implicit conversions among these fields. For
+ * example, if a regular string field is set and you read the _w wide
+ * character field, the entry will implicitly convert narrow-to-wide
+ * using the current locale. Similarly, dev values are automatically
+ * updated when you write devmajor or devminor and vice versa.
+ *
+ * In addition, fields can be "set" or "unset." Unset string fields
+ * return NULL, non-string fields have _is_set() functions to test
+ * whether they've been set. You can "unset" a string field by
+ * assigning NULL; non-string fields have _unset() functions to
+ * unset them.
+ *
+ * Note: There is one ambiguity in the above; string fields will
+ * also return NULL when implicit character set conversions fail.
+ * This is usually what you want.
+ */
+__LA_DECL time_t archive_entry_atime(struct archive_entry *);
+__LA_DECL long archive_entry_atime_nsec(struct archive_entry *);
+__LA_DECL int archive_entry_atime_is_set(struct archive_entry *);
+__LA_DECL time_t archive_entry_birthtime(struct archive_entry *);
+__LA_DECL long archive_entry_birthtime_nsec(struct archive_entry *);
+__LA_DECL int archive_entry_birthtime_is_set(struct archive_entry *);
+__LA_DECL time_t archive_entry_ctime(struct archive_entry *);
+__LA_DECL long archive_entry_ctime_nsec(struct archive_entry *);
+__LA_DECL int archive_entry_ctime_is_set(struct archive_entry *);
+__LA_DECL dev_t archive_entry_dev(struct archive_entry *);
+__LA_DECL dev_t archive_entry_devmajor(struct archive_entry *);
+__LA_DECL dev_t archive_entry_devminor(struct archive_entry *);
+__LA_DECL __LA_MODE_T archive_entry_filetype(struct archive_entry *);
+__LA_DECL void archive_entry_fflags(struct archive_entry *,
+ unsigned long * /* set */,
+ unsigned long * /* clear */);
+__LA_DECL const char *archive_entry_fflags_text(struct archive_entry *);
+__LA_DECL __LA_GID_T archive_entry_gid(struct archive_entry *);
+__LA_DECL const char *archive_entry_gname(struct archive_entry *);
+__LA_DECL const wchar_t *archive_entry_gname_w(struct archive_entry *);
+__LA_DECL const char *archive_entry_hardlink(struct archive_entry *);
+__LA_DECL const wchar_t *archive_entry_hardlink_w(struct archive_entry *);
+__LA_DECL __LA_INO_T archive_entry_ino(struct archive_entry *);
+__LA_DECL __LA_INT64_T archive_entry_ino64(struct archive_entry *);
+__LA_DECL __LA_MODE_T archive_entry_mode(struct archive_entry *);
+__LA_DECL time_t archive_entry_mtime(struct archive_entry *);
+__LA_DECL long archive_entry_mtime_nsec(struct archive_entry *);
+__LA_DECL int archive_entry_mtime_is_set(struct archive_entry *);
+__LA_DECL unsigned int archive_entry_nlink(struct archive_entry *);
+__LA_DECL const char *archive_entry_pathname(struct archive_entry *);
+__LA_DECL const wchar_t *archive_entry_pathname_w(struct archive_entry *);
+__LA_DECL dev_t archive_entry_rdev(struct archive_entry *);
+__LA_DECL dev_t archive_entry_rdevmajor(struct archive_entry *);
+__LA_DECL dev_t archive_entry_rdevminor(struct archive_entry *);
+__LA_DECL const char *archive_entry_sourcepath(struct archive_entry *);
+__LA_DECL __LA_INT64_T archive_entry_size(struct archive_entry *);
+__LA_DECL int archive_entry_size_is_set(struct archive_entry *);
+__LA_DECL const char *archive_entry_strmode(struct archive_entry *);
+__LA_DECL const char *archive_entry_symlink(struct archive_entry *);
+__LA_DECL const wchar_t *archive_entry_symlink_w(struct archive_entry *);
+__LA_DECL __LA_UID_T archive_entry_uid(struct archive_entry *);
+__LA_DECL const char *archive_entry_uname(struct archive_entry *);
+__LA_DECL const wchar_t *archive_entry_uname_w(struct archive_entry *);
+
+/*
+ * Set fields in an archive_entry.
+ *
+ * Note that string 'set' functions do not copy the string, only the pointer.
+ * In contrast, 'copy' functions do copy the object pointed to.
+ *
+ * Note: As of libarchive 2.4, 'set' functions do copy the string and
+ * are therefore exact synonyms for the 'copy' versions. The 'copy'
+ * names will be retired in libarchive 3.0.
+ */
+
+__LA_DECL void archive_entry_set_atime(struct archive_entry *, time_t, long);
+__LA_DECL void archive_entry_unset_atime(struct archive_entry *);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+__LA_DECL void archive_entry_copy_bhfi(struct archive_entry *,
+ BY_HANDLE_FILE_INFORMATION *);
+#endif
+__LA_DECL void archive_entry_set_birthtime(struct archive_entry *, time_t, long);
+__LA_DECL void archive_entry_unset_birthtime(struct archive_entry *);
+__LA_DECL void archive_entry_set_ctime(struct archive_entry *, time_t, long);
+__LA_DECL void archive_entry_unset_ctime(struct archive_entry *);
+__LA_DECL void archive_entry_set_dev(struct archive_entry *, dev_t);
+__LA_DECL void archive_entry_set_devmajor(struct archive_entry *, dev_t);
+__LA_DECL void archive_entry_set_devminor(struct archive_entry *, dev_t);
+__LA_DECL void archive_entry_set_filetype(struct archive_entry *, unsigned int);
+__LA_DECL void archive_entry_set_fflags(struct archive_entry *,
+ unsigned long /* set */, unsigned long /* clear */);
+/* Returns pointer to start of first invalid token, or NULL if none. */
+/* Note that all recognized tokens are processed, regardless. */
+__LA_DECL const char *archive_entry_copy_fflags_text(struct archive_entry *,
+ const char *);
+__LA_DECL const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *,
+ const wchar_t *);
+__LA_DECL void archive_entry_set_gid(struct archive_entry *, __LA_GID_T);
+__LA_DECL void archive_entry_set_gname(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_copy_gname(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_copy_gname_w(struct archive_entry *, const wchar_t *);
+__LA_DECL int archive_entry_update_gname_utf8(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_set_hardlink(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_copy_hardlink(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *);
+__LA_DECL int archive_entry_update_hardlink_utf8(struct archive_entry *, const char *);
+#if ARCHIVE_VERSION_NUMBER >= 3000000
+/* Starting with libarchive 3.0, this will be synonym for ino64. */
+__LA_DECL void archive_entry_set_ino(struct archive_entry *, __LA_INT64_T);
+#else
+__LA_DECL void archive_entry_set_ino(struct archive_entry *, unsigned long);
+#endif
+__LA_DECL void archive_entry_set_ino64(struct archive_entry *, __LA_INT64_T);
+__LA_DECL void archive_entry_set_link(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_copy_link(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_copy_link_w(struct archive_entry *, const wchar_t *);
+__LA_DECL int archive_entry_update_link_utf8(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_set_mode(struct archive_entry *, __LA_MODE_T);
+__LA_DECL void archive_entry_set_mtime(struct archive_entry *, time_t, long);
+__LA_DECL void archive_entry_unset_mtime(struct archive_entry *);
+__LA_DECL void archive_entry_set_nlink(struct archive_entry *, unsigned int);
+__LA_DECL void archive_entry_set_pathname(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_copy_pathname(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_copy_pathname_w(struct archive_entry *, const wchar_t *);
+__LA_DECL int archive_entry_update_pathname_utf8(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_set_perm(struct archive_entry *, __LA_MODE_T);
+__LA_DECL void archive_entry_set_rdev(struct archive_entry *, dev_t);
+__LA_DECL void archive_entry_set_rdevmajor(struct archive_entry *, dev_t);
+__LA_DECL void archive_entry_set_rdevminor(struct archive_entry *, dev_t);
+__LA_DECL void archive_entry_set_size(struct archive_entry *, __LA_INT64_T);
+__LA_DECL void archive_entry_unset_size(struct archive_entry *);
+__LA_DECL void archive_entry_copy_sourcepath(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_set_symlink(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_copy_symlink(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_copy_symlink_w(struct archive_entry *, const wchar_t *);
+__LA_DECL int archive_entry_update_symlink_utf8(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_set_uid(struct archive_entry *, __LA_UID_T);
+__LA_DECL void archive_entry_set_uname(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_copy_uname(struct archive_entry *, const char *);
+__LA_DECL void archive_entry_copy_uname_w(struct archive_entry *, const wchar_t *);
+__LA_DECL int archive_entry_update_uname_utf8(struct archive_entry *, const char *);
+/*
+ * Routines to bulk copy fields to/from a platform-native "struct
+ * stat." Libarchive used to just store a struct stat inside of each
+ * archive_entry object, but this created issues when trying to
+ * manipulate archives on systems different than the ones they were
+ * created on.
+ *
+ * TODO: On Linux, provide both stat32 and stat64 versions of these functions.
+ */
+__LA_DECL const struct stat *archive_entry_stat(struct archive_entry *);
+__LA_DECL void archive_entry_copy_stat(struct archive_entry *, const struct stat *);
+
+
+/*
+ * ACL routines. This used to simply store and return text-format ACL
+ * strings, but that proved insufficient for a number of reasons:
+ * = clients need control over uname/uid and gname/gid mappings
+ * = there are many different ACL text formats
+ * = would like to be able to read/convert archives containing ACLs
+ * on platforms that lack ACL libraries
+ *
+ * This last point, in particular, forces me to implement a reasonably
+ * complete set of ACL support routines.
+ *
+ * TODO: Extend this to support NFSv4/NTFS permissions. That should
+ * allow full ACL support on Mac OS, in particular, which uses
+ * POSIX.1e-style interfaces to manipulate NFSv4/NTFS permissions.
+ */
+
+/*
+ * Permission bits mimic POSIX.1e. Note that I've not followed POSIX.1e's
+ * "permset"/"perm" abstract type nonsense. A permset is just a simple
+ * bitmap, following long-standing Unix tradition.
+ */
+#define ARCHIVE_ENTRY_ACL_EXECUTE 1
+#define ARCHIVE_ENTRY_ACL_WRITE 2
+#define ARCHIVE_ENTRY_ACL_READ 4
+
+/* We need to be able to specify either or both of these. */
+#define ARCHIVE_ENTRY_ACL_TYPE_ACCESS 256
+#define ARCHIVE_ENTRY_ACL_TYPE_DEFAULT 512
+
+/* Tag values mimic POSIX.1e */
+#define ARCHIVE_ENTRY_ACL_USER 10001 /* Specified user. */
+#define ARCHIVE_ENTRY_ACL_USER_OBJ 10002 /* User who owns the file. */
+#define ARCHIVE_ENTRY_ACL_GROUP 10003 /* Specified group. */
+#define ARCHIVE_ENTRY_ACL_GROUP_OBJ 10004 /* Group who owns the file. */
+#define ARCHIVE_ENTRY_ACL_MASK 10005 /* Modify group access. */
+#define ARCHIVE_ENTRY_ACL_OTHER 10006 /* Public. */
+
+/*
+ * Set the ACL by clearing it and adding entries one at a time.
+ * Unlike the POSIX.1e ACL routines, you must specify the type
+ * (access/default) for each entry. Internally, the ACL data is just
+ * a soup of entries. API calls here allow you to retrieve just the
+ * entries of interest. This design (which goes against the spirit of
+ * POSIX.1e) is useful for handling archive formats that combine
+ * default and access information in a single ACL list.
+ */
+__LA_DECL void archive_entry_acl_clear(struct archive_entry *);
+__LA_DECL void archive_entry_acl_add_entry(struct archive_entry *,
+ int /* type */, int /* permset */, int /* tag */,
+ int /* qual */, const char * /* name */);
+__LA_DECL void archive_entry_acl_add_entry_w(struct archive_entry *,
+ int /* type */, int /* permset */, int /* tag */,
+ int /* qual */, const wchar_t * /* name */);
+
+/*
+ * To retrieve the ACL, first "reset", then repeatedly ask for the
+ * "next" entry. The want_type parameter allows you to request only
+ * access entries or only default entries.
+ */
+__LA_DECL int archive_entry_acl_reset(struct archive_entry *, int /* want_type */);
+__LA_DECL int archive_entry_acl_next(struct archive_entry *, int /* want_type */,
+ int * /* type */, int * /* permset */, int * /* tag */,
+ int * /* qual */, const char ** /* name */);
+__LA_DECL int archive_entry_acl_next_w(struct archive_entry *, int /* want_type */,
+ int * /* type */, int * /* permset */, int * /* tag */,
+ int * /* qual */, const wchar_t ** /* name */);
+
+/*
+ * Construct a text-format ACL. The flags argument is a bitmask that
+ * can include any of the following:
+ *
+ * ARCHIVE_ENTRY_ACL_TYPE_ACCESS - Include access entries.
+ * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - Include default entries.
+ * ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID - Include extra numeric ID field in
+ * each ACL entry. (As used by 'star'.)
+ * ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT - Include "default:" before each
+ * default ACL entry.
+ */
+#define ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 1024
+#define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 2048
+__LA_DECL const wchar_t *archive_entry_acl_text_w(struct archive_entry *,
+ int /* flags */);
+
+/* Return a count of entries matching 'want_type' */
+__LA_DECL int archive_entry_acl_count(struct archive_entry *, int /* want_type */);
+
+/*
+ * Private ACL parser. This is private because it handles some
+ * very weird formats that clients should not be messing with.
+ * Clients should only deal with their platform-native formats.
+ * Because of the need to support many formats cleanly, new arguments
+ * are likely to get added on a regular basis. Clients who try to use
+ * this interface are likely to be surprised when it changes.
+ *
+ * You were warned!
+ *
+ * TODO: Move this declaration out of the public header and into
+ * a private header. Warnings above are silly.
+ */
+__LA_DECL int __archive_entry_acl_parse_w(struct archive_entry *,
+ const wchar_t *, int /* type */);
+
+/*
+ * extended attributes
+ */
+
+__LA_DECL void archive_entry_xattr_clear(struct archive_entry *);
+__LA_DECL void archive_entry_xattr_add_entry(struct archive_entry *,
+ const char * /* name */, const void * /* value */,
+ size_t /* size */);
+
+/*
+ * To retrieve the xattr list, first "reset", then repeatedly ask for the
+ * "next" entry.
+ */
+
+__LA_DECL int archive_entry_xattr_count(struct archive_entry *);
+__LA_DECL int archive_entry_xattr_reset(struct archive_entry *);
+__LA_DECL int archive_entry_xattr_next(struct archive_entry *,
+ const char ** /* name */, const void ** /* value */, size_t *);
+
+/*
+ * Utility to match up hardlinks.
+ *
+ * The 'struct archive_entry_linkresolver' is a cache of archive entries
+ * for files with multiple links. Here's how to use it:
+ * 1. Create a lookup object with archive_entry_linkresolver_new()
+ * 2. Tell it the archive format you're using.
+ * 3. Hand each archive_entry to archive_entry_linkify().
+ * That function will return 0, 1, or 2 entries that should
+ * be written.
+ * 4. Call archive_entry_linkify(resolver, NULL) until
+ * no more entries are returned.
+ * 5. Call archive_entry_link_resolver_free(resolver) to free resources.
+ *
+ * The entries returned have their hardlink and size fields updated
+ * appropriately. If an entry is passed in that does not refer to
+ * a file with multiple links, it is returned unchanged. The intention
+ * is that you should be able to simply filter all entries through
+ * this machine.
+ *
+ * To make things more efficient, be sure that each entry has a valid
+ * nlinks value. The hardlink cache uses this to track when all links
+ * have been found. If the nlinks value is zero, it will keep every
+ * name in the cache indefinitely, which can use a lot of memory.
+ *
+ * Note that archive_entry_size() is reset to zero if the file
+ * body should not be written to the archive. Pay attention!
+ */
+struct archive_entry_linkresolver;
+
+/*
+ * There are three different strategies for marking hardlinks.
+ * The descriptions below name them after the best-known
+ * formats that rely on each strategy:
+ *
+ * "Old cpio" is the simplest, it always returns any entry unmodified.
+ * As far as I know, only cpio formats use this. Old cpio archives
+ * store every link with the full body; the onus is on the dearchiver
+ * to detect and properly link the files as they are restored.
+ * "tar" is also pretty simple; it caches a copy the first time it sees
+ * any link. Subsequent appearances are modified to be hardlink
+ * references to the first one without any body. Used by all tar
+ * formats, although the newest tar formats permit the "old cpio" strategy
+ * as well. This strategy is very simple for the dearchiver,
+ * and reasonably straightforward for the archiver.
+ * "new cpio" is trickier. It stores the body only with the last
+ * occurrence. The complication is that we might not
+ * see every link to a particular file in a single session, so
+ * there's no easy way to know when we've seen the last occurrence.
+ * The solution here is to queue one link until we see the next.
+ * At the end of the session, you can enumerate any remaining
+ * entries by calling archive_entry_linkify(NULL) and store those
+ * bodies. If you have a file with three links l1, l2, and l3,
+ * you'll get the following behavior if you see all three links:
+ * linkify(l1) => NULL (the resolver stores l1 internally)
+ * linkify(l2) => l1 (resolver stores l2, you write l1)
+ * linkify(l3) => l2, l3 (all links seen, you can write both).
+ * If you only see l1 and l2, you'll get this behavior:
+ * linkify(l1) => NULL
+ * linkify(l2) => l1
+ * linkify(NULL) => l2 (at end, you retrieve remaining links)
+ * As the name suggests, this strategy is used by newer cpio variants.
+ * It's noticably more complex for the archiver, slightly more complex
+ * for the dearchiver than the tar strategy, but makes it straightforward
+ * to restore a file using any link by simply continuing to scan until
+ * you see a link that is stored with a body. In contrast, the tar
+ * strategy requires you to rescan the archive from the beginning to
+ * correctly extract an arbitrary link.
+ */
+
+__LA_DECL struct archive_entry_linkresolver *archive_entry_linkresolver_new(void);
+__LA_DECL void archive_entry_linkresolver_set_strategy(
+ struct archive_entry_linkresolver *, int /* format_code */);
+__LA_DECL void archive_entry_linkresolver_free(struct archive_entry_linkresolver *);
+__LA_DECL void archive_entry_linkify(struct archive_entry_linkresolver *,
+ struct archive_entry **, struct archive_entry **);
+
+#ifdef __cplusplus
+}
+#endif
+
+/* This is meaningless outside of this header. */
+#undef __LA_DECL
+
+#endif /* !ARCHIVE_ENTRY_H_INCLUDED */
diff --git a/archivers/libarchive/files/libarchive/archive_entry_copy_stat.c b/archivers/libarchive/files/libarchive/archive_entry_copy_stat.c
new file mode 100644
index 00000000000..ef59a5e78a0
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_entry_copy_stat.c
@@ -0,0 +1,77 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_copy_stat.c 189466 2009-03-07 00:52:02Z kientzle $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#include "archive_entry.h"
+
+void
+archive_entry_copy_stat(struct archive_entry *entry, const struct stat *st)
+{
+#if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
+ archive_entry_set_atime(entry, st->st_atime, st->st_atimespec.tv_nsec);
+ archive_entry_set_ctime(entry, st->st_ctime, st->st_ctimespec.tv_nsec);
+ archive_entry_set_mtime(entry, st->st_mtime, st->st_mtimespec.tv_nsec);
+#elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
+ archive_entry_set_atime(entry, st->st_atime, st->st_atim.tv_nsec);
+ archive_entry_set_ctime(entry, st->st_ctime, st->st_ctim.tv_nsec);
+ archive_entry_set_mtime(entry, st->st_mtime, st->st_mtim.tv_nsec);
+#elif HAVE_STRUCT_STAT_ST_MTIME_N
+ archive_entry_set_atime(entry, st->st_atime, st->st_atime_n);
+ archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_n);
+ archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_n);
+#elif HAVE_STRUCT_STAT_ST_UMTIME
+ archive_entry_set_atime(entry, st->st_atime, st->st_uatime * 1000);
+ archive_entry_set_ctime(entry, st->st_ctime, st->st_uctime * 1000);
+ archive_entry_set_mtime(entry, st->st_mtime, st->st_umtime * 1000);
+#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
+ archive_entry_set_atime(entry, st->st_atime, st->st_atime_usec * 1000);
+ archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_usec * 1000);
+ archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_usec * 1000);
+#else
+ archive_entry_set_atime(entry, st->st_atime, 0);
+ archive_entry_set_ctime(entry, st->st_ctime, 0);
+ archive_entry_set_mtime(entry, st->st_mtime, 0);
+#if HAVE_STRUCT_STAT_ST_BIRTHTIME
+ archive_entry_set_birthtime(entry, st->st_birthtime, 0);
+#endif
+#endif
+#if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
+ archive_entry_set_birthtime(entry, st->st_birthtime, st->st_birthtimespec.tv_nsec);
+#endif
+ archive_entry_set_dev(entry, st->st_dev);
+ archive_entry_set_gid(entry, st->st_gid);
+ archive_entry_set_uid(entry, st->st_uid);
+ archive_entry_set_ino(entry, st->st_ino);
+ archive_entry_set_nlink(entry, st->st_nlink);
+ archive_entry_set_rdev(entry, st->st_rdev);
+ archive_entry_set_size(entry, st->st_size);
+ archive_entry_set_mode(entry, st->st_mode);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c b/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c
new file mode 100644
index 00000000000..3b13e19c8bf
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_entry_link_resolver.c
@@ -0,0 +1,405 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_link_resolver.c 201100 2009-12-28 03:05:31Z kientzle $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+
+/*
+ * This is mostly a pretty straightforward hash table implementation.
+ * The only interesting bit is the different strategies used to
+ * match up links. These strategies match those used by various
+ * archiving formats:
+ * tar - content stored with first link, remainder refer back to it.
+ * This requires us to match each subsequent link up with the
+ * first appearance.
+ * cpio - Old cpio just stored body with each link, match-ups were
+ * implicit. This is trivial.
+ * new cpio - New cpio only stores body with last link, match-ups
+ * are implicit. This is actually quite tricky; see the notes
+ * below.
+ */
+
+/* Users pass us a format code, we translate that into a strategy here. */
+#define ARCHIVE_ENTRY_LINKIFY_LIKE_TAR 0
+#define ARCHIVE_ENTRY_LINKIFY_LIKE_MTREE 1
+#define ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO 2
+#define ARCHIVE_ENTRY_LINKIFY_LIKE_NEW_CPIO 3
+
+/* Initial size of link cache. */
+#define links_cache_initial_size 1024
+
+struct links_entry {
+ struct links_entry *next;
+ struct links_entry *previous;
+ int links; /* # links not yet seen */
+ int hash;
+ struct archive_entry *canonical;
+ struct archive_entry *entry;
+};
+
+struct archive_entry_linkresolver {
+ struct links_entry **buckets;
+ struct links_entry *spare;
+ unsigned long number_entries;
+ size_t number_buckets;
+ int strategy;
+};
+
+static struct links_entry *find_entry(struct archive_entry_linkresolver *,
+ struct archive_entry *);
+static void grow_hash(struct archive_entry_linkresolver *);
+static struct links_entry *insert_entry(struct archive_entry_linkresolver *,
+ struct archive_entry *);
+static struct links_entry *next_entry(struct archive_entry_linkresolver *);
+
+struct archive_entry_linkresolver *
+archive_entry_linkresolver_new(void)
+{
+ struct archive_entry_linkresolver *res;
+ size_t i;
+
+ res = malloc(sizeof(struct archive_entry_linkresolver));
+ if (res == NULL)
+ return (NULL);
+ memset(res, 0, sizeof(struct archive_entry_linkresolver));
+ res->number_buckets = links_cache_initial_size;
+ res->buckets = malloc(res->number_buckets *
+ sizeof(res->buckets[0]));
+ if (res->buckets == NULL) {
+ free(res);
+ return (NULL);
+ }
+ for (i = 0; i < res->number_buckets; i++)
+ res->buckets[i] = NULL;
+ return (res);
+}
+
+void
+archive_entry_linkresolver_set_strategy(struct archive_entry_linkresolver *res,
+ int fmt)
+{
+ int fmtbase = fmt & ARCHIVE_FORMAT_BASE_MASK;
+
+ switch (fmtbase) {
+ case ARCHIVE_FORMAT_CPIO:
+ switch (fmt) {
+ case ARCHIVE_FORMAT_CPIO_SVR4_NOCRC:
+ case ARCHIVE_FORMAT_CPIO_SVR4_CRC:
+ res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_NEW_CPIO;
+ break;
+ default:
+ res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO;
+ break;
+ }
+ break;
+ case ARCHIVE_FORMAT_MTREE:
+ res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_MTREE;
+ break;
+ case ARCHIVE_FORMAT_TAR:
+ res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_TAR;
+ break;
+ default:
+ res->strategy = ARCHIVE_ENTRY_LINKIFY_LIKE_TAR;
+ break;
+ }
+}
+
+void
+archive_entry_linkresolver_free(struct archive_entry_linkresolver *res)
+{
+ struct links_entry *le;
+
+ if (res == NULL)
+ return;
+
+ if (res->buckets != NULL) {
+ while ((le = next_entry(res)) != NULL)
+ archive_entry_free(le->entry);
+ free(res->buckets);
+ res->buckets = NULL;
+ }
+ free(res);
+}
+
+void
+archive_entry_linkify(struct archive_entry_linkresolver *res,
+ struct archive_entry **e, struct archive_entry **f)
+{
+ struct links_entry *le;
+ struct archive_entry *t;
+
+ *f = NULL; /* Default: Don't return a second entry. */
+
+ if (*e == NULL) {
+ le = next_entry(res);
+ if (le != NULL) {
+ *e = le->entry;
+ le->entry = NULL;
+ }
+ return;
+ }
+
+ /* If it has only one link, then we're done. */
+ if (archive_entry_nlink(*e) == 1)
+ return;
+ /* Directories, devices never have hardlinks. */
+ if (archive_entry_filetype(*e) == AE_IFDIR
+ || archive_entry_filetype(*e) == AE_IFBLK
+ || archive_entry_filetype(*e) == AE_IFCHR)
+ return;
+
+ switch (res->strategy) {
+ case ARCHIVE_ENTRY_LINKIFY_LIKE_TAR:
+ le = find_entry(res, *e);
+ if (le != NULL) {
+ archive_entry_unset_size(*e);
+ archive_entry_copy_hardlink(*e,
+ archive_entry_pathname(le->canonical));
+ } else
+ insert_entry(res, *e);
+ return;
+ case ARCHIVE_ENTRY_LINKIFY_LIKE_MTREE:
+ le = find_entry(res, *e);
+ if (le != NULL) {
+ archive_entry_copy_hardlink(*e,
+ archive_entry_pathname(le->canonical));
+ } else
+ insert_entry(res, *e);
+ return;
+ case ARCHIVE_ENTRY_LINKIFY_LIKE_OLD_CPIO:
+ /* This one is trivial. */
+ return;
+ case ARCHIVE_ENTRY_LINKIFY_LIKE_NEW_CPIO:
+ le = find_entry(res, *e);
+ if (le != NULL) {
+ /*
+ * Put the new entry in le, return the
+ * old entry from le.
+ */
+ t = *e;
+ *e = le->entry;
+ le->entry = t;
+ /* Make the old entry into a hardlink. */
+ archive_entry_unset_size(*e);
+ archive_entry_copy_hardlink(*e,
+ archive_entry_pathname(le->canonical));
+ /* If we ran out of links, return the
+ * final entry as well. */
+ if (le->links == 0) {
+ *f = le->entry;
+ le->entry = NULL;
+ }
+ } else {
+ /*
+ * If we haven't seen it, tuck it away
+ * for future use.
+ */
+ le = insert_entry(res, *e);
+ le->entry = *e;
+ *e = NULL;
+ }
+ return;
+ default:
+ break;
+ }
+ return;
+}
+
+static struct links_entry *
+find_entry(struct archive_entry_linkresolver *res,
+ struct archive_entry *entry)
+{
+ struct links_entry *le;
+ int hash, bucket;
+ dev_t dev;
+ int64_t ino;
+
+ /* Free a held entry. */
+ if (res->spare != NULL) {
+ archive_entry_free(res->spare->canonical);
+ archive_entry_free(res->spare->entry);
+ free(res->spare);
+ res->spare = NULL;
+ }
+
+ /* If the links cache overflowed and got flushed, don't bother. */
+ if (res->buckets == NULL)
+ return (NULL);
+
+ dev = archive_entry_dev(entry);
+ ino = archive_entry_ino64(entry);
+ hash = (int)(dev ^ ino);
+
+ /* Try to locate this entry in the links cache. */
+ bucket = hash % res->number_buckets;
+ for (le = res->buckets[bucket]; le != NULL; le = le->next) {
+ if (le->hash == hash
+ && dev == archive_entry_dev(le->canonical)
+ && ino == archive_entry_ino64(le->canonical)) {
+ /*
+ * Decrement link count each time and release
+ * the entry if it hits zero. This saves
+ * memory and is necessary for detecting
+ * missed links.
+ */
+ --le->links;
+ if (le->links > 0)
+ return (le);
+ /* Remove it from this hash bucket. */
+ if (le->previous != NULL)
+ le->previous->next = le->next;
+ if (le->next != NULL)
+ le->next->previous = le->previous;
+ if (res->buckets[bucket] == le)
+ res->buckets[bucket] = le->next;
+ res->number_entries--;
+ /* Defer freeing this entry. */
+ res->spare = le;
+ return (le);
+ }
+ }
+ return (NULL);
+}
+
+static struct links_entry *
+next_entry(struct archive_entry_linkresolver *res)
+{
+ struct links_entry *le;
+ size_t bucket;
+
+ /* Free a held entry. */
+ if (res->spare != NULL) {
+ archive_entry_free(res->spare->canonical);
+ free(res->spare);
+ res->spare = NULL;
+ }
+
+ /* If the links cache overflowed and got flushed, don't bother. */
+ if (res->buckets == NULL)
+ return (NULL);
+
+ /* Look for next non-empty bucket in the links cache. */
+ for (bucket = 0; bucket < res->number_buckets; bucket++) {
+ le = res->buckets[bucket];
+ if (le != NULL) {
+ /* Remove it from this hash bucket. */
+ if (le->next != NULL)
+ le->next->previous = le->previous;
+ res->buckets[bucket] = le->next;
+ res->number_entries--;
+ /* Defer freeing this entry. */
+ res->spare = le;
+ return (le);
+ }
+ }
+ return (NULL);
+}
+
+static struct links_entry *
+insert_entry(struct archive_entry_linkresolver *res,
+ struct archive_entry *entry)
+{
+ struct links_entry *le;
+ int hash, bucket;
+
+ /* Add this entry to the links cache. */
+ le = malloc(sizeof(struct links_entry));
+ if (le == NULL)
+ return (NULL);
+ memset(le, 0, sizeof(*le));
+ le->canonical = archive_entry_clone(entry);
+
+ /* If the links cache is getting too full, enlarge the hash table. */
+ if (res->number_entries > res->number_buckets * 2)
+ grow_hash(res);
+
+ hash = archive_entry_dev(entry) ^ archive_entry_ino64(entry);
+ bucket = hash % res->number_buckets;
+
+ /* If we could allocate the entry, record it. */
+ if (res->buckets[bucket] != NULL)
+ res->buckets[bucket]->previous = le;
+ res->number_entries++;
+ le->next = res->buckets[bucket];
+ le->previous = NULL;
+ res->buckets[bucket] = le;
+ le->hash = hash;
+ le->links = archive_entry_nlink(entry) - 1;
+ return (le);
+}
+
+static void
+grow_hash(struct archive_entry_linkresolver *res)
+{
+ struct links_entry *le, **new_buckets;
+ size_t new_size;
+ size_t i, bucket;
+
+ /* Try to enlarge the bucket list. */
+ new_size = res->number_buckets * 2;
+ new_buckets = malloc(new_size * sizeof(struct links_entry *));
+
+ if (new_buckets != NULL) {
+ memset(new_buckets, 0,
+ new_size * sizeof(struct links_entry *));
+ for (i = 0; i < res->number_buckets; i++) {
+ while (res->buckets[i] != NULL) {
+ /* Remove entry from old bucket. */
+ le = res->buckets[i];
+ res->buckets[i] = le->next;
+
+ /* Add entry to new bucket. */
+ bucket = le->hash % new_size;
+
+ if (new_buckets[bucket] != NULL)
+ new_buckets[bucket]->previous =
+ le;
+ le->next = new_buckets[bucket];
+ le->previous = NULL;
+ new_buckets[bucket] = le;
+ }
+ }
+ free(res->buckets);
+ res->buckets = new_buckets;
+ res->number_buckets = new_size;
+ }
+}
diff --git a/archivers/libarchive/files/libarchive/archive_entry_private.h b/archivers/libarchive/files/libarchive/archive_entry_private.h
new file mode 100644
index 00000000000..5ab4f75f0bc
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_entry_private.h
@@ -0,0 +1,184 @@
+/*-
+ * 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: head/lib/libarchive/archive_entry_private.h 201096 2009-12-28 02:41:27Z kientzle $
+ */
+
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
+
+#ifndef ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
+#define ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
+
+#include "archive_string.h"
+
+/*
+ * Handle wide character (i.e., Unicode) and non-wide character
+ * strings transparently.
+ */
+
+struct aes {
+ struct archive_string aes_mbs;
+ struct archive_string aes_utf8;
+ const wchar_t *aes_wcs;
+ /* Bitmap of which of the above are valid. Because we're lazy
+ * about malloc-ing and reusing the underlying storage, we
+ * can't rely on NULL pointers to indicate whether a string
+ * has been set. */
+ int aes_set;
+#define AES_SET_MBS 1
+#define AES_SET_UTF8 2
+#define AES_SET_WCS 4
+};
+
+struct ae_acl {
+ struct ae_acl *next;
+ int type; /* E.g., access or default */
+ int tag; /* E.g., user/group/other/mask */
+ int permset; /* r/w/x bits */
+ int id; /* uid/gid for user/group */
+ struct aes name; /* uname/gname */
+};
+
+struct ae_xattr {
+ struct ae_xattr *next;
+
+ char *name;
+ void *value;
+ size_t size;
+};
+
+/*
+ * Description of an archive entry.
+ *
+ * Basically, this is a "struct stat" with a few text fields added in.
+ *
+ * TODO: Add "comment", "charset", and possibly other entries
+ * that are supported by "pax interchange" format. However, GNU, ustar,
+ * cpio, and other variants don't support these features, so they're not an
+ * excruciatingly high priority right now.
+ *
+ * TODO: "pax interchange" format allows essentially arbitrary
+ * key/value attributes to be attached to any entry. Supporting
+ * such extensions may make this library useful for special
+ * applications (e.g., a package manager could attach special
+ * package-management attributes to each entry). There are tricky
+ * API issues involved, so this is not going to happen until
+ * there's a real demand for it.
+ *
+ * TODO: Design a good API for handling sparse files.
+ */
+struct archive_entry {
+ /*
+ * Note that ae_stat.st_mode & AE_IFMT can be 0!
+ *
+ * This occurs when the actual file type of the object is not
+ * in the archive. For example, 'tar' archives store
+ * hardlinks without marking the type of the underlying
+ * object.
+ */
+
+ /*
+ * Read archive_entry_copy_stat.c for an explanation of why I
+ * don't just use "struct stat" instead of "struct aest" here
+ * and why I have this odd pointer to a separately-allocated
+ * struct stat.
+ */
+ void *stat;
+ int stat_valid; /* Set to 0 whenever a field in aest changes. */
+
+ struct aest {
+ int64_t aest_atime;
+ uint32_t aest_atime_nsec;
+ int64_t aest_ctime;
+ uint32_t aest_ctime_nsec;
+ int64_t aest_mtime;
+ uint32_t aest_mtime_nsec;
+ int64_t aest_birthtime;
+ uint32_t aest_birthtime_nsec;
+ gid_t aest_gid;
+ int64_t aest_ino;
+ mode_t aest_mode;
+ uint32_t aest_nlink;
+ uint64_t aest_size;
+ uid_t aest_uid;
+ /*
+ * Because converting between device codes and
+ * major/minor values is platform-specific and
+ * inherently a bit risky, we only do that conversion
+ * lazily. That way, we will do a better job of
+ * preserving information in those cases where no
+ * conversion is actually required.
+ */
+ int aest_dev_is_broken_down;
+ dev_t aest_dev;
+ dev_t aest_devmajor;
+ dev_t aest_devminor;
+ int aest_rdev_is_broken_down;
+ dev_t aest_rdev;
+ dev_t aest_rdevmajor;
+ dev_t aest_rdevminor;
+ } ae_stat;
+
+ int ae_set; /* bitmap of fields that are currently set */
+#define AE_SET_HARDLINK 1
+#define AE_SET_SYMLINK 2
+#define AE_SET_ATIME 4
+#define AE_SET_CTIME 8
+#define AE_SET_MTIME 16
+#define AE_SET_BIRTHTIME 32
+#define AE_SET_SIZE 64
+
+ /*
+ * Use aes here so that we get transparent mbs<->wcs conversions.
+ */
+ struct aes ae_fflags_text; /* Text fflags per fflagstostr(3) */
+ unsigned long ae_fflags_set; /* Bitmap fflags */
+ unsigned long ae_fflags_clear;
+ struct aes ae_gname; /* Name of owning group */
+ struct aes ae_hardlink; /* Name of target for hardlink */
+ struct aes ae_pathname; /* Name of entry */
+ struct aes ae_symlink; /* symlink contents */
+ struct aes ae_uname; /* Name of owner */
+
+ /* Not used within libarchive; useful for some clients. */
+ struct aes ae_sourcepath; /* Path this entry is sourced from. */
+
+ /* ACL support. */
+ struct ae_acl *acl_head;
+ struct ae_acl *acl_p;
+ int acl_state; /* See acl_next for details. */
+ wchar_t *acl_text_w;
+
+ /* extattr support. */
+ struct ae_xattr *xattr_head;
+ struct ae_xattr *xattr_p;
+
+ /* Miscellaneous. */
+ char strmode[12];
+};
+
+
+#endif /* ARCHIVE_ENTRY_PRIVATE_H_INCLUDED */
diff --git a/archivers/libarchive/files/libarchive/archive_entry_stat.c b/archivers/libarchive/files/libarchive/archive_entry_stat.c
new file mode 100644
index 00000000000..ad772c9564b
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_entry_stat.c
@@ -0,0 +1,118 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_entry_stat.c 201100 2009-12-28 03:05:31Z kientzle $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#include "archive_entry.h"
+#include "archive_entry_private.h"
+
+const struct stat *
+archive_entry_stat(struct archive_entry *entry)
+{
+ struct stat *st;
+ if (entry->stat == NULL) {
+ entry->stat = malloc(sizeof(*st));
+ if (entry->stat == NULL)
+ return (NULL);
+ entry->stat_valid = 0;
+ }
+
+ /*
+ * If none of the underlying fields have been changed, we
+ * don't need to regenerate. In theory, we could use a bitmap
+ * here to flag only those items that have changed, but the
+ * extra complexity probably isn't worth it. It will be very
+ * rare for anyone to change just one field then request a new
+ * stat structure.
+ */
+ if (entry->stat_valid)
+ return (entry->stat);
+
+ st = entry->stat;
+ /*
+ * Use the public interfaces to extract items, so that
+ * the appropriate conversions get invoked.
+ */
+ st->st_atime = archive_entry_atime(entry);
+#if HAVE_STRUCT_STAT_ST_BIRTHTIME
+ st->st_birthtime = archive_entry_birthtime(entry);
+#endif
+ st->st_ctime = archive_entry_ctime(entry);
+ st->st_mtime = archive_entry_mtime(entry);
+ st->st_dev = archive_entry_dev(entry);
+ st->st_gid = archive_entry_gid(entry);
+ st->st_uid = archive_entry_uid(entry);
+ st->st_ino = archive_entry_ino64(entry);
+ st->st_nlink = archive_entry_nlink(entry);
+ st->st_rdev = archive_entry_rdev(entry);
+ st->st_size = archive_entry_size(entry);
+ st->st_mode = archive_entry_mode(entry);
+
+ /*
+ * On systems that support high-res timestamps, copy that
+ * information into struct stat.
+ */
+#if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
+ st->st_atimespec.tv_nsec = archive_entry_atime_nsec(entry);
+ st->st_ctimespec.tv_nsec = archive_entry_ctime_nsec(entry);
+ st->st_mtimespec.tv_nsec = archive_entry_mtime_nsec(entry);
+#elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
+ st->st_atim.tv_nsec = archive_entry_atime_nsec(entry);
+ st->st_ctim.tv_nsec = archive_entry_ctime_nsec(entry);
+ st->st_mtim.tv_nsec = archive_entry_mtime_nsec(entry);
+#elif HAVE_STRUCT_STAT_ST_MTIME_N
+ st->st_atime_n = archive_entry_atime_nsec(entry);
+ st->st_ctime_n = archive_entry_ctime_nsec(entry);
+ st->st_mtime_n = archive_entry_mtime_nsec(entry);
+#elif HAVE_STRUCT_STAT_ST_UMTIME
+ st->st_uatime = archive_entry_atime_nsec(entry) / 1000;
+ st->st_uctime = archive_entry_ctime_nsec(entry) / 1000;
+ st->st_umtime = archive_entry_mtime_nsec(entry) / 1000;
+#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
+ st->st_atime_usec = archive_entry_atime_nsec(entry) / 1000;
+ st->st_ctime_usec = archive_entry_ctime_nsec(entry) / 1000;
+ st->st_mtime_usec = archive_entry_mtime_nsec(entry) / 1000;
+#endif
+#if HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC
+ st->st_birthtimespec.tv_nsec = archive_entry_birthtime_nsec(entry);
+#endif
+
+ /*
+ * TODO: On Linux, store 32 or 64 here depending on whether
+ * the cached stat structure is a stat32 or a stat64. This
+ * will allow us to support both variants interchangably.
+ */
+ entry->stat_valid = 1;
+
+ return (st);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_entry_strmode.c b/archivers/libarchive/files/libarchive/archive_entry_strmode.c
new file mode 100644
index 00000000000..16cb3f7bb33
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_entry_strmode.c
@@ -0,0 +1,87 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_entry_strmode.c,v 1.4 2008/06/15 05:14:01 kientzle Exp $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive_entry.h"
+#include "archive_entry_private.h"
+
+const char *
+archive_entry_strmode(struct archive_entry *entry)
+{
+ static const mode_t permbits[] =
+ { 0400, 0200, 0100, 0040, 0020, 0010, 0004, 0002, 0001 };
+ char *bp = entry->strmode;
+ mode_t mode;
+ int i;
+
+ /* Fill in a default string, then selectively override. */
+ strcpy(bp, "?rwxrwxrwx ");
+
+ mode = archive_entry_mode(entry);
+ switch (archive_entry_filetype(entry)) {
+ case AE_IFREG: bp[0] = '-'; break;
+ case AE_IFBLK: bp[0] = 'b'; break;
+ case AE_IFCHR: bp[0] = 'c'; break;
+ case AE_IFDIR: bp[0] = 'd'; break;
+ case AE_IFLNK: bp[0] = 'l'; break;
+ case AE_IFSOCK: bp[0] = 's'; break;
+ case AE_IFIFO: bp[0] = 'p'; break;
+ default:
+ if (archive_entry_hardlink(entry) != NULL) {
+ bp[0] = 'h';
+ break;
+ }
+ }
+
+ for (i = 0; i < 9; i++)
+ if (!(mode & permbits[i]))
+ bp[i+1] = '-';
+
+ if (mode & S_ISUID) {
+ if (mode & 0100) bp[3] = 's';
+ else bp[3] = 'S';
+ }
+ if (mode & S_ISGID) {
+ if (mode & 0010) bp[6] = 's';
+ else bp[6] = 'S';
+ }
+ if (mode & S_ISVTX) {
+ if (mode & 0001) bp[9] = 't';
+ else bp[9] = 'T';
+ }
+ if (archive_entry_acl_count(entry, ARCHIVE_ENTRY_ACL_TYPE_ACCESS))
+ bp[10] = '+';
+
+ return (bp);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_platform.h b/archivers/libarchive/files/libarchive/archive_platform.h
new file mode 100644
index 00000000000..ce2f482ba04
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_platform.h
@@ -0,0 +1,165 @@
+/*-
+ * 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: head/lib/libarchive/archive_platform.h 201090 2009-12-28 02:22:04Z kientzle $
+ */
+
+/* !!ONLY FOR USE INTERNALLY TO LIBARCHIVE!! */
+
+/*
+ * This header is the first thing included in any of the libarchive
+ * source files. As far as possible, platform-specific issues should
+ * be dealt with here and not within individual source files. I'm
+ * actively trying to minimize #if blocks within the main source,
+ * since they obfuscate the code.
+ */
+
+#ifndef ARCHIVE_PLATFORM_H_INCLUDED
+#define ARCHIVE_PLATFORM_H_INCLUDED
+
+/* archive.h and archive_entry.h require this. */
+#define __LIBARCHIVE_BUILD 1
+
+#if defined(PLATFORM_CONFIG_H)
+/* Use hand-built config.h in environments that need it. */
+#include PLATFORM_CONFIG_H
+#elif defined(HAVE_CONFIG_H)
+/* Most POSIX platforms use the 'configure' script to build config.h */
+#include "config.h"
+#else
+/* Warn if the library hasn't been (automatically or manually) configured. */
+#error Oops: No config.h and no pre-built configuration in archive_platform.h.
+#endif
+
+/* It should be possible to get rid of this by extending the feature-test
+ * macros to cover Windows API functions, probably along with non-trivial
+ * refactoring of code to find structures that sit more cleanly on top of
+ * either Windows or Posix APIs. */
+#if (defined(__WIN32__) || defined(_WIN32) || defined(__WIN32)) && !defined(__CYGWIN__)
+#include "archive_windows.h"
+#endif
+
+/*
+ * The config files define a lot of feature macros. The following
+ * uses those macros to select/define replacements and include key
+ * headers as required.
+ */
+
+/* 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
+
+/* Try to get standard C99-style integer type definitions. */
+#if HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif
+#if HAVE_STDINT_H
+#include <stdint.h>
+#endif
+
+/* Borland warns about its own constants! */
+#if defined(__BORLANDC__)
+# if HAVE_DECL_UINT64_MAX
+# undef UINT64_MAX
+# undef HAVE_DECL_UINT64_MAX
+# endif
+# if HAVE_DECL_UINT64_MIN
+# undef UINT64_MIN
+# undef HAVE_DECL_UINT64_MIN
+# endif
+# if HAVE_DECL_INT64_MAX
+# undef INT64_MAX
+# undef HAVE_DECL_INT64_MAX
+# endif
+# if HAVE_DECL_INT64_MIN
+# undef INT64_MIN
+# undef HAVE_DECL_INT64_MIN
+# endif
+#endif
+
+/* Some platforms lack the standard *_MAX definitions. */
+#if !HAVE_DECL_SIZE_MAX
+#define SIZE_MAX (~(size_t)0)
+#endif
+#if !HAVE_DECL_SSIZE_MAX
+#define SSIZE_MAX ((ssize_t)(SIZE_MAX >> 1))
+#endif
+#if !HAVE_DECL_UINT32_MAX
+#define UINT32_MAX (~(uint32_t)0)
+#endif
+#if !HAVE_DECL_UINT64_MAX
+#define UINT64_MAX (~(uint64_t)0)
+#endif
+#if !HAVE_DECL_INT64_MAX
+#define INT64_MAX ((int64_t)(UINT64_MAX >> 1))
+#endif
+#if !HAVE_DECL_INT64_MIN
+#define INT64_MIN ((int64_t)(~INT64_MAX))
+#endif
+
+/*
+ * If this platform has <sys/acl.h>, acl_create(), acl_init(),
+ * acl_set_file(), and ACL_USER, we assume it has the rest of the
+ * POSIX.1e draft functions used in archive_read_extract.c.
+ */
+#if HAVE_SYS_ACL_H && HAVE_ACL_CREATE_ENTRY && HAVE_ACL_INIT && HAVE_ACL_SET_FILE && HAVE_ACL_USER
+#define HAVE_POSIX_ACL 1
+#endif
+
+/*
+ * If we can't restore metadata using a file descriptor, then
+ * for compatibility's sake, close files before trying to restore metadata.
+ */
+#if defined(HAVE_FCHMOD) || defined(HAVE_FUTIMES) || defined(HAVE_ACL_SET_FD) || defined(HAVE_ACL_SET_FD_NP) || defined(HAVE_FCHOWN)
+#define CAN_RESTORE_METADATA_FD
+#endif
+
+/* Set up defaults for internal error codes. */
+#ifndef ARCHIVE_ERRNO_FILE_FORMAT
+#if HAVE_EFTYPE
+#define ARCHIVE_ERRNO_FILE_FORMAT EFTYPE
+#else
+#if HAVE_EILSEQ
+#define ARCHIVE_ERRNO_FILE_FORMAT EILSEQ
+#else
+#define ARCHIVE_ERRNO_FILE_FORMAT EINVAL
+#endif
+#endif
+#endif
+
+#ifndef ARCHIVE_ERRNO_PROGRAMMER
+#define ARCHIVE_ERRNO_PROGRAMMER EINVAL
+#endif
+
+#ifndef ARCHIVE_ERRNO_MISC
+#define ARCHIVE_ERRNO_MISC (-1)
+#endif
+
+#endif /* !ARCHIVE_PLATFORM_H_INCLUDED */
diff --git a/archivers/libarchive/files/libarchive/archive_private.h b/archivers/libarchive/files/libarchive/archive_private.h
new file mode 100644
index 00000000000..63384b82fed
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_private.h
@@ -0,0 +1,124 @@
+/*-
+ * 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: head/lib/libarchive/archive_private.h 201098 2009-12-28 02:58:14Z kientzle $
+ */
+
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
+
+#ifndef ARCHIVE_PRIVATE_H_INCLUDED
+#define ARCHIVE_PRIVATE_H_INCLUDED
+
+#include "archive.h"
+#include "archive_string.h"
+
+#if defined(__GNUC__) && (__GNUC__ > 2 || \
+ (__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
+#define __LA_DEAD __attribute__((__noreturn__))
+#else
+#define __LA_DEAD
+#endif
+
+#define ARCHIVE_WRITE_MAGIC (0xb0c5c0deU)
+#define ARCHIVE_READ_MAGIC (0xdeb0c5U)
+#define ARCHIVE_WRITE_DISK_MAGIC (0xc001b0c5U)
+#define ARCHIVE_READ_DISK_MAGIC (0xbadb0c5U)
+
+#define ARCHIVE_STATE_ANY 0xFFFFU
+#define ARCHIVE_STATE_NEW 1U
+#define ARCHIVE_STATE_HEADER 2U
+#define ARCHIVE_STATE_DATA 4U
+#define ARCHIVE_STATE_DATA_END 8U
+#define ARCHIVE_STATE_EOF 0x10U
+#define ARCHIVE_STATE_CLOSED 0x20U
+#define ARCHIVE_STATE_FATAL 0x8000U
+
+struct archive_vtable {
+ int (*archive_close)(struct archive *);
+ int (*archive_finish)(struct archive *);
+ int (*archive_write_header)(struct archive *,
+ struct archive_entry *);
+ int (*archive_write_finish_entry)(struct archive *);
+ ssize_t (*archive_write_data)(struct archive *,
+ const void *, size_t);
+ ssize_t (*archive_write_data_block)(struct archive *,
+ const void *, size_t, off_t);
+};
+
+struct archive {
+ /*
+ * The magic/state values are used to sanity-check the
+ * client's usage. If an API function is called at a
+ * ridiculous time, or the client passes us an invalid
+ * pointer, these values allow me to catch that.
+ */
+ unsigned int magic;
+ unsigned int state;
+
+ /*
+ * Some public API functions depend on the "real" type of the
+ * archive object.
+ */
+ struct archive_vtable *vtable;
+
+ int archive_format;
+ const char *archive_format_name;
+
+ int compression_code; /* Currently active compression. */
+ const char *compression_name;
+
+ /* Position in UNCOMPRESSED data stream. */
+ int64_t file_position;
+ /* Position in COMPRESSED data stream. */
+ int64_t raw_position;
+ /* Number of file entries processed. */
+ int file_count;
+
+ int archive_error_number;
+ const char *error;
+ struct archive_string error_string;
+};
+
+/* Check magic value and state; exit if it isn't valid. */
+void __archive_check_magic(struct archive *, unsigned int magic,
+ unsigned int state, const char *func);
+
+void __archive_errx(int retvalue, const char *msg) __LA_DEAD;
+
+int __archive_parse_options(const char *p, const char *fn,
+ int keysize, char *key, int valsize, char *val);
+
+#define err_combine(a,b) ((a) < (b) ? (a) : (b))
+
+#if defined(__BORLANDC__) || (defined(_MSC_VER) && _MSC_VER <= 1300)
+# define ARCHIVE_LITERAL_LL(x) x##i64
+# define ARCHIVE_LITERAL_ULL(x) x##ui64
+#else
+# define ARCHIVE_LITERAL_LL(x) x##ll
+# define ARCHIVE_LITERAL_ULL(x) x##ull
+#endif
+
+#endif
diff --git a/archivers/libarchive/files/libarchive/archive_read.3 b/archivers/libarchive/files/libarchive/archive_read.3
new file mode 100644
index 00000000000..43f3c76327a
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read.3
@@ -0,0 +1,714 @@
+.\" 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 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: head/lib/libarchive/archive_read.3 191595 2009-04-27 20:13:13Z kientzle $
+.\"
+.Dd April 13, 2009
+.Dt archive_read 3
+.Os
+.Sh NAME
+.Nm archive_read_new ,
+.Nm archive_read_set_filter_options ,
+.Nm archive_read_set_format_options ,
+.Nm archive_read_set_options ,
+.Nm archive_read_support_compression_all ,
+.Nm archive_read_support_compression_bzip2 ,
+.Nm archive_read_support_compression_compress ,
+.Nm archive_read_support_compression_gzip ,
+.Nm archive_read_support_compression_lzma ,
+.Nm archive_read_support_compression_none ,
+.Nm archive_read_support_compression_xz ,
+.Nm archive_read_support_compression_program ,
+.Nm archive_read_support_compression_program_signature ,
+.Nm archive_read_support_format_all ,
+.Nm archive_read_support_format_ar ,
+.Nm archive_read_support_format_cpio ,
+.Nm archive_read_support_format_empty ,
+.Nm archive_read_support_format_iso9660 ,
+.Nm archive_read_support_format_mtree,
+.Nm archive_read_support_format_raw,
+.Nm archive_read_support_format_tar ,
+.Nm archive_read_support_format_zip ,
+.Nm archive_read_open ,
+.Nm archive_read_open2 ,
+.Nm archive_read_open_fd ,
+.Nm archive_read_open_FILE ,
+.Nm archive_read_open_filename ,
+.Nm archive_read_open_memory ,
+.Nm archive_read_next_header ,
+.Nm archive_read_next_header2 ,
+.Nm archive_read_data ,
+.Nm archive_read_data_block ,
+.Nm archive_read_data_skip ,
+.\" #if ARCHIVE_API_VERSION < 3
+.Nm archive_read_data_into_buffer ,
+.\" #endif
+.Nm archive_read_data_into_fd ,
+.Nm archive_read_extract ,
+.Nm archive_read_extract2 ,
+.Nm archive_read_extract_set_progress_callback ,
+.Nm archive_read_close ,
+.Nm archive_read_finish
+.Nd functions for reading streaming archives
+.Sh SYNOPSIS
+.In archive.h
+.Ft struct archive *
+.Fn archive_read_new "void"
+.Ft int
+.Fn archive_read_support_compression_all "struct archive *"
+.Ft int
+.Fn archive_read_support_compression_bzip2 "struct archive *"
+.Ft int
+.Fn archive_read_support_compression_compress "struct archive *"
+.Ft int
+.Fn archive_read_support_compression_gzip "struct archive *"
+.Ft int
+.Fn archive_read_support_compression_lzma "struct archive *"
+.Ft int
+.Fn archive_read_support_compression_none "struct archive *"
+.Ft int
+.Fn archive_read_support_compression_xz "struct archive *"
+.Ft int
+.Fo archive_read_support_compression_program
+.Fa "struct archive *"
+.Fa "const char *cmd"
+.Fc
+.Ft int
+.Fo archive_read_support_compression_program_signature
+.Fa "struct archive *"
+.Fa "const char *cmd"
+.Fa "const void *signature"
+.Fa "size_t signature_length"
+.Fc
+.Ft int
+.Fn archive_read_support_format_all "struct archive *"
+.Ft int
+.Fn archive_read_support_format_ar "struct archive *"
+.Ft int
+.Fn archive_read_support_format_cpio "struct archive *"
+.Ft int
+.Fn archive_read_support_format_empty "struct archive *"
+.Ft int
+.Fn archive_read_support_format_iso9660 "struct archive *"
+.Ft int
+.Fn archive_read_support_format_mtree "struct archive *"
+.Ft int
+.Fn archive_read_support_format_raw "struct archive *"
+.Ft int
+.Fn archive_read_support_format_tar "struct archive *"
+.Ft int
+.Fn archive_read_support_format_zip "struct archive *"
+.Ft int
+.Fn archive_read_set_filter_options "struct archive *" "const char *"
+.Ft int
+.Fn archive_read_set_format_options "struct archive *" "const char *"
+.Ft int
+.Fn archive_read_set_options "struct archive *" "const char *"
+.Ft int
+.Fo archive_read_open
+.Fa "struct archive *"
+.Fa "void *client_data"
+.Fa "archive_open_callback *"
+.Fa "archive_read_callback *"
+.Fa "archive_close_callback *"
+.Fc
+.Ft int
+.Fo archive_read_open2
+.Fa "struct archive *"
+.Fa "void *client_data"
+.Fa "archive_open_callback *"
+.Fa "archive_read_callback *"
+.Fa "archive_skip_callback *"
+.Fa "archive_close_callback *"
+.Fc
+.Ft int
+.Fn archive_read_open_FILE "struct archive *" "FILE *file"
+.Ft int
+.Fn archive_read_open_fd "struct archive *" "int fd" "size_t block_size"
+.Ft int
+.Fo archive_read_open_filename
+.Fa "struct archive *"
+.Fa "const char *filename"
+.Fa "size_t block_size"
+.Fc
+.Ft int
+.Fn archive_read_open_memory "struct archive *" "void *buff" "size_t size"
+.Ft int
+.Fn archive_read_next_header "struct archive *" "struct archive_entry **"
+.Ft int
+.Fn archive_read_next_header2 "struct archive *" "struct archive_entry *"
+.Ft ssize_t
+.Fn archive_read_data "struct archive *" "void *buff" "size_t len"
+.Ft int
+.Fo archive_read_data_block
+.Fa "struct archive *"
+.Fa "const void **buff"
+.Fa "size_t *len"
+.Fa "off_t *offset"
+.Fc
+.Ft int
+.Fn archive_read_data_skip "struct archive *"
+.\" #if ARCHIVE_API_VERSION < 3
+.Ft int
+.Fn archive_read_data_into_buffer "struct archive *" "void *" "ssize_t len"
+.\" #endif
+.Ft int
+.Fn archive_read_data_into_fd "struct archive *" "int fd"
+.Ft int
+.Fo archive_read_extract
+.Fa "struct archive *"
+.Fa "struct archive_entry *"
+.Fa "int flags"
+.Fc
+.Ft int
+.Fo archive_read_extract2
+.Fa "struct archive *src"
+.Fa "struct archive_entry *"
+.Fa "struct archive *dest"
+.Fc
+.Ft void
+.Fo archive_read_extract_set_progress_callback
+.Fa "struct archive *"
+.Fa "void (*func)(void *)"
+.Fa "void *user_data"
+.Fc
+.Ft int
+.Fn archive_read_close "struct archive *"
+.Ft int
+.Fn archive_read_finish "struct archive *"
+.Sh DESCRIPTION
+These functions provide a complete API for reading streaming archives.
+The general process is to first create the
+.Tn struct archive
+object, set options, initialize the reader, iterate over the archive
+headers and associated data, then close the archive and release all
+resources.
+The following summary describes the functions in approximately the
+order they would be used:
+.Bl -tag -compact -width indent
+.It Fn archive_read_new
+Allocates and initializes a
+.Tn struct archive
+object suitable for reading from an archive.
+.It Xo
+.Fn archive_read_support_compression_bzip2 ,
+.Fn archive_read_support_compression_compress ,
+.Fn archive_read_support_compression_gzip ,
+.Fn archive_read_support_compression_lzma ,
+.Fn archive_read_support_compression_none ,
+.Fn archive_read_support_compression_xz
+.Xc
+Enables auto-detection code and decompression support for the
+specified compression.
+Returns
+.Cm ARCHIVE_OK
+if the compression is fully supported, or
+.Cm ARCHIVE_WARN
+if the compression is supported only through an external program.
+Note that decompression using an external program is usually slower than
+decompression through built-in libraries.
+Note that
+.Dq none
+is always enabled by default.
+.It Fn archive_read_support_compression_all
+Enables all available decompression filters.
+.It Fn archive_read_support_compression_program
+Data is fed through the specified external program before being dearchived.
+Note that this disables automatic detection of the compression format,
+so it makes no sense to specify this in conjunction with any other
+decompression option.
+.It Fn archive_read_support_compression_program_signature
+This feeds data through the specified external program
+but only if the initial bytes of the data match the specified
+signature value.
+.It Xo
+.Fn archive_read_support_format_all ,
+.Fn archive_read_support_format_ar ,
+.Fn archive_read_support_format_cpio ,
+.Fn archive_read_support_format_empty ,
+.Fn archive_read_support_format_iso9660 ,
+.Fn archive_read_support_format_mtree ,
+.Fn archive_read_support_format_tar ,
+.Fn archive_read_support_format_zip
+.Xc
+Enables support---including auto-detection code---for the
+specified archive format.
+For example,
+.Fn archive_read_support_format_tar
+enables support for a variety of standard tar formats, old-style tar,
+ustar, pax interchange format, and many common variants.
+For convenience,
+.Fn archive_read_support_format_all
+enables support for all available formats.
+Only empty archives are supported by default.
+.It Fn archive_read_support_format_raw
+The
+.Dq raw
+format handler allows libarchive to be used to read arbitrary data.
+It treats any data stream as an archive with a single entry.
+The pathname of this entry is
+.Dq data ;
+all other entry fields are unset.
+This is not enabled by
+.Fn archive_read_support_format_all
+in order to avoid erroneous handling of damaged archives.
+.It Xo
+.Fn archive_read_set_filter_options ,
+.Fn archive_read_set_format_options ,
+.Fn archive_read_set_options
+.Xc
+Specifies options that will be passed to currently-registered
+filters (including decompression filters) and/or format readers.
+The argument is a comma-separated list of individual options.
+Individual options have one of the following forms:
+.Bl -tag -compact -width indent
+.It Ar option=value
+The option/value pair will be provided to every module.
+Modules that do not accept an option with this name will ignore it.
+.It Ar option
+The option will be provided to every module with a value of
+.Dq 1 .
+.It Ar !option
+The option will be provided to every module with a NULL value.
+.It Ar module:option=value , Ar module:option , Ar module:!option
+As above, but the corresponding option and value will be provided
+only to modules whose name matches
+.Ar module .
+.El
+The return value will be
+.Cm ARCHIVE_OK
+if any module accepts the option, or
+.Cm ARCHIVE_WARN
+if no module accepted the option, or
+.Cm ARCHIVE_FATAL
+if there was a fatal error while attempting to process the option.
+.Pp
+The currently supported options are:
+.Bl -tag -compact -width indent
+.It Format iso9660
+.Bl -tag -compact -width indent
+.It Cm joliet
+Support Joliet extensions.
+Defaults to enabled, use
+.Cm !joliet
+to disable.
+.El
+.El
+.It Fn archive_read_open
+The same as
+.Fn archive_read_open2 ,
+except that the skip callback is assumed to be
+.Dv NULL .
+.It Fn archive_read_open2
+Freeze the settings, open the archive, and prepare for reading entries.
+This is the most generic version of this call, which accepts
+four callback functions.
+Most clients will want to use
+.Fn archive_read_open_filename ,
+.Fn archive_read_open_FILE ,
+.Fn archive_read_open_fd ,
+or
+.Fn archive_read_open_memory
+instead.
+The library invokes the client-provided functions to obtain
+raw bytes from the archive.
+.It Fn archive_read_open_FILE
+Like
+.Fn archive_read_open ,
+except that it accepts a
+.Ft "FILE *"
+pointer.
+This function should not be used with tape drives or other devices
+that require strict I/O blocking.
+.It Fn archive_read_open_fd
+Like
+.Fn archive_read_open ,
+except that it accepts a file descriptor and block size rather than
+a set of function pointers.
+Note that the file descriptor will not be automatically closed at
+end-of-archive.
+This function is safe for use with tape drives or other blocked devices.
+.It Fn archive_read_open_file
+This is a deprecated synonym for
+.Fn archive_read_open_filename .
+.It Fn archive_read_open_filename
+Like
+.Fn archive_read_open ,
+except that it accepts a simple filename and a block size.
+A NULL filename represents standard input.
+This function is safe for use with tape drives or other blocked devices.
+.It Fn archive_read_open_memory
+Like
+.Fn archive_read_open ,
+except that it accepts a pointer and size of a block of
+memory containing the archive data.
+.It Fn archive_read_next_header
+Read the header for the next entry and return a pointer to
+a
+.Tn struct archive_entry .
+This is a convenience wrapper around
+.Fn archive_read_next_header2
+that reuses an internal
+.Tn struct archive_entry
+object for each request.
+.It Fn archive_read_next_header2
+Read the header for the next entry and populate the provided
+.Tn struct archive_entry .
+.It Fn archive_read_data
+Read data associated with the header just read.
+Internally, this is a convenience function that calls
+.Fn archive_read_data_block
+and fills any gaps with nulls so that callers see a single
+continuous stream of data.
+.It Fn archive_read_data_block
+Return the next available block of data for this entry.
+Unlike
+.Fn archive_read_data ,
+the
+.Fn archive_read_data_block
+function avoids copying data and allows you to correctly handle
+sparse files, as supported by some archive formats.
+The library guarantees that offsets will increase and that blocks
+will not overlap.
+Note that the blocks returned from this function can be much larger
+than the block size read from disk, due to compression
+and internal buffer optimizations.
+.It Fn archive_read_data_skip
+A convenience function that repeatedly calls
+.Fn archive_read_data_block
+to skip all of the data for this archive entry.
+.\" #if ARCHIVE_API_VERSION < 3
+.It Fn archive_read_data_into_buffer
+This function is deprecated and will be removed.
+Use
+.Fn archive_read_data
+instead.
+.\" #endif
+.It Fn archive_read_data_into_fd
+A convenience function that repeatedly calls
+.Fn archive_read_data_block
+to copy the entire entry to the provided file descriptor.
+.It Fn archive_read_extract , Fn archive_read_extract_set_skip_file
+A convenience function that wraps the corresponding
+.Xr archive_write_disk 3
+interfaces.
+The first call to
+.Fn archive_read_extract
+creates a restore object using
+.Xr archive_write_disk_new 3
+and
+.Xr archive_write_disk_set_standard_lookup 3 ,
+then transparently invokes
+.Xr archive_write_disk_set_options 3 ,
+.Xr archive_write_header 3 ,
+.Xr archive_write_data 3 ,
+and
+.Xr archive_write_finish_entry 3
+to create the entry on disk and copy data into it.
+The
+.Va flags
+argument is passed unmodified to
+.Xr archive_write_disk_set_options 3 .
+.It Fn archive_read_extract2
+This is another version of
+.Fn archive_read_extract
+that allows you to provide your own restore object.
+In particular, this allows you to override the standard lookup functions
+using
+.Xr archive_write_disk_set_group_lookup 3 ,
+and
+.Xr archive_write_disk_set_user_lookup 3 .
+Note that
+.Fn archive_read_extract2
+does not accept a
+.Va flags
+argument; you should use
+.Fn archive_write_disk_set_options
+to set the restore options yourself.
+.It Fn archive_read_extract_set_progress_callback
+Sets a pointer to a user-defined callback that can be used
+for updating progress displays during extraction.
+The progress function will be invoked during the extraction of large
+regular files.
+The progress function will be invoked with the pointer provided to this call.
+Generally, the data pointed to should include a reference to the archive
+object and the archive_entry object so that various statistics
+can be retrieved for the progress display.
+.It Fn archive_read_close
+Complete the archive and invoke the close callback.
+.It Fn archive_read_finish
+Invokes
+.Fn archive_read_close
+if it was not invoked manually, then release all resources.
+Note: In libarchive 1.x, this function was declared to return
+.Ft void ,
+which made it impossible to detect certain errors when
+.Fn archive_read_close
+was invoked implicitly from this function.
+The declaration is corrected beginning with libarchive 2.0.
+.El
+.Pp
+Note that the library determines most of the relevant information about
+the archive by inspection.
+In particular, it automatically detects
+.Xr gzip 1
+or
+.Xr bzip2 1
+compression and transparently performs the appropriate decompression.
+It also automatically detects the archive format.
+.Pp
+A complete description of the
+.Tn struct archive
+and
+.Tn struct archive_entry
+objects can be found in the overview manual page for
+.Xr libarchive 3 .
+.Sh CLIENT CALLBACKS
+The callback functions must match the following prototypes:
+.Bl -item -offset indent
+.It
+.Ft typedef ssize_t
+.Fo archive_read_callback
+.Fa "struct archive *"
+.Fa "void *client_data"
+.Fa "const void **buffer"
+.Fc
+.It
+.\" #if ARCHIVE_API_VERSION < 2
+.Ft typedef int
+.Fo archive_skip_callback
+.Fa "struct archive *"
+.Fa "void *client_data"
+.Fa "size_t request"
+.Fc
+.\" #else
+.\" .Ft typedef off_t
+.\" .Fo archive_skip_callback
+.\" .Fa "struct archive *"
+.\" .Fa "void *client_data"
+.\" .Fa "off_t request"
+.\" .Fc
+.\" #endif
+.It
+.Ft typedef int
+.Fn archive_open_callback "struct archive *" "void *client_data"
+.It
+.Ft typedef int
+.Fn archive_close_callback "struct archive *" "void *client_data"
+.El
+.Pp
+The open callback is invoked by
+.Fn archive_open .
+It should return
+.Cm ARCHIVE_OK
+if the underlying file or data source is successfully
+opened.
+If the open fails, it should call
+.Fn archive_set_error
+to register an error code and message and return
+.Cm ARCHIVE_FATAL .
+.Pp
+The read callback is invoked whenever the library
+requires raw bytes from the archive.
+The read callback should read data into a buffer,
+set the
+.Li const void **buffer
+argument to point to the available data, and
+return a count of the number of bytes available.
+The library will invoke the read callback again
+only after it has consumed this data.
+The library imposes no constraints on the size
+of the data blocks returned.
+On end-of-file, the read callback should
+return zero.
+On error, the read callback should invoke
+.Fn archive_set_error
+to register an error code and message and
+return -1.
+.Pp
+The skip callback is invoked when the
+library wants to ignore a block of data.
+The return value is the number of bytes actually
+skipped, which may differ from the request.
+If the callback cannot skip data, it should return
+zero.
+If the skip callback is not provided (the
+function pointer is
+.Dv NULL ),
+the library will invoke the read function
+instead and simply discard the result.
+A skip callback can provide significant
+performance gains when reading uncompressed
+archives from slow disk drives or other media
+that can skip quickly.
+.Pp
+The close callback is invoked by archive_close when
+the archive processing is complete.
+The callback should return
+.Cm ARCHIVE_OK
+on success.
+On failure, the callback should invoke
+.Fn archive_set_error
+to register an error code and message and
+return
+.Cm ARCHIVE_FATAL.
+.Sh EXAMPLE
+The following illustrates basic usage of the library.
+In this example,
+the callback functions are simply wrappers around the standard
+.Xr open 2 ,
+.Xr read 2 ,
+and
+.Xr close 2
+system calls.
+.Bd -literal -offset indent
+void
+list_archive(const char *name)
+{
+ struct mydata *mydata;
+ struct archive *a;
+ struct archive_entry *entry;
+
+ mydata = malloc(sizeof(struct mydata));
+ a = archive_read_new();
+ mydata->name = name;
+ archive_read_support_compression_all(a);
+ archive_read_support_format_all(a);
+ archive_read_open(a, mydata, myopen, myread, myclose);
+ while (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
+ printf("%s\\n",archive_entry_pathname(entry));
+ archive_read_data_skip(a);
+ }
+ archive_read_finish(a);
+ free(mydata);
+}
+
+ssize_t
+myread(struct archive *a, void *client_data, const void **buff)
+{
+ struct mydata *mydata = client_data;
+
+ *buff = mydata->buff;
+ return (read(mydata->fd, mydata->buff, 10240));
+}
+
+int
+myopen(struct archive *a, void *client_data)
+{
+ struct mydata *mydata = client_data;
+
+ mydata->fd = open(mydata->name, O_RDONLY);
+ return (mydata->fd >= 0 ? ARCHIVE_OK : ARCHIVE_FATAL);
+}
+
+int
+myclose(struct archive *a, void *client_data)
+{
+ struct mydata *mydata = client_data;
+
+ if (mydata->fd > 0)
+ close(mydata->fd);
+ return (ARCHIVE_OK);
+}
+.Ed
+.Sh RETURN VALUES
+Most functions return zero on success, non-zero on error.
+The possible return codes include:
+.Cm ARCHIVE_OK
+(the operation succeeded),
+.Cm ARCHIVE_WARN
+(the operation succeeded but a non-critical error was encountered),
+.Cm ARCHIVE_EOF
+(end-of-archive was encountered),
+.Cm ARCHIVE_RETRY
+(the operation failed but can be retried),
+and
+.Cm ARCHIVE_FATAL
+(there was a fatal error; the archive should be closed immediately).
+Detailed error codes and textual descriptions are available from the
+.Fn archive_errno
+and
+.Fn archive_error_string
+functions.
+.Pp
+.Fn archive_read_new
+returns a pointer to a freshly allocated
+.Tn struct archive
+object.
+It returns
+.Dv NULL
+on error.
+.Pp
+.Fn archive_read_data
+returns a count of bytes actually read or zero at the end of the entry.
+On error, a value of
+.Cm ARCHIVE_FATAL ,
+.Cm ARCHIVE_WARN ,
+or
+.Cm ARCHIVE_RETRY
+is returned and an error code and textual description can be retrieved from the
+.Fn archive_errno
+and
+.Fn archive_error_string
+functions.
+.Pp
+The library expects the client callbacks to behave similarly.
+If there is an error, you can use
+.Fn archive_set_error
+to set an appropriate error code and description,
+then return one of the non-zero values above.
+(Note that the value eventually returned to the client may
+not be the same; many errors that are not critical at the level
+of basic I/O can prevent the archive from being properly read,
+thus most I/O errors eventually cause
+.Cm ARCHIVE_FATAL
+to be returned.)
+.\" .Sh ERRORS
+.Sh SEE ALSO
+.Xr tar 1 ,
+.Xr archive 3 ,
+.Xr archive_util 3 ,
+.Xr tar 5
+.Sh HISTORY
+The
+.Nm libarchive
+library first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm libarchive
+library was written by
+.An Tim Kientzle Aq kientzle@acm.org .
+.Sh BUGS
+Many traditional archiver programs treat
+empty files as valid empty archives.
+For example, many implementations of
+.Xr tar 1
+allow you to append entries to an empty file.
+Of course, it is impossible to determine the format of an empty file
+by inspecting the contents, so this library treats empty files as
+having a special
+.Dq empty
+format.
diff --git a/archivers/libarchive/files/libarchive/archive_read.c b/archivers/libarchive/files/libarchive/archive_read.c
new file mode 100644
index 00000000000..f39f5cec29d
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read.c
@@ -0,0 +1,1249 @@
+/*-
+ * 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.
+ */
+
+/*
+ * This file contains the "essential" portions of the read API, that
+ * is, stuff that will probably always be used by any client that
+ * actually needs to read an archive. Optional pieces have been, as
+ * far as possible, separated out into separate files to avoid
+ * needlessly bloating statically-linked clients.
+ */
+
+#include "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read.c 201157 2009-12-29 05:30:23Z kientzle $");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+
+#define minimum(a, b) (a < b ? a : b)
+
+static int build_stream(struct archive_read *);
+static int choose_format(struct archive_read *);
+static int cleanup_filters(struct archive_read *);
+static struct archive_vtable *archive_read_vtable(void);
+static int _archive_read_close(struct archive *);
+static int _archive_read_finish(struct archive *);
+
+static struct archive_vtable *
+archive_read_vtable(void)
+{
+ static struct archive_vtable av;
+ static int inited = 0;
+
+ if (!inited) {
+ av.archive_finish = _archive_read_finish;
+ av.archive_close = _archive_read_close;
+ }
+ return (&av);
+}
+
+/*
+ * Allocate, initialize and return a struct archive object.
+ */
+struct archive *
+archive_read_new(void)
+{
+ struct archive_read *a;
+
+ a = (struct archive_read *)malloc(sizeof(*a));
+ if (a == NULL)
+ return (NULL);
+ memset(a, 0, sizeof(*a));
+ a->archive.magic = ARCHIVE_READ_MAGIC;
+
+ a->archive.state = ARCHIVE_STATE_NEW;
+ a->entry = archive_entry_new();
+ a->archive.vtable = archive_read_vtable();
+
+ return (&a->archive);
+}
+
+/*
+ * Record the do-not-extract-to file. This belongs in archive_read_extract.c.
+ */
+void
+archive_read_extract_set_skip_file(struct archive *_a, dev_t d, ino_t i)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_ANY,
+ "archive_read_extract_set_skip_file");
+ a->skip_file_dev = d;
+ a->skip_file_ino = i;
+}
+
+/*
+ * Set read options for the format.
+ */
+int
+archive_read_set_format_options(struct archive *_a, const char *s)
+{
+ struct archive_read *a;
+ struct archive_format_descriptor *format;
+ char key[64], val[64];
+ char *valp;
+ size_t i;
+ int len, r;
+
+ __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW,
+ "archive_read_set_format_options");
+
+ if (s == NULL || *s == '\0')
+ return (ARCHIVE_OK);
+ a = (struct archive_read *)_a;
+ __archive_check_magic(&a->archive, ARCHIVE_READ_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_read_set_format_options");
+ len = 0;
+ for (i = 0; i < sizeof(a->formats)/sizeof(a->formats[0]); i++) {
+ format = &a->formats[i];
+ if (format == NULL || format->options == NULL ||
+ format->name == NULL)
+ /* This format does not support option. */
+ continue;
+
+ while ((len = __archive_parse_options(s, format->name,
+ sizeof(key), key, sizeof(val), val)) > 0) {
+ valp = val[0] == '\0' ? NULL : val;
+ a->format = format;
+ r = format->options(a, key, valp);
+ a->format = NULL;
+ if (r == ARCHIVE_FATAL)
+ return (r);
+ s += len;
+ }
+ }
+ if (len < 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Illegal format options.");
+ return (ARCHIVE_WARN);
+ }
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Set read options for the filter.
+ */
+int
+archive_read_set_filter_options(struct archive *_a, const char *s)
+{
+ struct archive_read *a;
+ struct archive_read_filter *filter;
+ struct archive_read_filter_bidder *bidder;
+ char key[64], val[64];
+ int len, r;
+
+ __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW,
+ "archive_read_set_filter_options");
+
+ if (s == NULL || *s == '\0')
+ return (ARCHIVE_OK);
+ a = (struct archive_read *)_a;
+ __archive_check_magic(&a->archive, ARCHIVE_READ_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_read_set_filter_options");
+ len = 0;
+ for (filter = a->filter; filter != NULL; filter = filter->upstream) {
+ bidder = filter->bidder;
+ if (bidder == NULL)
+ continue;
+ if (bidder->options == NULL)
+ /* This bidder does not support option */
+ continue;
+ while ((len = __archive_parse_options(s, filter->name,
+ sizeof(key), key, sizeof(val), val)) > 0) {
+ if (val[0] == '\0')
+ r = bidder->options(bidder, key, NULL);
+ else
+ r = bidder->options(bidder, key, val);
+ if (r == ARCHIVE_FATAL)
+ return (r);
+ s += len;
+ }
+ }
+ if (len < 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Illegal format options.");
+ return (ARCHIVE_WARN);
+ }
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Set read options for the format and the filter.
+ */
+int
+archive_read_set_options(struct archive *_a, const char *s)
+{
+ int r;
+
+ __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW,
+ "archive_read_set_options");
+ archive_clear_error(_a);
+
+ r = archive_read_set_format_options(_a, s);
+ if (r != ARCHIVE_OK)
+ return (r);
+ r = archive_read_set_filter_options(_a, s);
+ if (r != ARCHIVE_OK)
+ return (r);
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Open the archive
+ */
+int
+archive_read_open(struct archive *a, void *client_data,
+ archive_open_callback *client_opener, archive_read_callback *client_reader,
+ archive_close_callback *client_closer)
+{
+ /* Old archive_read_open() is just a thin shell around
+ * archive_read_open2. */
+ return archive_read_open2(a, client_data, client_opener,
+ client_reader, NULL, client_closer);
+}
+
+static ssize_t
+client_read_proxy(struct archive_read_filter *self, const void **buff)
+{
+ ssize_t r;
+ r = (self->archive->client.reader)(&self->archive->archive,
+ self->data, buff);
+ self->archive->archive.raw_position += r;
+ return (r);
+}
+
+static int64_t
+client_skip_proxy(struct archive_read_filter *self, int64_t request)
+{
+ int64_t ask, get, total;
+ /* Limit our maximum seek request to 1GB on platforms
+ * with 32-bit off_t (such as Windows). */
+ int64_t skip_limit = ((int64_t)1) << (sizeof(off_t) * 8 - 2);
+
+ if (self->archive->client.skipper == NULL)
+ return (0);
+ total = 0;
+ for (;;) {
+ ask = request;
+ if (ask > skip_limit)
+ ask = skip_limit;
+ get = (self->archive->client.skipper)(&self->archive->archive,
+ self->data, ask);
+ if (get == 0)
+ return (total);
+ request -= get;
+ self->archive->archive.raw_position += get;
+ total += get;
+ }
+}
+
+static int
+client_close_proxy(struct archive_read_filter *self)
+{
+ int r = ARCHIVE_OK;
+
+ if (self->archive->client.closer != NULL)
+ r = (self->archive->client.closer)((struct archive *)self->archive,
+ self->data);
+ self->data = NULL;
+ return (r);
+}
+
+
+int
+archive_read_open2(struct archive *_a, void *client_data,
+ archive_open_callback *client_opener,
+ archive_read_callback *client_reader,
+ archive_skip_callback *client_skipper,
+ archive_close_callback *client_closer)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ struct archive_read_filter *filter;
+ int e;
+
+ __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW,
+ "archive_read_open");
+ archive_clear_error(&a->archive);
+
+ if (client_reader == NULL)
+ __archive_errx(1,
+ "No reader function provided to archive_read_open");
+
+ /* Open data source. */
+ if (client_opener != NULL) {
+ e =(client_opener)(&a->archive, client_data);
+ if (e != 0) {
+ /* If the open failed, call the closer to clean up. */
+ if (client_closer)
+ (client_closer)(&a->archive, client_data);
+ return (e);
+ }
+ }
+
+ /* Save the client functions and mock up the initial source. */
+ a->client.reader = client_reader;
+ a->client.skipper = client_skipper;
+ a->client.closer = client_closer;
+
+ filter = calloc(1, sizeof(*filter));
+ if (filter == NULL)
+ return (ARCHIVE_FATAL);
+ filter->bidder = NULL;
+ filter->upstream = NULL;
+ filter->archive = a;
+ filter->data = client_data;
+ filter->read = client_read_proxy;
+ filter->skip = client_skip_proxy;
+ filter->close = client_close_proxy;
+ filter->name = "none";
+ filter->code = ARCHIVE_COMPRESSION_NONE;
+ a->filter = filter;
+
+ /* Build out the input pipeline. */
+ e = build_stream(a);
+ if (e == ARCHIVE_OK)
+ a->archive.state = ARCHIVE_STATE_HEADER;
+
+ return (e);
+}
+
+/*
+ * Allow each registered stream transform to bid on whether
+ * it wants to handle this stream. Repeat until we've finished
+ * building the pipeline.
+ */
+static int
+build_stream(struct archive_read *a)
+{
+ int number_bidders, i, bid, best_bid;
+ struct archive_read_filter_bidder *bidder, *best_bidder;
+ struct archive_read_filter *filter;
+ ssize_t avail;
+ int r;
+
+ for (;;) {
+ number_bidders = sizeof(a->bidders) / sizeof(a->bidders[0]);
+
+ best_bid = 0;
+ best_bidder = NULL;
+
+ bidder = a->bidders;
+ for (i = 0; i < number_bidders; i++, bidder++) {
+ if (bidder->bid != NULL) {
+ bid = (bidder->bid)(bidder, a->filter);
+ if (bid > best_bid) {
+ best_bid = bid;
+ best_bidder = bidder;
+ }
+ }
+ }
+
+ /* If no bidder, we're done. */
+ if (best_bidder == NULL) {
+ a->archive.compression_name = a->filter->name;
+ a->archive.compression_code = a->filter->code;
+ return (ARCHIVE_OK);
+ }
+
+ filter
+ = (struct archive_read_filter *)calloc(1, sizeof(*filter));
+ if (filter == NULL)
+ return (ARCHIVE_FATAL);
+ filter->bidder = best_bidder;
+ filter->archive = a;
+ filter->upstream = a->filter;
+ r = (best_bidder->init)(filter);
+ if (r != ARCHIVE_OK) {
+ free(filter);
+ return (r);
+ }
+ a->filter = filter;
+ /* Verify the filter by asking it for some data. */
+ __archive_read_filter_ahead(filter, 1, &avail);
+ if (avail < 0) {
+ cleanup_filters(a);
+ return (ARCHIVE_FATAL);
+ }
+ }
+}
+
+/*
+ * Read header of next entry.
+ */
+int
+archive_read_next_header2(struct archive *_a, struct archive_entry *entry)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ int slot, ret;
+
+ __archive_check_magic(_a, ARCHIVE_READ_MAGIC,
+ ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA,
+ "archive_read_next_header");
+
+ ++_a->file_count;
+ archive_entry_clear(entry);
+ archive_clear_error(&a->archive);
+
+ /*
+ * If no format has yet been chosen, choose one.
+ */
+ if (a->format == NULL) {
+ slot = choose_format(a);
+ if (slot < 0) {
+ a->archive.state = ARCHIVE_STATE_FATAL;
+ return (ARCHIVE_FATAL);
+ }
+ a->format = &(a->formats[slot]);
+ }
+
+ /*
+ * If client didn't consume entire data, skip any remainder
+ * (This is especially important for GNU incremental directories.)
+ */
+ if (a->archive.state == ARCHIVE_STATE_DATA) {
+ ret = archive_read_data_skip(&a->archive);
+ if (ret == ARCHIVE_EOF) {
+ archive_set_error(&a->archive, EIO, "Premature end-of-file.");
+ a->archive.state = ARCHIVE_STATE_FATAL;
+ return (ARCHIVE_FATAL);
+ }
+ if (ret != ARCHIVE_OK)
+ return (ret);
+ }
+
+ /* Record start-of-header. */
+ a->header_position = a->archive.file_position;
+
+ ret = (a->format->read_header)(a, entry);
+
+ /*
+ * EOF and FATAL are persistent at this layer. By
+ * modifying the state, we guarantee that future calls to
+ * read a header or read data will fail.
+ */
+ switch (ret) {
+ case ARCHIVE_EOF:
+ a->archive.state = ARCHIVE_STATE_EOF;
+ break;
+ case ARCHIVE_OK:
+ a->archive.state = ARCHIVE_STATE_DATA;
+ break;
+ case ARCHIVE_WARN:
+ a->archive.state = ARCHIVE_STATE_DATA;
+ break;
+ case ARCHIVE_RETRY:
+ break;
+ case ARCHIVE_FATAL:
+ a->archive.state = ARCHIVE_STATE_FATAL;
+ break;
+ }
+
+ a->read_data_output_offset = 0;
+ a->read_data_remaining = 0;
+ return (ret);
+}
+
+int
+archive_read_next_header(struct archive *_a, struct archive_entry **entryp)
+{
+ int ret;
+ struct archive_read *a = (struct archive_read *)_a;
+ *entryp = NULL;
+ ret = archive_read_next_header2(_a, a->entry);
+ *entryp = a->entry;
+ return ret;
+}
+
+/*
+ * Allow each registered format to bid on whether it wants to handle
+ * the next entry. Return index of winning bidder.
+ */
+static int
+choose_format(struct archive_read *a)
+{
+ int slots;
+ int i;
+ int bid, best_bid;
+ int best_bid_slot;
+
+ slots = sizeof(a->formats) / sizeof(a->formats[0]);
+ best_bid = -1;
+ best_bid_slot = -1;
+
+ /* Set up a->format and a->pformat_data for convenience of bidders. */
+ a->format = &(a->formats[0]);
+ for (i = 0; i < slots; i++, a->format++) {
+ if (a->format->bid) {
+ bid = (a->format->bid)(a);
+ if (bid == ARCHIVE_FATAL)
+ return (ARCHIVE_FATAL);
+ if ((bid > best_bid) || (best_bid_slot < 0)) {
+ best_bid = bid;
+ best_bid_slot = i;
+ }
+ }
+ }
+
+ /*
+ * There were no bidders; this is a serious programmer error
+ * and demands a quick and definitive abort.
+ */
+ if (best_bid_slot < 0)
+ __archive_errx(1, "No formats were registered; you must "
+ "invoke at least one archive_read_support_format_XXX "
+ "function in order to successfully read an archive.");
+
+ /*
+ * There were bidders, but no non-zero bids; this means we
+ * can't support this stream.
+ */
+ if (best_bid < 1) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Unrecognized archive format");
+ return (ARCHIVE_FATAL);
+ }
+
+ return (best_bid_slot);
+}
+
+/*
+ * Return the file offset (within the uncompressed data stream) where
+ * the last header started.
+ */
+int64_t
+archive_read_header_position(struct archive *_a)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ __archive_check_magic(_a, ARCHIVE_READ_MAGIC,
+ ARCHIVE_STATE_ANY, "archive_read_header_position");
+ return (a->header_position);
+}
+
+/*
+ * Read data from an archive entry, using a read(2)-style interface.
+ * This is a convenience routine that just calls
+ * archive_read_data_block and copies the results into the client
+ * buffer, filling any gaps with zero bytes. Clients using this
+ * API can be completely ignorant of sparse-file issues; sparse files
+ * will simply be padded with nulls.
+ *
+ * DO NOT intermingle calls to this function and archive_read_data_block
+ * to read a single entry body.
+ */
+ssize_t
+archive_read_data(struct archive *_a, void *buff, size_t s)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ char *dest;
+ const void *read_buf;
+ size_t bytes_read;
+ size_t len;
+ int r;
+
+ bytes_read = 0;
+ dest = (char *)buff;
+
+ while (s > 0) {
+ if (a->read_data_remaining == 0) {
+ read_buf = a->read_data_block;
+ r = archive_read_data_block(&a->archive, &read_buf,
+ &a->read_data_remaining, &a->read_data_offset);
+ a->read_data_block = read_buf;
+ if (r == ARCHIVE_EOF)
+ return (bytes_read);
+ /*
+ * Error codes are all negative, so the status
+ * return here cannot be confused with a valid
+ * byte count. (ARCHIVE_OK is zero.)
+ */
+ if (r < ARCHIVE_OK)
+ return (r);
+ }
+
+ if (a->read_data_offset < a->read_data_output_offset) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Encountered out-of-order sparse blocks");
+ return (ARCHIVE_RETRY);
+ }
+
+ /* Compute the amount of zero padding needed. */
+ if (a->read_data_output_offset + (off_t)s <
+ a->read_data_offset) {
+ len = s;
+ } else if (a->read_data_output_offset <
+ a->read_data_offset) {
+ len = a->read_data_offset -
+ a->read_data_output_offset;
+ } else
+ len = 0;
+
+ /* Add zeroes. */
+ memset(dest, 0, len);
+ s -= len;
+ a->read_data_output_offset += len;
+ dest += len;
+ bytes_read += len;
+
+ /* Copy data if there is any space left. */
+ if (s > 0) {
+ len = a->read_data_remaining;
+ if (len > s)
+ len = s;
+ memcpy(dest, a->read_data_block, len);
+ s -= len;
+ a->read_data_block += len;
+ a->read_data_remaining -= len;
+ a->read_data_output_offset += len;
+ a->read_data_offset += len;
+ dest += len;
+ bytes_read += len;
+ }
+ }
+ return (bytes_read);
+}
+
+#if ARCHIVE_API_VERSION < 3
+/*
+ * Obsolete function provided for compatibility only. Note that the API
+ * of this function doesn't allow the caller to detect if the remaining
+ * data from the archive entry is shorter than the buffer provided, or
+ * even if an error occurred while reading data.
+ */
+int
+archive_read_data_into_buffer(struct archive *a, void *d, ssize_t len)
+{
+
+ archive_read_data(a, d, len);
+ return (ARCHIVE_OK);
+}
+#endif
+
+/*
+ * Skip over all remaining data in this entry.
+ */
+int
+archive_read_data_skip(struct archive *_a)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ int r;
+ const void *buff;
+ size_t size;
+ off_t offset;
+
+ __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_DATA,
+ "archive_read_data_skip");
+
+ if (a->format->read_data_skip != NULL)
+ r = (a->format->read_data_skip)(a);
+ else {
+ while ((r = archive_read_data_block(&a->archive,
+ &buff, &size, &offset))
+ == ARCHIVE_OK)
+ ;
+ }
+
+ if (r == ARCHIVE_EOF)
+ r = ARCHIVE_OK;
+
+ a->archive.state = ARCHIVE_STATE_HEADER;
+ return (r);
+}
+
+/*
+ * Read the next block of entry data from the archive.
+ * This is a zero-copy interface; the client receives a pointer,
+ * size, and file offset of the next available block of data.
+ *
+ * Returns ARCHIVE_OK if the operation is successful, ARCHIVE_EOF if
+ * the end of entry is encountered.
+ */
+int
+archive_read_data_block(struct archive *_a,
+ const void **buff, size_t *size, off_t *offset)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_DATA,
+ "archive_read_data_block");
+
+ if (a->format->read_data == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
+ "Internal error: "
+ "No format_read_data_block function registered");
+ return (ARCHIVE_FATAL);
+ }
+
+ return (a->format->read_data)(a, buff, size, offset);
+}
+
+/*
+ * Close the file and release most resources.
+ *
+ * Be careful: client might just call read_new and then read_finish.
+ * Don't assume we actually read anything or performed any non-trivial
+ * initialization.
+ */
+static int
+_archive_read_close(struct archive *_a)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ int r = ARCHIVE_OK, r1 = ARCHIVE_OK;
+ size_t i, n;
+
+ __archive_check_magic(&a->archive, ARCHIVE_READ_MAGIC,
+ ARCHIVE_STATE_ANY, "archive_read_close");
+ archive_clear_error(&a->archive);
+ a->archive.state = ARCHIVE_STATE_CLOSED;
+
+
+ /* Call cleanup functions registered by optional components. */
+ if (a->cleanup_archive_extract != NULL)
+ r = (a->cleanup_archive_extract)(a);
+
+ /* TODO: Clean up the formatters. */
+
+ /* Release the filter objects. */
+ r1 = cleanup_filters(a);
+ if (r1 < r)
+ r = r1;
+
+ /* Release the bidder objects. */
+ n = sizeof(a->bidders)/sizeof(a->bidders[0]);
+ for (i = 0; i < n; i++) {
+ if (a->bidders[i].free != NULL) {
+ r1 = (a->bidders[i].free)(&a->bidders[i]);
+ if (r1 < r)
+ r = r1;
+ }
+ }
+
+ return (r);
+}
+
+static int
+cleanup_filters(struct archive_read *a)
+{
+ int r = ARCHIVE_OK;
+ /* Clean up the filter pipeline. */
+ while (a->filter != NULL) {
+ struct archive_read_filter *t = a->filter->upstream;
+ if (a->filter->close != NULL) {
+ int r1 = (a->filter->close)(a->filter);
+ if (r1 < r)
+ r = r1;
+ }
+ free(a->filter->buffer);
+ free(a->filter);
+ a->filter = t;
+ }
+ return r;
+}
+
+/*
+ * Release memory and other resources.
+ */
+static int
+_archive_read_finish(struct archive *_a)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ int i;
+ int slots;
+ int r = ARCHIVE_OK;
+
+ __archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_ANY,
+ "archive_read_finish");
+ if (a->archive.state != ARCHIVE_STATE_CLOSED)
+ r = archive_read_close(&a->archive);
+
+ /* Cleanup format-specific data. */
+ slots = sizeof(a->formats) / sizeof(a->formats[0]);
+ for (i = 0; i < slots; i++) {
+ a->format = &(a->formats[i]);
+ if (a->formats[i].cleanup)
+ (a->formats[i].cleanup)(a);
+ }
+
+ archive_string_free(&a->archive.error_string);
+ if (a->entry)
+ archive_entry_free(a->entry);
+ a->archive.magic = 0;
+ free(a);
+#if ARCHIVE_API_VERSION > 1
+ return (r);
+#endif
+}
+
+/*
+ * Used internally by read format handlers to register their bid and
+ * initialization functions.
+ */
+int
+__archive_read_register_format(struct archive_read *a,
+ void *format_data,
+ const char *name,
+ int (*bid)(struct archive_read *),
+ int (*options)(struct archive_read *, const char *, const char *),
+ int (*read_header)(struct archive_read *, struct archive_entry *),
+ int (*read_data)(struct archive_read *, const void **, size_t *, off_t *),
+ int (*read_data_skip)(struct archive_read *),
+ int (*cleanup)(struct archive_read *))
+{
+ int i, number_slots;
+
+ __archive_check_magic(&a->archive,
+ ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW,
+ "__archive_read_register_format");
+
+ number_slots = sizeof(a->formats) / sizeof(a->formats[0]);
+
+ for (i = 0; i < number_slots; i++) {
+ if (a->formats[i].bid == bid)
+ return (ARCHIVE_WARN); /* We've already installed */
+ if (a->formats[i].bid == NULL) {
+ a->formats[i].bid = bid;
+ a->formats[i].options = options;
+ a->formats[i].read_header = read_header;
+ a->formats[i].read_data = read_data;
+ a->formats[i].read_data_skip = read_data_skip;
+ a->formats[i].cleanup = cleanup;
+ a->formats[i].data = format_data;
+ a->formats[i].name = name;
+ return (ARCHIVE_OK);
+ }
+ }
+
+ __archive_errx(1, "Not enough slots for format registration");
+ return (ARCHIVE_FATAL); /* Never actually called. */
+}
+
+/*
+ * Used internally by decompression routines to register their bid and
+ * initialization functions.
+ */
+struct archive_read_filter_bidder *
+__archive_read_get_bidder(struct archive_read *a)
+{
+ int i, number_slots;
+
+ __archive_check_magic(&a->archive,
+ ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW,
+ "__archive_read_get_bidder");
+
+ number_slots = sizeof(a->bidders) / sizeof(a->bidders[0]);
+
+ for (i = 0; i < number_slots; i++) {
+ if (a->bidders[i].bid == NULL) {
+ memset(a->bidders + i, 0, sizeof(a->bidders[0]));
+ return (a->bidders + i);
+ }
+ }
+
+ __archive_errx(1, "Not enough slots for compression registration");
+ return (NULL); /* Never actually executed. */
+}
+
+/*
+ * The next three functions comprise the peek/consume internal I/O
+ * system used by archive format readers. This system allows fairly
+ * flexible read-ahead and allows the I/O code to operate in a
+ * zero-copy manner most of the time.
+ *
+ * In the ideal case, filters generate blocks of data
+ * and __archive_read_ahead() just returns pointers directly into
+ * those blocks. Then __archive_read_consume() just bumps those
+ * pointers. Only if your request would span blocks does the I/O
+ * layer use a copy buffer to provide you with a contiguous block of
+ * data. The __archive_read_skip() is an optimization; it scans ahead
+ * very quickly (it usually translates into a seek() operation if
+ * you're reading uncompressed disk files).
+ *
+ * A couple of useful idioms:
+ * * "I just want some data." Ask for 1 byte and pay attention to
+ * the "number of bytes available" from __archive_read_ahead().
+ * You can consume more than you asked for; you just can't consume
+ * more than is available. If you consume everything that's
+ * immediately available, the next read_ahead() call will pull
+ * the next block.
+ * * "I want to output a large block of data." As above, ask for 1 byte,
+ * emit all that's available (up to whatever limit you have), then
+ * repeat until you're done.
+ * * "I want to peek ahead by a large amount." Ask for 4k or so, then
+ * double and repeat until you get an error or have enough. Note
+ * that the I/O layer will likely end up expanding its copy buffer
+ * to fit your request, so use this technique cautiously. This
+ * technique is used, for example, by some of the format tasting
+ * code that has uncertain look-ahead needs.
+ *
+ * TODO: Someday, provide a more generic __archive_read_seek() for
+ * those cases where it's useful. This is tricky because there are lots
+ * of cases where seek() is not available (reading gzip data from a
+ * network socket, for instance), so there needs to be a good way to
+ * communicate whether seek() is available and users of that interface
+ * need to use non-seeking strategies whenever seek() is not available.
+ */
+
+/*
+ * Looks ahead in the input stream:
+ * * If 'avail' pointer is provided, that returns number of bytes available
+ * in the current buffer, which may be much larger than requested.
+ * * If end-of-file, *avail gets set to zero.
+ * * If error, *avail gets error code.
+ * * If request can be met, returns pointer to data, returns NULL
+ * if request is not met.
+ *
+ * Note: If you just want "some data", ask for 1 byte and pay attention
+ * to *avail, which will have the actual amount available. If you
+ * know exactly how many bytes you need, just ask for that and treat
+ * a NULL return as an error.
+ *
+ * Important: This does NOT move the file pointer. See
+ * __archive_read_consume() below.
+ */
+
+/*
+ * This is tricky. We need to provide our clients with pointers to
+ * contiguous blocks of memory but we want to avoid copying whenever
+ * possible.
+ *
+ * Mostly, this code returns pointers directly into the block of data
+ * provided by the client_read routine. It can do this unless the
+ * request would split across blocks. In that case, we have to copy
+ * into an internal buffer to combine reads.
+ */
+const void *
+__archive_read_ahead(struct archive_read *a, size_t min, ssize_t *avail)
+{
+ return (__archive_read_filter_ahead(a->filter, min, avail));
+}
+
+const void *
+__archive_read_filter_ahead(struct archive_read_filter *filter,
+ size_t min, ssize_t *avail)
+{
+ ssize_t bytes_read;
+ size_t tocopy;
+
+ if (filter->fatal) {
+ if (avail)
+ *avail = ARCHIVE_FATAL;
+ return (NULL);
+ }
+
+ /*
+ * Keep pulling more data until we can satisfy the request.
+ */
+ for (;;) {
+
+ /*
+ * If we can satisfy from the copy buffer (and the
+ * copy buffer isn't empty), we're done. In particular,
+ * note that min == 0 is a perfectly well-defined
+ * request.
+ */
+ if (filter->avail >= min && filter->avail > 0) {
+ if (avail != NULL)
+ *avail = filter->avail;
+ return (filter->next);
+ }
+
+ /*
+ * We can satisfy directly from client buffer if everything
+ * currently in the copy buffer is still in the client buffer.
+ */
+ if (filter->client_total >= filter->client_avail + filter->avail
+ && filter->client_avail + filter->avail >= min) {
+ /* "Roll back" to client buffer. */
+ filter->client_avail += filter->avail;
+ filter->client_next -= filter->avail;
+ /* Copy buffer is now empty. */
+ filter->avail = 0;
+ filter->next = filter->buffer;
+ /* Return data from client buffer. */
+ if (avail != NULL)
+ *avail = filter->client_avail;
+ return (filter->client_next);
+ }
+
+ /* Move data forward in copy buffer if necessary. */
+ if (filter->next > filter->buffer &&
+ filter->next + min > filter->buffer + filter->buffer_size) {
+ if (filter->avail > 0)
+ memmove(filter->buffer, filter->next, filter->avail);
+ filter->next = filter->buffer;
+ }
+
+ /* If we've used up the client data, get more. */
+ if (filter->client_avail <= 0) {
+ if (filter->end_of_file) {
+ if (avail != NULL)
+ *avail = 0;
+ return (NULL);
+ }
+ bytes_read = (filter->read)(filter,
+ &filter->client_buff);
+ if (bytes_read < 0) { /* Read error. */
+ filter->client_total = filter->client_avail = 0;
+ filter->client_next = filter->client_buff = NULL;
+ filter->fatal = 1;
+ if (avail != NULL)
+ *avail = ARCHIVE_FATAL;
+ return (NULL);
+ }
+ if (bytes_read == 0) { /* Premature end-of-file. */
+ filter->client_total = filter->client_avail = 0;
+ filter->client_next = filter->client_buff = NULL;
+ filter->end_of_file = 1;
+ /* Return whatever we do have. */
+ if (avail != NULL)
+ *avail = filter->avail;
+ return (NULL);
+ }
+ filter->position += bytes_read;
+ filter->client_total = bytes_read;
+ filter->client_avail = filter->client_total;
+ filter->client_next = filter->client_buff;
+ }
+ else
+ {
+ /*
+ * We can't satisfy the request from the copy
+ * buffer or the existing client data, so we
+ * need to copy more client data over to the
+ * copy buffer.
+ */
+
+ /* Ensure the buffer is big enough. */
+ if (min > filter->buffer_size) {
+ size_t s, t;
+ char *p;
+
+ /* Double the buffer; watch for overflow. */
+ s = t = filter->buffer_size;
+ if (s == 0)
+ s = min;
+ while (s < min) {
+ t *= 2;
+ if (t <= s) { /* Integer overflow! */
+ archive_set_error(
+ &filter->archive->archive,
+ ENOMEM,
+ "Unable to allocate copy buffer");
+ filter->fatal = 1;
+ if (avail != NULL)
+ *avail = ARCHIVE_FATAL;
+ return (NULL);
+ }
+ s = t;
+ }
+ /* Now s >= min, so allocate a new buffer. */
+ p = (char *)malloc(s);
+ if (p == NULL) {
+ archive_set_error(
+ &filter->archive->archive,
+ ENOMEM,
+ "Unable to allocate copy buffer");
+ filter->fatal = 1;
+ if (avail != NULL)
+ *avail = ARCHIVE_FATAL;
+ return (NULL);
+ }
+ /* Move data into newly-enlarged buffer. */
+ if (filter->avail > 0)
+ memmove(p, filter->next, filter->avail);
+ free(filter->buffer);
+ filter->next = filter->buffer = p;
+ filter->buffer_size = s;
+ }
+
+ /* We can add client data to copy buffer. */
+ /* First estimate: copy to fill rest of buffer. */
+ tocopy = (filter->buffer + filter->buffer_size)
+ - (filter->next + filter->avail);
+ /* Don't waste time buffering more than we need to. */
+ if (tocopy + filter->avail > min)
+ tocopy = min - filter->avail;
+ /* Don't copy more than is available. */
+ if (tocopy > filter->client_avail)
+ tocopy = filter->client_avail;
+
+ memcpy(filter->next + filter->avail, filter->client_next,
+ tocopy);
+ /* Remove this data from client buffer. */
+ filter->client_next += tocopy;
+ filter->client_avail -= tocopy;
+ /* add it to copy buffer. */
+ filter->avail += tocopy;
+ }
+ }
+}
+
+/*
+ * Move the file pointer forward. This should be called after
+ * __archive_read_ahead() returns data to you. Don't try to move
+ * ahead by more than the amount of data available according to
+ * __archive_read_ahead().
+ */
+/*
+ * Mark the appropriate data as used. Note that the request here will
+ * often be much smaller than the size of the previous read_ahead
+ * request.
+ */
+ssize_t
+__archive_read_consume(struct archive_read *a, size_t request)
+{
+ ssize_t r;
+ r = __archive_read_filter_consume(a->filter, request);
+ a->archive.file_position += r;
+ return (r);
+}
+
+ssize_t
+__archive_read_filter_consume(struct archive_read_filter * filter,
+ size_t request)
+{
+ if (filter->avail > 0) {
+ /* Read came from copy buffer. */
+ filter->next += request;
+ filter->avail -= request;
+ } else {
+ /* Read came from client buffer. */
+ filter->client_next += request;
+ filter->client_avail -= request;
+ }
+ return (request);
+}
+
+/*
+ * Move the file pointer ahead by an arbitrary amount. If you're
+ * reading uncompressed data from a disk file, this will actually
+ * translate into a seek() operation. Even in cases where seek()
+ * isn't feasible, this at least pushes the read-and-discard loop
+ * down closer to the data source.
+ */
+int64_t
+__archive_read_skip(struct archive_read *a, int64_t request)
+{
+ int64_t skipped = __archive_read_skip_lenient(a, request);
+ if (skipped == request)
+ return (skipped);
+ /* We hit EOF before we satisfied the skip request. */
+ if (skipped < 0) // Map error code to 0 for error message below.
+ skipped = 0;
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_MISC,
+ "Truncated input file (needed %jd bytes, only %jd available)",
+ (intmax_t)request, (intmax_t)skipped);
+ return (ARCHIVE_FATAL);
+}
+
+int64_t
+__archive_read_skip_lenient(struct archive_read *a, int64_t request)
+{
+ int64_t skipped = __archive_read_filter_skip(a->filter, request);
+ if (skipped > 0)
+ a->archive.file_position += skipped;
+ return (skipped);
+}
+
+int64_t
+__archive_read_filter_skip(struct archive_read_filter *filter, int64_t request)
+{
+ int64_t bytes_skipped, total_bytes_skipped = 0;
+ size_t min;
+
+ if (filter->fatal)
+ return (-1);
+ /*
+ * If there is data in the buffers already, use that first.
+ */
+ if (filter->avail > 0) {
+ min = minimum(request, (off_t)filter->avail);
+ bytes_skipped = __archive_read_filter_consume(filter, min);
+ request -= bytes_skipped;
+ total_bytes_skipped += bytes_skipped;
+ }
+ if (filter->client_avail > 0) {
+ min = minimum(request, (int64_t)filter->client_avail);
+ bytes_skipped = __archive_read_filter_consume(filter, min);
+ request -= bytes_skipped;
+ total_bytes_skipped += bytes_skipped;
+ }
+ if (request == 0)
+ return (total_bytes_skipped);
+ /*
+ * If a client_skipper was provided, try that first.
+ */
+#if ARCHIVE_API_VERSION < 2
+ if ((filter->skip != NULL) && (request < SSIZE_MAX)) {
+#else
+ if (filter->skip != NULL) {
+#endif
+ bytes_skipped = (filter->skip)(filter, request);
+ if (bytes_skipped < 0) { /* error */
+ filter->client_total = filter->client_avail = 0;
+ filter->client_next = filter->client_buff = NULL;
+ filter->fatal = 1;
+ return (bytes_skipped);
+ }
+ total_bytes_skipped += bytes_skipped;
+ request -= bytes_skipped;
+ filter->client_next = filter->client_buff;
+ filter->client_avail = filter->client_total = 0;
+ }
+ /*
+ * Note that client_skipper will usually not satisfy the
+ * full request (due to low-level blocking concerns),
+ * so even if client_skipper is provided, we may still
+ * have to use ordinary reads to finish out the request.
+ */
+ while (request > 0) {
+ ssize_t bytes_read;
+ (void)__archive_read_filter_ahead(filter, 1, &bytes_read);
+ if (bytes_read < 0)
+ return (bytes_read);
+ if (bytes_read == 0) {
+ return (total_bytes_skipped);
+ }
+ min = (size_t)(minimum(bytes_read, request));
+ bytes_read = __archive_read_filter_consume(filter, min);
+ total_bytes_skipped += bytes_read;
+ request -= bytes_read;
+ }
+ return (total_bytes_skipped);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_data_into_fd.c b/archivers/libarchive/files/libarchive/archive_read_data_into_fd.c
new file mode 100644
index 00000000000..3aeef3bc2da
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_data_into_fd.c
@@ -0,0 +1,93 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_data_into_fd.c,v 1.16 2008/05/23 05:01:29 cperciva Exp $");
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "archive.h"
+#include "archive_private.h"
+
+/* Maximum amount of data to write at one time. */
+#define MAX_WRITE (1024 * 1024)
+
+/*
+ * This implementation minimizes copying of data and is sparse-file aware.
+ */
+int
+archive_read_data_into_fd(struct archive *a, int fd)
+{
+ int r;
+ const void *buff;
+ size_t size, bytes_to_write;
+ ssize_t bytes_written, total_written;
+ off_t offset;
+ off_t output_offset;
+
+ __archive_check_magic(a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_DATA, "archive_read_data_into_fd");
+
+ total_written = 0;
+ output_offset = 0;
+
+ while ((r = archive_read_data_block(a, &buff, &size, &offset)) ==
+ ARCHIVE_OK) {
+ const char *p = buff;
+ if (offset > output_offset) {
+ output_offset = lseek(fd,
+ offset - output_offset, SEEK_CUR);
+ if (output_offset != offset) {
+ archive_set_error(a, errno, "Seek error");
+ return (ARCHIVE_FATAL);
+ }
+ }
+ while (size > 0) {
+ bytes_to_write = size;
+ if (bytes_to_write > MAX_WRITE)
+ bytes_to_write = MAX_WRITE;
+ bytes_written = write(fd, p, bytes_to_write);
+ if (bytes_written < 0) {
+ archive_set_error(a, errno, "Write error");
+ return (ARCHIVE_FATAL);
+ }
+ output_offset += bytes_written;
+ total_written += bytes_written;
+ p += bytes_written;
+ size -= bytes_written;
+ }
+ }
+
+ if (r != ARCHIVE_EOF)
+ return (r);
+ return (ARCHIVE_OK);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_extract.c b/archivers/libarchive/files/libarchive/archive_read_extract.c
new file mode 100644
index 00000000000..e1027995ec0
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_extract.c
@@ -0,0 +1,182 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.61 2008/05/26 17:00:22 kientzle Exp $");
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#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 "archive.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+#include "archive_write_disk_private.h"
+
+struct extract {
+ struct archive *ad; /* archive_write_disk object */
+
+ /* Progress function invoked during extract. */
+ void (*extract_progress)(void *);
+ void *extract_progress_user_data;
+};
+
+static int archive_read_extract_cleanup(struct archive_read *);
+static int copy_data(struct archive *ar, struct archive *aw);
+static struct extract *get_extract(struct archive_read *);
+
+static struct extract *
+get_extract(struct archive_read *a)
+{
+ /* If we haven't initialized, do it now. */
+ /* This also sets up a lot of global state. */
+ if (a->extract == NULL) {
+ a->extract = (struct extract *)malloc(sizeof(*a->extract));
+ if (a->extract == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Can't extract");
+ return (NULL);
+ }
+ memset(a->extract, 0, sizeof(*a->extract));
+ a->extract->ad = archive_write_disk_new();
+ if (a->extract->ad == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Can't extract");
+ return (NULL);
+ }
+ archive_write_disk_set_standard_lookup(a->extract->ad);
+ a->cleanup_archive_extract = archive_read_extract_cleanup;
+ }
+ return (a->extract);
+}
+
+int
+archive_read_extract(struct archive *_a, struct archive_entry *entry, int flags)
+{
+ struct extract *extract;
+
+ extract = get_extract((struct archive_read *)_a);
+ if (extract == NULL)
+ return (ARCHIVE_FATAL);
+ archive_write_disk_set_options(extract->ad, flags);
+ return (archive_read_extract2(_a, entry, extract->ad));
+}
+
+int
+archive_read_extract2(struct archive *_a, struct archive_entry *entry,
+ struct archive *ad)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ int r, r2;
+
+ /* Set up for this particular entry. */
+ archive_write_disk_set_skip_file(ad,
+ a->skip_file_dev, a->skip_file_ino);
+ r = archive_write_header(ad, entry);
+ if (r < ARCHIVE_WARN)
+ r = ARCHIVE_WARN;
+ if (r != ARCHIVE_OK)
+ /* If _write_header failed, copy the error. */
+ archive_copy_error(&a->archive, ad);
+ else
+ /* Otherwise, pour data into the entry. */
+ r = copy_data(_a, ad);
+ r2 = archive_write_finish_entry(ad);
+ if (r2 < ARCHIVE_WARN)
+ r2 = ARCHIVE_WARN;
+ /* Use the first message. */
+ if (r2 != ARCHIVE_OK && r == ARCHIVE_OK)
+ archive_copy_error(&a->archive, ad);
+ /* Use the worst error return. */
+ if (r2 < r)
+ r = r2;
+ return (r);
+}
+
+void
+archive_read_extract_set_progress_callback(struct archive *_a,
+ void (*progress_func)(void *), void *user_data)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ struct extract *extract = get_extract(a);
+ if (extract != NULL) {
+ extract->extract_progress = progress_func;
+ extract->extract_progress_user_data = user_data;
+ }
+}
+
+static int
+copy_data(struct archive *ar, struct archive *aw)
+{
+ off_t offset;
+ const void *buff;
+ struct extract *extract;
+ size_t size;
+ int r;
+
+ extract = get_extract((struct archive_read *)ar);
+ for (;;) {
+ r = archive_read_data_block(ar, &buff, &size, &offset);
+ if (r == ARCHIVE_EOF)
+ return (ARCHIVE_OK);
+ if (r != ARCHIVE_OK)
+ return (r);
+ r = archive_write_data_block(aw, buff, size, offset);
+ if (r < ARCHIVE_WARN)
+ r = ARCHIVE_WARN;
+ if (r != ARCHIVE_OK) {
+ archive_set_error(ar, archive_errno(aw),
+ "%s", archive_error_string(aw));
+ return (r);
+ }
+ if (extract->extract_progress)
+ (extract->extract_progress)
+ (extract->extract_progress_user_data);
+ }
+}
+
+/*
+ * Cleanup function for archive_extract.
+ */
+static int
+archive_read_extract_cleanup(struct archive_read *a)
+{
+ int ret = ARCHIVE_OK;
+
+#if ARCHIVE_API_VERSION > 1
+ ret =
+#endif
+ archive_write_finish(a->extract->ad);
+ free(a->extract);
+ a->extract = NULL;
+ return (ret);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_open_fd.c b/archivers/libarchive/files/libarchive/archive_read_open_fd.c
new file mode 100644
index 00000000000..33b7cba1b9b
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_open_fd.c
@@ -0,0 +1,186 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_open_fd.c 201103 2009-12-28 03:13:49Z kientzle $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "archive.h"
+
+struct read_fd_data {
+ int fd;
+ size_t block_size;
+ char can_skip;
+ void *buffer;
+};
+
+static int file_close(struct archive *, void *);
+static ssize_t file_read(struct archive *, void *, const void **buff);
+#if ARCHIVE_API_VERSION < 2
+static ssize_t file_skip(struct archive *, void *, size_t request);
+#else
+static off_t file_skip(struct archive *, void *, off_t request);
+#endif
+
+int
+archive_read_open_fd(struct archive *a, int fd, size_t block_size)
+{
+ struct stat st;
+ struct read_fd_data *mine;
+ void *b;
+
+ archive_clear_error(a);
+ if (fstat(fd, &st) != 0) {
+ archive_set_error(a, errno, "Can't stat fd %d", fd);
+ return (ARCHIVE_FATAL);
+ }
+
+ mine = (struct read_fd_data *)malloc(sizeof(*mine));
+ b = malloc(block_size);
+ if (mine == NULL || b == NULL) {
+ archive_set_error(a, ENOMEM, "No memory");
+ free(mine);
+ free(b);
+ return (ARCHIVE_FATAL);
+ }
+ mine->block_size = block_size;
+ mine->buffer = b;
+ mine->fd = fd;
+ /*
+ * Skip support is a performance optimization for anything
+ * that supports lseek(). On FreeBSD, only regular files and
+ * raw disk devices support lseek() and there's no portable
+ * way to determine if a device is a raw disk device, so we
+ * only enable this optimization for regular files.
+ */
+ if (S_ISREG(st.st_mode)) {
+ archive_read_extract_set_skip_file(a, st.st_dev, st.st_ino);
+ mine->can_skip = 1;
+ } else
+ mine->can_skip = 0;
+#if defined(__CYGWIN__) || defined(_WIN32)
+ setmode(mine->fd, O_BINARY);
+#endif
+
+ return (archive_read_open2(a, mine,
+ NULL, file_read, file_skip, file_close));
+}
+
+static ssize_t
+file_read(struct archive *a, void *client_data, const void **buff)
+{
+ struct read_fd_data *mine = (struct read_fd_data *)client_data;
+ ssize_t bytes_read;
+
+ *buff = mine->buffer;
+ bytes_read = read(mine->fd, mine->buffer, mine->block_size);
+ if (bytes_read < 0) {
+ archive_set_error(a, errno, "Error reading fd %d", mine->fd);
+ }
+ return (bytes_read);
+}
+
+#if ARCHIVE_API_VERSION < 2
+static ssize_t
+file_skip(struct archive *a, void *client_data, size_t request)
+#else
+static off_t
+file_skip(struct archive *a, void *client_data, off_t request)
+#endif
+{
+ struct read_fd_data *mine = (struct read_fd_data *)client_data;
+ off_t old_offset, new_offset;
+
+ if (!mine->can_skip)
+ return (0);
+
+ /* Reduce request to the next smallest multiple of block_size */
+ request = (request / mine->block_size) * mine->block_size;
+ if (request == 0)
+ return (0);
+
+ /*
+ * Hurray for lazy evaluation: if the first lseek fails, the second
+ * one will not be executed.
+ */
+ if (((old_offset = lseek(mine->fd, 0, SEEK_CUR)) < 0) ||
+ ((new_offset = lseek(mine->fd, request, SEEK_CUR)) < 0))
+ {
+ /* If seek failed once, it will probably fail again. */
+ mine->can_skip = 0;
+
+ if (errno == ESPIPE)
+ {
+ /*
+ * Failure to lseek() can be caused by the file
+ * descriptor pointing to a pipe, socket or FIFO.
+ * Return 0 here, so the compression layer will use
+ * read()s instead to advance the file descriptor.
+ * It's slower of course, but works as well.
+ */
+ return (0);
+ }
+ /*
+ * There's been an error other than ESPIPE. This is most
+ * likely caused by a programmer error (too large request)
+ * or a corrupted archive file.
+ */
+ archive_set_error(a, errno, "Error seeking");
+ return (-1);
+ }
+ return (new_offset - old_offset);
+}
+
+static int
+file_close(struct archive *a, void *client_data)
+{
+ struct read_fd_data *mine = (struct read_fd_data *)client_data;
+
+ (void)a; /* UNUSED */
+ free(mine->buffer);
+ free(mine);
+ return (ARCHIVE_OK);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_open_file.c b/archivers/libarchive/files/libarchive/archive_read_open_file.c
new file mode 100644
index 00000000000..095ae6eb5ce
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_open_file.c
@@ -0,0 +1,165 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_open_file.c 201093 2009-12-28 02:28:44Z kientzle $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "archive.h"
+
+struct read_FILE_data {
+ FILE *f;
+ size_t block_size;
+ void *buffer;
+ char can_skip;
+};
+
+static int file_close(struct archive *, void *);
+static ssize_t file_read(struct archive *, void *, const void **buff);
+#if ARCHIVE_API_VERSION < 2
+static ssize_t file_skip(struct archive *, void *, size_t request);
+#else
+static off_t file_skip(struct archive *, void *, off_t request);
+#endif
+
+int
+archive_read_open_FILE(struct archive *a, FILE *f)
+{
+ struct stat st;
+ struct read_FILE_data *mine;
+ size_t block_size = 128 * 1024;
+ void *b;
+
+ archive_clear_error(a);
+ mine = (struct read_FILE_data *)malloc(sizeof(*mine));
+ b = malloc(block_size);
+ if (mine == NULL || b == NULL) {
+ archive_set_error(a, ENOMEM, "No memory");
+ free(mine);
+ free(b);
+ return (ARCHIVE_FATAL);
+ }
+ mine->block_size = block_size;
+ mine->buffer = b;
+ mine->f = f;
+ /*
+ * If we can't fstat() the file, it may just be that it's not
+ * a file. (FILE * objects can wrap many kinds of I/O
+ * streams, some of which don't support fileno()).)
+ */
+ if (fstat(fileno(mine->f), &st) == 0 && S_ISREG(st.st_mode)) {
+ archive_read_extract_set_skip_file(a, st.st_dev, st.st_ino);
+ /* Enable the seek optimization only for regular files. */
+ mine->can_skip = 1;
+ } else
+ mine->can_skip = 0;
+
+#if defined(__CYGWIN__) || defined(_WIN32)
+ setmode(fileno(mine->f), O_BINARY);
+#endif
+
+ return (archive_read_open2(a, mine, NULL, file_read,
+ file_skip, file_close));
+}
+
+static ssize_t
+file_read(struct archive *a, void *client_data, const void **buff)
+{
+ struct read_FILE_data *mine = (struct read_FILE_data *)client_data;
+ ssize_t bytes_read;
+
+ *buff = mine->buffer;
+ bytes_read = fread(mine->buffer, 1, mine->block_size, mine->f);
+ if (bytes_read < 0) {
+ archive_set_error(a, errno, "Error reading file");
+ }
+ return (bytes_read);
+}
+
+#if ARCHIVE_API_VERSION < 2
+static ssize_t
+file_skip(struct archive *a, void *client_data, size_t request)
+#else
+static off_t
+file_skip(struct archive *a, void *client_data, off_t request)
+#endif
+{
+ struct read_FILE_data *mine = (struct read_FILE_data *)client_data;
+
+ (void)a; /* UNUSED */
+
+ /*
+ * If we can't skip, return 0 as the amount we did step and
+ * the caller will work around by reading and discarding.
+ */
+ if (!mine->can_skip)
+ return (0);
+ if (request == 0)
+ return (0);
+
+#if HAVE_FSEEKO
+ if (fseeko(mine->f, request, SEEK_CUR) != 0)
+#else
+ if (fseek(mine->f, request, SEEK_CUR) != 0)
+#endif
+ {
+ mine->can_skip = 0;
+ return (0);
+ }
+ return (request);
+}
+
+static int
+file_close(struct archive *a, void *client_data)
+{
+ struct read_FILE_data *mine = (struct read_FILE_data *)client_data;
+
+ (void)a; /* UNUSED */
+ if (mine->buffer != NULL)
+ free(mine->buffer);
+ free(mine);
+ return (ARCHIVE_OK);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_open_filename.c b/archivers/libarchive/files/libarchive/archive_read_open_filename.c
new file mode 100644
index 00000000000..607b80c56c7
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_open_filename.c
@@ -0,0 +1,268 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_open_filename.c 201093 2009-12-28 02:28:44Z kientzle $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "archive.h"
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+struct read_file_data {
+ int fd;
+ size_t block_size;
+ void *buffer;
+ mode_t st_mode; /* Mode bits for opened file. */
+ char can_skip; /* This file supports skipping. */
+ char filename[1]; /* Must be last! */
+};
+
+static int file_close(struct archive *, void *);
+static ssize_t file_read(struct archive *, void *, const void **buff);
+#if ARCHIVE_API_VERSION < 2
+static ssize_t file_skip(struct archive *, void *, size_t request);
+#else
+static off_t file_skip(struct archive *, void *, off_t request);
+#endif
+
+int
+archive_read_open_file(struct archive *a, const char *filename,
+ size_t block_size)
+{
+ return (archive_read_open_filename(a, filename, block_size));
+}
+
+int
+archive_read_open_filename(struct archive *a, const char *filename,
+ size_t block_size)
+{
+ struct stat st;
+ struct read_file_data *mine;
+ void *b;
+ int fd;
+
+ archive_clear_error(a);
+ if (filename == NULL || filename[0] == '\0') {
+ /* We used to invoke archive_read_open_fd(a,0,block_size)
+ * here, but that doesn't (and shouldn't) handle the
+ * end-of-file flush when reading stdout from a pipe.
+ * Basically, read_open_fd() is intended for folks who
+ * are willing to handle such details themselves. This
+ * API is intended to be a little smarter for folks who
+ * want easy handling of the common case.
+ */
+ filename = ""; /* Normalize NULL to "" */
+ fd = 0;
+#if defined(__CYGWIN__) || defined(_WIN32)
+ setmode(0, O_BINARY);
+#endif
+ } else {
+ fd = open(filename, O_RDONLY | O_BINARY);
+ if (fd < 0) {
+ archive_set_error(a, errno,
+ "Failed to open '%s'", filename);
+ return (ARCHIVE_FATAL);
+ }
+ }
+ if (fstat(fd, &st) != 0) {
+ archive_set_error(a, errno, "Can't stat '%s'", filename);
+ return (ARCHIVE_FATAL);
+ }
+
+ mine = (struct read_file_data *)calloc(1,
+ sizeof(*mine) + strlen(filename));
+ b = malloc(block_size);
+ if (mine == NULL || b == NULL) {
+ archive_set_error(a, ENOMEM, "No memory");
+ free(mine);
+ free(b);
+ return (ARCHIVE_FATAL);
+ }
+ strcpy(mine->filename, filename);
+ mine->block_size = block_size;
+ mine->buffer = b;
+ mine->fd = fd;
+ /* Remember mode so close can decide whether to flush. */
+ mine->st_mode = st.st_mode;
+ /* If we're reading a file from disk, ensure that we don't
+ overwrite it with an extracted file. */
+ if (S_ISREG(st.st_mode)) {
+ archive_read_extract_set_skip_file(a, st.st_dev, st.st_ino);
+ /*
+ * Enabling skip here is a performance optimization
+ * for anything that supports lseek(). On FreeBSD
+ * (and probably many other systems), only regular
+ * files and raw disk devices support lseek() (on
+ * other input types, lseek() returns success but
+ * doesn't actually change the file pointer, which
+ * just completely screws up the position-tracking
+ * logic). In addition, I've yet to find a portable
+ * way to determine if a device is a raw disk device.
+ * So I don't see a way to do much better than to only
+ * enable this optimization for regular files.
+ */
+ mine->can_skip = 1;
+ }
+ return (archive_read_open2(a, mine,
+ NULL, file_read, file_skip, file_close));
+}
+
+static ssize_t
+file_read(struct archive *a, void *client_data, const void **buff)
+{
+ struct read_file_data *mine = (struct read_file_data *)client_data;
+ ssize_t bytes_read;
+
+ *buff = mine->buffer;
+ bytes_read = read(mine->fd, mine->buffer, mine->block_size);
+ if (bytes_read < 0) {
+ if (mine->filename[0] == '\0')
+ archive_set_error(a, errno, "Error reading stdin");
+ else
+ archive_set_error(a, errno, "Error reading '%s'",
+ mine->filename);
+ }
+ return (bytes_read);
+}
+
+#if ARCHIVE_API_VERSION < 2
+static ssize_t
+file_skip(struct archive *a, void *client_data, size_t request)
+#else
+static off_t
+file_skip(struct archive *a, void *client_data, off_t request)
+#endif
+{
+ struct read_file_data *mine = (struct read_file_data *)client_data;
+ off_t old_offset, new_offset;
+
+ if (!mine->can_skip) /* We can't skip, so ... */
+ return (0); /* ... skip zero bytes. */
+
+ /* Reduce request to the next smallest multiple of block_size */
+ request = (request / mine->block_size) * mine->block_size;
+ if (request == 0)
+ return (0);
+
+ /*
+ * Hurray for lazy evaluation: if the first lseek fails, the second
+ * one will not be executed.
+ */
+ if (((old_offset = lseek(mine->fd, 0, SEEK_CUR)) < 0) ||
+ ((new_offset = lseek(mine->fd, request, SEEK_CUR)) < 0))
+ {
+ /* If skip failed once, it will probably fail again. */
+ mine->can_skip = 0;
+
+ if (errno == ESPIPE)
+ {
+ /*
+ * Failure to lseek() can be caused by the file
+ * descriptor pointing to a pipe, socket or FIFO.
+ * Return 0 here, so the compression layer will use
+ * read()s instead to advance the file descriptor.
+ * It's slower of course, but works as well.
+ */
+ return (0);
+ }
+ /*
+ * There's been an error other than ESPIPE. This is most
+ * likely caused by a programmer error (too large request)
+ * or a corrupted archive file.
+ */
+ if (mine->filename[0] == '\0')
+ /*
+ * Should never get here, since lseek() on stdin ought
+ * to return an ESPIPE error.
+ */
+ archive_set_error(a, errno, "Error seeking in stdin");
+ else
+ archive_set_error(a, errno, "Error seeking in '%s'",
+ mine->filename);
+ return (-1);
+ }
+ return (new_offset - old_offset);
+}
+
+static int
+file_close(struct archive *a, void *client_data)
+{
+ struct read_file_data *mine = (struct read_file_data *)client_data;
+
+ (void)a; /* UNUSED */
+
+ /* Only flush and close if open succeeded. */
+ if (mine->fd >= 0) {
+ /*
+ * Sometimes, we should flush the input before closing.
+ * Regular files: faster to just close without flush.
+ * Devices: must not flush (user might need to
+ * read the "next" item on a non-rewind device).
+ * Pipes and sockets: must flush (otherwise, the
+ * program feeding the pipe or socket may complain).
+ * Here, I flush everything except for regular files and
+ * device nodes.
+ */
+ if (!S_ISREG(mine->st_mode)
+ && !S_ISCHR(mine->st_mode)
+ && !S_ISBLK(mine->st_mode)) {
+ ssize_t bytesRead;
+ do {
+ bytesRead = read(mine->fd, mine->buffer,
+ mine->block_size);
+ } while (bytesRead > 0);
+ }
+ /* If a named file was opened, then it needs to be closed. */
+ if (mine->filename[0] != '\0')
+ close(mine->fd);
+ }
+ free(mine->buffer);
+ free(mine);
+ return (ARCHIVE_OK);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_open_memory.c b/archivers/libarchive/files/libarchive/archive_read_open_memory.c
new file mode 100644
index 00000000000..61f574fa770
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_open_memory.c
@@ -0,0 +1,156 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_read_open_memory.c,v 1.6 2007/07/06 15:51:59 kientzle Exp $");
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "archive.h"
+
+/*
+ * Glue to read an archive from a block of memory.
+ *
+ * This is mostly a huge help in building test harnesses;
+ * test programs can build archives in memory and read them
+ * back again without having to mess with files on disk.
+ */
+
+struct read_memory_data {
+ unsigned char *buffer;
+ unsigned char *end;
+ ssize_t read_size;
+};
+
+static int memory_read_close(struct archive *, void *);
+static int memory_read_open(struct archive *, void *);
+#if ARCHIVE_API_VERSION < 2
+static ssize_t memory_read_skip(struct archive *, void *, size_t request);
+#else
+static off_t memory_read_skip(struct archive *, void *, off_t request);
+#endif
+static ssize_t memory_read(struct archive *, void *, const void **buff);
+
+int
+archive_read_open_memory(struct archive *a, void *buff, size_t size)
+{
+ return archive_read_open_memory2(a, buff, size, size);
+}
+
+/*
+ * Don't use _open_memory2() in production code; the archive_read_open_memory()
+ * version is the one you really want. This is just here so that
+ * test harnesses can exercise block operations inside the library.
+ */
+int
+archive_read_open_memory2(struct archive *a, void *buff,
+ size_t size, size_t read_size)
+{
+ struct read_memory_data *mine;
+
+ mine = (struct read_memory_data *)malloc(sizeof(*mine));
+ if (mine == NULL) {
+ archive_set_error(a, ENOMEM, "No memory");
+ return (ARCHIVE_FATAL);
+ }
+ memset(mine, 0, sizeof(*mine));
+ mine->buffer = (unsigned char *)buff;
+ mine->end = mine->buffer + size;
+ mine->read_size = read_size;
+ return (archive_read_open2(a, mine, memory_read_open,
+ memory_read, memory_read_skip, memory_read_close));
+}
+
+/*
+ * There's nothing to open.
+ */
+static int
+memory_read_open(struct archive *a, void *client_data)
+{
+ (void)a; /* UNUSED */
+ (void)client_data; /* UNUSED */
+ return (ARCHIVE_OK);
+}
+
+/*
+ * This is scary simple: Just advance a pointer. Limiting
+ * to read_size is not technically necessary, but it exercises
+ * more of the internal logic when used with a small block size
+ * in a test harness. Production use should not specify a block
+ * size; then this is much faster.
+ */
+static ssize_t
+memory_read(struct archive *a, void *client_data, const void **buff)
+{
+ struct read_memory_data *mine = (struct read_memory_data *)client_data;
+ ssize_t size;
+
+ (void)a; /* UNUSED */
+ *buff = mine->buffer;
+ size = mine->end - mine->buffer;
+ if (size > mine->read_size)
+ size = mine->read_size;
+ mine->buffer += size;
+ return (size);
+}
+
+/*
+ * Advancing is just as simple. Again, this is doing more than
+ * necessary in order to better exercise internal code when used
+ * as a test harness.
+ */
+#if ARCHIVE_API_VERSION < 2
+static ssize_t
+memory_read_skip(struct archive *a, void *client_data, size_t skip)
+#else
+static off_t
+memory_read_skip(struct archive *a, void *client_data, off_t skip)
+#endif
+{
+ struct read_memory_data *mine = (struct read_memory_data *)client_data;
+
+ (void)a; /* UNUSED */
+ if ((off_t)skip > (off_t)(mine->end - mine->buffer))
+ skip = mine->end - mine->buffer;
+ /* Round down to block size. */
+ skip /= mine->read_size;
+ skip *= mine->read_size;
+ mine->buffer += skip;
+ return (skip);
+}
+
+/*
+ * Close is just cleaning up our one small bit of data.
+ */
+static int
+memory_read_close(struct archive *a, void *client_data)
+{
+ struct read_memory_data *mine = (struct read_memory_data *)client_data;
+ (void)a; /* UNUSED */
+ free(mine);
+ return (ARCHIVE_OK);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_private.h b/archivers/libarchive/files/libarchive/archive_read_private.h
new file mode 100644
index 00000000000..5a850189042
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_private.h
@@ -0,0 +1,199 @@
+/*-
+ * 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: head/lib/libarchive/archive_read_private.h 201088 2009-12-28 02:18:55Z kientzle $
+ */
+
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
+
+#ifndef ARCHIVE_READ_PRIVATE_H_INCLUDED
+#define ARCHIVE_READ_PRIVATE_H_INCLUDED
+
+#include "archive.h"
+#include "archive_string.h"
+#include "archive_private.h"
+
+struct archive_read;
+struct archive_read_filter_bidder;
+struct archive_read_filter;
+
+/*
+ * How bidding works for filters:
+ * * The bid manager reads the first block from the current source.
+ * * It shows that block to each registered bidder.
+ * * The bid manager creates a new filter structure for the winning
+ * bidder and gives the winning bidder a chance to initialize it.
+ * * The new filter becomes the top filter in the archive_read structure
+ * and we repeat the process.
+ * This ends only when no bidder provides a non-zero bid.
+ */
+struct archive_read_filter_bidder {
+ /* Configuration data for the bidder. */
+ void *data;
+ /* Taste the upstream filter to see if we handle this. */
+ int (*bid)(struct archive_read_filter_bidder *,
+ struct archive_read_filter *);
+ /* Initialize a newly-created filter. */
+ int (*init)(struct archive_read_filter *);
+ /* Set an option for the filter bidder. */
+ int (*options)(struct archive_read_filter_bidder *,
+ const char *key, const char *value);
+ /* Release the bidder's configuration data. */
+ int (*free)(struct archive_read_filter_bidder *);
+};
+
+/*
+ * This structure is allocated within the archive_read core
+ * and initialized by archive_read and the init() method of the
+ * corresponding bidder above.
+ */
+struct archive_read_filter {
+ /* Essentially all filters will need these values, so
+ * just declare them here. */
+ struct archive_read_filter_bidder *bidder; /* My bidder. */
+ struct archive_read_filter *upstream; /* Who I read from. */
+ struct archive_read *archive; /* Associated archive. */
+ /* Return next block. */
+ ssize_t (*read)(struct archive_read_filter *, const void **);
+ /* Skip forward this many bytes. */
+ int64_t (*skip)(struct archive_read_filter *self, int64_t request);
+ /* Close (just this filter) and free(self). */
+ int (*close)(struct archive_read_filter *self);
+ /* My private data. */
+ void *data;
+
+ const char *name;
+ int code;
+
+ /* Used by reblocking logic. */
+ char *buffer;
+ size_t buffer_size;
+ char *next; /* Current read location. */
+ size_t avail; /* Bytes in my buffer. */
+ const void *client_buff; /* Client buffer information. */
+ size_t client_total;
+ const char *client_next;
+ size_t client_avail;
+ int64_t position;
+ char end_of_file;
+ char fatal;
+};
+
+/*
+ * The client looks a lot like a filter, so we just wrap it here.
+ *
+ * TODO: Make archive_read_filter and archive_read_client identical so
+ * that users of the library can easily register their own
+ * transformation filters. This will probably break the API/ABI and
+ * so should be deferred at least until libarchive 3.0.
+ */
+struct archive_read_client {
+ archive_read_callback *reader;
+ archive_skip_callback *skipper;
+ archive_close_callback *closer;
+};
+
+struct archive_read {
+ struct archive archive;
+
+ struct archive_entry *entry;
+
+ /* Dev/ino of the archive being read/written. */
+ dev_t skip_file_dev;
+ ino_t skip_file_ino;
+
+ /*
+ * Used by archive_read_data() to track blocks and copy
+ * data to client buffers, filling gaps with zero bytes.
+ */
+ const char *read_data_block;
+ off_t read_data_offset;
+ off_t read_data_output_offset;
+ size_t read_data_remaining;
+
+ /* Callbacks to open/read/write/close client archive stream. */
+ struct archive_read_client client;
+
+ /* Registered filter bidders. */
+ struct archive_read_filter_bidder bidders[8];
+
+ /* Last filter in chain */
+ struct archive_read_filter *filter;
+
+ /* File offset of beginning of most recently-read header. */
+ off_t header_position;
+
+ /*
+ * Format detection is mostly the same as compression
+ * detection, with one significant difference: The bidders
+ * use the read_ahead calls above to examine the stream rather
+ * than having the supervisor hand them a block of data to
+ * examine.
+ */
+
+ struct archive_format_descriptor {
+ void *data;
+ const char *name;
+ int (*bid)(struct archive_read *);
+ int (*options)(struct archive_read *, const char *key,
+ const char *value);
+ int (*read_header)(struct archive_read *, struct archive_entry *);
+ int (*read_data)(struct archive_read *, const void **, size_t *, off_t *);
+ int (*read_data_skip)(struct archive_read *);
+ int (*cleanup)(struct archive_read *);
+ } formats[9];
+ struct archive_format_descriptor *format; /* Active format. */
+
+ /*
+ * Various information needed by archive_extract.
+ */
+ struct extract *extract;
+ int (*cleanup_archive_extract)(struct archive_read *);
+};
+
+int __archive_read_register_format(struct archive_read *a,
+ void *format_data,
+ const char *name,
+ int (*bid)(struct archive_read *),
+ int (*options)(struct archive_read *, const char *, const char *),
+ int (*read_header)(struct archive_read *, struct archive_entry *),
+ int (*read_data)(struct archive_read *, const void **, size_t *, off_t *),
+ int (*read_data_skip)(struct archive_read *),
+ int (*cleanup)(struct archive_read *));
+
+struct archive_read_filter_bidder
+ *__archive_read_get_bidder(struct archive_read *a);
+
+const void *__archive_read_ahead(struct archive_read *, size_t, ssize_t *);
+const void *__archive_read_filter_ahead(struct archive_read_filter *,
+ size_t, ssize_t *);
+ssize_t __archive_read_consume(struct archive_read *, size_t);
+ssize_t __archive_read_filter_consume(struct archive_read_filter *, size_t);
+int64_t __archive_read_skip(struct archive_read *, int64_t);
+int64_t __archive_read_skip_lenient(struct archive_read *, int64_t);
+int64_t __archive_read_filter_skip(struct archive_read_filter *, int64_t);
+int __archive_read_program(struct archive_read_filter *, const char *);
+#endif
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_compression_all.c b/archivers/libarchive/files/libarchive/archive_read_support_compression_all.c
new file mode 100644
index 00000000000..a6db7364d09
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_support_compression_all.c
@@ -0,0 +1,60 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_all.c 201248 2009-12-30 06:12:03Z kientzle $");
+
+#include "archive.h"
+
+int
+archive_read_support_compression_all(struct archive *a)
+{
+ /* Bzip falls back to "bunzip2" command-line */
+ archive_read_support_compression_bzip2(a);
+ /* The decompress code doesn't use an outside library. */
+ archive_read_support_compression_compress(a);
+ /* Gzip decompress falls back to "gunzip" command-line. */
+ archive_read_support_compression_gzip(a);
+ /* The LZMA file format has a very weak signature, so it
+ * may not be feasible to keep this here, but we'll try.
+ * This will come back out if there are problems. */
+ /* Lzma falls back to "unlzma" command-line program. */
+ archive_read_support_compression_lzma(a);
+ /* Xz falls back to "unxz" command-line program. */
+ archive_read_support_compression_xz(a);
+ /* The decode code doesn't use an outside library. */
+ archive_read_support_compression_uu(a);
+ /* The decode code doesn't use an outside library. */
+ archive_read_support_compression_rpm(a);
+
+ /* Note: We always return ARCHIVE_OK here, even if some of the
+ * above return ARCHIVE_WARN. The intent here is to enable
+ * "as much as possible." Clients who need specific
+ * compression should enable those individually so they can
+ * verify the level of support. */
+ /* Clear any warning messages set by the above functions. */
+ archive_clear_error(a);
+ return (ARCHIVE_OK);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_compression_bzip2.c b/archivers/libarchive/files/libarchive/archive_read_support_compression_bzip2.c
new file mode 100644
index 00000000000..1e45f22023c
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_support_compression_bzip2.c
@@ -0,0 +1,353 @@
+/*-
+ * 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 "archive_platform.h"
+
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_bzip2.c 201108 2009-12-28 03:28:21Z kientzle $");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_BZLIB_H
+#include <bzlib.h>
+#endif
+
+#include "archive.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+
+#if HAVE_BZLIB_H
+struct private_data {
+ bz_stream stream;
+ char *out_block;
+ size_t out_block_size;
+ char valid; /* True = decompressor is initialized */
+ char eof; /* True = found end of compressed data. */
+};
+
+/* Bzip2 filter */
+static ssize_t bzip2_filter_read(struct archive_read_filter *, const void **);
+static int bzip2_filter_close(struct archive_read_filter *);
+#endif
+
+/*
+ * Note that we can detect bzip2 archives even if we can't decompress
+ * them. (In fact, we like detecting them because we can give better
+ * error messages.) So the bid framework here gets compiled even
+ * if bzlib is unavailable.
+ */
+static int bzip2_reader_bid(struct archive_read_filter_bidder *, struct archive_read_filter *);
+static int bzip2_reader_init(struct archive_read_filter *);
+static int bzip2_reader_free(struct archive_read_filter_bidder *);
+
+int
+archive_read_support_compression_bzip2(struct archive *_a)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ struct archive_read_filter_bidder *reader = __archive_read_get_bidder(a);
+
+ if (reader == NULL)
+ return (ARCHIVE_FATAL);
+
+ reader->data = NULL;
+ reader->bid = bzip2_reader_bid;
+ reader->init = bzip2_reader_init;
+ reader->options = NULL;
+ reader->free = bzip2_reader_free;
+#if HAVE_BZLIB_H
+ return (ARCHIVE_OK);
+#else
+ archive_set_error(_a, ARCHIVE_ERRNO_MISC,
+ "Using external bunzip2 program");
+ return (ARCHIVE_WARN);
+#endif
+}
+
+static int
+bzip2_reader_free(struct archive_read_filter_bidder *self){
+ (void)self; /* UNUSED */
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Test whether we can handle this data.
+ *
+ * This logic returns zero if any part of the signature fails. It
+ * also tries to Do The Right Thing if a very short buffer prevents us
+ * from verifying as much as we would like.
+ */
+static int
+bzip2_reader_bid(struct archive_read_filter_bidder *self, struct archive_read_filter *filter)
+{
+ const unsigned char *buffer;
+ ssize_t avail;
+ int bits_checked;
+
+ (void)self; /* UNUSED */
+
+ /* Minimal bzip2 archive is 14 bytes. */
+ buffer = __archive_read_filter_ahead(filter, 14, &avail);
+ if (buffer == NULL)
+ return (0);
+
+ /* First three bytes must be "BZh" */
+ bits_checked = 0;
+ if (buffer[0] != 'B' || buffer[1] != 'Z' || buffer[2] != 'h')
+ return (0);
+ bits_checked += 24;
+
+ /* Next follows a compression flag which must be an ASCII digit. */
+ if (buffer[3] < '1' || buffer[3] > '9')
+ return (0);
+ bits_checked += 5;
+
+ /* After BZh[1-9], there must be either a data block
+ * which begins with 0x314159265359 or an end-of-data
+ * marker of 0x177245385090. */
+ if (memcmp(buffer + 4, "\x31\x41\x59\x26\x53\x59", 6) == 0)
+ bits_checked += 48;
+ else if (memcmp(buffer + 4, "\x17\x72\x45\x38\x50\x90", 6) == 0)
+ bits_checked += 48;
+ else
+ return (0);
+
+ return (bits_checked);
+}
+
+#ifndef HAVE_BZLIB_H
+
+/*
+ * If we don't have the library on this system, we can't actually do the
+ * decompression. We can, however, still detect compressed archives
+ * and emit a useful message.
+ */
+static int
+bzip2_reader_init(struct archive_read_filter *self)
+{
+ int r;
+
+ r = __archive_read_program(self, "bunzip2");
+ /* Note: We set the format here even if __archive_read_program()
+ * above fails. We do, after all, know what the format is
+ * even if we weren't able to read it. */
+ self->code = ARCHIVE_COMPRESSION_BZIP2;
+ self->name = "bzip2";
+ return (r);
+}
+
+
+#else
+
+/*
+ * Setup the callbacks.
+ */
+static int
+bzip2_reader_init(struct archive_read_filter *self)
+{
+ static const size_t out_block_size = 64 * 1024;
+ void *out_block;
+ struct private_data *state;
+
+ self->code = ARCHIVE_COMPRESSION_BZIP2;
+ self->name = "bzip2";
+
+ state = (struct private_data *)calloc(sizeof(*state), 1);
+ out_block = (unsigned char *)malloc(out_block_size);
+ if (self == NULL || state == NULL || out_block == NULL) {
+ archive_set_error(&self->archive->archive, ENOMEM,
+ "Can't allocate data for bzip2 decompression");
+ free(out_block);
+ free(state);
+ return (ARCHIVE_FATAL);
+ }
+
+ self->data = state;
+ state->out_block_size = out_block_size;
+ state->out_block = out_block;
+ self->read = bzip2_filter_read;
+ self->skip = NULL; /* not supported */
+ self->close = bzip2_filter_close;
+
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Return the next block of decompressed data.
+ */
+static ssize_t
+bzip2_filter_read(struct archive_read_filter *self, const void **p)
+{
+ struct private_data *state;
+ size_t decompressed;
+ const char *read_buf;
+ ssize_t ret;
+
+ state = (struct private_data *)self->data;
+
+ if (state->eof) {
+ *p = NULL;
+ return (0);
+ }
+
+ /* Empty our output buffer. */
+ state->stream.next_out = state->out_block;
+ state->stream.avail_out = state->out_block_size;
+
+ /* Try to fill the output buffer. */
+ for (;;) {
+ if (!state->valid) {
+ if (bzip2_reader_bid(self->bidder, self->upstream) == 0) {
+ state->eof = 1;
+ *p = state->out_block;
+ decompressed = state->stream.next_out
+ - state->out_block;
+ return (decompressed);
+ }
+ /* Initialize compression library. */
+ ret = BZ2_bzDecompressInit(&(state->stream),
+ 0 /* library verbosity */,
+ 0 /* don't use low-mem algorithm */);
+
+ /* If init fails, try low-memory algorithm instead. */
+ if (ret == BZ_MEM_ERROR)
+ ret = BZ2_bzDecompressInit(&(state->stream),
+ 0 /* library verbosity */,
+ 1 /* do use low-mem algo */);
+
+ if (ret != BZ_OK) {
+ const char *detail = NULL;
+ int err = ARCHIVE_ERRNO_MISC;
+ switch (ret) {
+ case BZ_PARAM_ERROR:
+ detail = "invalid setup parameter";
+ break;
+ case BZ_MEM_ERROR:
+ err = ENOMEM;
+ detail = "out of memory";
+ break;
+ case BZ_CONFIG_ERROR:
+ detail = "mis-compiled library";
+ break;
+ }
+ archive_set_error(&self->archive->archive, err,
+ "Internal error initializing decompressor%s%s",
+ detail == NULL ? "" : ": ",
+ detail);
+ return (ARCHIVE_FATAL);
+ }
+ state->valid = 1;
+ }
+
+ /* stream.next_in is really const, but bzlib
+ * doesn't declare it so. <sigh> */
+ read_buf =
+ __archive_read_filter_ahead(self->upstream, 1, &ret);
+ if (read_buf == NULL)
+ return (ARCHIVE_FATAL);
+ state->stream.next_in = (char *)(uintptr_t)read_buf;
+ state->stream.avail_in = ret;
+ /* There is no more data, return whatever we have. */
+ if (ret == 0) {
+ state->eof = 1;
+ *p = state->out_block;
+ decompressed = state->stream.next_out
+ - state->out_block;
+ return (decompressed);
+ }
+
+ /* Decompress as much as we can in one pass. */
+ ret = BZ2_bzDecompress(&(state->stream));
+ __archive_read_filter_consume(self->upstream,
+ state->stream.next_in - read_buf);
+
+ switch (ret) {
+ case BZ_STREAM_END: /* Found end of stream. */
+ switch (BZ2_bzDecompressEnd(&(state->stream))) {
+ case BZ_OK:
+ break;
+ default:
+ archive_set_error(&(self->archive->archive),
+ ARCHIVE_ERRNO_MISC,
+ "Failed to clean up decompressor");
+ return (ARCHIVE_FATAL);
+ }
+ state->valid = 0;
+ /* FALLTHROUGH */
+ case BZ_OK: /* Decompressor made some progress. */
+ /* If we filled our buffer, update stats and return. */
+ if (state->stream.avail_out == 0) {
+ *p = state->out_block;
+ decompressed = state->stream.next_out
+ - state->out_block;
+ return (decompressed);
+ }
+ break;
+ default: /* Return an error. */
+ archive_set_error(&self->archive->archive,
+ ARCHIVE_ERRNO_MISC, "bzip decompression failed");
+ return (ARCHIVE_FATAL);
+ }
+ }
+}
+
+/*
+ * Clean up the decompressor.
+ */
+static int
+bzip2_filter_close(struct archive_read_filter *self)
+{
+ struct private_data *state;
+ int ret = ARCHIVE_OK;
+
+ state = (struct private_data *)self->data;
+
+ if (state->valid) {
+ switch (BZ2_bzDecompressEnd(&state->stream)) {
+ case BZ_OK:
+ break;
+ default:
+ archive_set_error(&self->archive->archive,
+ ARCHIVE_ERRNO_MISC,
+ "Failed to clean up decompressor");
+ ret = ARCHIVE_FATAL;
+ }
+ }
+
+ free(state->out_block);
+ free(state);
+ return (ret);
+}
+
+#endif /* HAVE_BZLIB_H */
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_compression_compress.c b/archivers/libarchive/files/libarchive/archive_read_support_compression_compress.c
new file mode 100644
index 00000000000..2461975e59b
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_support_compression_compress.c
@@ -0,0 +1,444 @@
+/*-
+ * 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.
+ */
+
+/*
+ * This code borrows heavily from "compress" source code, which is
+ * protected by the following copyright. (Clause 3 dropped by request
+ * of the Regents.)
+ */
+
+/*-
+ * Copyright (c) 1985, 1986, 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Diomidis Spinellis and James A. Woods, derived from original
+ * work by Spencer Thomas and Joseph Orost.
+ *
+ * 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.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+
+#include "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_compress.c 201094 2009-12-28 02:29:21Z kientzle $");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "archive.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+
+/*
+ * Because LZW decompression is pretty simple, I've just implemented
+ * the whole decompressor here (cribbing from "compress" source code,
+ * of course), rather than relying on an external library. I have
+ * made an effort to clarify and simplify the algorithm, so the
+ * names and structure here don't exactly match those used by compress.
+ */
+
+struct private_data {
+ /* Input variables. */
+ const unsigned char *next_in;
+ size_t avail_in;
+ int bit_buffer;
+ int bits_avail;
+ size_t bytes_in_section;
+
+ /* Output variables. */
+ size_t out_block_size;
+ void *out_block;
+
+ /* Decompression status variables. */
+ int use_reset_code;
+ int end_of_stream; /* EOF status. */
+ int maxcode; /* Largest code. */
+ int maxcode_bits; /* Length of largest code. */
+ int section_end_code; /* When to increase bits. */
+ int bits; /* Current code length. */
+ int oldcode; /* Previous code. */
+ int finbyte; /* Last byte of prev code. */
+
+ /* Dictionary. */
+ int free_ent; /* Next dictionary entry. */
+ unsigned char suffix[65536];
+ uint16_t prefix[65536];
+
+ /*
+ * Scratch area for expanding dictionary entries. Note:
+ * "worst" case here comes from compressing /dev/zero: the
+ * last code in the dictionary will code a sequence of
+ * 65536-256 zero bytes. Thus, we need stack space to expand
+ * a 65280-byte dictionary entry. (Of course, 32640:1
+ * compression could also be considered the "best" case. ;-)
+ */
+ unsigned char *stackp;
+ unsigned char stack[65300];
+};
+
+static int compress_bidder_bid(struct archive_read_filter_bidder *, struct archive_read_filter *);
+static int compress_bidder_init(struct archive_read_filter *);
+static int compress_bidder_free(struct archive_read_filter_bidder *);
+
+static ssize_t compress_filter_read(struct archive_read_filter *, const void **);
+static int compress_filter_close(struct archive_read_filter *);
+
+static int getbits(struct archive_read_filter *, int n);
+static int next_code(struct archive_read_filter *);
+
+int
+archive_read_support_compression_compress(struct archive *_a)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ struct archive_read_filter_bidder *bidder = __archive_read_get_bidder(a);
+
+ if (bidder == NULL)
+ return (ARCHIVE_FATAL);
+
+ bidder->data = NULL;
+ bidder->bid = compress_bidder_bid;
+ bidder->init = compress_bidder_init;
+ bidder->options = NULL;
+ bidder->free = compress_bidder_free;
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Test whether we can handle this data.
+ *
+ * This logic returns zero if any part of the signature fails. It
+ * also tries to Do The Right Thing if a very short buffer prevents us
+ * from verifying as much as we would like.
+ */
+static int
+compress_bidder_bid(struct archive_read_filter_bidder *self,
+ struct archive_read_filter *filter)
+{
+ const unsigned char *buffer;
+ ssize_t avail;
+ int bits_checked;
+
+ (void)self; /* UNUSED */
+
+ buffer = __archive_read_filter_ahead(filter, 2, &avail);
+
+ if (buffer == NULL)
+ return (0);
+
+ bits_checked = 0;
+ if (buffer[0] != 037) /* Verify first ID byte. */
+ return (0);
+ bits_checked += 8;
+
+ if (buffer[1] != 0235) /* Verify second ID byte. */
+ return (0);
+ bits_checked += 8;
+
+ /*
+ * TODO: Verify more.
+ */
+
+ return (bits_checked);
+}
+
+/*
+ * Setup the callbacks.
+ */
+static int
+compress_bidder_init(struct archive_read_filter *self)
+{
+ struct private_data *state;
+ static const size_t out_block_size = 64 * 1024;
+ void *out_block;
+ int code;
+
+ self->code = ARCHIVE_COMPRESSION_COMPRESS;
+ self->name = "compress (.Z)";
+
+ state = (struct private_data *)calloc(sizeof(*state), 1);
+ out_block = malloc(out_block_size);
+ if (state == NULL || out_block == NULL) {
+ free(out_block);
+ free(state);
+ archive_set_error(&self->archive->archive, ENOMEM,
+ "Can't allocate data for %s decompression",
+ self->name);
+ return (ARCHIVE_FATAL);
+ }
+
+ self->data = state;
+ state->out_block_size = out_block_size;
+ state->out_block = out_block;
+ self->read = compress_filter_read;
+ self->skip = NULL; /* not supported */
+ self->close = compress_filter_close;
+
+ /* XXX MOVE THE FOLLOWING OUT OF INIT() XXX */
+
+ (void)getbits(self, 8); /* Skip first signature byte. */
+ (void)getbits(self, 8); /* Skip second signature byte. */
+
+ code = getbits(self, 8);
+ state->maxcode_bits = code & 0x1f;
+ state->maxcode = (1 << state->maxcode_bits);
+ state->use_reset_code = code & 0x80;
+
+ /* Initialize decompressor. */
+ state->free_ent = 256;
+ state->stackp = state->stack;
+ if (state->use_reset_code)
+ state->free_ent++;
+ state->bits = 9;
+ state->section_end_code = (1<<state->bits) - 1;
+ state->oldcode = -1;
+ for (code = 255; code >= 0; code--) {
+ state->prefix[code] = 0;
+ state->suffix[code] = code;
+ }
+ next_code(self);
+
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Return a block of data from the decompression buffer. Decompress more
+ * as necessary.
+ */
+static ssize_t
+compress_filter_read(struct archive_read_filter *self, const void **pblock)
+{
+ struct private_data *state;
+ unsigned char *p, *start, *end;
+ int ret;
+
+ state = (struct private_data *)self->data;
+ if (state->end_of_stream) {
+ *pblock = NULL;
+ return (0);
+ }
+ p = start = (unsigned char *)state->out_block;
+ end = start + state->out_block_size;
+
+ while (p < end && !state->end_of_stream) {
+ if (state->stackp > state->stack) {
+ *p++ = *--state->stackp;
+ } else {
+ ret = next_code(self);
+ if (ret == -1)
+ state->end_of_stream = ret;
+ else if (ret != ARCHIVE_OK)
+ return (ret);
+ }
+ }
+
+ *pblock = start;
+ return (p - start);
+}
+
+/*
+ * Clean up the reader.
+ */
+static int
+compress_bidder_free(struct archive_read_filter_bidder *self)
+{
+ self->data = NULL;
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Close and release the filter.
+ */
+static int
+compress_filter_close(struct archive_read_filter *self)
+{
+ struct private_data *state = (struct private_data *)self->data;
+
+ free(state->out_block);
+ free(state);
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Process the next code and fill the stack with the expansion
+ * of the code. Returns ARCHIVE_FATAL if there is a fatal I/O or
+ * format error, ARCHIVE_EOF if we hit end of data, ARCHIVE_OK otherwise.
+ */
+static int
+next_code(struct archive_read_filter *self)
+{
+ struct private_data *state = (struct private_data *)self->data;
+ int code, newcode;
+
+ static int debug_buff[1024];
+ static unsigned debug_index;
+
+ code = newcode = getbits(self, state->bits);
+ if (code < 0)
+ return (code);
+
+ debug_buff[debug_index++] = code;
+ if (debug_index >= sizeof(debug_buff)/sizeof(debug_buff[0]))
+ debug_index = 0;
+
+ /* If it's a reset code, reset the dictionary. */
+ if ((code == 256) && state->use_reset_code) {
+ /*
+ * The original 'compress' implementation blocked its
+ * I/O in a manner that resulted in junk bytes being
+ * inserted after every reset. The next section skips
+ * this junk. (Yes, the number of *bytes* to skip is
+ * a function of the current *bit* length.)
+ */
+ int skip_bytes = state->bits -
+ (state->bytes_in_section % state->bits);
+ skip_bytes %= state->bits;
+ state->bits_avail = 0; /* Discard rest of this byte. */
+ while (skip_bytes-- > 0) {
+ code = getbits(self, 8);
+ if (code < 0)
+ return (code);
+ }
+ /* Now, actually do the reset. */
+ state->bytes_in_section = 0;
+ state->bits = 9;
+ state->section_end_code = (1 << state->bits) - 1;
+ state->free_ent = 257;
+ state->oldcode = -1;
+ return (next_code(self));
+ }
+
+ if (code > state->free_ent) {
+ /* An invalid code is a fatal error. */
+ archive_set_error(&(self->archive->archive), -1,
+ "Invalid compressed data");
+ return (ARCHIVE_FATAL);
+ }
+
+ /* Special case for KwKwK string. */
+ if (code >= state->free_ent) {
+ *state->stackp++ = state->finbyte;
+ code = state->oldcode;
+ }
+
+ /* Generate output characters in reverse order. */
+ while (code >= 256) {
+ *state->stackp++ = state->suffix[code];
+ code = state->prefix[code];
+ }
+ *state->stackp++ = state->finbyte = code;
+
+ /* Generate the new entry. */
+ code = state->free_ent;
+ if (code < state->maxcode && state->oldcode >= 0) {
+ state->prefix[code] = state->oldcode;
+ state->suffix[code] = state->finbyte;
+ ++state->free_ent;
+ }
+ if (state->free_ent > state->section_end_code) {
+ state->bits++;
+ state->bytes_in_section = 0;
+ if (state->bits == state->maxcode_bits)
+ state->section_end_code = state->maxcode;
+ else
+ state->section_end_code = (1 << state->bits) - 1;
+ }
+
+ /* Remember previous code. */
+ state->oldcode = newcode;
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Return next 'n' bits from stream.
+ *
+ * -1 indicates end of available data.
+ */
+static int
+getbits(struct archive_read_filter *self, int n)
+{
+ struct private_data *state = (struct private_data *)self->data;
+ int code;
+ ssize_t ret;
+ static const int mask[] = {
+ 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff,
+ 0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x7fff, 0xffff
+ };
+
+ while (state->bits_avail < n) {
+ if (state->avail_in <= 0) {
+ state->next_in
+ = __archive_read_filter_ahead(self->upstream,
+ 1, &ret);
+ if (ret == 0)
+ return (-1);
+ if (ret < 0 || state->next_in == NULL)
+ return (ARCHIVE_FATAL);
+ state->avail_in = ret;
+ __archive_read_filter_consume(self->upstream, ret);
+ }
+ state->bit_buffer |= *state->next_in++ << state->bits_avail;
+ state->avail_in--;
+ state->bits_avail += 8;
+ state->bytes_in_section++;
+ }
+
+ code = state->bit_buffer;
+ state->bit_buffer >>= n;
+ state->bits_avail -= n;
+
+ return (code & mask[n]);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_compression_gzip.c b/archivers/libarchive/files/libarchive/archive_read_support_compression_gzip.c
new file mode 100644
index 00000000000..8cc924c9fc1
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_support_compression_gzip.c
@@ -0,0 +1,465 @@
+/*-
+ * 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 "archive_platform.h"
+
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_gzip.c 201082 2009-12-28 02:05:28Z kientzle $");
+
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_ZLIB_H
+#include <zlib.h>
+#endif
+
+#include "archive.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+
+#ifdef HAVE_ZLIB_H
+struct private_data {
+ z_stream stream;
+ char in_stream;
+ unsigned char *out_block;
+ size_t out_block_size;
+ int64_t total_out;
+ unsigned long crc;
+ char eof; /* True = found end of compressed data. */
+};
+
+/* Gzip Filter. */
+static ssize_t gzip_filter_read(struct archive_read_filter *, const void **);
+static int gzip_filter_close(struct archive_read_filter *);
+#endif
+
+/*
+ * Note that we can detect gzip archives even if we can't decompress
+ * them. (In fact, we like detecting them because we can give better
+ * error messages.) So the bid framework here gets compiled even
+ * if zlib is unavailable.
+ *
+ * TODO: If zlib is unavailable, gzip_bidder_init() should
+ * use the compress_program framework to try to fire up an external
+ * gunzip program.
+ */
+static int gzip_bidder_bid(struct archive_read_filter_bidder *,
+ struct archive_read_filter *);
+static int gzip_bidder_init(struct archive_read_filter *);
+
+int
+archive_read_support_compression_gzip(struct archive *_a)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ struct archive_read_filter_bidder *bidder = __archive_read_get_bidder(a);
+
+ if (bidder == NULL)
+ return (ARCHIVE_FATAL);
+
+ bidder->data = NULL;
+ bidder->bid = gzip_bidder_bid;
+ bidder->init = gzip_bidder_init;
+ bidder->options = NULL;
+ bidder->free = NULL; /* No data, so no cleanup necessary. */
+ /* Signal the extent of gzip support with the return value here. */
+#if HAVE_ZLIB_H
+ return (ARCHIVE_OK);
+#else
+ archive_set_error(_a, ARCHIVE_ERRNO_MISC,
+ "Using external gunzip program");
+ return (ARCHIVE_WARN);
+#endif
+}
+
+/*
+ * Read and verify the header.
+ *
+ * Returns zero if the header couldn't be validated, else returns
+ * number of bytes in header. If pbits is non-NULL, it receives a
+ * count of bits verified, suitable for use by bidder.
+ */
+static int
+peek_at_header(struct archive_read_filter *filter, int *pbits)
+{
+ const unsigned char *p;
+ ssize_t avail, len;
+ int bits = 0;
+ int header_flags;
+
+ /* Start by looking at the first ten bytes of the header, which
+ * is all fixed layout. */
+ len = 10;
+ p = __archive_read_filter_ahead(filter, len, &avail);
+ if (p == NULL || avail == 0)
+ return (0);
+ if (p[0] != 037)
+ return (0);
+ bits += 8;
+ if (p[1] != 0213)
+ return (0);
+ bits += 8;
+ if (p[2] != 8) /* We only support deflation. */
+ return (0);
+ bits += 8;
+ if ((p[3] & 0xE0)!= 0) /* No reserved flags set. */
+ return (0);
+ bits += 3;
+ header_flags = p[3];
+ /* Bytes 4-7 are mod time. */
+ /* Byte 8 is deflate flags. */
+ /* XXXX TODO: return deflate flags back to consume_header for use
+ in initializing the decompressor. */
+ /* Byte 9 is OS. */
+
+ /* Optional extra data: 2 byte length plus variable body. */
+ if (header_flags & 4) {
+ p = __archive_read_filter_ahead(filter, len + 2, &avail);
+ if (p == NULL)
+ return (0);
+ len += ((int)p[len + 1] << 8) | (int)p[len];
+ len += 2;
+ }
+
+ /* Null-terminated optional filename. */
+ if (header_flags & 8) {
+ do {
+ ++len;
+ if (avail < len)
+ p = __archive_read_filter_ahead(filter,
+ len, &avail);
+ if (p == NULL)
+ return (0);
+ } while (p[len - 1] != 0);
+ }
+
+ /* Null-terminated optional comment. */
+ if (header_flags & 16) {
+ do {
+ ++len;
+ if (avail < len)
+ p = __archive_read_filter_ahead(filter,
+ len, &avail);
+ if (p == NULL)
+ return (0);
+ } while (p[len - 1] != 0);
+ }
+
+ /* Optional header CRC */
+ if ((header_flags & 2)) {
+ p = __archive_read_filter_ahead(filter, len + 2, &avail);
+ if (p == NULL)
+ return (0);
+#if 0
+ int hcrc = ((int)p[len + 1] << 8) | (int)p[len];
+ int crc = /* XXX TODO: Compute header CRC. */;
+ if (crc != hcrc)
+ return (0);
+ bits += 16;
+#endif
+ len += 2;
+ }
+
+ if (pbits != NULL)
+ *pbits = bits;
+ return (len);
+}
+
+/*
+ * Bidder just verifies the header and returns the number of verified bits.
+ */
+static int
+gzip_bidder_bid(struct archive_read_filter_bidder *self,
+ struct archive_read_filter *filter)
+{
+ int bits_checked;
+
+ (void)self; /* UNUSED */
+
+ if (peek_at_header(filter, &bits_checked))
+ return (bits_checked);
+ return (0);
+}
+
+
+#ifndef HAVE_ZLIB_H
+
+/*
+ * If we don't have the library on this system, we can't do the
+ * decompression directly. We can, however, try to run gunzip
+ * in case that's available.
+ */
+static int
+gzip_bidder_init(struct archive_read_filter *self)
+{
+ int r;
+
+ r = __archive_read_program(self, "gunzip");
+ /* Note: We set the format here even if __archive_read_program()
+ * above fails. We do, after all, know what the format is
+ * even if we weren't able to read it. */
+ self->code = ARCHIVE_COMPRESSION_GZIP;
+ self->name = "gzip";
+ return (r);
+}
+
+#else
+
+/*
+ * Initialize the filter object.
+ */
+static int
+gzip_bidder_init(struct archive_read_filter *self)
+{
+ struct private_data *state;
+ static const size_t out_block_size = 64 * 1024;
+ void *out_block;
+
+ self->code = ARCHIVE_COMPRESSION_GZIP;
+ self->name = "gzip";
+
+ state = (struct private_data *)calloc(sizeof(*state), 1);
+ out_block = (unsigned char *)malloc(out_block_size);
+ if (state == NULL || out_block == NULL) {
+ free(out_block);
+ free(state);
+ archive_set_error(&self->archive->archive, ENOMEM,
+ "Can't allocate data for gzip decompression");
+ return (ARCHIVE_FATAL);
+ }
+
+ self->data = state;
+ state->out_block_size = out_block_size;
+ state->out_block = out_block;
+ self->read = gzip_filter_read;
+ self->skip = NULL; /* not supported */
+ self->close = gzip_filter_close;
+
+ state->in_stream = 0; /* We're not actually within a stream yet. */
+
+ return (ARCHIVE_OK);
+}
+
+static int
+consume_header(struct archive_read_filter *self)
+{
+ struct private_data *state;
+ ssize_t avail;
+ size_t len;
+ int ret;
+
+ state = (struct private_data *)self->data;
+
+ /* If this is a real header, consume it. */
+ len = peek_at_header(self->upstream, NULL);
+ if (len == 0)
+ return (ARCHIVE_EOF);
+ __archive_read_filter_consume(self->upstream, len);
+
+ /* Initialize CRC accumulator. */
+ state->crc = crc32(0L, NULL, 0);
+
+ /* Initialize compression library. */
+ state->stream.next_in = (unsigned char *)(uintptr_t)
+ __archive_read_filter_ahead(self->upstream, 1, &avail);
+ state->stream.avail_in = avail;
+ ret = inflateInit2(&(state->stream),
+ -15 /* Don't check for zlib header */);
+
+ /* Decipher the error code. */
+ switch (ret) {
+ case Z_OK:
+ state->in_stream = 1;
+ return (ARCHIVE_OK);
+ case Z_STREAM_ERROR:
+ archive_set_error(&self->archive->archive,
+ ARCHIVE_ERRNO_MISC,
+ "Internal error initializing compression library: "
+ "invalid setup parameter");
+ break;
+ case Z_MEM_ERROR:
+ archive_set_error(&self->archive->archive, ENOMEM,
+ "Internal error initializing compression library: "
+ "out of memory");
+ break;
+ case Z_VERSION_ERROR:
+ archive_set_error(&self->archive->archive,
+ ARCHIVE_ERRNO_MISC,
+ "Internal error initializing compression library: "
+ "invalid library version");
+ break;
+ default:
+ archive_set_error(&self->archive->archive,
+ ARCHIVE_ERRNO_MISC,
+ "Internal error initializing compression library: "
+ " Zlib error %d", ret);
+ break;
+ }
+ return (ARCHIVE_FATAL);
+}
+
+static int
+consume_trailer(struct archive_read_filter *self)
+{
+ struct private_data *state;
+ const unsigned char *p;
+ ssize_t avail;
+
+ state = (struct private_data *)self->data;
+
+ state->in_stream = 0;
+ switch (inflateEnd(&(state->stream))) {
+ case Z_OK:
+ break;
+ default:
+ archive_set_error(&self->archive->archive,
+ ARCHIVE_ERRNO_MISC,
+ "Failed to clean up gzip decompressor");
+ return (ARCHIVE_FATAL);
+ }
+
+ /* GZip trailer is a fixed 8 byte structure. */
+ p = __archive_read_filter_ahead(self->upstream, 8, &avail);
+ if (p == NULL || avail == 0)
+ return (ARCHIVE_FATAL);
+
+ /* XXX TODO: Verify the length and CRC. */
+
+ /* We've verified the trailer, so consume it now. */
+ __archive_read_filter_consume(self->upstream, 8);
+
+ return (ARCHIVE_OK);
+}
+
+static ssize_t
+gzip_filter_read(struct archive_read_filter *self, const void **p)
+{
+ struct private_data *state;
+ size_t decompressed;
+ ssize_t avail_in;
+ int ret;
+
+ state = (struct private_data *)self->data;
+
+ /* Empty our output buffer. */
+ state->stream.next_out = state->out_block;
+ state->stream.avail_out = state->out_block_size;
+
+ /* Try to fill the output buffer. */
+ while (state->stream.avail_out > 0 && !state->eof) {
+ /* If we're not in a stream, read a header
+ * and initialize the decompression library. */
+ if (!state->in_stream) {
+ ret = consume_header(self);
+ if (ret == ARCHIVE_EOF) {
+ state->eof = 1;
+ break;
+ }
+ if (ret < ARCHIVE_OK)
+ return (ret);
+ }
+
+ /* Peek at the next available data. */
+ /* ZLib treats stream.next_in as const but doesn't declare
+ * it so, hence this ugly cast. */
+ state->stream.next_in = (unsigned char *)(uintptr_t)
+ __archive_read_filter_ahead(self->upstream, 1, &avail_in);
+ if (state->stream.next_in == NULL)
+ return (ARCHIVE_FATAL);
+ state->stream.avail_in = avail_in;
+
+ /* Decompress and consume some of that data. */
+ ret = inflate(&(state->stream), 0);
+ switch (ret) {
+ case Z_OK: /* Decompressor made some progress. */
+ __archive_read_filter_consume(self->upstream,
+ avail_in - state->stream.avail_in);
+ break;
+ case Z_STREAM_END: /* Found end of stream. */
+ __archive_read_filter_consume(self->upstream,
+ avail_in - state->stream.avail_in);
+ /* Consume the stream trailer; release the
+ * decompression library. */
+ ret = consume_trailer(self);
+ if (ret < ARCHIVE_OK)
+ return (ret);
+ break;
+ default:
+ /* Return an error. */
+ archive_set_error(&self->archive->archive,
+ ARCHIVE_ERRNO_MISC,
+ "gzip decompression failed");
+ return (ARCHIVE_FATAL);
+ }
+ }
+
+ /* We've read as much as we can. */
+ decompressed = state->stream.next_out - state->out_block;
+ state->total_out += decompressed;
+ if (decompressed == 0)
+ *p = NULL;
+ else
+ *p = state->out_block;
+ return (decompressed);
+}
+
+/*
+ * Clean up the decompressor.
+ */
+static int
+gzip_filter_close(struct archive_read_filter *self)
+{
+ struct private_data *state;
+ int ret;
+
+ state = (struct private_data *)self->data;
+ ret = ARCHIVE_OK;
+
+ if (state->in_stream) {
+ switch (inflateEnd(&(state->stream))) {
+ case Z_OK:
+ break;
+ default:
+ archive_set_error(&(self->archive->archive),
+ ARCHIVE_ERRNO_MISC,
+ "Failed to clean up gzip compressor");
+ ret = ARCHIVE_FATAL;
+ }
+ }
+
+ free(state->out_block);
+ free(state);
+ return (ret);
+}
+
+#endif /* HAVE_ZLIB_H */
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_compression_none.c b/archivers/libarchive/files/libarchive/archive_read_support_compression_none.c
new file mode 100644
index 00000000000..955d06d9aa1
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_support_compression_none.c
@@ -0,0 +1,40 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_none.c 185679 2008-12-06 06:45:15Z kientzle $");
+
+#include "archive.h"
+
+/*
+ * Uncompressed streams are handled implicitly by the read core,
+ * so this is now a no-op.
+ */
+int
+archive_read_support_compression_none(struct archive *a)
+{
+ (void)a; /* UNUSED */
+ return (ARCHIVE_OK);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_compression_program.c b/archivers/libarchive/files/libarchive/archive_read_support_compression_program.c
new file mode 100644
index 00000000000..0c63f2e8312
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_support_compression_program.c
@@ -0,0 +1,459 @@
+/*-
+ * Copyright (c) 2007 Joerg Sonnenberger
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_compression_program.c 201112 2009-12-28 06:59:35Z kientzle $");
+
+#ifdef HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+#ifdef HAVE_ERRNO_H
+# include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+#ifdef HAVE_SIGNAL_H
+# include <signal.h>
+#endif
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+# include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "archive.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+
+int
+archive_read_support_compression_program(struct archive *a, const char *cmd)
+{
+ return (archive_read_support_compression_program_signature(a, cmd, NULL, 0));
+}
+
+
+/* This capability is only available on POSIX systems. */
+#if (!defined(HAVE_PIPE) || !defined(HAVE_FCNTL) || \
+ !(defined(HAVE_FORK) || defined(HAVE_VFORK))) && (!defined(_WIN32) || defined(__CYGWIN__))
+
+/*
+ * On non-Posix systems, allow the program to build, but choke if
+ * this function is actually invoked.
+ */
+int
+archive_read_support_compression_program_signature(struct archive *_a,
+ const char *cmd, void *signature, size_t signature_len)
+{
+ (void)_a; /* UNUSED */
+ (void)cmd; /* UNUSED */
+ (void)signature; /* UNUSED */
+ (void)signature_len; /* UNUSED */
+
+ archive_set_error(_a, -1,
+ "External compression programs not supported on this platform");
+ return (ARCHIVE_FATAL);
+}
+
+int
+__archive_read_program(struct archive_read_filter *self, const char *cmd)
+{
+ (void)self; /* UNUSED */
+ (void)cmd; /* UNUSED */
+
+ archive_set_error(&self->archive->archive, -1,
+ "External compression programs not supported on this platform");
+ return (ARCHIVE_FATAL);
+}
+
+#else
+
+#include "filter_fork.h"
+
+/*
+ * The bidder object stores the command and the signature to watch for.
+ * The 'inhibit' entry here is used to ensure that unchecked filters never
+ * bid twice in the same pipeline.
+ */
+struct program_bidder {
+ char *cmd;
+ void *signature;
+ size_t signature_len;
+ int inhibit;
+};
+
+static int program_bidder_bid(struct archive_read_filter_bidder *,
+ struct archive_read_filter *upstream);
+static int program_bidder_init(struct archive_read_filter *);
+static int program_bidder_free(struct archive_read_filter_bidder *);
+
+/*
+ * The actual filter needs to track input and output data.
+ */
+struct program_filter {
+ char *description;
+ pid_t child;
+ int exit_status;
+ int waitpid_return;
+ int child_stdin, child_stdout;
+
+ char *out_buf;
+ size_t out_buf_len;
+};
+
+static ssize_t program_filter_read(struct archive_read_filter *,
+ const void **);
+static int program_filter_close(struct archive_read_filter *);
+
+int
+archive_read_support_compression_program_signature(struct archive *_a,
+ const char *cmd, const void *signature, size_t signature_len)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ struct archive_read_filter_bidder *bidder;
+ struct program_bidder *state;
+
+ /*
+ * Get a bidder object from the read core.
+ */
+ bidder = __archive_read_get_bidder(a);
+ if (bidder == NULL)
+ return (ARCHIVE_FATAL);
+
+ /*
+ * Allocate our private state.
+ */
+ state = (struct program_bidder *)calloc(sizeof (*state), 1);
+ if (state == NULL)
+ return (ARCHIVE_FATAL);
+ state->cmd = strdup(cmd);
+ if (signature != NULL && signature_len > 0) {
+ state->signature_len = signature_len;
+ state->signature = malloc(signature_len);
+ memcpy(state->signature, signature, signature_len);
+ }
+
+ /*
+ * Fill in the bidder object.
+ */
+ bidder->data = state;
+ bidder->bid = program_bidder_bid;
+ bidder->init = program_bidder_init;
+ bidder->options = NULL;
+ bidder->free = program_bidder_free;
+ return (ARCHIVE_OK);
+}
+
+static int
+program_bidder_free(struct archive_read_filter_bidder *self)
+{
+ struct program_bidder *state = (struct program_bidder *)self->data;
+ free(state->cmd);
+ free(state->signature);
+ free(self->data);
+ return (ARCHIVE_OK);
+}
+
+/*
+ * If we do have a signature, bid only if that matches.
+ *
+ * If there's no signature, we bid INT_MAX the first time
+ * we're called, then never bid again.
+ */
+static int
+program_bidder_bid(struct archive_read_filter_bidder *self,
+ struct archive_read_filter *upstream)
+{
+ struct program_bidder *state = self->data;
+ const char *p;
+
+ /* If we have a signature, use that to match. */
+ if (state->signature_len > 0) {
+ p = __archive_read_filter_ahead(upstream,
+ state->signature_len, NULL);
+ if (p == NULL)
+ return (0);
+ /* No match, so don't bid. */
+ if (memcmp(p, state->signature, state->signature_len) != 0)
+ return (0);
+ return ((int)state->signature_len * 8);
+ }
+
+ /* Otherwise, bid once and then never bid again. */
+ if (state->inhibit)
+ return (0);
+ state->inhibit = 1;
+ return (INT_MAX);
+}
+
+/*
+ * Shut down the child, return ARCHIVE_OK if it exited normally.
+ *
+ * Note that the return value is sticky; if we're called again,
+ * we won't reap the child again, but we will return the same status
+ * (including error message if the child came to a bad end).
+ */
+static int
+child_stop(struct archive_read_filter *self, struct program_filter *state)
+{
+ /* Close our side of the I/O with the child. */
+ if (state->child_stdin != -1) {
+ close(state->child_stdin);
+ state->child_stdin = -1;
+ }
+ if (state->child_stdout != -1) {
+ close(state->child_stdout);
+ state->child_stdout = -1;
+ }
+
+ if (state->child != 0) {
+ /* Reap the child. */
+ do {
+ state->waitpid_return
+ = waitpid(state->child, &state->exit_status, 0);
+ } while (state->waitpid_return == -1 && errno == EINTR);
+ state->child = 0;
+ }
+
+ if (state->waitpid_return < 0) {
+ /* waitpid() failed? This is ugly. */
+ archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC,
+ "Child process exited badly");
+ return (ARCHIVE_WARN);
+ }
+
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ if (WIFSIGNALED(state->exit_status)) {
+#ifdef SIGPIPE
+ /* If the child died because we stopped reading before
+ * it was done, that's okay. Some archive formats
+ * have padding at the end that we routinely ignore. */
+ /* The alternative to this would be to add a step
+ * before close(child_stdout) above to read from the
+ * child until the child has no more to write. */
+ if (WTERMSIG(state->exit_status) == SIGPIPE)
+ return (ARCHIVE_OK);
+#endif
+ archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC,
+ "Child process exited with signal %d",
+ WTERMSIG(state->exit_status));
+ return (ARCHIVE_WARN);
+ }
+#endif /* !_WIN32 || __CYGWIN__ */
+
+ if (WIFEXITED(state->exit_status)) {
+ if (WEXITSTATUS(state->exit_status) == 0)
+ return (ARCHIVE_OK);
+
+ archive_set_error(&self->archive->archive,
+ ARCHIVE_ERRNO_MISC,
+ "Child process exited with status %d",
+ WEXITSTATUS(state->exit_status));
+ return (ARCHIVE_WARN);
+ }
+
+ return (ARCHIVE_WARN);
+}
+
+/*
+ * Use select() to decide whether the child is ready for read or write.
+ */
+static ssize_t
+child_read(struct archive_read_filter *self, char *buf, size_t buf_len)
+{
+ struct program_filter *state = self->data;
+ ssize_t ret, requested, avail;
+ const char *p;
+
+ requested = buf_len > SSIZE_MAX ? SSIZE_MAX : buf_len;
+
+ for (;;) {
+ do {
+ ret = read(state->child_stdout, buf, requested);
+ } while (ret == -1 && errno == EINTR);
+
+ if (ret > 0)
+ return (ret);
+ if (ret == 0 || (ret == -1 && errno == EPIPE))
+ /* Child has closed its output; reap the child
+ * and return the status. */
+ return (child_stop(self, state));
+ if (ret == -1 && errno != EAGAIN)
+ return (-1);
+
+ if (state->child_stdin == -1) {
+ /* Block until child has some I/O ready. */
+ __archive_check_child(state->child_stdin,
+ state->child_stdout);
+ continue;
+ }
+
+ /* Get some more data from upstream. */
+ p = __archive_read_filter_ahead(self->upstream, 1, &avail);
+ if (p == NULL) {
+ close(state->child_stdin);
+ state->child_stdin = -1;
+ fcntl(state->child_stdout, F_SETFL, 0);
+ if (avail < 0)
+ return (avail);
+ continue;
+ }
+
+ do {
+ ret = write(state->child_stdin, p, avail);
+ } while (ret == -1 && errno == EINTR);
+
+ if (ret > 0) {
+ /* Consume whatever we managed to write. */
+ __archive_read_filter_consume(self->upstream, ret);
+ } else if (ret == -1 && errno == EAGAIN) {
+ /* Block until child has some I/O ready. */
+ __archive_check_child(state->child_stdin,
+ state->child_stdout);
+ } else {
+ /* Write failed. */
+ close(state->child_stdin);
+ state->child_stdin = -1;
+ fcntl(state->child_stdout, F_SETFL, 0);
+ /* If it was a bad error, we're done; otherwise
+ * it was EPIPE or EOF, and we can still read
+ * from the child. */
+ if (ret == -1 && errno != EPIPE)
+ return (-1);
+ }
+ }
+}
+
+int
+__archive_read_program(struct archive_read_filter *self, const char *cmd)
+{
+ struct program_filter *state;
+ static const size_t out_buf_len = 65536;
+ char *out_buf;
+ char *description;
+ const char *prefix = "Program: ";
+
+ state = (struct program_filter *)calloc(1, sizeof(*state));
+ out_buf = (char *)malloc(out_buf_len);
+ description = (char *)malloc(strlen(prefix) + strlen(cmd) + 1);
+ if (state == NULL || out_buf == NULL || description == NULL) {
+ archive_set_error(&self->archive->archive, ENOMEM,
+ "Can't allocate input data");
+ free(state);
+ free(out_buf);
+ free(description);
+ return (ARCHIVE_FATAL);
+ }
+
+ self->code = ARCHIVE_COMPRESSION_PROGRAM;
+ state->description = description;
+ strcpy(state->description, prefix);
+ strcat(state->description, cmd);
+ self->name = state->description;
+
+ state->out_buf = out_buf;
+ state->out_buf_len = out_buf_len;
+
+ if ((state->child = __archive_create_child(cmd,
+ &state->child_stdin, &state->child_stdout)) == -1) {
+ free(state->out_buf);
+ free(state);
+ archive_set_error(&self->archive->archive, EINVAL,
+ "Can't initialise filter");
+ return (ARCHIVE_FATAL);
+ }
+
+ self->data = state;
+ self->read = program_filter_read;
+ self->skip = NULL;
+ self->close = program_filter_close;
+
+ /* XXX Check that we can read at least one byte? */
+ return (ARCHIVE_OK);
+}
+
+static int
+program_bidder_init(struct archive_read_filter *self)
+{
+ struct program_bidder *bidder_state;
+
+ bidder_state = (struct program_bidder *)self->bidder->data;
+ return (__archive_read_program(self, bidder_state->cmd));
+}
+
+static ssize_t
+program_filter_read(struct archive_read_filter *self, const void **buff)
+{
+ struct program_filter *state;
+ ssize_t bytes;
+ size_t total;
+ char *p;
+
+ state = (struct program_filter *)self->data;
+
+ total = 0;
+ p = state->out_buf;
+ while (state->child_stdout != -1 && total < state->out_buf_len) {
+ bytes = child_read(self, p, state->out_buf_len - total);
+ if (bytes < 0)
+ /* No recovery is possible if we can no longer
+ * read from the child. */
+ return (ARCHIVE_FATAL);
+ if (bytes == 0)
+ /* We got EOF from the child. */
+ break;
+ total += bytes;
+ p += bytes;
+ }
+
+ *buff = state->out_buf;
+ return (total);
+}
+
+static int
+program_filter_close(struct archive_read_filter *self)
+{
+ struct program_filter *state;
+ int e;
+
+ state = (struct program_filter *)self->data;
+ e = child_stop(self, state);
+
+ /* Release our private data. */
+ free(state->out_buf);
+ free(state->description);
+ free(state);
+
+ return (e);
+}
+
+#endif /* !defined(HAVE_PIPE) || !defined(HAVE_VFORK) || !defined(HAVE_FCNTL) */
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_all.c b/archivers/libarchive/files/libarchive/archive_read_support_format_all.c
new file mode 100644
index 00000000000..96778388594
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_all.c
@@ -0,0 +1,43 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_all.c 174991 2007-12-30 04:58:22Z kientzle $");
+
+#include "archive.h"
+
+int
+archive_read_support_format_all(struct archive *a)
+{
+ archive_read_support_format_ar(a);
+ archive_read_support_format_cpio(a);
+ archive_read_support_format_empty(a);
+ archive_read_support_format_iso9660(a);
+ archive_read_support_format_mtree(a);
+ archive_read_support_format_tar(a);
+ archive_read_support_format_xar(a);
+ archive_read_support_format_zip(a);
+ return (ARCHIVE_OK);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c b/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c
new file mode 100644
index 00000000000..7c1ca3a0c87
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_ar.c
@@ -0,0 +1,584 @@
+/*-
+ * Copyright (c) 2007 Kai Wang
+ * Copyright (c) 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
+ * 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.
+ */
+
+#include "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_ar.c 201101 2009-12-28 03:06:27Z kientzle $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+
+struct ar {
+ off_t entry_bytes_remaining;
+ off_t entry_offset;
+ off_t entry_padding;
+ char *strtab;
+ size_t strtab_size;
+};
+
+/*
+ * Define structure of the "ar" header.
+ */
+#define AR_name_offset 0
+#define AR_name_size 16
+#define AR_date_offset 16
+#define AR_date_size 12
+#define AR_uid_offset 28
+#define AR_uid_size 6
+#define AR_gid_offset 34
+#define AR_gid_size 6
+#define AR_mode_offset 40
+#define AR_mode_size 8
+#define AR_size_offset 48
+#define AR_size_size 10
+#define AR_fmag_offset 58
+#define AR_fmag_size 2
+
+static int archive_read_format_ar_bid(struct archive_read *a);
+static int archive_read_format_ar_cleanup(struct archive_read *a);
+static int archive_read_format_ar_read_data(struct archive_read *a,
+ const void **buff, size_t *size, off_t *offset);
+static int archive_read_format_ar_skip(struct archive_read *a);
+static int archive_read_format_ar_read_header(struct archive_read *a,
+ struct archive_entry *e);
+static uint64_t ar_atol8(const char *p, unsigned char_cnt);
+static uint64_t ar_atol10(const char *p, unsigned char_cnt);
+static int ar_parse_gnu_filename_table(struct archive_read *a);
+static int ar_parse_common_header(struct ar *ar, struct archive_entry *,
+ const char *h);
+
+int
+archive_read_support_format_ar(struct archive *_a)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ struct ar *ar;
+ int r;
+
+ ar = (struct ar *)malloc(sizeof(*ar));
+ if (ar == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate ar data");
+ return (ARCHIVE_FATAL);
+ }
+ memset(ar, 0, sizeof(*ar));
+ ar->strtab = NULL;
+
+ r = __archive_read_register_format(a,
+ ar,
+ "ar",
+ archive_read_format_ar_bid,
+ NULL,
+ archive_read_format_ar_read_header,
+ archive_read_format_ar_read_data,
+ archive_read_format_ar_skip,
+ archive_read_format_ar_cleanup);
+
+ if (r != ARCHIVE_OK) {
+ free(ar);
+ return (r);
+ }
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_read_format_ar_cleanup(struct archive_read *a)
+{
+ struct ar *ar;
+
+ ar = (struct ar *)(a->format->data);
+ if (ar->strtab)
+ free(ar->strtab);
+ free(ar);
+ (a->format->data) = NULL;
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_read_format_ar_bid(struct archive_read *a)
+{
+ const void *h;
+
+ if (a->archive.archive_format != 0 &&
+ (a->archive.archive_format & ARCHIVE_FORMAT_BASE_MASK) !=
+ ARCHIVE_FORMAT_AR)
+ return(0);
+
+ /*
+ * Verify the 8-byte file signature.
+ * TODO: Do we need to check more than this?
+ */
+ if ((h = __archive_read_ahead(a, 8, NULL)) == NULL)
+ return (-1);
+ if (strncmp((const char*)h, "!<arch>\n", 8) == 0) {
+ return (64);
+ }
+ return (-1);
+}
+
+static int
+archive_read_format_ar_read_header(struct archive_read *a,
+ struct archive_entry *entry)
+{
+ char filename[AR_name_size + 1];
+ struct ar *ar;
+ uint64_t number; /* Used to hold parsed numbers before validation. */
+ ssize_t bytes_read;
+ size_t bsd_name_length, entry_size;
+ char *p, *st;
+ const void *b;
+ const char *h;
+ int r;
+
+ ar = (struct ar*)(a->format->data);
+
+ if (a->archive.file_position == 0) {
+ /*
+ * We are now at the beginning of the archive,
+ * so we need first consume the ar global header.
+ */
+ __archive_read_consume(a, 8);
+ /* Set a default format code for now. */
+ a->archive.archive_format = ARCHIVE_FORMAT_AR;
+ }
+
+ /* Read the header for the next file entry. */
+ if ((b = __archive_read_ahead(a, 60, &bytes_read)) == NULL)
+ /* Broken header. */
+ return (ARCHIVE_EOF);
+ __archive_read_consume(a, 60);
+ h = (const char *)b;
+
+ /* Verify the magic signature on the file header. */
+ if (strncmp(h + AR_fmag_offset, "`\n", 2) != 0) {
+ archive_set_error(&a->archive, EINVAL,
+ "Incorrect file header signature");
+ return (ARCHIVE_WARN);
+ }
+
+ /* Copy filename into work buffer. */
+ strncpy(filename, h + AR_name_offset, AR_name_size);
+ filename[AR_name_size] = '\0';
+
+ /*
+ * Guess the format variant based on the filename.
+ */
+ if (a->archive.archive_format == ARCHIVE_FORMAT_AR) {
+ /* We don't already know the variant, so let's guess. */
+ /*
+ * Biggest clue is presence of '/': GNU starts special
+ * filenames with '/', appends '/' as terminator to
+ * non-special names, so anything with '/' should be
+ * GNU except for BSD long filenames.
+ */
+ if (strncmp(filename, "#1/", 3) == 0)
+ a->archive.archive_format = ARCHIVE_FORMAT_AR_BSD;
+ else if (strchr(filename, '/') != NULL)
+ a->archive.archive_format = ARCHIVE_FORMAT_AR_GNU;
+ else if (strncmp(filename, "__.SYMDEF", 9) == 0)
+ a->archive.archive_format = ARCHIVE_FORMAT_AR_BSD;
+ /*
+ * XXX Do GNU/SVR4 'ar' programs ever omit trailing '/'
+ * if name exactly fills 16-byte field? If so, we
+ * can't assume entries without '/' are BSD. XXX
+ */
+ }
+
+ /* Update format name from the code. */
+ if (a->archive.archive_format == ARCHIVE_FORMAT_AR_GNU)
+ a->archive.archive_format_name = "ar (GNU/SVR4)";
+ else if (a->archive.archive_format == ARCHIVE_FORMAT_AR_BSD)
+ a->archive.archive_format_name = "ar (BSD)";
+ else
+ a->archive.archive_format_name = "ar";
+
+ /*
+ * Remove trailing spaces from the filename. GNU and BSD
+ * variants both pad filename area out with spaces.
+ * This will only be wrong if GNU/SVR4 'ar' implementations
+ * omit trailing '/' for 16-char filenames and we have
+ * a 16-char filename that ends in ' '.
+ */
+ p = filename + AR_name_size - 1;
+ while (p >= filename && *p == ' ') {
+ *p = '\0';
+ p--;
+ }
+
+ /*
+ * Remove trailing slash unless first character is '/'.
+ * (BSD entries never end in '/', so this will only trim
+ * GNU-format entries. GNU special entries start with '/'
+ * and are not terminated in '/', so we don't trim anything
+ * that starts with '/'.)
+ */
+ if (filename[0] != '/' && *p == '/')
+ *p = '\0';
+
+ /*
+ * '//' is the GNU filename table.
+ * Later entries can refer to names in this table.
+ */
+ if (strcmp(filename, "//") == 0) {
+ /* This must come before any call to _read_ahead. */
+ ar_parse_common_header(ar, entry, h);
+ archive_entry_copy_pathname(entry, filename);
+ archive_entry_set_filetype(entry, AE_IFREG);
+ /* Get the size of the filename table. */
+ number = ar_atol10(h + AR_size_offset, AR_size_size);
+ if (number > SIZE_MAX) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Filename table too large");
+ return (ARCHIVE_FATAL);
+ }
+ entry_size = (size_t)number;
+ if (entry_size == 0) {
+ archive_set_error(&a->archive, EINVAL,
+ "Invalid string table");
+ return (ARCHIVE_WARN);
+ }
+ if (ar->strtab != NULL) {
+ archive_set_error(&a->archive, EINVAL,
+ "More than one string tables exist");
+ return (ARCHIVE_WARN);
+ }
+
+ /* Read the filename table into memory. */
+ st = malloc(entry_size);
+ if (st == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate filename table buffer");
+ return (ARCHIVE_FATAL);
+ }
+ ar->strtab = st;
+ ar->strtab_size = entry_size;
+ if ((b = __archive_read_ahead(a, entry_size, NULL)) == NULL)
+ return (ARCHIVE_FATAL);
+ memcpy(st, b, entry_size);
+ __archive_read_consume(a, entry_size);
+ /* All contents are consumed. */
+ ar->entry_bytes_remaining = 0;
+ archive_entry_set_size(entry, ar->entry_bytes_remaining);
+
+ /* Parse the filename table. */
+ return (ar_parse_gnu_filename_table(a));
+ }
+
+ /*
+ * GNU variant handles long filenames by storing /<number>
+ * to indicate a name stored in the filename table.
+ * XXX TODO: Verify that it's all digits... Don't be fooled
+ * by "/9xyz" XXX
+ */
+ if (filename[0] == '/' && filename[1] >= '0' && filename[1] <= '9') {
+ number = ar_atol10(h + AR_name_offset + 1, AR_name_size - 1);
+ /*
+ * If we can't look up the real name, warn and return
+ * the entry with the wrong name.
+ */
+ if (ar->strtab == NULL || number > ar->strtab_size) {
+ archive_set_error(&a->archive, EINVAL,
+ "Can't find long filename for entry");
+ archive_entry_copy_pathname(entry, filename);
+ /* Parse the time, owner, mode, size fields. */
+ ar_parse_common_header(ar, entry, h);
+ return (ARCHIVE_WARN);
+ }
+
+ archive_entry_copy_pathname(entry, &ar->strtab[(size_t)number]);
+ /* Parse the time, owner, mode, size fields. */
+ return (ar_parse_common_header(ar, entry, h));
+ }
+
+ /*
+ * BSD handles long filenames by storing "#1/" followed by the
+ * length of filename as a decimal number, then prepends the
+ * the filename to the file contents.
+ */
+ if (strncmp(filename, "#1/", 3) == 0) {
+ /* Parse the time, owner, mode, size fields. */
+ /* This must occur before _read_ahead is called again. */
+ ar_parse_common_header(ar, entry, h);
+
+ /* Parse the size of the name, adjust the file size. */
+ number = ar_atol10(h + AR_name_offset + 3, AR_name_size - 3);
+ bsd_name_length = (size_t)number;
+ /* Guard against the filename + trailing NUL
+ * overflowing a size_t and against the filename size
+ * being larger than the entire entry. */
+ if (number > (uint64_t)(bsd_name_length + 1)
+ || (off_t)bsd_name_length > ar->entry_bytes_remaining) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Bad input file size");
+ return (ARCHIVE_FATAL);
+ }
+ ar->entry_bytes_remaining -= bsd_name_length;
+ /* Adjust file size reported to client. */
+ archive_entry_set_size(entry, ar->entry_bytes_remaining);
+
+ /* Read the long name into memory. */
+ if ((b = __archive_read_ahead(a, bsd_name_length, NULL)) == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Truncated input file");
+ return (ARCHIVE_FATAL);
+ }
+ __archive_read_consume(a, bsd_name_length);
+
+ /* Store it in the entry. */
+ p = (char *)malloc(bsd_name_length + 1);
+ if (p == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate fname buffer");
+ return (ARCHIVE_FATAL);
+ }
+ strncpy(p, b, bsd_name_length);
+ p[bsd_name_length] = '\0';
+ archive_entry_copy_pathname(entry, p);
+ free(p);
+ return (ARCHIVE_OK);
+ }
+
+ /*
+ * "/" is the SVR4/GNU archive symbol table.
+ */
+ if (strcmp(filename, "/") == 0) {
+ archive_entry_copy_pathname(entry, "/");
+ /* Parse the time, owner, mode, size fields. */
+ r = ar_parse_common_header(ar, entry, h);
+ /* Force the file type to a regular file. */
+ archive_entry_set_filetype(entry, AE_IFREG);
+ return (r);
+ }
+
+ /*
+ * "__.SYMDEF" is a BSD archive symbol table.
+ */
+ if (strcmp(filename, "__.SYMDEF") == 0) {
+ archive_entry_copy_pathname(entry, filename);
+ /* Parse the time, owner, mode, size fields. */
+ return (ar_parse_common_header(ar, entry, h));
+ }
+
+ /*
+ * Otherwise, this is a standard entry. The filename
+ * has already been trimmed as much as possible, based
+ * on our current knowledge of the format.
+ */
+ archive_entry_copy_pathname(entry, filename);
+ return (ar_parse_common_header(ar, entry, h));
+}
+
+static int
+ar_parse_common_header(struct ar *ar, struct archive_entry *entry,
+ const char *h)
+{
+ uint64_t n;
+
+ /* Copy remaining header */
+ archive_entry_set_mtime(entry,
+ (time_t)ar_atol10(h + AR_date_offset, AR_date_size), 0L);
+ archive_entry_set_uid(entry,
+ (uid_t)ar_atol10(h + AR_uid_offset, AR_uid_size));
+ archive_entry_set_gid(entry,
+ (gid_t)ar_atol10(h + AR_gid_offset, AR_gid_size));
+ archive_entry_set_mode(entry,
+ (mode_t)ar_atol8(h + AR_mode_offset, AR_mode_size));
+ n = ar_atol10(h + AR_size_offset, AR_size_size);
+
+ ar->entry_offset = 0;
+ ar->entry_padding = n % 2;
+ archive_entry_set_size(entry, n);
+ ar->entry_bytes_remaining = n;
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_read_format_ar_read_data(struct archive_read *a,
+ const void **buff, size_t *size, off_t *offset)
+{
+ ssize_t bytes_read;
+ struct ar *ar;
+
+ ar = (struct ar *)(a->format->data);
+
+ if (ar->entry_bytes_remaining > 0) {
+ *buff = __archive_read_ahead(a, 1, &bytes_read);
+ if (bytes_read == 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Truncated ar archive");
+ return (ARCHIVE_FATAL);
+ }
+ if (bytes_read < 0)
+ return (ARCHIVE_FATAL);
+ if (bytes_read > ar->entry_bytes_remaining)
+ bytes_read = (ssize_t)ar->entry_bytes_remaining;
+ *size = bytes_read;
+ *offset = ar->entry_offset;
+ ar->entry_offset += bytes_read;
+ ar->entry_bytes_remaining -= bytes_read;
+ __archive_read_consume(a, (size_t)bytes_read);
+ return (ARCHIVE_OK);
+ } else {
+ while (ar->entry_padding > 0) {
+ *buff = __archive_read_ahead(a, 1, &bytes_read);
+ if (bytes_read <= 0)
+ return (ARCHIVE_FATAL);
+ if (bytes_read > ar->entry_padding)
+ bytes_read = (ssize_t)ar->entry_padding;
+ __archive_read_consume(a, (size_t)bytes_read);
+ ar->entry_padding -= bytes_read;
+ }
+ *buff = NULL;
+ *size = 0;
+ *offset = ar->entry_offset;
+ return (ARCHIVE_EOF);
+ }
+}
+
+static int
+archive_read_format_ar_skip(struct archive_read *a)
+{
+ off_t bytes_skipped;
+ struct ar* ar;
+
+ ar = (struct ar *)(a->format->data);
+
+ bytes_skipped = __archive_read_skip(a,
+ ar->entry_bytes_remaining + ar->entry_padding);
+ if (bytes_skipped < 0)
+ return (ARCHIVE_FATAL);
+
+ ar->entry_bytes_remaining = 0;
+ ar->entry_padding = 0;
+
+ return (ARCHIVE_OK);
+}
+
+static int
+ar_parse_gnu_filename_table(struct archive_read *a)
+{
+ struct ar *ar;
+ char *p;
+ size_t size;
+
+ ar = (struct ar*)(a->format->data);
+ size = ar->strtab_size;
+
+ for (p = ar->strtab; p < ar->strtab + size - 1; ++p) {
+ if (*p == '/') {
+ *p++ = '\0';
+ if (*p != '\n')
+ goto bad_string_table;
+ *p = '\0';
+ }
+ }
+ /*
+ * GNU ar always pads the table to an even size.
+ * The pad character is either '\n' or '`'.
+ */
+ if (p != ar->strtab + size && *p != '\n' && *p != '`')
+ goto bad_string_table;
+
+ /* Enforce zero termination. */
+ ar->strtab[size - 1] = '\0';
+
+ return (ARCHIVE_OK);
+
+bad_string_table:
+ archive_set_error(&a->archive, EINVAL,
+ "Invalid string table");
+ free(ar->strtab);
+ ar->strtab = NULL;
+ return (ARCHIVE_WARN);
+}
+
+static uint64_t
+ar_atol8(const char *p, unsigned char_cnt)
+{
+ uint64_t l, limit, last_digit_limit;
+ unsigned int digit, base;
+
+ base = 8;
+ limit = UINT64_MAX / base;
+ last_digit_limit = UINT64_MAX % base;
+
+ while ((*p == ' ' || *p == '\t') && char_cnt-- > 0)
+ p++;
+
+ l = 0;
+ digit = *p - '0';
+ while (*p >= '0' && digit < base && char_cnt-- > 0) {
+ if (l>limit || (l == limit && digit > last_digit_limit)) {
+ l = UINT64_MAX; /* Truncate on overflow. */
+ break;
+ }
+ l = (l * base) + digit;
+ digit = *++p - '0';
+ }
+ return (l);
+}
+
+static uint64_t
+ar_atol10(const char *p, unsigned char_cnt)
+{
+ uint64_t l, limit, last_digit_limit;
+ unsigned int base, digit;
+
+ base = 10;
+ limit = UINT64_MAX / base;
+ last_digit_limit = UINT64_MAX % base;
+
+ while ((*p == ' ' || *p == '\t') && char_cnt-- > 0)
+ p++;
+ l = 0;
+ digit = *p - '0';
+ while (*p >= '0' && digit < base && char_cnt-- > 0) {
+ if (l > limit || (l == limit && digit > last_digit_limit)) {
+ l = UINT64_MAX; /* Truncate on overflow. */
+ break;
+ }
+ l = (l * base) + digit;
+ digit = *++p - '0';
+ }
+ return (l);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c b/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c
new file mode 100644
index 00000000000..1def0006a6e
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_cpio.c
@@ -0,0 +1,777 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_cpio.c 201163 2009-12-29 05:50:34Z kientzle $");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+/* #include <stdint.h> */ /* See archive_platform.h */
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+
+struct cpio_bin_header {
+ unsigned char c_magic[2];
+ unsigned char c_dev[2];
+ unsigned char c_ino[2];
+ unsigned char c_mode[2];
+ unsigned char c_uid[2];
+ unsigned char c_gid[2];
+ unsigned char c_nlink[2];
+ unsigned char c_rdev[2];
+ unsigned char c_mtime[4];
+ unsigned char c_namesize[2];
+ unsigned char c_filesize[4];
+};
+
+struct cpio_odc_header {
+ char c_magic[6];
+ char c_dev[6];
+ char c_ino[6];
+ char c_mode[6];
+ char c_uid[6];
+ char c_gid[6];
+ char c_nlink[6];
+ char c_rdev[6];
+ char c_mtime[11];
+ char c_namesize[6];
+ char c_filesize[11];
+};
+
+struct cpio_newc_header {
+ char c_magic[6];
+ char c_ino[8];
+ char c_mode[8];
+ char c_uid[8];
+ char c_gid[8];
+ char c_nlink[8];
+ char c_mtime[8];
+ char c_filesize[8];
+ char c_devmajor[8];
+ char c_devminor[8];
+ char c_rdevmajor[8];
+ char c_rdevminor[8];
+ char c_namesize[8];
+ char c_crc[8];
+};
+
+struct links_entry {
+ struct links_entry *next;
+ struct links_entry *previous;
+ int links;
+ dev_t dev;
+ int64_t ino;
+ char *name;
+};
+
+#define CPIO_MAGIC 0x13141516
+struct cpio {
+ int magic;
+ int (*read_header)(struct archive_read *, struct cpio *,
+ struct archive_entry *, size_t *, size_t *);
+ struct links_entry *links_head;
+ struct archive_string entry_name;
+ struct archive_string entry_linkname;
+ off_t entry_bytes_remaining;
+ off_t entry_offset;
+ off_t entry_padding;
+};
+
+static int64_t atol16(const char *, unsigned);
+static int64_t atol8(const char *, unsigned);
+static int archive_read_format_cpio_bid(struct archive_read *);
+static int archive_read_format_cpio_cleanup(struct archive_read *);
+static int archive_read_format_cpio_read_data(struct archive_read *,
+ const void **, size_t *, off_t *);
+static int archive_read_format_cpio_read_header(struct archive_read *,
+ struct archive_entry *);
+static int be4(const unsigned char *);
+static int find_odc_header(struct archive_read *);
+static int find_newc_header(struct archive_read *);
+static int header_bin_be(struct archive_read *, struct cpio *,
+ struct archive_entry *, size_t *, size_t *);
+static int header_bin_le(struct archive_read *, struct cpio *,
+ struct archive_entry *, size_t *, size_t *);
+static int header_newc(struct archive_read *, struct cpio *,
+ struct archive_entry *, size_t *, size_t *);
+static int header_odc(struct archive_read *, struct cpio *,
+ struct archive_entry *, size_t *, size_t *);
+static int is_octal(const char *, size_t);
+static int is_hex(const char *, size_t);
+static int le4(const unsigned char *);
+static void record_hardlink(struct cpio *cpio, struct archive_entry *entry);
+
+int
+archive_read_support_format_cpio(struct archive *_a)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ struct cpio *cpio;
+ int r;
+
+ cpio = (struct cpio *)malloc(sizeof(*cpio));
+ if (cpio == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
+ return (ARCHIVE_FATAL);
+ }
+ memset(cpio, 0, sizeof(*cpio));
+ cpio->magic = CPIO_MAGIC;
+
+ r = __archive_read_register_format(a,
+ cpio,
+ "cpio",
+ archive_read_format_cpio_bid,
+ NULL,
+ archive_read_format_cpio_read_header,
+ archive_read_format_cpio_read_data,
+ NULL,
+ archive_read_format_cpio_cleanup);
+
+ if (r != ARCHIVE_OK)
+ free(cpio);
+ return (ARCHIVE_OK);
+}
+
+
+static int
+archive_read_format_cpio_bid(struct archive_read *a)
+{
+ const void *h;
+ const unsigned char *p;
+ struct cpio *cpio;
+ int bid;
+
+ cpio = (struct cpio *)(a->format->data);
+
+ if ((h = __archive_read_ahead(a, 6, NULL)) == NULL)
+ return (-1);
+
+ p = (const unsigned char *)h;
+ bid = 0;
+ if (memcmp(p, "070707", 6) == 0) {
+ /* ASCII cpio archive (odc, POSIX.1) */
+ cpio->read_header = header_odc;
+ bid += 48;
+ /*
+ * XXX TODO: More verification; Could check that only octal
+ * digits appear in appropriate header locations. XXX
+ */
+ } else if (memcmp(p, "070701", 6) == 0) {
+ /* ASCII cpio archive (SVR4 without CRC) */
+ cpio->read_header = header_newc;
+ bid += 48;
+ /*
+ * XXX TODO: More verification; Could check that only hex
+ * digits appear in appropriate header locations. XXX
+ */
+ } else if (memcmp(p, "070702", 6) == 0) {
+ /* ASCII cpio archive (SVR4 with CRC) */
+ /* XXX TODO: Flag that we should check the CRC. XXX */
+ cpio->read_header = header_newc;
+ bid += 48;
+ /*
+ * XXX TODO: More verification; Could check that only hex
+ * digits appear in appropriate header locations. XXX
+ */
+ } else if (p[0] * 256 + p[1] == 070707) {
+ /* big-endian binary cpio archives */
+ cpio->read_header = header_bin_be;
+ bid += 16;
+ /* Is more verification possible here? */
+ } else if (p[0] + p[1] * 256 == 070707) {
+ /* little-endian binary cpio archives */
+ cpio->read_header = header_bin_le;
+ bid += 16;
+ /* Is more verification possible here? */
+ } else
+ return (ARCHIVE_WARN);
+
+ return (bid);
+}
+
+static int
+archive_read_format_cpio_read_header(struct archive_read *a,
+ struct archive_entry *entry)
+{
+ struct cpio *cpio;
+ const void *h;
+ size_t namelength;
+ size_t name_pad;
+ int r;
+
+ cpio = (struct cpio *)(a->format->data);
+ r = (cpio->read_header(a, cpio, entry, &namelength, &name_pad));
+
+ if (r < ARCHIVE_WARN)
+ return (r);
+
+ /* Read name from buffer. */
+ h = __archive_read_ahead(a, namelength + name_pad, NULL);
+ if (h == NULL)
+ return (ARCHIVE_FATAL);
+ __archive_read_consume(a, namelength + name_pad);
+ archive_strncpy(&cpio->entry_name, (const char *)h, namelength);
+ archive_entry_set_pathname(entry, cpio->entry_name.s);
+ cpio->entry_offset = 0;
+
+ /* If this is a symlink, read the link contents. */
+ if (archive_entry_filetype(entry) == AE_IFLNK) {
+ h = __archive_read_ahead(a, cpio->entry_bytes_remaining, NULL);
+ if (h == NULL)
+ return (ARCHIVE_FATAL);
+ __archive_read_consume(a, cpio->entry_bytes_remaining);
+ archive_strncpy(&cpio->entry_linkname, (const char *)h,
+ cpio->entry_bytes_remaining);
+ archive_entry_set_symlink(entry, cpio->entry_linkname.s);
+ cpio->entry_bytes_remaining = 0;
+ }
+
+ /* XXX TODO: If the full mode is 0160200, then this is a Solaris
+ * ACL description for the following entry. Read this body
+ * and parse it as a Solaris-style ACL, then read the next
+ * header. XXX */
+
+ /* Compare name to "TRAILER!!!" to test for end-of-archive. */
+ if (namelength == 11 && strcmp((const char *)h, "TRAILER!!!") == 0) {
+ /* TODO: Store file location of start of block. */
+ archive_set_error(&a->archive, 0, NULL);
+ return (ARCHIVE_EOF);
+ }
+
+ /* Detect and record hardlinks to previously-extracted entries. */
+ record_hardlink(cpio, entry);
+
+ return (r);
+}
+
+static int
+archive_read_format_cpio_read_data(struct archive_read *a,
+ const void **buff, size_t *size, off_t *offset)
+{
+ ssize_t bytes_read;
+ struct cpio *cpio;
+
+ cpio = (struct cpio *)(a->format->data);
+ if (cpio->entry_bytes_remaining > 0) {
+ *buff = __archive_read_ahead(a, 1, &bytes_read);
+ if (bytes_read <= 0)
+ return (ARCHIVE_FATAL);
+ if (bytes_read > cpio->entry_bytes_remaining)
+ bytes_read = cpio->entry_bytes_remaining;
+ *size = bytes_read;
+ *offset = cpio->entry_offset;
+ cpio->entry_offset += bytes_read;
+ cpio->entry_bytes_remaining -= bytes_read;
+ __archive_read_consume(a, bytes_read);
+ return (ARCHIVE_OK);
+ } else {
+ while (cpio->entry_padding > 0) {
+ *buff = __archive_read_ahead(a, 1, &bytes_read);
+ if (bytes_read <= 0)
+ return (ARCHIVE_FATAL);
+ if (bytes_read > cpio->entry_padding)
+ bytes_read = cpio->entry_padding;
+ __archive_read_consume(a, bytes_read);
+ cpio->entry_padding -= bytes_read;
+ }
+ *buff = NULL;
+ *size = 0;
+ *offset = cpio->entry_offset;
+ return (ARCHIVE_EOF);
+ }
+}
+
+/*
+ * Skip forward to the next cpio newc header by searching for the
+ * 07070[12] string. This should be generalized and merged with
+ * find_odc_header below.
+ */
+static int
+is_hex(const char *p, size_t len)
+{
+ while (len-- > 0) {
+ if ((*p >= '0' && *p <= '9')
+ || (*p >= 'a' && *p <= 'f')
+ || (*p >= 'A' && *p <= 'F'))
+ ++p;
+ else
+ return (0);
+ }
+ return (1);
+}
+
+static int
+find_newc_header(struct archive_read *a)
+{
+ const void *h;
+ const char *p, *q;
+ size_t skip, skipped = 0;
+ ssize_t bytes;
+
+ for (;;) {
+ h = __archive_read_ahead(a, sizeof(struct cpio_newc_header), &bytes);
+ if (h == NULL)
+ return (ARCHIVE_FATAL);
+ p = h;
+ q = p + bytes;
+
+ /* Try the typical case first, then go into the slow search.*/
+ if (memcmp("07070", p, 5) == 0
+ && (p[5] == '1' || p[5] == '2')
+ && is_hex(p, sizeof(struct cpio_newc_header)))
+ return (ARCHIVE_OK);
+
+ /*
+ * Scan ahead until we find something that looks
+ * like an odc header.
+ */
+ while (p + sizeof(struct cpio_newc_header) <= q) {
+ switch (p[5]) {
+ case '1':
+ case '2':
+ if (memcmp("07070", p, 5) == 0
+ && is_hex(p, sizeof(struct cpio_newc_header))) {
+ skip = p - (const char *)h;
+ __archive_read_consume(a, skip);
+ skipped += skip;
+ if (skipped > 0) {
+ archive_set_error(&a->archive,
+ 0,
+ "Skipped %d bytes before "
+ "finding valid header",
+ (int)skipped);
+ return (ARCHIVE_WARN);
+ }
+ return (ARCHIVE_OK);
+ }
+ p += 2;
+ break;
+ case '0':
+ p++;
+ break;
+ default:
+ p += 6;
+ break;
+ }
+ }
+ skip = p - (const char *)h;
+ __archive_read_consume(a, skip);
+ skipped += skip;
+ }
+}
+
+static int
+header_newc(struct archive_read *a, struct cpio *cpio,
+ struct archive_entry *entry, size_t *namelength, size_t *name_pad)
+{
+ const void *h;
+ const struct cpio_newc_header *header;
+ int r;
+
+ r = find_newc_header(a);
+ if (r < ARCHIVE_WARN)
+ return (r);
+
+ /* Read fixed-size portion of header. */
+ h = __archive_read_ahead(a, sizeof(struct cpio_newc_header), NULL);
+ if (h == NULL)
+ return (ARCHIVE_FATAL);
+ __archive_read_consume(a, sizeof(struct cpio_newc_header));
+
+ /* Parse out hex fields. */
+ header = (const struct cpio_newc_header *)h;
+
+ if (memcmp(header->c_magic, "070701", 6) == 0) {
+ a->archive.archive_format = ARCHIVE_FORMAT_CPIO_SVR4_NOCRC;
+ a->archive.archive_format_name = "ASCII cpio (SVR4 with no CRC)";
+ } else if (memcmp(header->c_magic, "070702", 6) == 0) {
+ a->archive.archive_format = ARCHIVE_FORMAT_CPIO_SVR4_CRC;
+ a->archive.archive_format_name = "ASCII cpio (SVR4 with CRC)";
+ } else {
+ /* TODO: Abort here? */
+ }
+
+ archive_entry_set_devmajor(entry, atol16(header->c_devmajor, sizeof(header->c_devmajor)));
+ archive_entry_set_devminor(entry, atol16(header->c_devminor, sizeof(header->c_devminor)));
+ archive_entry_set_ino(entry, atol16(header->c_ino, sizeof(header->c_ino)));
+ archive_entry_set_mode(entry, atol16(header->c_mode, sizeof(header->c_mode)));
+ archive_entry_set_uid(entry, atol16(header->c_uid, sizeof(header->c_uid)));
+ archive_entry_set_gid(entry, atol16(header->c_gid, sizeof(header->c_gid)));
+ archive_entry_set_nlink(entry, atol16(header->c_nlink, sizeof(header->c_nlink)));
+ archive_entry_set_rdevmajor(entry, atol16(header->c_rdevmajor, sizeof(header->c_rdevmajor)));
+ archive_entry_set_rdevminor(entry, atol16(header->c_rdevminor, sizeof(header->c_rdevminor)));
+ archive_entry_set_mtime(entry, atol16(header->c_mtime, sizeof(header->c_mtime)), 0);
+ *namelength = atol16(header->c_namesize, sizeof(header->c_namesize));
+ /* Pad name to 2 more than a multiple of 4. */
+ *name_pad = (2 - *namelength) & 3;
+
+ /*
+ * Note: entry_bytes_remaining is at least 64 bits and
+ * therefore guaranteed to be big enough for a 33-bit file
+ * size.
+ */
+ cpio->entry_bytes_remaining =
+ atol16(header->c_filesize, sizeof(header->c_filesize));
+ archive_entry_set_size(entry, cpio->entry_bytes_remaining);
+ /* Pad file contents to a multiple of 4. */
+ cpio->entry_padding = 3 & -cpio->entry_bytes_remaining;
+ return (r);
+}
+
+/*
+ * Skip forward to the next cpio odc header by searching for the
+ * 070707 string. This is a hand-optimized search that could
+ * probably be easily generalized to handle all character-based
+ * cpio variants.
+ */
+static int
+is_octal(const char *p, size_t len)
+{
+ while (len-- > 0) {
+ if (*p < '0' || *p > '7')
+ return (0);
+ ++p;
+ }
+ return (1);
+}
+
+static int
+find_odc_header(struct archive_read *a)
+{
+ const void *h;
+ const char *p, *q;
+ size_t skip, skipped = 0;
+ ssize_t bytes;
+
+ for (;;) {
+ h = __archive_read_ahead(a, sizeof(struct cpio_odc_header), &bytes);
+ if (h == NULL)
+ return (ARCHIVE_FATAL);
+ p = h;
+ q = p + bytes;
+
+ /* Try the typical case first, then go into the slow search.*/
+ if (memcmp("070707", p, 6) == 0
+ && is_octal(p, sizeof(struct cpio_odc_header)))
+ return (ARCHIVE_OK);
+
+ /*
+ * Scan ahead until we find something that looks
+ * like an odc header.
+ */
+ while (p + sizeof(struct cpio_odc_header) <= q) {
+ switch (p[5]) {
+ case '7':
+ if (memcmp("070707", p, 6) == 0
+ && is_octal(p, sizeof(struct cpio_odc_header))) {
+ skip = p - (const char *)h;
+ __archive_read_consume(a, skip);
+ skipped += skip;
+ if (skipped > 0) {
+ archive_set_error(&a->archive,
+ 0,
+ "Skipped %d bytes before "
+ "finding valid header",
+ (int)skipped);
+ return (ARCHIVE_WARN);
+ }
+ return (ARCHIVE_OK);
+ }
+ p += 2;
+ break;
+ case '0':
+ p++;
+ break;
+ default:
+ p += 6;
+ break;
+ }
+ }
+ skip = p - (const char *)h;
+ __archive_read_consume(a, skip);
+ skipped += skip;
+ }
+}
+
+static int
+header_odc(struct archive_read *a, struct cpio *cpio,
+ struct archive_entry *entry, size_t *namelength, size_t *name_pad)
+{
+ const void *h;
+ int r;
+ const struct cpio_odc_header *header;
+
+ a->archive.archive_format = ARCHIVE_FORMAT_CPIO_POSIX;
+ a->archive.archive_format_name = "POSIX octet-oriented cpio";
+
+ /* Find the start of the next header. */
+ r = find_odc_header(a);
+ if (r < ARCHIVE_WARN)
+ return (r);
+
+ /* Read fixed-size portion of header. */
+ h = __archive_read_ahead(a, sizeof(struct cpio_odc_header), NULL);
+ if (h == NULL)
+ return (ARCHIVE_FATAL);
+ __archive_read_consume(a, sizeof(struct cpio_odc_header));
+
+ /* Parse out octal fields. */
+ header = (const struct cpio_odc_header *)h;
+
+ archive_entry_set_dev(entry, atol8(header->c_dev, sizeof(header->c_dev)));
+ archive_entry_set_ino(entry, atol8(header->c_ino, sizeof(header->c_ino)));
+ archive_entry_set_mode(entry, atol8(header->c_mode, sizeof(header->c_mode)));
+ archive_entry_set_uid(entry, atol8(header->c_uid, sizeof(header->c_uid)));
+ archive_entry_set_gid(entry, atol8(header->c_gid, sizeof(header->c_gid)));
+ archive_entry_set_nlink(entry, atol8(header->c_nlink, sizeof(header->c_nlink)));
+ archive_entry_set_rdev(entry, atol8(header->c_rdev, sizeof(header->c_rdev)));
+ archive_entry_set_mtime(entry, atol8(header->c_mtime, sizeof(header->c_mtime)), 0);
+ *namelength = atol8(header->c_namesize, sizeof(header->c_namesize));
+ *name_pad = 0; /* No padding of filename. */
+
+ /*
+ * Note: entry_bytes_remaining is at least 64 bits and
+ * therefore guaranteed to be big enough for a 33-bit file
+ * size.
+ */
+ cpio->entry_bytes_remaining =
+ atol8(header->c_filesize, sizeof(header->c_filesize));
+ archive_entry_set_size(entry, cpio->entry_bytes_remaining);
+ cpio->entry_padding = 0;
+ return (r);
+}
+
+static int
+header_bin_le(struct archive_read *a, struct cpio *cpio,
+ struct archive_entry *entry, size_t *namelength, size_t *name_pad)
+{
+ const void *h;
+ const struct cpio_bin_header *header;
+
+ a->archive.archive_format = ARCHIVE_FORMAT_CPIO_BIN_LE;
+ a->archive.archive_format_name = "cpio (little-endian binary)";
+
+ /* Read fixed-size portion of header. */
+ h = __archive_read_ahead(a, sizeof(struct cpio_bin_header), NULL);
+ if (h == NULL)
+ return (ARCHIVE_FATAL);
+ __archive_read_consume(a, sizeof(struct cpio_bin_header));
+
+ /* Parse out binary fields. */
+ header = (const struct cpio_bin_header *)h;
+
+ archive_entry_set_dev(entry, header->c_dev[0] + header->c_dev[1] * 256);
+ archive_entry_set_ino(entry, header->c_ino[0] + header->c_ino[1] * 256);
+ archive_entry_set_mode(entry, header->c_mode[0] + header->c_mode[1] * 256);
+ archive_entry_set_uid(entry, header->c_uid[0] + header->c_uid[1] * 256);
+ archive_entry_set_gid(entry, header->c_gid[0] + header->c_gid[1] * 256);
+ archive_entry_set_nlink(entry, header->c_nlink[0] + header->c_nlink[1] * 256);
+ archive_entry_set_rdev(entry, header->c_rdev[0] + header->c_rdev[1] * 256);
+ archive_entry_set_mtime(entry, le4(header->c_mtime), 0);
+ *namelength = header->c_namesize[0] + header->c_namesize[1] * 256;
+ *name_pad = *namelength & 1; /* Pad to even. */
+
+ cpio->entry_bytes_remaining = le4(header->c_filesize);
+ archive_entry_set_size(entry, cpio->entry_bytes_remaining);
+ cpio->entry_padding = cpio->entry_bytes_remaining & 1; /* Pad to even. */
+ return (ARCHIVE_OK);
+}
+
+static int
+header_bin_be(struct archive_read *a, struct cpio *cpio,
+ struct archive_entry *entry, size_t *namelength, size_t *name_pad)
+{
+ const void *h;
+ const struct cpio_bin_header *header;
+
+ a->archive.archive_format = ARCHIVE_FORMAT_CPIO_BIN_BE;
+ a->archive.archive_format_name = "cpio (big-endian binary)";
+
+ /* Read fixed-size portion of header. */
+ h = __archive_read_ahead(a, sizeof(struct cpio_bin_header), NULL);
+ if (h == NULL)
+ return (ARCHIVE_FATAL);
+ __archive_read_consume(a, sizeof(struct cpio_bin_header));
+
+ /* Parse out binary fields. */
+ header = (const struct cpio_bin_header *)h;
+ archive_entry_set_dev(entry, header->c_dev[0] * 256 + header->c_dev[1]);
+ archive_entry_set_ino(entry, header->c_ino[0] * 256 + header->c_ino[1]);
+ archive_entry_set_mode(entry, header->c_mode[0] * 256 + header->c_mode[1]);
+ archive_entry_set_uid(entry, header->c_uid[0] * 256 + header->c_uid[1]);
+ archive_entry_set_gid(entry, header->c_gid[0] * 256 + header->c_gid[1]);
+ archive_entry_set_nlink(entry, header->c_nlink[0] * 256 + header->c_nlink[1]);
+ archive_entry_set_rdev(entry, header->c_rdev[0] * 256 + header->c_rdev[1]);
+ archive_entry_set_mtime(entry, be4(header->c_mtime), 0);
+ *namelength = header->c_namesize[0] * 256 + header->c_namesize[1];
+ *name_pad = *namelength & 1; /* Pad to even. */
+
+ cpio->entry_bytes_remaining = be4(header->c_filesize);
+ archive_entry_set_size(entry, cpio->entry_bytes_remaining);
+ cpio->entry_padding = cpio->entry_bytes_remaining & 1; /* Pad to even. */
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_read_format_cpio_cleanup(struct archive_read *a)
+{
+ struct cpio *cpio;
+
+ cpio = (struct cpio *)(a->format->data);
+ /* Free inode->name map */
+ while (cpio->links_head != NULL) {
+ struct links_entry *lp = cpio->links_head->next;
+
+ if (cpio->links_head->name)
+ free(cpio->links_head->name);
+ free(cpio->links_head);
+ cpio->links_head = lp;
+ }
+ archive_string_free(&cpio->entry_name);
+ free(cpio);
+ (a->format->data) = NULL;
+ return (ARCHIVE_OK);
+}
+
+static int
+le4(const unsigned char *p)
+{
+ return ((p[0]<<16) + (p[1]<<24) + (p[2]<<0) + (p[3]<<8));
+}
+
+
+static int
+be4(const unsigned char *p)
+{
+ return ((p[0]<<24) + (p[1]<<16) + (p[2]<<8) + (p[3]));
+}
+
+/*
+ * Note that this implementation does not (and should not!) obey
+ * locale settings; you cannot simply substitute strtol here, since
+ * it does obey locale.
+ */
+static int64_t
+atol8(const char *p, unsigned char_cnt)
+{
+ int64_t l;
+ int digit;
+
+ l = 0;
+ while (char_cnt-- > 0) {
+ if (*p >= '0' && *p <= '7')
+ digit = *p - '0';
+ else
+ return (l);
+ p++;
+ l <<= 3;
+ l |= digit;
+ }
+ return (l);
+}
+
+static int64_t
+atol16(const char *p, unsigned char_cnt)
+{
+ int64_t l;
+ int digit;
+
+ l = 0;
+ while (char_cnt-- > 0) {
+ if (*p >= 'a' && *p <= 'f')
+ digit = *p - 'a' + 10;
+ else if (*p >= 'A' && *p <= 'F')
+ digit = *p - 'A' + 10;
+ else if (*p >= '0' && *p <= '9')
+ digit = *p - '0';
+ else
+ return (l);
+ p++;
+ l <<= 4;
+ l |= digit;
+ }
+ return (l);
+}
+
+static void
+record_hardlink(struct cpio *cpio, struct archive_entry *entry)
+{
+ struct links_entry *le;
+ dev_t dev;
+ int64_t ino;
+
+ if (archive_entry_nlink(entry) <= 1)
+ return;
+
+ dev = archive_entry_dev(entry);
+ ino = archive_entry_ino64(entry);
+
+ /*
+ * First look in the list of multiply-linked files. If we've
+ * already dumped it, convert this entry to a hard link entry.
+ */
+ for (le = cpio->links_head; le; le = le->next) {
+ if (le->dev == dev && le->ino == ino) {
+ archive_entry_copy_hardlink(entry, le->name);
+
+ if (--le->links <= 0) {
+ if (le->previous != NULL)
+ le->previous->next = le->next;
+ if (le->next != NULL)
+ le->next->previous = le->previous;
+ if (cpio->links_head == le)
+ cpio->links_head = le->next;
+ free(le->name);
+ free(le);
+ }
+
+ return;
+ }
+ }
+
+ le = (struct links_entry *)malloc(sizeof(struct links_entry));
+ if (le == NULL)
+ __archive_errx(1, "Out of memory adding file to list");
+ if (cpio->links_head != NULL)
+ cpio->links_head->previous = le;
+ le->next = cpio->links_head;
+ le->previous = NULL;
+ cpio->links_head = le;
+ le->dev = dev;
+ le->ino = ino;
+ le->links = archive_entry_nlink(entry) - 1;
+ le->name = strdup(archive_entry_pathname(entry));
+ if (le->name == NULL)
+ __archive_errx(1, "Out of memory adding file to list");
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_empty.c b/archivers/libarchive/files/libarchive/archive_read_support_format_empty.c
new file mode 100644
index 00000000000..518fdcb4913
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_empty.c
@@ -0,0 +1,93 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_empty.c 191524 2009-04-26 18:24:14Z kientzle $");
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+
+static int archive_read_format_empty_bid(struct archive_read *);
+static int archive_read_format_empty_read_data(struct archive_read *,
+ const void **, size_t *, off_t *);
+static int archive_read_format_empty_read_header(struct archive_read *,
+ struct archive_entry *);
+int
+archive_read_support_format_empty(struct archive *_a)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ int r;
+
+ r = __archive_read_register_format(a,
+ NULL,
+ NULL,
+ archive_read_format_empty_bid,
+ NULL,
+ archive_read_format_empty_read_header,
+ archive_read_format_empty_read_data,
+ NULL,
+ NULL);
+
+ return (r);
+}
+
+
+static int
+archive_read_format_empty_bid(struct archive_read *a)
+{
+ ssize_t avail;
+
+ (void)__archive_read_ahead(a, 1, &avail);
+ if (avail != 0)
+ return (-1);
+ return (1);
+}
+
+static int
+archive_read_format_empty_read_header(struct archive_read *a,
+ struct archive_entry *entry)
+{
+ (void)a; /* UNUSED */
+ (void)entry; /* UNUSED */
+
+ a->archive.archive_format = ARCHIVE_FORMAT_EMPTY;
+ a->archive.archive_format_name = "Empty file";
+
+ return (ARCHIVE_EOF);
+}
+
+static int
+archive_read_format_empty_read_data(struct archive_read *a,
+ const void **buff, size_t *size, off_t *offset)
+{
+ (void)a; /* UNUSED */
+ (void)buff; /* UNUSED */
+ (void)size; /* UNUSED */
+ (void)offset; /* UNUSED */
+
+ return (ARCHIVE_EOF);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c b/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c
new file mode 100644
index 00000000000..0c640c88e86
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_iso9660.c
@@ -0,0 +1,2830 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * Copyright (c) 2009 Andreas Henriksson <andreas@fatal.se>
+ * Copyright (c) 2009 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_iso9660.c 201246 2009-12-30 05:30:35Z kientzle $");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+/* #include <stdint.h> */ /* See archive_platform.h */
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#include <time.h>
+#ifdef HAVE_ZLIB_H
+#include <zlib.h>
+#endif
+
+#include "archive.h"
+#include "archive_endian.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+#include "archive_string.h"
+
+/*
+ * An overview of ISO 9660 format:
+ *
+ * Each disk is laid out as follows:
+ * * 32k reserved for private use
+ * * Volume descriptor table. Each volume descriptor
+ * is 2k and specifies basic format information.
+ * The "Primary Volume Descriptor" (PVD) is defined by the
+ * standard and should always be present; other volume
+ * descriptors include various vendor-specific extensions.
+ * * Files and directories. Each file/dir is specified by
+ * an "extent" (starting sector and length in bytes).
+ * Dirs are just files with directory records packed one
+ * after another. The PVD contains a single dir entry
+ * specifying the location of the root directory. Everything
+ * else follows from there.
+ *
+ * This module works by first reading the volume descriptors, then
+ * building a list of directory entries, sorted by starting
+ * sector. At each step, I look for the earliest dir entry that
+ * hasn't yet been read, seek forward to that location and read
+ * that entry. If it's a dir, I slurp in the new dir entries and
+ * add them to the heap; if it's a regular file, I return the
+ * corresponding archive_entry and wait for the client to request
+ * the file body. This strategy allows us to read most compliant
+ * CDs with a single pass through the data, as required by libarchive.
+ */
+#define LOGICAL_BLOCK_SIZE 2048
+#define SYSTEM_AREA_BLOCK 16
+
+/* Structure of on-disk primary volume descriptor. */
+#define PVD_type_offset 0
+#define PVD_type_size 1
+#define PVD_id_offset (PVD_type_offset + PVD_type_size)
+#define PVD_id_size 5
+#define PVD_version_offset (PVD_id_offset + PVD_id_size)
+#define PVD_version_size 1
+#define PVD_reserved1_offset (PVD_version_offset + PVD_version_size)
+#define PVD_reserved1_size 1
+#define PVD_system_id_offset (PVD_reserved1_offset + PVD_reserved1_size)
+#define PVD_system_id_size 32
+#define PVD_volume_id_offset (PVD_system_id_offset + PVD_system_id_size)
+#define PVD_volume_id_size 32
+#define PVD_reserved2_offset (PVD_volume_id_offset + PVD_volume_id_size)
+#define PVD_reserved2_size 8
+#define PVD_volume_space_size_offset (PVD_reserved2_offset + PVD_reserved2_size)
+#define PVD_volume_space_size_size 8
+#define PVD_reserved3_offset (PVD_volume_space_size_offset + PVD_volume_space_size_size)
+#define PVD_reserved3_size 32
+#define PVD_volume_set_size_offset (PVD_reserved3_offset + PVD_reserved3_size)
+#define PVD_volume_set_size_size 4
+#define PVD_volume_sequence_number_offset (PVD_volume_set_size_offset + PVD_volume_set_size_size)
+#define PVD_volume_sequence_number_size 4
+#define PVD_logical_block_size_offset (PVD_volume_sequence_number_offset + PVD_volume_sequence_number_size)
+#define PVD_logical_block_size_size 4
+#define PVD_path_table_size_offset (PVD_logical_block_size_offset + PVD_logical_block_size_size)
+#define PVD_path_table_size_size 8
+#define PVD_type_1_path_table_offset (PVD_path_table_size_offset + PVD_path_table_size_size)
+#define PVD_type_1_path_table_size 4
+#define PVD_opt_type_1_path_table_offset (PVD_type_1_path_table_offset + PVD_type_1_path_table_size)
+#define PVD_opt_type_1_path_table_size 4
+#define PVD_type_m_path_table_offset (PVD_opt_type_1_path_table_offset + PVD_opt_type_1_path_table_size)
+#define PVD_type_m_path_table_size 4
+#define PVD_opt_type_m_path_table_offset (PVD_type_m_path_table_offset + PVD_type_m_path_table_size)
+#define PVD_opt_type_m_path_table_size 4
+#define PVD_root_directory_record_offset (PVD_opt_type_m_path_table_offset + PVD_opt_type_m_path_table_size)
+#define PVD_root_directory_record_size 34
+#define PVD_volume_set_id_offset (PVD_root_directory_record_offset + PVD_root_directory_record_size)
+#define PVD_volume_set_id_size 128
+#define PVD_publisher_id_offset (PVD_volume_set_id_offset + PVD_volume_set_id_size)
+#define PVD_publisher_id_size 128
+#define PVD_preparer_id_offset (PVD_publisher_id_offset + PVD_publisher_id_size)
+#define PVD_preparer_id_size 128
+#define PVD_application_id_offset (PVD_preparer_id_offset + PVD_preparer_id_size)
+#define PVD_application_id_size 128
+#define PVD_copyright_file_id_offset (PVD_application_id_offset + PVD_application_id_size)
+#define PVD_copyright_file_id_size 37
+#define PVD_abstract_file_id_offset (PVD_copyright_file_id_offset + PVD_copyright_file_id_size)
+#define PVD_abstract_file_id_size 37
+#define PVD_bibliographic_file_id_offset (PVD_abstract_file_id_offset + PVD_abstract_file_id_size)
+#define PVD_bibliographic_file_id_size 37
+#define PVD_creation_date_offset (PVD_bibliographic_file_id_offset + PVD_bibliographic_file_id_size)
+#define PVD_creation_date_size 17
+#define PVD_modification_date_offset (PVD_creation_date_offset + PVD_creation_date_size)
+#define PVD_modification_date_size 17
+#define PVD_expiration_date_offset (PVD_modification_date_offset + PVD_modification_date_size)
+#define PVD_expiration_date_size 17
+#define PVD_effective_date_offset (PVD_expiration_date_offset + PVD_expiration_date_size)
+#define PVD_effective_date_size 17
+#define PVD_file_structure_version_offset (PVD_effective_date_offset + PVD_effective_date_size)
+#define PVD_file_structure_version_size 1
+#define PVD_reserved4_offset (PVD_file_structure_version_offset + PVD_file_structure_version_size)
+#define PVD_reserved4_size 1
+#define PVD_application_data_offset (PVD_reserved4_offset + PVD_reserved4_size)
+#define PVD_application_data_size 512
+#define PVD_reserved5_offset (PVD_application_data_offset + PVD_application_data_size)
+#define PVD_reserved5_size (2048 - PVD_reserved5_offset)
+
+/* TODO: It would make future maintenance easier to just hardcode the
+ * above values. In particular, ECMA119 states the offsets as part of
+ * the standard. That would eliminate the need for the following check.*/
+#if PVD_reserved5_offset != 1395
+#error PVD offset and size definitions are wrong.
+#endif
+
+
+/* Structure of optional on-disk supplementary volume descriptor. */
+#define SVD_type_offset 0
+#define SVD_type_size 1
+#define SVD_id_offset (SVD_type_offset + SVD_type_size)
+#define SVD_id_size 5
+#define SVD_version_offset (SVD_id_offset + SVD_id_size)
+#define SVD_version_size 1
+/* ... */
+#define SVD_reserved1_offset 72
+#define SVD_reserved1_size 8
+#define SVD_volume_space_size_offset 80
+#define SVD_volume_space_size_size 8
+#define SVD_escape_sequences_offset (SVD_volume_space_size_offset + SVD_volume_space_size_size)
+#define SVD_escape_sequences_size 32
+/* ... */
+#define SVD_logical_block_size_offset 128
+#define SVD_logical_block_size_size 4
+#define SVD_type_L_path_table_offset 140
+#define SVD_type_M_path_table_offset 148
+/* ... */
+#define SVD_root_directory_record_offset 156
+#define SVD_root_directory_record_size 34
+#define SVD_file_structure_version_offset 881
+#define SVD_reserved2_offset 882
+#define SVD_reserved2_size 1
+#define SVD_reserved3_offset 1395
+#define SVD_reserved3_size 653
+/* ... */
+/* FIXME: validate correctness of last SVD entry offset. */
+
+/* Structure of an on-disk directory record. */
+/* Note: ISO9660 stores each multi-byte integer twice, once in
+ * each byte order. The sizes here are the size of just one
+ * of the two integers. (This is why the offset of a field isn't
+ * the same as the offset+size of the previous field.) */
+#define DR_length_offset 0
+#define DR_length_size 1
+#define DR_ext_attr_length_offset 1
+#define DR_ext_attr_length_size 1
+#define DR_extent_offset 2
+#define DR_extent_size 4
+#define DR_size_offset 10
+#define DR_size_size 4
+#define DR_date_offset 18
+#define DR_date_size 7
+#define DR_flags_offset 25
+#define DR_flags_size 1
+#define DR_file_unit_size_offset 26
+#define DR_file_unit_size_size 1
+#define DR_interleave_offset 27
+#define DR_interleave_size 1
+#define DR_volume_sequence_number_offset 28
+#define DR_volume_sequence_number_size 2
+#define DR_name_len_offset 32
+#define DR_name_len_size 1
+#define DR_name_offset 33
+
+#ifdef HAVE_ZLIB_H
+static const unsigned char zisofs_magic[8] = {
+ 0x37, 0xE4, 0x53, 0x96, 0xC9, 0xDB, 0xD6, 0x07
+};
+
+struct zisofs {
+ /* Set 1 if this file compressed by paged zlib */
+ int pz;
+ int pz_log2_bs; /* Log2 of block size */
+ uint64_t pz_uncompressed_size;
+
+ int initialized;
+ unsigned char *uncompressed_buffer;
+ size_t uncompressed_buffer_size;
+
+ uint32_t pz_offset;
+ unsigned char header[16];
+ size_t header_avail;
+ int header_passed;
+ unsigned char *block_pointers;
+ size_t block_pointers_alloc;
+ size_t block_pointers_size;
+ size_t block_pointers_avail;
+ size_t block_off;
+ uint32_t block_avail;
+
+ z_stream stream;
+ int stream_valid;
+};
+#else
+struct zisofs {
+ /* Set 1 if this file compressed by paged zlib */
+ int pz;
+};
+#endif
+
+struct content {
+ uint64_t offset;/* Offset on disk. */
+ uint64_t size; /* File size in bytes. */
+ struct content *next;
+};
+
+/* In-memory storage for a directory record. */
+struct file_info {
+ struct file_info *use_next;
+ struct file_info *parent;
+ struct file_info *next;
+ int subdirs;
+ uint64_t key; /* Heap Key. */
+ uint64_t offset; /* Offset on disk. */
+ uint64_t size; /* File size in bytes. */
+ uint32_t ce_offset; /* Offset of CE. */
+ uint32_t ce_size; /* Size of CE. */
+ char re; /* Having RRIP "RE" extension. */
+ uint64_t cl_offset; /* Having RRIP "CL" extension. */
+ int birthtime_is_set;
+ time_t birthtime; /* File created time. */
+ time_t mtime; /* File last modified time. */
+ time_t atime; /* File last accessed time. */
+ time_t ctime; /* File attribute change time. */
+ uint64_t rdev; /* Device number. */
+ mode_t mode;
+ uid_t uid;
+ gid_t gid;
+ int64_t number;
+ int nlinks;
+ struct archive_string name; /* Pathname */
+ char name_continues; /* Non-zero if name continues */
+ struct archive_string symlink;
+ char symlink_continues; /* Non-zero if link continues */
+ /* Set 1 if this file compressed by paged zlib(zisofs) */
+ int pz;
+ int pz_log2_bs; /* Log2 of block size */
+ uint64_t pz_uncompressed_size;
+ /* Set 1 if this file is multi extent. */
+ int multi_extent;
+ struct {
+ struct content *first;
+ struct content **last;
+ } contents;
+ char exposed;
+};
+
+struct heap_queue {
+ struct file_info **files;
+ int allocated;
+ int used;
+};
+
+struct iso9660 {
+ int magic;
+#define ISO9660_MAGIC 0x96609660
+
+ int opt_support_joliet;
+ int opt_support_rockridge;
+
+ struct archive_string pathname;
+ char seenRockridge; /* Set true if RR extensions are used. */
+ char seenSUSP; /* Set true if SUSP is beging used. */
+ char seenJoliet;
+
+ unsigned char suspOffset;
+ struct file_info *rr_moved;
+ struct heap_queue re_dirs;
+ struct heap_queue cl_files;
+ struct read_ce_queue {
+ struct read_ce_req {
+ uint64_t offset;/* Offset of CE on disk. */
+ struct file_info *file;
+ } *reqs;
+ int cnt;
+ int allocated;
+ } read_ce_req;
+
+ int64_t previous_number;
+ struct archive_string previous_pathname;
+
+ struct file_info *use_files;
+ struct heap_queue pending_files;
+ struct {
+ struct file_info *first;
+ struct file_info **last;
+ } cache_files;
+
+ uint64_t current_position;
+ ssize_t logical_block_size;
+ uint64_t volume_size; /* Total size of volume in bytes. */
+ int32_t volume_block;/* Total size of volume in logical blocks. */
+
+ struct vd {
+ int location; /* Location of Extent. */
+ uint32_t size;
+ } primary, joliet;
+
+ off_t entry_sparse_offset;
+ int64_t entry_bytes_remaining;
+ struct zisofs entry_zisofs;
+ struct content *entry_content;
+};
+
+static int archive_read_format_iso9660_bid(struct archive_read *);
+static int archive_read_format_iso9660_options(struct archive_read *,
+ const char *, const char *);
+static int archive_read_format_iso9660_cleanup(struct archive_read *);
+static int archive_read_format_iso9660_read_data(struct archive_read *,
+ const void **, size_t *, off_t *);
+static int archive_read_format_iso9660_read_data_skip(struct archive_read *);
+static int archive_read_format_iso9660_read_header(struct archive_read *,
+ struct archive_entry *);
+static const char *build_pathname(struct archive_string *, struct file_info *);
+#if DEBUG
+static void dump_isodirrec(FILE *, const unsigned char *isodirrec);
+#endif
+static time_t time_from_tm(struct tm *);
+static time_t isodate17(const unsigned char *);
+static time_t isodate7(const unsigned char *);
+static int isBootRecord(struct iso9660 *, const unsigned char *);
+static int isVolumePartition(struct iso9660 *, const unsigned char *);
+static int isVDSetTerminator(struct iso9660 *, const unsigned char *);
+static int isJolietSVD(struct iso9660 *, const unsigned char *);
+static int isSVD(struct iso9660 *, const unsigned char *);
+static int isEVD(struct iso9660 *, const unsigned char *);
+static int isPVD(struct iso9660 *, const unsigned char *);
+static struct file_info *next_cache_entry(struct iso9660 *iso9660);
+static int next_entry_seek(struct archive_read *a, struct iso9660 *iso9660,
+ struct file_info **pfile);
+static struct file_info *
+ parse_file_info(struct archive_read *a,
+ struct file_info *parent, const unsigned char *isodirrec);
+static int parse_rockridge(struct archive_read *a,
+ struct file_info *file, const unsigned char *start,
+ const unsigned char *end);
+static int register_CE(struct archive_read *a, int32_t location,
+ struct file_info *file);
+static int read_CE(struct archive_read *a, struct iso9660 *iso9660);
+static void parse_rockridge_NM1(struct file_info *,
+ const unsigned char *, int);
+static void parse_rockridge_SL1(struct file_info *,
+ const unsigned char *, int);
+static void parse_rockridge_TF1(struct file_info *,
+ const unsigned char *, int);
+static void parse_rockridge_ZF1(struct file_info *,
+ const unsigned char *, int);
+static void register_file(struct iso9660 *, struct file_info *);
+static void release_files(struct iso9660 *);
+static unsigned toi(const void *p, int n);
+static inline void cache_add_entry(struct iso9660 *iso9660,
+ struct file_info *file);
+static inline void cache_add_to_next_of_parent(struct iso9660 *iso9660,
+ struct file_info *file);
+static inline struct file_info *cache_get_entry(struct iso9660 *iso9660);
+static void heap_add_entry(struct heap_queue *heap,
+ struct file_info *file, uint64_t key);
+static struct file_info *heap_get_entry(struct heap_queue *heap);
+
+#define add_entry(iso9660, file) \
+ heap_add_entry(&((iso9660)->pending_files), file, file->offset)
+#define next_entry(iso9660) \
+ heap_get_entry(&((iso9660)->pending_files))
+
+int
+archive_read_support_format_iso9660(struct archive *_a)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ struct iso9660 *iso9660;
+ int r;
+
+ iso9660 = (struct iso9660 *)malloc(sizeof(*iso9660));
+ if (iso9660 == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Can't allocate iso9660 data");
+ return (ARCHIVE_FATAL);
+ }
+ memset(iso9660, 0, sizeof(*iso9660));
+ iso9660->magic = ISO9660_MAGIC;
+ iso9660->cache_files.first = NULL;
+ iso9660->cache_files.last = &(iso9660->cache_files.first);
+ /* Enable to support Joliet extensions by default. */
+ iso9660->opt_support_joliet = 1;
+ /* Enable to support Rock Ridge extensions by default. */
+ iso9660->opt_support_rockridge = 1;
+
+ r = __archive_read_register_format(a,
+ iso9660,
+ "iso9660",
+ archive_read_format_iso9660_bid,
+ archive_read_format_iso9660_options,
+ archive_read_format_iso9660_read_header,
+ archive_read_format_iso9660_read_data,
+ archive_read_format_iso9660_read_data_skip,
+ archive_read_format_iso9660_cleanup);
+
+ if (r != ARCHIVE_OK) {
+ free(iso9660);
+ return (r);
+ }
+ return (ARCHIVE_OK);
+}
+
+
+static int
+archive_read_format_iso9660_bid(struct archive_read *a)
+{
+ struct iso9660 *iso9660;
+ ssize_t bytes_read;
+ const void *h;
+ const unsigned char *p;
+ int seenTerminator;
+
+ iso9660 = (struct iso9660 *)(a->format->data);
+
+ /*
+ * Skip the first 32k (reserved area) and get the first
+ * 8 sectors of the volume descriptor table. Of course,
+ * if the I/O layer gives us more, we'll take it.
+ */
+#define RESERVED_AREA (SYSTEM_AREA_BLOCK * LOGICAL_BLOCK_SIZE)
+ h = __archive_read_ahead(a,
+ RESERVED_AREA + 8 * LOGICAL_BLOCK_SIZE,
+ &bytes_read);
+ if (h == NULL)
+ return (-1);
+ p = (const unsigned char *)h;
+
+ /* Skip the reserved area. */
+ bytes_read -= RESERVED_AREA;
+ p += RESERVED_AREA;
+
+ /* Check each volume descriptor. */
+ seenTerminator = 0;
+ for (; bytes_read > LOGICAL_BLOCK_SIZE;
+ bytes_read -= LOGICAL_BLOCK_SIZE, p += LOGICAL_BLOCK_SIZE) {
+ /* Do not handle undefined Volume Descriptor Type. */
+ if (p[0] >= 4 && p[0] <= 254)
+ return (0);
+ /* Standard Identifier must be "CD001" */
+ if (memcmp(p + 1, "CD001", 5) != 0)
+ return (0);
+ if (!iso9660->primary.location) {
+ if (isPVD(iso9660, p))
+ continue;
+ }
+ if (!iso9660->joliet.location) {
+ if (isJolietSVD(iso9660, p))
+ continue;
+ }
+ if (isBootRecord(iso9660, p))
+ continue;
+ if (isEVD(iso9660, p))
+ continue;
+ if (isSVD(iso9660, p))
+ continue;
+ if (isVolumePartition(iso9660, p))
+ continue;
+ if (isVDSetTerminator(iso9660, p)) {
+ seenTerminator = 1;
+ break;
+ }
+ return (0);
+ }
+ /*
+ * ISO 9660 format must have Primary Volume Descriptor and
+ * Volume Descriptor Set Terminator.
+ */
+ if (seenTerminator && iso9660->primary.location > 16)
+ return (48);
+
+ /* We didn't find a valid PVD; return a bid of zero. */
+ return (0);
+}
+
+static int
+archive_read_format_iso9660_options(struct archive_read *a,
+ const char *key, const char *val)
+{
+ struct iso9660 *iso9660;
+
+ iso9660 = (struct iso9660 *)(a->format->data);
+
+ if (strcmp(key, "joliet") == 0) {
+ if (val == NULL || strcmp(val, "off") == 0 ||
+ strcmp(val, "ignore") == 0 ||
+ strcmp(val, "disable") == 0 ||
+ strcmp(val, "0") == 0)
+ iso9660->opt_support_joliet = 0;
+ else
+ iso9660->opt_support_joliet = 1;
+ return (ARCHIVE_OK);
+ }
+ if (strcmp(key, "rockridge") == 0 ||
+ strcmp(key, "Rockridge") == 0) {
+ iso9660->opt_support_rockridge = val != NULL;
+ return (ARCHIVE_OK);
+ }
+
+ /* Note: The "warn" return is just to inform the options
+ * supervisor that we didn't handle it. It will generate
+ * a suitable error if noone used this option. */
+ return (ARCHIVE_WARN);
+}
+
+static int
+isBootRecord(struct iso9660 *iso9660, const unsigned char *h)
+{
+ (void)iso9660; /* UNUSED */
+
+ /* Type of the Volume Descriptor Boot Record must be 0. */
+ if (h[0] != 0)
+ return (0);
+
+ /* Volume Descriptor Version must be 1. */
+ if (h[6] != 1)
+ return (0);
+
+ return (1);
+}
+
+static int
+isVolumePartition(struct iso9660 *iso9660, const unsigned char *h)
+{
+ int32_t location;
+
+ /* Type of the Volume Partition Descriptor must be 3. */
+ if (h[0] != 3)
+ return (0);
+
+ /* Volume Descriptor Version must be 1. */
+ if (h[6] != 1)
+ return (0);
+ /* Unused Field */
+ if (h[7] != 0)
+ return (0);
+
+ location = archive_le32dec(h + 72);
+ if (location <= SYSTEM_AREA_BLOCK ||
+ location >= iso9660->volume_block)
+ return (0);
+ if ((uint32_t)location != archive_be32dec(h + 76))
+ return (0);
+
+ return (1);
+}
+
+static int
+isVDSetTerminator(struct iso9660 *iso9660, const unsigned char *h)
+{
+ int i;
+
+ (void)iso9660; /* UNUSED */
+
+ /* Type of the Volume Descriptor Set Terminator must be 255. */
+ if (h[0] != 255)
+ return (0);
+
+ /* Volume Descriptor Version must be 1. */
+ if (h[6] != 1)
+ return (0);
+
+ /* Reserved field must be 0. */
+ for (i = 7; i < 2048; ++i)
+ if (h[i] != 0)
+ return (0);
+
+ return (1);
+}
+
+static int
+isJolietSVD(struct iso9660 *iso9660, const unsigned char *h)
+{
+ const unsigned char *p;
+ ssize_t logical_block_size;
+ int32_t volume_block;
+
+ /* Check if current sector is a kind of Supplementary Volume
+ * Descriptor. */
+ if (!isSVD(iso9660, h))
+ return (0);
+
+ /* FIXME: do more validations according to joliet spec. */
+
+ /* check if this SVD contains joliet extension! */
+ p = h + SVD_escape_sequences_offset;
+ /* N.B. Joliet spec says p[1] == '\\', but.... */
+ if (p[0] == '%' && p[1] == '/') {
+ int level = 0;
+
+ if (p[2] == '@')
+ level = 1;
+ else if (p[2] == 'C')
+ level = 2;
+ else if (p[2] == 'E')
+ level = 3;
+ else /* not joliet */
+ return (0);
+
+ iso9660->seenJoliet = level;
+
+ } else /* not joliet */
+ return (0);
+
+ logical_block_size =
+ archive_le16dec(h + SVD_logical_block_size_offset);
+ volume_block = archive_le32dec(h + SVD_volume_space_size_offset);
+
+ iso9660->logical_block_size = logical_block_size;
+ iso9660->volume_block = volume_block;
+ iso9660->volume_size = logical_block_size * (uint64_t)volume_block;
+ /* Read Root Directory Record in Volume Descriptor. */
+ p = h + SVD_root_directory_record_offset;
+ iso9660->joliet.location = archive_le32dec(p + DR_extent_offset);
+ iso9660->joliet.size = archive_le32dec(p + DR_size_offset);
+
+ return (48);
+}
+
+static int
+isSVD(struct iso9660 *iso9660, const unsigned char *h)
+{
+ const unsigned char *p;
+ ssize_t logical_block_size;
+ int32_t volume_block;
+ int32_t location;
+ int i;
+
+ (void)iso9660; /* UNUSED */
+
+ /* Type 2 means it's a SVD. */
+ if (h[SVD_type_offset] != 2)
+ return (0);
+
+ /* Reserved field must be 0. */
+ for (i = 0; i < SVD_reserved1_size; ++i)
+ if (h[SVD_reserved1_offset + i] != 0)
+ return (0);
+ for (i = 0; i < SVD_reserved2_size; ++i)
+ if (h[SVD_reserved2_offset + i] != 0)
+ return (0);
+ for (i = 0; i < SVD_reserved3_size; ++i)
+ if (h[SVD_reserved3_offset + i] != 0)
+ return (0);
+
+ /* File structure version must be 1 for ISO9660/ECMA119. */
+ if (h[SVD_file_structure_version_offset] != 1)
+ return (0);
+
+ logical_block_size =
+ archive_le16dec(h + SVD_logical_block_size_offset);
+ if (logical_block_size <= 0)
+ return (0);
+
+ volume_block = archive_le32dec(h + SVD_volume_space_size_offset);
+ if (volume_block <= SYSTEM_AREA_BLOCK+4)
+ return (0);
+
+ /* Location of Occurrence of Type L Path Table must be
+ * available location,
+ * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */
+ location = archive_le32dec(h+SVD_type_L_path_table_offset);
+ if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block)
+ return (0);
+
+ /* Location of Occurrence of Type M Path Table must be
+ * available location,
+ * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */
+ location = archive_be32dec(h+SVD_type_M_path_table_offset);
+ if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block)
+ return (0);
+
+ /* Read Root Directory Record in Volume Descriptor. */
+ p = h + SVD_root_directory_record_offset;
+ if (p[DR_length_offset] != 34)
+ return (0);
+
+ return (48);
+}
+
+static int
+isEVD(struct iso9660 *iso9660, const unsigned char *h)
+{
+ const unsigned char *p;
+ ssize_t logical_block_size;
+ int32_t volume_block;
+ int32_t location;
+ int i;
+
+ (void)iso9660; /* UNUSED */
+
+ /* Type of the Enhanced Volume Descriptor must be 2. */
+ if (h[PVD_type_offset] != 2)
+ return (0);
+
+ /* EVD version must be 2. */
+ if (h[PVD_version_offset] != 2)
+ return (0);
+
+ /* Reserved field must be 0. */
+ if (h[PVD_reserved1_offset] != 0)
+ return (0);
+
+ /* Reserved field must be 0. */
+ for (i = 0; i < PVD_reserved2_size; ++i)
+ if (h[PVD_reserved2_offset + i] != 0)
+ return (0);
+
+ /* Reserved field must be 0. */
+ for (i = 0; i < PVD_reserved3_size; ++i)
+ if (h[PVD_reserved3_offset + i] != 0)
+ return (0);
+
+ /* Logical block size must be > 0. */
+ /* I've looked at Ecma 119 and can't find any stronger
+ * restriction on this field. */
+ logical_block_size =
+ archive_le16dec(h + PVD_logical_block_size_offset);
+ if (logical_block_size <= 0)
+ return (0);
+
+ volume_block =
+ archive_le32dec(h + PVD_volume_space_size_offset);
+ if (volume_block <= SYSTEM_AREA_BLOCK+4)
+ return (0);
+
+ /* File structure version must be 2 for ISO9660:1999. */
+ if (h[PVD_file_structure_version_offset] != 2)
+ return (0);
+
+ /* Location of Occurrence of Type L Path Table must be
+ * available location,
+ * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */
+ location = archive_le32dec(h+PVD_type_1_path_table_offset);
+ if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block)
+ return (0);
+
+ /* Location of Occurrence of Type M Path Table must be
+ * available location,
+ * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */
+ location = archive_be32dec(h+PVD_type_m_path_table_offset);
+ if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block)
+ return (0);
+
+ /* Reserved field must be 0. */
+ for (i = 0; i < PVD_reserved4_size; ++i)
+ if (h[PVD_reserved4_offset + i] != 0)
+ return (0);
+
+ /* Reserved field must be 0. */
+ for (i = 0; i < PVD_reserved5_size; ++i)
+ if (h[PVD_reserved5_offset + i] != 0)
+ return (0);
+
+ /* Read Root Directory Record in Volume Descriptor. */
+ p = h + PVD_root_directory_record_offset;
+ if (p[DR_length_offset] != 34)
+ return (0);
+
+ return (48);
+}
+
+static int
+isPVD(struct iso9660 *iso9660, const unsigned char *h)
+{
+ const unsigned char *p;
+ ssize_t logical_block_size;
+ int32_t volume_block;
+ int32_t location;
+ int i;
+
+ /* Type of the Primary Volume Descriptor must be 1. */
+ if (h[PVD_type_offset] != 1)
+ return (0);
+
+ /* PVD version must be 1. */
+ if (h[PVD_version_offset] != 1)
+ return (0);
+
+ /* Reserved field must be 0. */
+ if (h[PVD_reserved1_offset] != 0)
+ return (0);
+
+ /* Reserved field must be 0. */
+ for (i = 0; i < PVD_reserved2_size; ++i)
+ if (h[PVD_reserved2_offset + i] != 0)
+ return (0);
+
+ /* Reserved field must be 0. */
+ for (i = 0; i < PVD_reserved3_size; ++i)
+ if (h[PVD_reserved3_offset + i] != 0)
+ return (0);
+
+ /* Logical block size must be > 0. */
+ /* I've looked at Ecma 119 and can't find any stronger
+ * restriction on this field. */
+ logical_block_size =
+ archive_le16dec(h + PVD_logical_block_size_offset);
+ if (logical_block_size <= 0)
+ return (0);
+
+ volume_block = archive_le32dec(h + PVD_volume_space_size_offset);
+ if (volume_block <= SYSTEM_AREA_BLOCK+4)
+ return (0);
+
+ /* File structure version must be 1 for ISO9660/ECMA119. */
+ if (h[PVD_file_structure_version_offset] != 1)
+ return (0);
+
+ /* Location of Occurrence of Type L Path Table must be
+ * available location,
+ * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */
+ location = archive_le32dec(h+PVD_type_1_path_table_offset);
+ if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block)
+ return (0);
+
+ /* Location of Occurrence of Type M Path Table must be
+ * available location,
+ * > SYSTEM_AREA_BLOCK(16) + 2 and < Volume Space Size. */
+ location = archive_be32dec(h+PVD_type_m_path_table_offset);
+ if (location <= SYSTEM_AREA_BLOCK+2 || location >= volume_block)
+ return (0);
+
+ /* Reserved field must be 0. */
+ for (i = 0; i < PVD_reserved4_size; ++i)
+ if (h[PVD_reserved4_offset + i] != 0)
+ return (0);
+
+ /* Reserved field must be 0. */
+ for (i = 0; i < PVD_reserved5_size; ++i)
+ if (h[PVD_reserved5_offset + i] != 0)
+ return (0);
+
+ /* XXX TODO: Check other values for sanity; reject more
+ * malformed PVDs. XXX */
+
+ /* Read Root Directory Record in Volume Descriptor. */
+ p = h + PVD_root_directory_record_offset;
+ if (p[DR_length_offset] != 34)
+ return (0);
+
+ iso9660->logical_block_size = logical_block_size;
+ iso9660->volume_block = volume_block;
+ iso9660->volume_size = logical_block_size * (uint64_t)volume_block;
+ iso9660->primary.location = archive_le32dec(p + DR_extent_offset);
+ iso9660->primary.size = archive_le32dec(p + DR_size_offset);
+
+ return (48);
+}
+
+static int
+read_children(struct archive_read *a, struct file_info *parent)
+{
+ struct iso9660 *iso9660;
+ const unsigned char *b, *p;
+ struct file_info *multi;
+ size_t step;
+
+ iso9660 = (struct iso9660 *)(a->format->data);
+ if (iso9660->current_position > parent->offset) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Ignoring out-of-order directory (%s) %jd > %jd",
+ parent->name.s,
+ iso9660->current_position,
+ parent->offset);
+ return (ARCHIVE_WARN);
+ }
+ if (parent->offset + parent->size > iso9660->volume_size) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Directory is beyond end-of-media: %s",
+ parent->name);
+ return (ARCHIVE_WARN);
+ }
+ if (iso9660->current_position < parent->offset) {
+ int64_t skipsize;
+
+ skipsize = parent->offset - iso9660->current_position;
+ skipsize = __archive_read_skip(a, skipsize);
+ if (skipsize < 0)
+ return ((int)skipsize);
+ iso9660->current_position = parent->offset;
+ }
+
+ step = ((parent->size + iso9660->logical_block_size -1) /
+ iso9660->logical_block_size) * iso9660->logical_block_size;
+ b = __archive_read_ahead(a, step, NULL);
+ if (b == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Failed to read full block when scanning "
+ "ISO9660 directory list");
+ return (ARCHIVE_FATAL);
+ }
+ __archive_read_consume(a, step);
+ iso9660->current_position += step;
+ multi = NULL;
+ while (step) {
+ p = b;
+ b += iso9660->logical_block_size;
+ step -= iso9660->logical_block_size;
+ for (; *p != 0 && p < b && p + *p <= b; p += *p) {
+ struct file_info *child;
+
+ /* N.B.: these special directory identifiers
+ * are 8 bit "values" even on a
+ * Joliet CD with UCS-2 (16bit) encoding.
+ */
+
+ /* Skip '.' entry. */
+ if (*(p + DR_name_len_offset) == 1
+ && *(p + DR_name_offset) == '\0')
+ continue;
+ /* Skip '..' entry. */
+ if (*(p + DR_name_len_offset) == 1
+ && *(p + DR_name_offset) == '\001')
+ continue;
+ child = parse_file_info(a, parent, p);
+ if (child == NULL)
+ return (ARCHIVE_FATAL);
+ if (child->cl_offset)
+ heap_add_entry(&(iso9660->cl_files),
+ child, child->cl_offset);
+ else {
+ if (child->multi_extent || multi != NULL) {
+ struct content *con;
+
+ if (multi == NULL) {
+ multi = child;
+ multi->contents.first = NULL;
+ multi->contents.last =
+ &(multi->contents.first);
+ }
+ con = malloc(sizeof(struct content));
+ if (con == NULL) {
+ archive_set_error(
+ &a->archive, ENOMEM,
+ "No memory for "
+ "multi extent");
+ return (ARCHIVE_FATAL);
+ }
+ con->offset = child->offset;
+ con->size = child->size;
+ con->next = NULL;
+ *multi->contents.last = con;
+ multi->contents.last = &(con->next);
+ if (multi == child)
+ add_entry(iso9660, child);
+ else {
+ multi->size += child->size;
+ if (!child->multi_extent)
+ multi = NULL;
+ }
+ } else
+ add_entry(iso9660, child);
+ }
+ }
+ }
+
+ /* Read data which recorded by RRIP "CE" extension. */
+ if (read_CE(a, iso9660) != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+
+ return (ARCHIVE_OK);
+}
+
+static int
+relocate_dir(struct iso9660 *iso9660, struct file_info *file)
+{
+ struct file_info *re;
+
+ re = heap_get_entry(&(iso9660->re_dirs));
+ while (re != NULL && re->offset < file->cl_offset) {
+ /* This case is wrong pattern.
+ * But dont't reject this directory entry to be robust. */
+ cache_add_entry(iso9660, re);
+ re = heap_get_entry(&(iso9660->re_dirs));
+ }
+ if (re == NULL)
+ /* This case is wrong pattern. */
+ return (0);
+ if (re->offset == file->cl_offset) {
+ re->parent->subdirs--;
+ re->parent = file->parent;
+ re->parent->subdirs++;
+ cache_add_to_next_of_parent(iso9660, re);
+ return (1);
+ } else
+ /* This case is wrong pattern. */
+ heap_add_entry(&(iso9660->re_dirs), re, re->offset);
+ return (0);
+}
+
+static int
+read_entries(struct archive_read *a)
+{
+ struct iso9660 *iso9660;
+ struct file_info *file;
+ int r;
+
+ iso9660 = (struct iso9660 *)(a->format->data);
+
+ while ((file = next_entry(iso9660)) != NULL &&
+ (file->mode & AE_IFMT) == AE_IFDIR) {
+ r = read_children(a, file);
+ if (r != ARCHIVE_OK)
+ return (r);
+
+ if (iso9660->seenRockridge &&
+ file->parent != NULL &&
+ file->parent->parent == NULL &&
+ iso9660->rr_moved == NULL &&
+ (strcmp(file->name.s, "rr_moved") == 0 ||
+ strcmp(file->name.s, ".rr_moved") == 0)) {
+ iso9660->rr_moved = file;
+ } else if (file->re)
+ heap_add_entry(&(iso9660->re_dirs), file,
+ file->offset);
+ else
+ cache_add_entry(iso9660, file);
+ }
+ if (file != NULL)
+ add_entry(iso9660, file);
+
+ if (iso9660->rr_moved != NULL) {
+ /*
+ * Relocate directory which rr_moved has.
+ */
+ while ((file = heap_get_entry(&(iso9660->cl_files))) != NULL)
+ relocate_dir(iso9660, file);
+
+ /* If rr_moved directory still has children,
+ * Add rr_moved into pending_files to show
+ */
+ if (iso9660->rr_moved->subdirs) {
+ cache_add_entry(iso9660, iso9660->rr_moved);
+ /* If entries which have "RE" extension are still
+ * remaining(this case is unlikely except ISO image
+ * is broken), the entries won't be exposed. */
+ while ((file = heap_get_entry(&(iso9660->re_dirs))) != NULL)
+ cache_add_entry(iso9660, file);
+ } else
+ iso9660->rr_moved->parent->subdirs--;
+ } else {
+ /*
+ * In case ISO image is broken. If the name of rr_moved
+ * directory has been changed by damage, subdirectories
+ * of rr_moved entry won't be exposed.
+ */
+ while ((file = heap_get_entry(&(iso9660->re_dirs))) != NULL)
+ cache_add_entry(iso9660, file);
+ }
+
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_read_format_iso9660_read_header(struct archive_read *a,
+ struct archive_entry *entry)
+{
+ struct iso9660 *iso9660;
+ struct file_info *file;
+ int r, rd_r;
+
+ iso9660 = (struct iso9660 *)(a->format->data);
+
+ if (!a->archive.archive_format) {
+ a->archive.archive_format = ARCHIVE_FORMAT_ISO9660;
+ a->archive.archive_format_name = "ISO9660";
+ }
+
+ if (iso9660->current_position == 0) {
+ int64_t skipsize;
+ struct vd *vd;
+ const void *block;
+ char seenJoliet;
+
+ vd = &(iso9660->primary);
+ if (!iso9660->opt_support_joliet)
+ iso9660->seenJoliet = 0;
+ if (iso9660->seenJoliet &&
+ vd->location > iso9660->joliet.location)
+ /* This condition is unlikely; by way of caution. */
+ vd = &(iso9660->joliet);
+
+ skipsize = LOGICAL_BLOCK_SIZE * vd->location;
+ skipsize = __archive_read_skip(a, skipsize);
+ if (skipsize < 0)
+ return ((int)skipsize);
+ iso9660->current_position = skipsize;
+
+ block = __archive_read_ahead(a, vd->size, NULL);
+ if (block == NULL) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_MISC,
+ "Failed to read full block when scanning "
+ "ISO9660 directory list");
+ return (ARCHIVE_FATAL);
+ }
+
+ /*
+ * While reading Root Directory, flag seenJoliet
+ * must be zero to avoid converting special name
+ * 0x00(Current Directory) and next byte to UCS2.
+ */
+ seenJoliet = iso9660->seenJoliet;/* Save flag. */
+ iso9660->seenJoliet = 0;
+ file = parse_file_info(a, NULL, block);
+ if (file == NULL)
+ return (ARCHIVE_FATAL);
+ iso9660->seenJoliet = seenJoliet;
+ if (vd == &(iso9660->primary) && iso9660->seenRockridge
+ && iso9660->seenJoliet)
+ /*
+ * If iso image has RockRidge and Joliet,
+ * we use RockRidge Extensions.
+ */
+ iso9660->seenJoliet = 0;
+ if (vd == &(iso9660->primary) && !iso9660->seenRockridge
+ && iso9660->seenJoliet) {
+ /* Switch reading data from primary to joliet. */
+ vd = &(iso9660->joliet);
+ skipsize = LOGICAL_BLOCK_SIZE * vd->location;
+ skipsize -= iso9660->current_position;
+ skipsize = __archive_read_skip(a, skipsize);
+ if (skipsize < 0)
+ return ((int)skipsize);
+ iso9660->current_position += skipsize;
+
+ block = __archive_read_ahead(a, vd->size, NULL);
+ if (block == NULL) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_MISC,
+ "Failed to read full block when scanning "
+ "ISO9660 directory list");
+ return (ARCHIVE_FATAL);
+ }
+ seenJoliet = iso9660->seenJoliet;/* Save flag. */
+ iso9660->seenJoliet = 0;
+ file = parse_file_info(a, NULL, block);
+ if (file == NULL)
+ return (ARCHIVE_FATAL);
+ iso9660->seenJoliet = seenJoliet;
+ }
+ /* Store the root directory in the pending list. */
+ add_entry(iso9660, file);
+ if (iso9660->seenRockridge) {
+ a->archive.archive_format =
+ ARCHIVE_FORMAT_ISO9660_ROCKRIDGE;
+ a->archive.archive_format_name =
+ "ISO9660 with Rockridge extensions";
+ }
+ rd_r = read_entries(a);
+ if (rd_r == ARCHIVE_FATAL)
+ return (ARCHIVE_FATAL);
+ } else
+ rd_r = ARCHIVE_OK;
+
+ /* Get the next entry that appears after the current offset. */
+ r = next_entry_seek(a, iso9660, &file);
+ if (r != ARCHIVE_OK)
+ return (r);
+
+ iso9660->entry_bytes_remaining = file->size;
+ iso9660->entry_sparse_offset = 0; /* Offset for sparse-file-aware clients. */
+
+ if (file->offset + file->size > iso9660->volume_size) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "File is beyond end-of-media: %s", file->name);
+ iso9660->entry_bytes_remaining = 0;
+ iso9660->entry_sparse_offset = 0;
+ return (ARCHIVE_WARN);
+ }
+
+ /* Set up the entry structure with information about this entry. */
+ archive_entry_set_mode(entry, file->mode);
+ archive_entry_set_uid(entry, file->uid);
+ archive_entry_set_gid(entry, file->gid);
+ archive_entry_set_nlink(entry, file->nlinks);
+ if (file->birthtime_is_set)
+ archive_entry_set_birthtime(entry, file->birthtime, 0);
+ else
+ archive_entry_unset_birthtime(entry);
+ archive_entry_set_mtime(entry, file->mtime, 0);
+ archive_entry_set_ctime(entry, file->ctime, 0);
+ archive_entry_set_atime(entry, file->atime, 0);
+ /* N.B.: Rock Ridge supports 64-bit device numbers. */
+ archive_entry_set_rdev(entry, (dev_t)file->rdev);
+ archive_entry_set_size(entry, iso9660->entry_bytes_remaining);
+ archive_string_empty(&iso9660->pathname);
+ archive_entry_set_pathname(entry,
+ build_pathname(&iso9660->pathname, file));
+ if (file->symlink.s != NULL)
+ archive_entry_copy_symlink(entry, file->symlink.s);
+
+ /* Note: If the input isn't seekable, we can't rewind to
+ * return the same body again, so if the next entry refers to
+ * the same data, we have to return it as a hardlink to the
+ * original entry. */
+ if (file->number != -1 &&
+ file->number == iso9660->previous_number) {
+ archive_entry_set_hardlink(entry,
+ iso9660->previous_pathname.s);
+ archive_entry_unset_size(entry);
+ iso9660->entry_bytes_remaining = 0;
+ iso9660->entry_sparse_offset = 0;
+ return (ARCHIVE_OK);
+ }
+
+ /* Except for the hardlink case above, if the offset of the
+ * next entry is before our current position, we can't seek
+ * backwards to extract it, so issue a warning. Note that
+ * this can only happen if this entry was added to the heap
+ * after we passed this offset, that is, only if the directory
+ * mentioning this entry is later than the body of the entry.
+ * Such layouts are very unusual; most ISO9660 writers lay out
+ * and record all directory information first, then store
+ * all file bodies. */
+ /* TODO: Someday, libarchive's I/O core will support optional
+ * seeking. When that day comes, this code should attempt to
+ * seek and only return the error if the seek fails. That
+ * will give us support for whacky ISO images that require
+ * seeking while retaining the ability to read almost all ISO
+ * images in a streaming fashion. */
+ if ((file->mode & AE_IFMT) != AE_IFDIR &&
+ file->offset < iso9660->current_position) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Ignoring out-of-order file @%x (%s) %jd < %jd",
+ file,
+ iso9660->pathname.s,
+ file->offset, iso9660->current_position);
+ iso9660->entry_bytes_remaining = 0;
+ iso9660->entry_sparse_offset = 0;
+ return (ARCHIVE_WARN);
+ }
+
+ /* Initialize zisofs variables. */
+ iso9660->entry_zisofs.pz = file->pz;
+ if (file->pz) {
+#ifdef HAVE_ZLIB_H
+ struct zisofs *zisofs;
+
+ zisofs = &iso9660->entry_zisofs;
+ zisofs->initialized = 0;
+ zisofs->pz_log2_bs = file->pz_log2_bs;
+ zisofs->pz_uncompressed_size = file->pz_uncompressed_size;
+ zisofs->pz_offset = 0;
+ zisofs->header_avail = 0;
+ zisofs->header_passed = 0;
+ zisofs->block_pointers_avail = 0;
+#endif
+ archive_entry_set_size(entry, file->pz_uncompressed_size);
+ }
+
+ iso9660->previous_number = file->number;
+ archive_strcpy(&iso9660->previous_pathname, iso9660->pathname.s);
+
+ /* Reset entry_bytes_remaining if the file is multi extent. */
+ iso9660->entry_content = file->contents.first;
+ if (iso9660->entry_content != NULL)
+ iso9660->entry_bytes_remaining = iso9660->entry_content->size;
+
+ if (archive_entry_filetype(entry) == AE_IFDIR) {
+ /* Overwrite nlinks by proper link number which is
+ * calculated from number of sub directories. */
+ archive_entry_set_nlink(entry, 2 + file->subdirs);
+ /* Directory data has been read completely. */
+ iso9660->entry_bytes_remaining = 0;
+ iso9660->entry_sparse_offset = 0;
+ file->exposed = 1;
+ }
+
+ if (rd_r != ARCHIVE_OK)
+ return (rd_r);
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_read_format_iso9660_read_data_skip(struct archive_read *a)
+{
+ /* Because read_next_header always does an explicit skip
+ * to the next entry, we don't need to do anything here. */
+ (void)a; /* UNUSED */
+ return (ARCHIVE_OK);
+}
+
+#ifdef HAVE_ZLIB_H
+
+static int
+zisofs_read_data(struct archive_read *a,
+ const void **buff, size_t *size, off_t *offset)
+{
+ struct iso9660 *iso9660;
+ struct zisofs *zisofs;
+ const unsigned char *p;
+ size_t avail;
+ ssize_t bytes_read;
+ size_t uncompressed_size;
+ int r;
+
+ iso9660 = (struct iso9660 *)(a->format->data);
+ zisofs = &iso9660->entry_zisofs;
+
+ p = __archive_read_ahead(a, 1, &bytes_read);
+ if (bytes_read <= 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Truncated zisofs file body");
+ return (ARCHIVE_FATAL);
+ }
+ if (bytes_read > iso9660->entry_bytes_remaining)
+ bytes_read = iso9660->entry_bytes_remaining;
+ avail = bytes_read;
+ uncompressed_size = 0;
+
+ if (!zisofs->initialized) {
+ size_t ceil, xsize;
+
+ /* Allocate block pointers buffer. */
+ ceil = (zisofs->pz_uncompressed_size +
+ (1LL << zisofs->pz_log2_bs) - 1)
+ >> zisofs->pz_log2_bs;
+ xsize = (ceil + 1) * 4;
+ if (zisofs->block_pointers_alloc < xsize) {
+ size_t alloc;
+
+ if (zisofs->block_pointers != NULL)
+ free(zisofs->block_pointers);
+ alloc = ((xsize >> 10) + 1) << 10;
+ zisofs->block_pointers = malloc(alloc);
+ if (zisofs->block_pointers == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "No memory for zisofs decompression");
+ return (ARCHIVE_FATAL);
+ }
+ zisofs->block_pointers_alloc = alloc;
+ }
+ zisofs->block_pointers_size = xsize;
+
+ /* Allocate uncompressed data buffer. */
+ xsize = 1UL << zisofs->pz_log2_bs;
+ if (zisofs->uncompressed_buffer_size < xsize) {
+ if (zisofs->uncompressed_buffer != NULL)
+ free(zisofs->uncompressed_buffer);
+ zisofs->uncompressed_buffer = malloc(xsize);
+ if (zisofs->uncompressed_buffer == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "No memory for zisofs decompression");
+ return (ARCHIVE_FATAL);
+ }
+ }
+ zisofs->uncompressed_buffer_size = xsize;
+
+ /*
+ * Read the file header, and check the magic code of zisofs.
+ */
+ if (zisofs->header_avail < sizeof(zisofs->header)) {
+ xsize = sizeof(zisofs->header) - zisofs->header_avail;
+ if (avail < xsize)
+ xsize = avail;
+ memcpy(zisofs->header + zisofs->header_avail, p, xsize);
+ zisofs->header_avail += xsize;
+ avail -= xsize;
+ p += xsize;
+ }
+ if (!zisofs->header_passed &&
+ zisofs->header_avail == sizeof(zisofs->header)) {
+ int err = 0;
+
+ if (memcmp(zisofs->header, zisofs_magic,
+ sizeof(zisofs_magic)) != 0)
+ err = 1;
+ if (archive_le32dec(zisofs->header + 8)
+ != zisofs->pz_uncompressed_size)
+ err = 1;
+ if (zisofs->header[12] != 4)
+ err = 1;
+ if (zisofs->header[13] != zisofs->pz_log2_bs)
+ err = 1;
+ if (err) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Illegal zisofs file body");
+ return (ARCHIVE_FATAL);
+ }
+ zisofs->header_passed = 1;
+ }
+ /*
+ * Read block pointers.
+ */
+ if (zisofs->header_passed &&
+ zisofs->block_pointers_avail < zisofs->block_pointers_size) {
+ xsize = zisofs->block_pointers_size
+ - zisofs->block_pointers_avail;
+ if (avail < xsize)
+ xsize = avail;
+ memcpy(zisofs->block_pointers
+ + zisofs->block_pointers_avail, p, xsize);
+ zisofs->block_pointers_avail += xsize;
+ avail -= xsize;
+ p += xsize;
+ if (zisofs->block_pointers_avail
+ == zisofs->block_pointers_size) {
+ /* We've got all block pointers and initialize
+ * related variables. */
+ zisofs->block_off = 0;
+ zisofs->block_avail = 0;
+ /* Complete a initialization */
+ zisofs->initialized = 1;
+ }
+ }
+
+ if (!zisofs->initialized)
+ goto next_data; /* We need more datas. */
+ }
+
+ /*
+ * Get block offsets from block pointers.
+ */
+ if (zisofs->block_avail == 0) {
+ uint32_t bst, bed;
+
+ if (zisofs->block_off + 4 >= zisofs->block_pointers_size) {
+ /* There isn't a pair of offsets. */
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Illegal zisofs block pointers");
+ return (ARCHIVE_FATAL);
+ }
+ bst = archive_le32dec(zisofs->block_pointers + zisofs->block_off);
+ if (bst != zisofs->pz_offset + (bytes_read - avail)) {
+ /* TODO: Should we seek offset of current file by bst ? */
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Illegal zisofs block pointers(cannot seek)");
+ return (ARCHIVE_FATAL);
+ }
+ bed = archive_le32dec(
+ zisofs->block_pointers + zisofs->block_off + 4);
+ if (bed < bst) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Illegal zisofs block pointers");
+ return (ARCHIVE_FATAL);
+ }
+ zisofs->block_avail = bed - bst;
+ zisofs->block_off += 4;
+
+ /* Initialize compression library for new block. */
+ if (zisofs->stream_valid)
+ r = inflateReset(&zisofs->stream);
+ else
+ r = inflateInit(&zisofs->stream);
+ if (r != Z_OK) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Can't initialize zisofs decompression.");
+ return (ARCHIVE_FATAL);
+ }
+ zisofs->stream_valid = 1;
+ zisofs->stream.total_in = 0;
+ zisofs->stream.total_out = 0;
+ }
+
+ /*
+ * Make uncompressed datas.
+ */
+ if (zisofs->block_avail == 0) {
+ memset(zisofs->uncompressed_buffer, 0,
+ zisofs->uncompressed_buffer_size);
+ uncompressed_size = zisofs->uncompressed_buffer_size;
+ } else {
+ zisofs->stream.next_in = (Bytef *)(uintptr_t)(const void *)p;
+ if (avail > zisofs->block_avail)
+ zisofs->stream.avail_in = zisofs->block_avail;
+ else
+ zisofs->stream.avail_in = avail;
+ zisofs->stream.next_out = zisofs->uncompressed_buffer;
+ zisofs->stream.avail_out = zisofs->uncompressed_buffer_size;
+
+ r = inflate(&zisofs->stream, 0);
+ switch (r) {
+ case Z_OK: /* Decompressor made some progress.*/
+ case Z_STREAM_END: /* Found end of stream. */
+ break;
+ default:
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "zisofs decompression failed (%d)", r);
+ return (ARCHIVE_FATAL);
+ }
+ uncompressed_size =
+ zisofs->uncompressed_buffer_size - zisofs->stream.avail_out;
+ avail -= zisofs->stream.next_in - p;
+ zisofs->block_avail -= zisofs->stream.next_in - p;
+ }
+next_data:
+ bytes_read -= avail;
+ *buff = zisofs->uncompressed_buffer;
+ *size = uncompressed_size;
+ *offset = iso9660->entry_sparse_offset;
+ iso9660->entry_sparse_offset += uncompressed_size;
+ iso9660->entry_bytes_remaining -= bytes_read;
+ iso9660->current_position += bytes_read;
+ zisofs->pz_offset += bytes_read;
+ __archive_read_consume(a, bytes_read);
+
+ return (ARCHIVE_OK);
+}
+
+#else /* HAVE_ZLIB_H */
+
+static int
+zisofs_read_data(struct archive_read *a,
+ const void **buff, size_t *size, off_t *offset)
+{
+
+ (void)buff;/* UNUSED */
+ (void)size;/* UNUSED */
+ (void)offset;/* UNUSED */
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "zisofs is not supported on this platform.");
+ return (ARCHIVE_FAILED);
+}
+
+#endif /* HAVE_ZLIB_H */
+
+static int
+archive_read_format_iso9660_read_data(struct archive_read *a,
+ const void **buff, size_t *size, off_t *offset)
+{
+ ssize_t bytes_read;
+ struct iso9660 *iso9660;
+
+ iso9660 = (struct iso9660 *)(a->format->data);
+ if (iso9660->entry_bytes_remaining <= 0) {
+ if (iso9660->entry_content != NULL)
+ iso9660->entry_content = iso9660->entry_content->next;
+ if (iso9660->entry_content == NULL) {
+ *buff = NULL;
+ *size = 0;
+ *offset = iso9660->entry_sparse_offset;
+ return (ARCHIVE_EOF);
+ }
+ /* Seek forward to the start of the entry. */
+ if (iso9660->current_position < iso9660->entry_content->offset) {
+ int64_t step;
+
+ step = iso9660->entry_content->offset -
+ iso9660->current_position;
+ step = __archive_read_skip(a, step);
+ if (step < 0)
+ return ((int)step);
+ iso9660->current_position =
+ iso9660->entry_content->offset;
+ }
+ if (iso9660->entry_content->offset < iso9660->current_position) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Ignoring out-of-order file (%s) %jd < %jd",
+ iso9660->pathname.s,
+ iso9660->entry_content->offset,
+ iso9660->current_position);
+ *buff = NULL;
+ *size = 0;
+ *offset = iso9660->entry_sparse_offset;
+ return (ARCHIVE_WARN);
+ }
+ iso9660->entry_bytes_remaining = iso9660->entry_content->size;
+ }
+ if (iso9660->entry_zisofs.pz)
+ return (zisofs_read_data(a, buff, size, offset));
+
+ *buff = __archive_read_ahead(a, 1, &bytes_read);
+ if (bytes_read == 0)
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Truncated input file");
+ if (*buff == NULL)
+ return (ARCHIVE_FATAL);
+ if (bytes_read > iso9660->entry_bytes_remaining)
+ bytes_read = iso9660->entry_bytes_remaining;
+ *size = bytes_read;
+ *offset = iso9660->entry_sparse_offset;
+ iso9660->entry_sparse_offset += bytes_read;
+ iso9660->entry_bytes_remaining -= bytes_read;
+ iso9660->current_position += bytes_read;
+ __archive_read_consume(a, bytes_read);
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_read_format_iso9660_cleanup(struct archive_read *a)
+{
+ struct iso9660 *iso9660;
+ int r = ARCHIVE_OK;
+
+ iso9660 = (struct iso9660 *)(a->format->data);
+ release_files(iso9660);
+ free(iso9660->read_ce_req.reqs);
+ archive_string_free(&iso9660->pathname);
+ archive_string_free(&iso9660->previous_pathname);
+ if (iso9660->pending_files.files)
+ free(iso9660->pending_files.files);
+ if (iso9660->re_dirs.files)
+ free(iso9660->re_dirs.files);
+ if (iso9660->cl_files.files)
+ free(iso9660->cl_files.files);
+#ifdef HAVE_ZLIB_H
+ free(iso9660->entry_zisofs.uncompressed_buffer);
+ free(iso9660->entry_zisofs.block_pointers);
+ if (iso9660->entry_zisofs.stream_valid) {
+ if (inflateEnd(&iso9660->entry_zisofs.stream) != Z_OK) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Failed to clean up zlib decompressor");
+ r = ARCHIVE_FATAL;
+ }
+ }
+#endif
+ free(iso9660);
+ (a->format->data) = NULL;
+ return (r);
+}
+
+/*
+ * This routine parses a single ISO directory record, makes sense
+ * of any extensions, and stores the result in memory.
+ */
+static struct file_info *
+parse_file_info(struct archive_read *a, struct file_info *parent,
+ const unsigned char *isodirrec)
+{
+ struct iso9660 *iso9660;
+ struct file_info *file;
+ size_t name_len;
+ const unsigned char *rr_start, *rr_end;
+ const unsigned char *p;
+ size_t dr_len;
+ int32_t location;
+ int flags;
+
+ iso9660 = (struct iso9660 *)(a->format->data);
+
+ dr_len = (size_t)isodirrec[DR_length_offset];
+ name_len = (size_t)isodirrec[DR_name_len_offset];
+ location = archive_le32dec(isodirrec + DR_extent_offset);
+ /* Sanity check that dr_len needs at least 34. */
+ if (dr_len < 34) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Invalid length of directory record");
+ return (NULL);
+ }
+ /* Sanity check that name_len doesn't exceed dr_len. */
+ if (dr_len - 33 < name_len || name_len == 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Invalid length of file identifier");
+ return (NULL);
+ }
+ /* Sanity check that location doesn't exceed volume block.
+ * Don't check lower limit of location; it's possibility
+ * the location has negative value when file type is symbolic
+ * link or file size is zero. As far as I know latest mkisofs
+ * do that.
+ */
+ if (location >= iso9660->volume_block) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Invalid location of extent of file");
+ return (NULL);
+ }
+
+ /* Create a new file entry and copy data from the ISO dir record. */
+ file = (struct file_info *)malloc(sizeof(*file));
+ if (file == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "No memory for file entry");
+ return (NULL);
+ }
+ memset(file, 0, sizeof(*file));
+ file->parent = parent;
+ file->offset = iso9660->logical_block_size * (uint64_t)location;
+ file->size = toi(isodirrec + DR_size_offset, DR_size_size);
+ file->mtime = isodate7(isodirrec + DR_date_offset);
+ file->ctime = file->atime = file->mtime;
+
+ p = isodirrec + DR_name_offset;
+ /* Rockridge extensions (if any) follow name. Compute this
+ * before fidgeting the name_len below. */
+ rr_start = p + name_len + (name_len & 1 ? 0 : 1);
+ rr_end = isodirrec + dr_len;
+
+ if (iso9660->seenJoliet) {
+ /* Joliet names are max 64 chars (128 bytes) according to spec,
+ * but genisoimage/mkisofs allows recording longer Joliet
+ * names which are 103 UCS2 characters(206 bytes) by their
+ * option '-joliet-long'.
+ */
+ wchar_t wbuff[103+1], *wp;
+ const unsigned char *c;
+
+ if (name_len > 206)
+ name_len = 206;
+ /* convert BE UTF-16 to wchar_t */
+ for (c = p, wp = wbuff;
+ c < (p + name_len) &&
+ wp < (wbuff + sizeof(wbuff)/sizeof(*wbuff) - 1);
+ c += 2) {
+ *wp++ = (((255 & (int)c[0]) << 8) | (255 & (int)c[1]));
+ }
+ *wp = L'\0';
+
+#if 0 /* untested code, is it at all useful on Joliet? */
+ /* trim trailing first version and dot from filename.
+ *
+ * Remember we where in UTF-16BE land!
+ * SEPARATOR 1 (.) and SEPARATOR 2 (;) are both
+ * 16 bits big endian characters on Joliet.
+ *
+ * TODO: sanitize filename?
+ * Joliet allows any UCS-2 char except:
+ * *, /, :, ;, ? and \.
+ */
+ /* Chop off trailing ';1' from files. */
+ if (*(wp-2) == ';' && *(wp-1) == '1') {
+ wp-=2;
+ *wp = L'\0';
+ }
+
+ /* Chop off trailing '.' from filenames. */
+ if (*(wp-1) == '.')
+ *(--wp) = L'\0';
+#endif
+
+ /* store the result in the file name field. */
+ archive_strappend_w_utf8(&file->name, wbuff);
+ } else {
+ /* Chop off trailing ';1' from files. */
+ if (name_len > 2 && p[name_len - 2] == ';' &&
+ p[name_len - 1] == '1')
+ name_len -= 2;
+ /* Chop off trailing '.' from filenames. */
+ if (name_len > 1 && p[name_len - 1] == '.')
+ --name_len;
+
+ archive_strncpy(&file->name, (const char *)p, name_len);
+ }
+
+ flags = isodirrec[DR_flags_offset];
+ if (flags & 0x02)
+ file->mode = AE_IFDIR | 0700;
+ else
+ file->mode = AE_IFREG | 0400;
+ if (flags & 0x80)
+ file->multi_extent = 1;
+ else
+ file->multi_extent = 0;
+ /*
+ * Use location for file number.
+ * File number is treated as inode number to find out harlink
+ * target. If Rockridge extensions is being used, file number
+ * will be overwritten by FILE SERIAL NUMBER of RRIP "PX"
+ * extension.
+ * NOTE: Old mkisofs did not record that FILE SERIAL NUMBER
+ * in ISO images.
+ */
+ if (file->size == 0 && location >= 0)
+ /* If file->size is zero, its location points wrong place.
+ * Dot not use it for file number.
+ * When location has negative value, it can be used
+ * for file number.
+ */
+ file->number = -1;
+ else
+ file->number = (int64_t)(uint32_t)location;
+
+ /* Rockridge extensions overwrite information from above. */
+ if (iso9660->opt_support_rockridge) {
+ if (parent == NULL && rr_end - rr_start >= 7) {
+ p = rr_start;
+ if (p[0] == 'S' && p[1] == 'P'
+ && p[2] == 7 && p[3] == 1
+ && p[4] == 0xBE && p[5] == 0xEF) {
+ /*
+ * SP extension stores the suspOffset
+ * (Number of bytes to skip between
+ * filename and SUSP records.)
+ * It is mandatory by the SUSP standard
+ * (IEEE 1281).
+ *
+ * It allows SUSP to coexist with
+ * non-SUSP uses of the System
+ * Use Area by placing non-SUSP data
+ * before SUSP data.
+ *
+ * SP extension must be in the root
+ * directory entry, disable all SUSP
+ * processing if not found.
+ */
+ iso9660->suspOffset = p[6];
+ iso9660->seenSUSP = 1;
+ rr_start += 7;
+ }
+ }
+ if (iso9660->seenSUSP) {
+ int r;
+
+ file->name_continues = 0;
+ file->symlink_continues = 0;
+ rr_start += iso9660->suspOffset;
+ r = parse_rockridge(a, file, rr_start, rr_end);
+ if (r != ARCHIVE_OK) {
+ free(file);
+ return (NULL);
+ }
+ } else
+ /* If there isn't SUSP, disable parsing
+ * rock ridge extensions. */
+ iso9660->opt_support_rockridge = 0;
+ }
+
+ file->nlinks = 1;/* Reset nlink. we'll calculate it later. */
+ /* Tell file's parent how many children that parent has. */
+ if (parent != NULL && (flags & 0x02) && file->cl_offset == 0)
+ parent->subdirs++;
+
+#if DEBUG
+ /* DEBUGGING: Warn about attributes I don't yet fully support. */
+ if ((flags & ~0x02) != 0) {
+ fprintf(stderr, "\n ** Unrecognized flag: ");
+ dump_isodirrec(stderr, isodirrec);
+ fprintf(stderr, "\n");
+ } else if (toi(isodirrec + DR_volume_sequence_number_offset, 2) != 1) {
+ fprintf(stderr, "\n ** Unrecognized sequence number: ");
+ dump_isodirrec(stderr, isodirrec);
+ fprintf(stderr, "\n");
+ } else if (*(isodirrec + DR_file_unit_size_offset) != 0) {
+ fprintf(stderr, "\n ** Unexpected file unit size: ");
+ dump_isodirrec(stderr, isodirrec);
+ fprintf(stderr, "\n");
+ } else if (*(isodirrec + DR_interleave_offset) != 0) {
+ fprintf(stderr, "\n ** Unexpected interleave: ");
+ dump_isodirrec(stderr, isodirrec);
+ fprintf(stderr, "\n");
+ } else if (*(isodirrec + DR_ext_attr_length_offset) != 0) {
+ fprintf(stderr, "\n ** Unexpected extended attribute length: ");
+ dump_isodirrec(stderr, isodirrec);
+ fprintf(stderr, "\n");
+ }
+#endif
+ register_file(iso9660, file);
+ return (file);
+}
+
+static int
+parse_rockridge(struct archive_read *a, struct file_info *file,
+ const unsigned char *p, const unsigned char *end)
+{
+ struct iso9660 *iso9660;
+
+ iso9660 = (struct iso9660 *)(a->format->data);
+
+ while (p + 4 <= end /* Enough space for another entry. */
+ && p[0] >= 'A' && p[0] <= 'Z' /* Sanity-check 1st char of name. */
+ && p[1] >= 'A' && p[1] <= 'Z' /* Sanity-check 2nd char of name. */
+ && p[2] >= 4 /* Sanity-check length. */
+ && p + p[2] <= end) { /* Sanity-check length. */
+ const unsigned char *data = p + 4;
+ int data_length = p[2] - 4;
+ int version = p[3];
+
+ /*
+ * Yes, each 'if' here does test p[0] again.
+ * Otherwise, the fall-through handling to catch
+ * unsupported extensions doesn't work.
+ */
+ switch(p[0]) {
+ case 'C':
+ if (p[0] == 'C' && p[1] == 'E') {
+ if (version == 1 && data_length == 24) {
+ /*
+ * CE extension comprises:
+ * 8 byte sector containing extension
+ * 8 byte offset w/in above sector
+ * 8 byte length of continuation
+ */
+ int32_t location =
+ archive_le32dec(data);
+ file->ce_offset =
+ archive_le32dec(data+8);
+ file->ce_size =
+ archive_le32dec(data+16);
+ if (register_CE(a, location, file)
+ != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+ }
+ break;
+ }
+ if (p[0] == 'C' && p[1] == 'L') {
+ if (version == 1 && data_length == 8) {
+ file->cl_offset = (uint64_t)
+ iso9660->logical_block_size *
+ (uint64_t)archive_le32dec(data);
+ iso9660->seenRockridge = 1;
+ }
+ break;
+ }
+ /* FALLTHROUGH */
+ case 'N':
+ if (p[0] == 'N' && p[1] == 'M') {
+ if (version == 1) {
+ parse_rockridge_NM1(file,
+ data, data_length);
+ iso9660->seenRockridge = 1;
+ }
+ break;
+ }
+ /* FALLTHROUGH */
+ case 'P':
+ if (p[0] == 'P' && p[1] == 'D') {
+ /*
+ * PD extension is padding;
+ * contents are always ignored.
+ */
+ break;
+ }
+ if (p[0] == 'P' && p[1] == 'N') {
+ if (version == 1 && data_length == 16) {
+ file->rdev = toi(data,4);
+ file->rdev <<= 32;
+ file->rdev |= toi(data + 8, 4);
+ iso9660->seenRockridge = 1;
+ }
+ break;
+ }
+ if (p[0] == 'P' && p[1] == 'X') {
+ /*
+ * PX extension comprises:
+ * 8 bytes for mode,
+ * 8 bytes for nlinks,
+ * 8 bytes for uid,
+ * 8 bytes for gid,
+ * 8 bytes for inode.
+ */
+ if (version == 1) {
+ if (data_length >= 8)
+ file->mode
+ = toi(data, 4);
+ if (data_length >= 16)
+ file->nlinks
+ = toi(data + 8, 4);
+ if (data_length >= 24)
+ file->uid
+ = toi(data + 16, 4);
+ if (data_length >= 32)
+ file->gid
+ = toi(data + 24, 4);
+ if (data_length >= 40)
+ file->number
+ = toi(data + 32, 4);
+ iso9660->seenRockridge = 1;
+ }
+ break;
+ }
+ /* FALLTHROUGH */
+ case 'R':
+ if (p[0] == 'R' && p[1] == 'E' && version == 1) {
+ file->re = 1;
+ iso9660->seenRockridge = 1;
+ break;
+ }
+ if (p[0] == 'R' && p[1] == 'R' && version == 1) {
+ /*
+ * RR extension comprises:
+ * one byte flag value
+ * This extension is obsolete,
+ * so contents are always ignored.
+ */
+ break;
+ }
+ /* FALLTHROUGH */
+ case 'S':
+ if (p[0] == 'S' && p[1] == 'L') {
+ if (version == 1) {
+ parse_rockridge_SL1(file,
+ data, data_length);
+ iso9660->seenRockridge = 1;
+ }
+ break;
+ }
+ if (p[0] == 'S' && p[1] == 'T'
+ && data_length == 0 && version == 1) {
+ /*
+ * ST extension marks end of this
+ * block of SUSP entries.
+ *
+ * It allows SUSP to coexist with
+ * non-SUSP uses of the System
+ * Use Area by placing non-SUSP data
+ * after SUSP data.
+ */
+ iso9660->seenSUSP = 0;
+ iso9660->seenRockridge = 0;
+ return (ARCHIVE_OK);
+ }
+ case 'T':
+ if (p[0] == 'T' && p[1] == 'F') {
+ if (version == 1) {
+ parse_rockridge_TF1(file,
+ data, data_length);
+ iso9660->seenRockridge = 1;
+ }
+ break;
+ }
+ /* FALLTHROUGH */
+ case 'Z':
+ if (p[0] == 'Z' && p[1] == 'F') {
+ if (version == 1)
+ parse_rockridge_ZF1(file,
+ data, data_length);
+ break;
+ }
+ /* FALLTHROUGH */
+ default:
+ /* The FALLTHROUGHs above leave us here for
+ * any unsupported extension. */
+ break;
+ }
+
+
+
+ p += p[2];
+ }
+ return (ARCHIVE_OK);
+}
+
+static int
+register_CE(struct archive_read *a, int32_t location,
+ struct file_info *file)
+{
+ struct iso9660 *iso9660;
+ struct read_ce_queue *heap;
+ struct read_ce_req *p;
+ uint64_t offset, parent_offset;
+ int hole, parent;
+
+ iso9660 = (struct iso9660 *)(a->format->data);
+ offset = ((uint64_t)location) * (uint64_t)iso9660->logical_block_size;
+ if (((file->mode & AE_IFMT) == AE_IFREG &&
+ offset >= file->offset) ||
+ offset < iso9660->current_position) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Invalid location in SUSP \"CE\" extension");
+ return (ARCHIVE_FATAL);
+ }
+
+ /* Expand our CE list as necessary. */
+ heap = &(iso9660->read_ce_req);
+ if (heap->cnt >= heap->allocated) {
+ int new_size;
+
+ if (heap->allocated < 16)
+ new_size = 16;
+ else
+ new_size = heap->allocated * 2;
+ /* Overflow might keep us from growing the list. */
+ if (new_size <= heap->allocated)
+ __archive_errx(1, "Out of memory");
+ p = malloc(new_size * sizeof(p[0]));
+ if (p == NULL)
+ __archive_errx(1, "Out of memory");
+ if (heap->reqs != NULL) {
+ memcpy(p, heap->reqs, heap->cnt * sizeof(*p));
+ free(heap->reqs);
+ }
+ heap->reqs = p;
+ heap->allocated = new_size;
+ }
+
+ /*
+ * Start with hole at end, walk it up tree to find insertion point.
+ */
+ hole = heap->cnt++;
+ while (hole > 0) {
+ parent = (hole - 1)/2;
+ parent_offset = heap->reqs[parent].offset;
+ if (offset >= parent_offset) {
+ heap->reqs[hole].offset = offset;
+ heap->reqs[hole].file = file;
+ return (ARCHIVE_OK);
+ }
+ // Move parent into hole <==> move hole up tree.
+ heap->reqs[hole] = heap->reqs[parent];
+ hole = parent;
+ }
+ heap->reqs[0].offset = offset;
+ heap->reqs[0].file = file;
+ return (ARCHIVE_OK);
+}
+
+static void
+next_CE(struct read_ce_queue *heap)
+{
+ uint64_t a_offset, b_offset, c_offset;
+ int a, b, c;
+ struct read_ce_req tmp;
+
+ if (heap->cnt < 1)
+ return;
+
+ /*
+ * Move the last item in the heap to the root of the tree
+ */
+ heap->reqs[0] = heap->reqs[--(heap->cnt)];
+
+ /*
+ * Rebalance the heap.
+ */
+ a = 0; // Starting element and its offset
+ a_offset = heap->reqs[a].offset;
+ for (;;) {
+ b = a + a + 1; // First child
+ if (b >= heap->cnt)
+ return;
+ b_offset = heap->reqs[b].offset;
+ c = b + 1; // Use second child if it is smaller.
+ if (c < heap->cnt) {
+ c_offset = heap->reqs[c].offset;
+ if (c_offset < b_offset) {
+ b = c;
+ b_offset = c_offset;
+ }
+ }
+ if (a_offset <= b_offset)
+ return;
+ tmp = heap->reqs[a];
+ heap->reqs[a] = heap->reqs[b];
+ heap->reqs[b] = tmp;
+ a = b;
+ }
+}
+
+
+static int
+read_CE(struct archive_read *a, struct iso9660 *iso9660)
+{
+ struct read_ce_queue *heap;
+ const unsigned char *b, *p, *end;
+ struct file_info *file;
+ size_t step;
+ int r;
+
+ /* Read data which RRIP "CE" extension points. */
+ heap = &(iso9660->read_ce_req);
+ step = iso9660->logical_block_size;
+ while (heap->cnt &&
+ heap->reqs[0].offset == iso9660->current_position) {
+ b = __archive_read_ahead(a, step, NULL);
+ if (b == NULL) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_MISC,
+ "Failed to read full block when scanning "
+ "ISO9660 directory list");
+ return (ARCHIVE_FATAL);
+ }
+ do {
+ file = heap->reqs[0].file;
+ p = b + file->ce_offset;
+ end = p + file->ce_size;
+ next_CE(heap);
+ r = parse_rockridge(a, file, p, end);
+ if (r != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+ } while (heap->cnt &&
+ heap->reqs[0].offset == iso9660->current_position);
+ /* NOTE: Do not move this consume's code to fron of
+ * do-while loop. Registration of nested CE extension
+ * might cause error because of current position. */
+ __archive_read_consume(a, step);
+ iso9660->current_position += step;
+ }
+ return (ARCHIVE_OK);
+}
+
+static void
+parse_rockridge_NM1(struct file_info *file,
+ const unsigned char *data, int data_length)
+{
+ if (!file->name_continues)
+ archive_string_empty(&file->name);
+ file->name_continues = 0;
+ if (data_length < 1)
+ return;
+ /*
+ * NM version 1 extension comprises:
+ * 1 byte flag, value is one of:
+ * = 0: remainder is name
+ * = 1: remainder is name, next NM entry continues name
+ * = 2: "."
+ * = 4: ".."
+ * = 32: Implementation specific
+ * All other values are reserved.
+ */
+ switch(data[0]) {
+ case 0:
+ if (data_length < 2)
+ return;
+ archive_strncat(&file->name, (const char *)data + 1, data_length - 1);
+ break;
+ case 1:
+ if (data_length < 2)
+ return;
+ archive_strncat(&file->name, (const char *)data + 1, data_length - 1);
+ file->name_continues = 1;
+ break;
+ case 2:
+ archive_strcat(&file->name, ".");
+ break;
+ case 4:
+ archive_strcat(&file->name, "..");
+ break;
+ default:
+ return;
+ }
+
+}
+
+static void
+parse_rockridge_TF1(struct file_info *file, const unsigned char *data,
+ int data_length)
+{
+ char flag;
+ /*
+ * TF extension comprises:
+ * one byte flag
+ * create time (optional)
+ * modify time (optional)
+ * access time (optional)
+ * attribute time (optional)
+ * Time format and presence of fields
+ * is controlled by flag bits.
+ */
+ if (data_length < 1)
+ return;
+ flag = data[0];
+ ++data;
+ --data_length;
+ if (flag & 0x80) {
+ /* Use 17-byte time format. */
+ if ((flag & 1) && data_length >= 17) {
+ /* Create time. */
+ file->birthtime_is_set = 1;
+ file->birthtime = isodate17(data);
+ data += 17;
+ data_length -= 17;
+ }
+ if ((flag & 2) && data_length >= 17) {
+ /* Modify time. */
+ file->mtime = isodate17(data);
+ data += 17;
+ data_length -= 17;
+ }
+ if ((flag & 4) && data_length >= 17) {
+ /* Access time. */
+ file->atime = isodate17(data);
+ data += 17;
+ data_length -= 17;
+ }
+ if ((flag & 8) && data_length >= 17) {
+ /* Attribute change time. */
+ file->ctime = isodate17(data);
+ }
+ } else {
+ /* Use 7-byte time format. */
+ if ((flag & 1) && data_length >= 7) {
+ /* Create time. */
+ file->birthtime_is_set = 1;
+ file->birthtime = isodate7(data);
+ data += 7;
+ data_length -= 7;
+ }
+ if ((flag & 2) && data_length >= 7) {
+ /* Modify time. */
+ file->mtime = isodate7(data);
+ data += 7;
+ data_length -= 7;
+ }
+ if ((flag & 4) && data_length >= 7) {
+ /* Access time. */
+ file->atime = isodate7(data);
+ data += 7;
+ data_length -= 7;
+ }
+ if ((flag & 8) && data_length >= 7) {
+ /* Attribute change time. */
+ file->ctime = isodate7(data);
+ }
+ }
+}
+
+static void
+parse_rockridge_SL1(struct file_info *file, const unsigned char *data,
+ int data_length)
+{
+ const char *separator = "";
+
+ if (!file->symlink_continues || file->symlink.length < 1)
+ archive_string_empty(&file->symlink);
+ else if (!file->symlink_continues &&
+ file->symlink.s[file->symlink.length - 1] != '/')
+ separator = "/";
+ file->symlink_continues = 0;
+
+ /*
+ * Defined flag values:
+ * 0: This is the last SL record for this symbolic link
+ * 1: this symbolic link field continues in next SL entry
+ * All other values are reserved.
+ */
+ if (data_length < 1)
+ return;
+ switch(*data) {
+ case 0:
+ break;
+ case 1:
+ file->symlink_continues = 1;
+ break;
+ default:
+ return;
+ }
+ ++data; /* Skip flag byte. */
+ --data_length;
+
+ /*
+ * SL extension body stores "components".
+ * Basically, this is a complicated way of storing
+ * a POSIX path. It also interferes with using
+ * symlinks for storing non-path data. <sigh>
+ *
+ * Each component is 2 bytes (flag and length)
+ * possibly followed by name data.
+ */
+ while (data_length >= 2) {
+ unsigned char flag = *data++;
+ unsigned char nlen = *data++;
+ data_length -= 2;
+
+ archive_strcat(&file->symlink, separator);
+ separator = "/";
+
+ switch(flag) {
+ case 0: /* Usual case, this is text. */
+ if (data_length < nlen)
+ return;
+ archive_strncat(&file->symlink,
+ (const char *)data, nlen);
+ break;
+ case 0x01: /* Text continues in next component. */
+ if (data_length < nlen)
+ return;
+ archive_strncat(&file->symlink,
+ (const char *)data, nlen);
+ separator = "";
+ break;
+ case 0x02: /* Current dir. */
+ archive_strcat(&file->symlink, ".");
+ break;
+ case 0x04: /* Parent dir. */
+ archive_strcat(&file->symlink, "..");
+ break;
+ case 0x08: /* Root of filesystem. */
+ archive_strcat(&file->symlink, "/");
+ separator = "";
+ break;
+ case 0x10: /* Undefined (historically "volume root" */
+ archive_string_empty(&file->symlink);
+ archive_strcat(&file->symlink, "ROOT");
+ break;
+ case 0x20: /* Undefined (historically "hostname") */
+ archive_strcat(&file->symlink, "hostname");
+ break;
+ default:
+ /* TODO: issue a warning ? */
+ return;
+ }
+ data += nlen;
+ data_length -= nlen;
+ }
+}
+
+static void
+parse_rockridge_ZF1(struct file_info *file, const unsigned char *data,
+ int data_length)
+{
+
+ if (data[0] == 0x70 && data[1] == 0x7a && data_length == 12) {
+ /* paged zlib */
+ file->pz = 1;
+ file->pz_log2_bs = data[3];
+ file->pz_uncompressed_size = archive_le32dec(&data[4]);
+ }
+}
+
+static void
+register_file(struct iso9660 *iso9660, struct file_info *file)
+{
+
+ file->use_next = iso9660->use_files;
+ iso9660->use_files = file;
+}
+
+static void
+release_files(struct iso9660 *iso9660)
+{
+ struct content *con, *connext;
+ struct file_info *file;
+
+ file = iso9660->use_files;
+ while (file != NULL) {
+ struct file_info *next = file->use_next;
+
+ archive_string_free(&file->name);
+ archive_string_free(&file->symlink);
+ con = file->contents.first;
+ while (con != NULL) {
+ connext = con->next;
+ free(con);
+ con = connext;
+ }
+ free(file);
+ file = next;
+ }
+}
+
+static int
+next_entry_seek(struct archive_read *a, struct iso9660 *iso9660,
+ struct file_info **pfile)
+{
+ struct file_info *file;
+
+ *pfile = file = next_cache_entry(iso9660);
+ if (file == NULL)
+ return (ARCHIVE_EOF);
+
+ /* Don't waste time seeking for zero-length bodies. */
+ if (file->size == 0)
+ file->offset = iso9660->current_position;
+
+ /* Seek forward to the start of the entry. */
+ if (iso9660->current_position < file->offset) {
+ int64_t step;
+
+ step = file->offset - iso9660->current_position;
+ step = __archive_read_skip(a, step);
+ if (step < 0)
+ return ((int)step);
+ iso9660->current_position = file->offset;
+ }
+
+ /* We found body of file; handle it now. */
+ return (ARCHIVE_OK);
+}
+
+static struct file_info *
+next_cache_entry(struct iso9660 *iso9660)
+{
+ struct file_info *file;
+ struct {
+ struct file_info *first;
+ struct file_info **last;
+ } empty_files;
+ int64_t number;
+ int count;
+
+ file = cache_get_entry(iso9660);
+ if (file != NULL) {
+ while (file->parent != NULL && !file->parent->exposed) {
+ /* If file's parent is not exposed, it's moved
+ * to next entry of its parent. */
+ cache_add_to_next_of_parent(iso9660, file);
+ file = cache_get_entry(iso9660);
+ }
+ return (file);
+ }
+
+ file = next_entry(iso9660);
+ if (file == NULL)
+ return (NULL);
+
+ if ((file->mode & AE_IFMT) != AE_IFREG || file->number == -1)
+ return (file);
+
+ count = 0;
+ number = file->number;
+ iso9660->cache_files.first = NULL;
+ iso9660->cache_files.last = &(iso9660->cache_files.first);
+ empty_files.first = NULL;
+ empty_files.last = &empty_files.first;
+ /* Collect files which has the same file serial number.
+ * Peek pending_files so that file which number is different
+ * is not put bak. */
+ while (iso9660->pending_files.used > 0 &&
+ (iso9660->pending_files.files[0]->number == -1 ||
+ iso9660->pending_files.files[0]->number == number)) {
+ if (file->number == -1) {
+ /* This file has the same offset
+ * but it's wrong offset which empty files
+ * and symlink files have.
+ * NOTE: This wrong offse was recorded by
+ * old mkisofs utility. If ISO images is
+ * created by latest mkisofs, this does not
+ * happen.
+ */
+ file->next = NULL;
+ *empty_files.last = file;
+ empty_files.last = &(file->next);
+ } else {
+ count++;
+ cache_add_entry(iso9660, file);
+ }
+ file = next_entry(iso9660);
+ }
+
+ if (count == 0)
+ return (file);
+ if (file->number == -1) {
+ file->next = NULL;
+ *empty_files.last = file;
+ empty_files.last = &(file->next);
+ } else {
+ count++;
+ cache_add_entry(iso9660, file);
+ }
+
+ if (count > 1) {
+ /* The count is the same as number of hardlink,
+ * so much so that each nlinks of files in cache_file
+ * is overwritten by value of the count.
+ */
+ for (file = iso9660->cache_files.first;
+ file != NULL; file = file->next)
+ file->nlinks = count;
+ }
+ /* If there are empty files, that files are added
+ * to the tail of the cache_files. */
+ if (empty_files.first != NULL) {
+ *iso9660->cache_files.last = empty_files.first;
+ iso9660->cache_files.last = empty_files.last;
+ }
+ return (cache_get_entry(iso9660));
+}
+
+static inline void
+cache_add_entry(struct iso9660 *iso9660, struct file_info *file)
+{
+ file->next = NULL;
+ *iso9660->cache_files.last = file;
+ iso9660->cache_files.last = &(file->next);
+}
+
+static inline void
+cache_add_to_next_of_parent(struct iso9660 *iso9660, struct file_info *file)
+{
+ file->next = file->parent->next;
+ file->parent->next = file;
+ if (iso9660->cache_files.last == &(file->parent->next))
+ iso9660->cache_files.last = &(file->next);
+}
+
+static inline struct file_info *
+cache_get_entry(struct iso9660 *iso9660)
+{
+ struct file_info *file;
+
+ if ((file = iso9660->cache_files.first) != NULL) {
+ iso9660->cache_files.first = file->next;
+ if (iso9660->cache_files.first == NULL)
+ iso9660->cache_files.last = &(iso9660->cache_files.first);
+ }
+ return (file);
+}
+
+static void
+heap_add_entry(struct heap_queue *heap, struct file_info *file, uint64_t key)
+{
+ uint64_t file_key, parent_key;
+ int hole, parent;
+
+ /* Expand our pending files list as necessary. */
+ if (heap->used >= heap->allocated) {
+ struct file_info **new_pending_files;
+ int new_size = heap->allocated * 2;
+
+ if (heap->allocated < 1024)
+ new_size = 1024;
+ /* Overflow might keep us from growing the list. */
+ if (new_size <= heap->allocated)
+ __archive_errx(1, "Out of memory");
+ new_pending_files = (struct file_info **)
+ malloc(new_size * sizeof(new_pending_files[0]));
+ if (new_pending_files == NULL)
+ __archive_errx(1, "Out of memory");
+ memcpy(new_pending_files, heap->files,
+ heap->allocated * sizeof(new_pending_files[0]));
+ if (heap->files != NULL)
+ free(heap->files);
+ heap->files = new_pending_files;
+ heap->allocated = new_size;
+ }
+
+ file_key = file->key = key;
+
+ /*
+ * Start with hole at end, walk it up tree to find insertion point.
+ */
+ hole = heap->used++;
+ while (hole > 0) {
+ parent = (hole - 1)/2;
+ parent_key = heap->files[parent]->key;
+ if (file_key >= parent_key) {
+ heap->files[hole] = file;
+ return;
+ }
+ // Move parent into hole <==> move hole up tree.
+ heap->files[hole] = heap->files[parent];
+ hole = parent;
+ }
+ heap->files[0] = file;
+}
+
+static struct file_info *
+heap_get_entry(struct heap_queue *heap)
+{
+ uint64_t a_key, b_key, c_key;
+ int a, b, c;
+ struct file_info *r, *tmp;
+
+ if (heap->used < 1)
+ return (NULL);
+
+ /*
+ * The first file in the list is the earliest; we'll return this.
+ */
+ r = heap->files[0];
+
+ /*
+ * Move the last item in the heap to the root of the tree
+ */
+ heap->files[0] = heap->files[--(heap->used)];
+
+ /*
+ * Rebalance the heap.
+ */
+ a = 0; // Starting element and its heap key
+ a_key = heap->files[a]->key;
+ for (;;) {
+ b = a + a + 1; // First child
+ if (b >= heap->used)
+ return (r);
+ b_key = heap->files[b]->key;
+ c = b + 1; // Use second child if it is smaller.
+ if (c < heap->used) {
+ c_key = heap->files[c]->key;
+ if (c_key < b_key) {
+ b = c;
+ b_key = c_key;
+ }
+ }
+ if (a_key <= b_key)
+ return (r);
+ tmp = heap->files[a];
+ heap->files[a] = heap->files[b];
+ heap->files[b] = tmp;
+ a = b;
+ }
+}
+
+static unsigned int
+toi(const void *p, int n)
+{
+ const unsigned char *v = (const unsigned char *)p;
+ if (n > 1)
+ return v[0] + 256 * toi(v + 1, n - 1);
+ if (n == 1)
+ return v[0];
+ return (0);
+}
+
+static time_t
+isodate7(const unsigned char *v)
+{
+ struct tm tm;
+ int offset;
+ memset(&tm, 0, sizeof(tm));
+ tm.tm_year = v[0];
+ tm.tm_mon = v[1] - 1;
+ tm.tm_mday = v[2];
+ tm.tm_hour = v[3];
+ tm.tm_min = v[4];
+ tm.tm_sec = v[5];
+ /* v[6] is the signed timezone offset, in 1/4-hour increments. */
+ offset = ((const signed char *)v)[6];
+ if (offset > -48 && offset < 52) {
+ tm.tm_hour -= offset / 4;
+ tm.tm_min -= (offset % 4) * 15;
+ }
+ return (time_from_tm(&tm));
+}
+
+static time_t
+isodate17(const unsigned char *v)
+{
+ struct tm tm;
+ int offset;
+ memset(&tm, 0, sizeof(tm));
+ tm.tm_year = (v[0] - '0') * 1000 + (v[1] - '0') * 100
+ + (v[2] - '0') * 10 + (v[3] - '0')
+ - 1900;
+ tm.tm_mon = (v[4] - '0') * 10 + (v[5] - '0');
+ tm.tm_mday = (v[6] - '0') * 10 + (v[7] - '0');
+ tm.tm_hour = (v[8] - '0') * 10 + (v[9] - '0');
+ tm.tm_min = (v[10] - '0') * 10 + (v[11] - '0');
+ tm.tm_sec = (v[12] - '0') * 10 + (v[13] - '0');
+ /* v[16] is the signed timezone offset, in 1/4-hour increments. */
+ offset = ((const signed char *)v)[16];
+ if (offset > -48 && offset < 52) {
+ tm.tm_hour -= offset / 4;
+ tm.tm_min -= (offset % 4) * 15;
+ }
+ return (time_from_tm(&tm));
+}
+
+static time_t
+time_from_tm(struct tm *t)
+{
+#if HAVE_TIMEGM
+ /* Use platform timegm() if available. */
+ return (timegm(t));
+#else
+ /* Else use direct calculation using POSIX assumptions. */
+ /* First, fix up tm_yday based on the year/month/day. */
+ mktime(t);
+ /* Then we can compute timegm() from first principles. */
+ return (t->tm_sec + t->tm_min * 60 + t->tm_hour * 3600
+ + t->tm_yday * 86400 + (t->tm_year - 70) * 31536000
+ + ((t->tm_year - 69) / 4) * 86400 -
+ ((t->tm_year - 1) / 100) * 86400
+ + ((t->tm_year + 299) / 400) * 86400);
+#endif
+}
+
+static const char *
+build_pathname(struct archive_string *as, struct file_info *file)
+{
+ if (file->parent != NULL && archive_strlen(&file->parent->name) > 0) {
+ build_pathname(as, file->parent);
+ archive_strcat(as, "/");
+ }
+ if (archive_strlen(&file->name) == 0)
+ archive_strcat(as, ".");
+ else
+ archive_string_concat(as, &file->name);
+ return (as->s);
+}
+
+#if DEBUG
+static void
+dump_isodirrec(FILE *out, const unsigned char *isodirrec)
+{
+ fprintf(out, " l %d,",
+ toi(isodirrec + DR_length_offset, DR_length_size));
+ fprintf(out, " a %d,",
+ toi(isodirrec + DR_ext_attr_length_offset, DR_ext_attr_length_size));
+ fprintf(out, " ext 0x%x,",
+ toi(isodirrec + DR_extent_offset, DR_extent_size));
+ fprintf(out, " s %d,",
+ toi(isodirrec + DR_size_offset, DR_extent_size));
+ fprintf(out, " f 0x%02x,",
+ toi(isodirrec + DR_flags_offset, DR_flags_size));
+ fprintf(out, " u %d,",
+ toi(isodirrec + DR_file_unit_size_offset, DR_file_unit_size_size));
+ fprintf(out, " ilv %d,",
+ toi(isodirrec + DR_interleave_offset, DR_interleave_size));
+ fprintf(out, " seq %d,",
+ toi(isodirrec + DR_volume_sequence_number_offset, DR_volume_sequence_number_size));
+ fprintf(out, " nl %d:",
+ toi(isodirrec + DR_name_len_offset, DR_name_len_size));
+ fprintf(out, " `%.*s'",
+ toi(isodirrec + DR_name_len_offset, DR_name_len_size), isodirrec + DR_name_offset);
+}
+#endif
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c b/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c
new file mode 100644
index 00000000000..f83ebe53339
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_mtree.c
@@ -0,0 +1,1304 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * Copyright (c) 2008 Joerg Sonnenberger
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_mtree.c 201165 2009-12-29 05:52:13Z kientzle $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#include <stddef.h>
+/* #include <stdint.h> */ /* See archive_platform.h */
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+#include "archive_string.h"
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+#define MTREE_HAS_DEVICE 0x0001
+#define MTREE_HAS_FFLAGS 0x0002
+#define MTREE_HAS_GID 0x0004
+#define MTREE_HAS_GNAME 0x0008
+#define MTREE_HAS_MTIME 0x0010
+#define MTREE_HAS_NLINK 0x0020
+#define MTREE_HAS_PERM 0x0040
+#define MTREE_HAS_SIZE 0x0080
+#define MTREE_HAS_TYPE 0x0100
+#define MTREE_HAS_UID 0x0200
+#define MTREE_HAS_UNAME 0x0400
+
+#define MTREE_HAS_OPTIONAL 0x0800
+
+struct mtree_option {
+ struct mtree_option *next;
+ char *value;
+};
+
+struct mtree_entry {
+ struct mtree_entry *next;
+ struct mtree_option *options;
+ char *name;
+ char full;
+ char used;
+};
+
+struct mtree {
+ struct archive_string line;
+ size_t buffsize;
+ char *buff;
+ off_t offset;
+ int fd;
+ int filetype;
+ int archive_format;
+ const char *archive_format_name;
+ struct mtree_entry *entries;
+ struct mtree_entry *this_entry;
+ struct archive_string current_dir;
+ struct archive_string contents_name;
+
+ struct archive_entry_linkresolver *resolver;
+
+ off_t cur_size, cur_offset;
+};
+
+static int cleanup(struct archive_read *);
+static int mtree_bid(struct archive_read *);
+static int parse_file(struct archive_read *, struct archive_entry *,
+ struct mtree *, struct mtree_entry *, int *);
+static void parse_escapes(char *, struct mtree_entry *);
+static int parse_line(struct archive_read *, struct archive_entry *,
+ struct mtree *, struct mtree_entry *, int *);
+static int parse_keyword(struct archive_read *, struct mtree *,
+ struct archive_entry *, struct mtree_option *, int *);
+static int read_data(struct archive_read *a,
+ const void **buff, size_t *size, off_t *offset);
+static ssize_t readline(struct archive_read *, struct mtree *, char **, ssize_t);
+static int skip(struct archive_read *a);
+static int read_header(struct archive_read *,
+ struct archive_entry *);
+static int64_t mtree_atol10(char **);
+static int64_t mtree_atol8(char **);
+static int64_t mtree_atol(char **);
+
+static void
+free_options(struct mtree_option *head)
+{
+ struct mtree_option *next;
+
+ for (; head != NULL; head = next) {
+ next = head->next;
+ free(head->value);
+ free(head);
+ }
+}
+
+int
+archive_read_support_format_mtree(struct archive *_a)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ struct mtree *mtree;
+ int r;
+
+ mtree = (struct mtree *)malloc(sizeof(*mtree));
+ if (mtree == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate mtree data");
+ return (ARCHIVE_FATAL);
+ }
+ memset(mtree, 0, sizeof(*mtree));
+ mtree->fd = -1;
+
+ r = __archive_read_register_format(a, mtree, "mtree",
+ mtree_bid, NULL, read_header, read_data, skip, cleanup);
+
+ if (r != ARCHIVE_OK)
+ free(mtree);
+ return (ARCHIVE_OK);
+}
+
+static int
+cleanup(struct archive_read *a)
+{
+ struct mtree *mtree;
+ struct mtree_entry *p, *q;
+
+ mtree = (struct mtree *)(a->format->data);
+
+ p = mtree->entries;
+ while (p != NULL) {
+ q = p->next;
+ free(p->name);
+ free_options(p->options);
+ free(p);
+ p = q;
+ }
+ archive_string_free(&mtree->line);
+ archive_string_free(&mtree->current_dir);
+ archive_string_free(&mtree->contents_name);
+ archive_entry_linkresolver_free(mtree->resolver);
+
+ free(mtree->buff);
+ free(mtree);
+ (a->format->data) = NULL;
+ return (ARCHIVE_OK);
+}
+
+
+static int
+mtree_bid(struct archive_read *a)
+{
+ const char *signature = "#mtree";
+ const char *p;
+
+ /* Now let's look at the actual header and see if it matches. */
+ p = __archive_read_ahead(a, strlen(signature), NULL);
+ if (p == NULL)
+ return (-1);
+
+ if (strncmp(p, signature, strlen(signature)) == 0)
+ return (8 * (int)strlen(signature));
+ return (0);
+}
+
+/*
+ * The extended mtree format permits multiple lines specifying
+ * attributes for each file. For those entries, only the last line
+ * is actually used. Practically speaking, that means we have
+ * to read the entire mtree file into memory up front.
+ *
+ * The parsing is done in two steps. First, it is decided if a line
+ * changes the global defaults and if it is, processed accordingly.
+ * Otherwise, the options of the line are merged with the current
+ * global options.
+ */
+static int
+add_option(struct archive_read *a, struct mtree_option **global,
+ const char *value, size_t len)
+{
+ struct mtree_option *option;
+
+ if ((option = malloc(sizeof(*option))) == NULL) {
+ archive_set_error(&a->archive, errno, "Can't allocate memory");
+ return (ARCHIVE_FATAL);
+ }
+ if ((option->value = malloc(len + 1)) == NULL) {
+ free(option);
+ archive_set_error(&a->archive, errno, "Can't allocate memory");
+ return (ARCHIVE_FATAL);
+ }
+ memcpy(option->value, value, len);
+ option->value[len] = '\0';
+ option->next = *global;
+ *global = option;
+ return (ARCHIVE_OK);
+}
+
+static void
+remove_option(struct mtree_option **global, const char *value, size_t len)
+{
+ struct mtree_option *iter, *last;
+
+ last = NULL;
+ for (iter = *global; iter != NULL; last = iter, iter = iter->next) {
+ if (strncmp(iter->value, value, len) == 0 &&
+ (iter->value[len] == '\0' ||
+ iter->value[len] == '='))
+ break;
+ }
+ if (iter == NULL)
+ return;
+ if (last == NULL)
+ *global = iter->next;
+ else
+ last->next = iter->next;
+
+ free(iter->value);
+ free(iter);
+}
+
+static int
+process_global_set(struct archive_read *a,
+ struct mtree_option **global, const char *line)
+{
+ const char *next, *eq;
+ size_t len;
+ int r;
+
+ line += 4;
+ for (;;) {
+ next = line + strspn(line, " \t\r\n");
+ if (*next == '\0')
+ return (ARCHIVE_OK);
+ line = next;
+ next = line + strcspn(line, " \t\r\n");
+ eq = strchr(line, '=');
+ if (eq > next)
+ len = next - line;
+ else
+ len = eq - line;
+
+ remove_option(global, line, len);
+ r = add_option(a, global, line, next - line);
+ if (r != ARCHIVE_OK)
+ return (r);
+ line = next;
+ }
+}
+
+static int
+process_global_unset(struct archive_read *a,
+ struct mtree_option **global, const char *line)
+{
+ const char *next;
+ size_t len;
+
+ line += 6;
+ if (strchr(line, '=') != NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "/unset shall not contain `='");
+ return ARCHIVE_FATAL;
+ }
+
+ for (;;) {
+ next = line + strspn(line, " \t\r\n");
+ if (*next == '\0')
+ return (ARCHIVE_OK);
+ line = next;
+ len = strcspn(line, " \t\r\n");
+
+ if (len == 3 && strncmp(line, "all", 3) == 0) {
+ free_options(*global);
+ *global = NULL;
+ } else {
+ remove_option(global, line, len);
+ }
+
+ line += len;
+ }
+}
+
+static int
+process_add_entry(struct archive_read *a, struct mtree *mtree,
+ struct mtree_option **global, const char *line,
+ struct mtree_entry **last_entry)
+{
+ struct mtree_entry *entry;
+ struct mtree_option *iter;
+ const char *next, *eq;
+ size_t len;
+ int r;
+
+ if ((entry = malloc(sizeof(*entry))) == NULL) {
+ archive_set_error(&a->archive, errno, "Can't allocate memory");
+ return (ARCHIVE_FATAL);
+ }
+ entry->next = NULL;
+ entry->options = NULL;
+ entry->name = NULL;
+ entry->used = 0;
+ entry->full = 0;
+
+ /* Add this entry to list. */
+ if (*last_entry == NULL)
+ mtree->entries = entry;
+ else
+ (*last_entry)->next = entry;
+ *last_entry = entry;
+
+ len = strcspn(line, " \t\r\n");
+ if ((entry->name = malloc(len + 1)) == NULL) {
+ archive_set_error(&a->archive, errno, "Can't allocate memory");
+ return (ARCHIVE_FATAL);
+ }
+
+ memcpy(entry->name, line, len);
+ entry->name[len] = '\0';
+ parse_escapes(entry->name, entry);
+
+ line += len;
+ for (iter = *global; iter != NULL; iter = iter->next) {
+ r = add_option(a, &entry->options, iter->value,
+ strlen(iter->value));
+ if (r != ARCHIVE_OK)
+ return (r);
+ }
+
+ for (;;) {
+ next = line + strspn(line, " \t\r\n");
+ if (*next == '\0')
+ return (ARCHIVE_OK);
+ line = next;
+ next = line + strcspn(line, " \t\r\n");
+ eq = strchr(line, '=');
+ if (eq > next)
+ len = next - line;
+ else
+ len = eq - line;
+
+ remove_option(&entry->options, line, len);
+ r = add_option(a, &entry->options, line, next - line);
+ if (r != ARCHIVE_OK)
+ return (r);
+ line = next;
+ }
+}
+
+static int
+read_mtree(struct archive_read *a, struct mtree *mtree)
+{
+ ssize_t len;
+ uintmax_t counter;
+ char *p;
+ struct mtree_option *global;
+ struct mtree_entry *last_entry;
+ int r;
+
+ mtree->archive_format = ARCHIVE_FORMAT_MTREE;
+ mtree->archive_format_name = "mtree";
+
+ global = NULL;
+ last_entry = NULL;
+
+ for (counter = 1; ; ++counter) {
+ len = readline(a, mtree, &p, 256);
+ if (len == 0) {
+ mtree->this_entry = mtree->entries;
+ free_options(global);
+ return (ARCHIVE_OK);
+ }
+ if (len < 0) {
+ free_options(global);
+ return (len);
+ }
+ /* Leading whitespace is never significant, ignore it. */
+ while (*p == ' ' || *p == '\t') {
+ ++p;
+ --len;
+ }
+ /* Skip content lines and blank lines. */
+ if (*p == '#')
+ continue;
+ if (*p == '\r' || *p == '\n' || *p == '\0')
+ continue;
+ if (*p != '/') {
+ r = process_add_entry(a, mtree, &global, p,
+ &last_entry);
+ } else if (strncmp(p, "/set", 4) == 0) {
+ if (p[4] != ' ' && p[4] != '\t')
+ break;
+ r = process_global_set(a, &global, p);
+ } else if (strncmp(p, "/unset", 6) == 0) {
+ if (p[6] != ' ' && p[6] != '\t')
+ break;
+ r = process_global_unset(a, &global, p);
+ } else
+ break;
+
+ if (r != ARCHIVE_OK) {
+ free_options(global);
+ return r;
+ }
+ }
+
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Can't parse line %ju", counter);
+ free_options(global);
+ return (ARCHIVE_FATAL);
+}
+
+/*
+ * Read in the entire mtree file into memory on the first request.
+ * Then use the next unused file to satisfy each header request.
+ */
+static int
+read_header(struct archive_read *a, struct archive_entry *entry)
+{
+ struct mtree *mtree;
+ char *p;
+ int r, use_next;
+
+ mtree = (struct mtree *)(a->format->data);
+
+ if (mtree->fd >= 0) {
+ close(mtree->fd);
+ mtree->fd = -1;
+ }
+
+ if (mtree->entries == NULL) {
+ mtree->resolver = archive_entry_linkresolver_new();
+ if (mtree->resolver == NULL)
+ return ARCHIVE_FATAL;
+ archive_entry_linkresolver_set_strategy(mtree->resolver,
+ ARCHIVE_FORMAT_MTREE);
+ r = read_mtree(a, mtree);
+ if (r != ARCHIVE_OK)
+ return (r);
+ }
+
+ a->archive.archive_format = mtree->archive_format;
+ a->archive.archive_format_name = mtree->archive_format_name;
+
+ for (;;) {
+ if (mtree->this_entry == NULL)
+ return (ARCHIVE_EOF);
+ if (strcmp(mtree->this_entry->name, "..") == 0) {
+ mtree->this_entry->used = 1;
+ if (archive_strlen(&mtree->current_dir) > 0) {
+ /* Roll back current path. */
+ p = mtree->current_dir.s
+ + mtree->current_dir.length - 1;
+ while (p >= mtree->current_dir.s && *p != '/')
+ --p;
+ if (p >= mtree->current_dir.s)
+ --p;
+ mtree->current_dir.length
+ = p - mtree->current_dir.s + 1;
+ }
+ }
+ if (!mtree->this_entry->used) {
+ use_next = 0;
+ r = parse_file(a, entry, mtree, mtree->this_entry, &use_next);
+ if (use_next == 0)
+ return (r);
+ }
+ mtree->this_entry = mtree->this_entry->next;
+ }
+}
+
+/*
+ * A single file can have multiple lines contribute specifications.
+ * Parse as many lines as necessary, then pull additional information
+ * from a backing file on disk as necessary.
+ */
+static int
+parse_file(struct archive_read *a, struct archive_entry *entry,
+ struct mtree *mtree, struct mtree_entry *mentry, int *use_next)
+{
+ const char *path;
+ struct stat st_storage, *st;
+ struct mtree_entry *mp;
+ struct archive_entry *sparse_entry;
+ int r = ARCHIVE_OK, r1, parsed_kws, mismatched_type;
+
+ mentry->used = 1;
+
+ /* Initialize reasonable defaults. */
+ mtree->filetype = AE_IFREG;
+ archive_entry_set_size(entry, 0);
+
+ /* Parse options from this line. */
+ parsed_kws = 0;
+ r = parse_line(a, entry, mtree, mentry, &parsed_kws);
+
+ if (mentry->full) {
+ archive_entry_copy_pathname(entry, mentry->name);
+ /*
+ * "Full" entries are allowed to have multiple lines
+ * and those lines aren't required to be adjacent. We
+ * don't support multiple lines for "relative" entries
+ * nor do we make any attempt to merge data from
+ * separate "relative" and "full" entries. (Merging
+ * "relative" and "full" entries would require dealing
+ * with pathname canonicalization, which is a very
+ * tricky subject.)
+ */
+ for (mp = mentry->next; mp != NULL; mp = mp->next) {
+ if (mp->full && !mp->used
+ && strcmp(mentry->name, mp->name) == 0) {
+ /* Later lines override earlier ones. */
+ mp->used = 1;
+ r1 = parse_line(a, entry, mtree, mp,
+ &parsed_kws);
+ if (r1 < r)
+ r = r1;
+ }
+ }
+ } else {
+ /*
+ * Relative entries require us to construct
+ * the full path and possibly update the
+ * current directory.
+ */
+ size_t n = archive_strlen(&mtree->current_dir);
+ if (n > 0)
+ archive_strcat(&mtree->current_dir, "/");
+ archive_strcat(&mtree->current_dir, mentry->name);
+ archive_entry_copy_pathname(entry, mtree->current_dir.s);
+ if (archive_entry_filetype(entry) != AE_IFDIR)
+ mtree->current_dir.length = n;
+ }
+
+ /*
+ * Try to open and stat the file to get the real size
+ * and other file info. It would be nice to avoid
+ * this here so that getting a listing of an mtree
+ * wouldn't require opening every referenced contents
+ * file. But then we wouldn't know the actual
+ * contents size, so I don't see a really viable way
+ * around this. (Also, we may want to someday pull
+ * other unspecified info from the contents file on
+ * disk.)
+ */
+ mtree->fd = -1;
+ if (archive_strlen(&mtree->contents_name) > 0)
+ path = mtree->contents_name.s;
+ else
+ path = archive_entry_pathname(entry);
+
+ if (archive_entry_filetype(entry) == AE_IFREG ||
+ archive_entry_filetype(entry) == AE_IFDIR) {
+ mtree->fd = open(path, O_RDONLY | O_BINARY);
+ if (mtree->fd == -1 &&
+ (errno != ENOENT ||
+ archive_strlen(&mtree->contents_name) > 0)) {
+ archive_set_error(&a->archive, errno,
+ "Can't open %s", path);
+ r = ARCHIVE_WARN;
+ }
+ }
+
+ st = &st_storage;
+ if (mtree->fd >= 0) {
+ if (fstat(mtree->fd, st) == -1) {
+ archive_set_error(&a->archive, errno,
+ "Could not fstat %s", path);
+ r = ARCHIVE_WARN;
+ /* If we can't stat it, don't keep it open. */
+ close(mtree->fd);
+ mtree->fd = -1;
+ st = NULL;
+ }
+ } else if (lstat(path, st) == -1) {
+ st = NULL;
+ }
+
+ /*
+ * If there is a contents file on disk, use that size;
+ * otherwise leave it as-is (it might have been set from
+ * the mtree size= keyword).
+ */
+ if (st != NULL) {
+ mismatched_type = 0;
+ if ((st->st_mode & S_IFMT) == S_IFREG &&
+ archive_entry_filetype(entry) != AE_IFREG)
+ mismatched_type = 1;
+ if ((st->st_mode & S_IFMT) == S_IFLNK &&
+ archive_entry_filetype(entry) != AE_IFLNK)
+ mismatched_type = 1;
+ if ((st->st_mode & S_IFSOCK) == S_IFSOCK &&
+ archive_entry_filetype(entry) != AE_IFSOCK)
+ mismatched_type = 1;
+ if ((st->st_mode & S_IFMT) == S_IFCHR &&
+ archive_entry_filetype(entry) != AE_IFCHR)
+ mismatched_type = 1;
+ if ((st->st_mode & S_IFMT) == S_IFBLK &&
+ archive_entry_filetype(entry) != AE_IFBLK)
+ mismatched_type = 1;
+ if ((st->st_mode & S_IFMT) == S_IFDIR &&
+ archive_entry_filetype(entry) != AE_IFDIR)
+ mismatched_type = 1;
+ if ((st->st_mode & S_IFMT) == S_IFIFO &&
+ archive_entry_filetype(entry) != AE_IFIFO)
+ mismatched_type = 1;
+
+ if (mismatched_type) {
+ if ((parsed_kws & MTREE_HAS_OPTIONAL) == 0) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_MISC,
+ "mtree specification has different type for %s",
+ archive_entry_pathname(entry));
+ r = ARCHIVE_WARN;
+ } else {
+ *use_next = 1;
+ }
+ /* Don't hold a non-regular file open. */
+ if (mtree->fd >= 0)
+ close(mtree->fd);
+ mtree->fd = -1;
+ st = NULL;
+ return r;
+ }
+ }
+
+ if (st != NULL) {
+ if ((parsed_kws & MTREE_HAS_DEVICE) == 0 &&
+ (archive_entry_filetype(entry) == AE_IFCHR ||
+ archive_entry_filetype(entry) == AE_IFBLK))
+ archive_entry_set_rdev(entry, st->st_rdev);
+ if ((parsed_kws & (MTREE_HAS_GID | MTREE_HAS_GNAME)) == 0)
+ archive_entry_set_gid(entry, st->st_gid);
+ if ((parsed_kws & (MTREE_HAS_UID | MTREE_HAS_UNAME)) == 0)
+ archive_entry_set_uid(entry, st->st_uid);
+ if ((parsed_kws & MTREE_HAS_MTIME) == 0) {
+#if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
+ archive_entry_set_mtime(entry, st->st_mtime,
+ st->st_mtimespec.tv_nsec);
+#elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
+ archive_entry_set_mtime(entry, st->st_mtime,
+ st->st_mtim.tv_nsec);
+#elif HAVE_STRUCT_STAT_ST_MTIME_N
+ archive_entry_set_mtime(entry, st->st_mtime,
+ st->st_mtime_n);
+#elif HAVE_STRUCT_STAT_ST_UMTIME
+ archive_entry_set_mtime(entry, st->st_mtime,
+ st->st_umtime*1000);
+#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
+ archive_entry_set_mtime(entry, st->st_mtime,
+ st->st_mtime_usec*1000);
+#else
+ archive_entry_set_mtime(entry, st->st_mtime, 0);
+#endif
+ }
+ if ((parsed_kws & MTREE_HAS_NLINK) == 0)
+ archive_entry_set_nlink(entry, st->st_nlink);
+ if ((parsed_kws & MTREE_HAS_PERM) == 0)
+ archive_entry_set_perm(entry, st->st_mode);
+ if ((parsed_kws & MTREE_HAS_SIZE) == 0)
+ archive_entry_set_size(entry, st->st_size);
+ archive_entry_set_ino(entry, st->st_ino);
+ archive_entry_set_dev(entry, st->st_dev);
+
+ archive_entry_linkify(mtree->resolver, &entry, &sparse_entry);
+ } else if (parsed_kws & MTREE_HAS_OPTIONAL) {
+ /*
+ * Couldn't open the entry, stat it or the on-disk type
+ * didn't match. If this entry is optional, just ignore it
+ * and read the next header entry.
+ */
+ *use_next = 1;
+ return ARCHIVE_OK;
+ }
+
+ mtree->cur_size = archive_entry_size(entry);
+ mtree->offset = 0;
+
+ return r;
+}
+
+/*
+ * Each line contains a sequence of keywords.
+ */
+static int
+parse_line(struct archive_read *a, struct archive_entry *entry,
+ struct mtree *mtree, struct mtree_entry *mp, int *parsed_kws)
+{
+ struct mtree_option *iter;
+ int r = ARCHIVE_OK, r1;
+
+ for (iter = mp->options; iter != NULL; iter = iter->next) {
+ r1 = parse_keyword(a, mtree, entry, iter, parsed_kws);
+ if (r1 < r)
+ r = r1;
+ }
+ if ((*parsed_kws & MTREE_HAS_TYPE) == 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Missing type keyword in mtree specification");
+ return (ARCHIVE_WARN);
+ }
+ return (r);
+}
+
+/*
+ * Device entries have one of the following forms:
+ * raw dev_t
+ * format,major,minor[,subdevice]
+ *
+ * Just use major and minor, no translation etc is done
+ * between formats.
+ */
+static int
+parse_device(struct archive *a, struct archive_entry *entry, char *val)
+{
+ char *comma1, *comma2;
+
+ comma1 = strchr(val, ',');
+ if (comma1 == NULL) {
+ archive_entry_set_dev(entry, mtree_atol10(&val));
+ return (ARCHIVE_OK);
+ }
+ ++comma1;
+ comma2 = strchr(comma1, ',');
+ if (comma2 == NULL) {
+ archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Malformed device attribute");
+ return (ARCHIVE_WARN);
+ }
+ ++comma2;
+ archive_entry_set_rdevmajor(entry, mtree_atol(&comma1));
+ archive_entry_set_rdevminor(entry, mtree_atol(&comma2));
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Parse a single keyword and its value.
+ */
+static int
+parse_keyword(struct archive_read *a, struct mtree *mtree,
+ struct archive_entry *entry, struct mtree_option *option, int *parsed_kws)
+{
+ char *val, *key;
+
+ key = option->value;
+
+ if (*key == '\0')
+ return (ARCHIVE_OK);
+
+ if (strcmp(key, "optional") == 0) {
+ *parsed_kws |= MTREE_HAS_OPTIONAL;
+ return (ARCHIVE_OK);
+ }
+ if (strcmp(key, "ignore") == 0) {
+ /*
+ * The mtree processing is not recursive, so
+ * recursion will only happen for explicitly listed
+ * entries.
+ */
+ return (ARCHIVE_OK);
+ }
+
+ val = strchr(key, '=');
+ if (val == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Malformed attribute \"%s\" (%d)", key, key[0]);
+ return (ARCHIVE_WARN);
+ }
+
+ *val = '\0';
+ ++val;
+
+ switch (key[0]) {
+ case 'c':
+ if (strcmp(key, "content") == 0
+ || strcmp(key, "contents") == 0) {
+ parse_escapes(val, NULL);
+ archive_strcpy(&mtree->contents_name, val);
+ break;
+ }
+ if (strcmp(key, "cksum") == 0)
+ break;
+ case 'd':
+ if (strcmp(key, "device") == 0) {
+ *parsed_kws |= MTREE_HAS_DEVICE;
+ return parse_device(&a->archive, entry, val);
+ }
+ case 'f':
+ if (strcmp(key, "flags") == 0) {
+ *parsed_kws |= MTREE_HAS_FFLAGS;
+ archive_entry_copy_fflags_text(entry, val);
+ break;
+ }
+ case 'g':
+ if (strcmp(key, "gid") == 0) {
+ *parsed_kws |= MTREE_HAS_GID;
+ archive_entry_set_gid(entry, mtree_atol10(&val));
+ break;
+ }
+ if (strcmp(key, "gname") == 0) {
+ *parsed_kws |= MTREE_HAS_GNAME;
+ archive_entry_copy_gname(entry, val);
+ break;
+ }
+ case 'l':
+ if (strcmp(key, "link") == 0) {
+ archive_entry_copy_symlink(entry, val);
+ break;
+ }
+ case 'm':
+ if (strcmp(key, "md5") == 0 || strcmp(key, "md5digest") == 0)
+ break;
+ if (strcmp(key, "mode") == 0) {
+ if (val[0] >= '0' && val[0] <= '9') {
+ *parsed_kws |= MTREE_HAS_PERM;
+ archive_entry_set_perm(entry,
+ mtree_atol8(&val));
+ } else {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Symbolic mode \"%s\" unsupported", val);
+ return ARCHIVE_WARN;
+ }
+ break;
+ }
+ case 'n':
+ if (strcmp(key, "nlink") == 0) {
+ *parsed_kws |= MTREE_HAS_NLINK;
+ archive_entry_set_nlink(entry, mtree_atol10(&val));
+ break;
+ }
+ case 'r':
+ if (strcmp(key, "rmd160") == 0 ||
+ strcmp(key, "rmd160digest") == 0)
+ break;
+ case 's':
+ if (strcmp(key, "sha1") == 0 || strcmp(key, "sha1digest") == 0)
+ break;
+ if (strcmp(key, "sha256") == 0 ||
+ strcmp(key, "sha256digest") == 0)
+ break;
+ if (strcmp(key, "sha384") == 0 ||
+ strcmp(key, "sha384digest") == 0)
+ break;
+ if (strcmp(key, "sha512") == 0 ||
+ strcmp(key, "sha512digest") == 0)
+ break;
+ if (strcmp(key, "size") == 0) {
+ archive_entry_set_size(entry, mtree_atol10(&val));
+ break;
+ }
+ case 't':
+ if (strcmp(key, "tags") == 0) {
+ /*
+ * Comma delimited list of tags.
+ * Ignore the tags for now, but the interface
+ * should be extended to allow inclusion/exclusion.
+ */
+ break;
+ }
+ if (strcmp(key, "time") == 0) {
+ time_t m;
+ long ns;
+
+ *parsed_kws |= MTREE_HAS_MTIME;
+ m = (time_t)mtree_atol10(&val);
+ if (*val == '.') {
+ ++val;
+ ns = (long)mtree_atol10(&val);
+ } else
+ ns = 0;
+ archive_entry_set_mtime(entry, m, ns);
+ break;
+ }
+ if (strcmp(key, "type") == 0) {
+ *parsed_kws |= MTREE_HAS_TYPE;
+ switch (val[0]) {
+ case 'b':
+ if (strcmp(val, "block") == 0) {
+ mtree->filetype = AE_IFBLK;
+ break;
+ }
+ case 'c':
+ if (strcmp(val, "char") == 0) {
+ mtree->filetype = AE_IFCHR;
+ break;
+ }
+ case 'd':
+ if (strcmp(val, "dir") == 0) {
+ mtree->filetype = AE_IFDIR;
+ break;
+ }
+ case 'f':
+ if (strcmp(val, "fifo") == 0) {
+ mtree->filetype = AE_IFIFO;
+ break;
+ }
+ if (strcmp(val, "file") == 0) {
+ mtree->filetype = AE_IFREG;
+ break;
+ }
+ case 'l':
+ if (strcmp(val, "link") == 0) {
+ mtree->filetype = AE_IFLNK;
+ break;
+ }
+ default:
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Unrecognized file type \"%s\"", val);
+ return (ARCHIVE_WARN);
+ }
+ archive_entry_set_filetype(entry, mtree->filetype);
+ break;
+ }
+ case 'u':
+ if (strcmp(key, "uid") == 0) {
+ *parsed_kws |= MTREE_HAS_UID;
+ archive_entry_set_uid(entry, mtree_atol10(&val));
+ break;
+ }
+ if (strcmp(key, "uname") == 0) {
+ *parsed_kws |= MTREE_HAS_UNAME;
+ archive_entry_copy_uname(entry, val);
+ break;
+ }
+ default:
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Unrecognized key %s=%s", key, val);
+ return (ARCHIVE_WARN);
+ }
+ return (ARCHIVE_OK);
+}
+
+static int
+read_data(struct archive_read *a, const void **buff, size_t *size, off_t *offset)
+{
+ size_t bytes_to_read;
+ ssize_t bytes_read;
+ struct mtree *mtree;
+
+ mtree = (struct mtree *)(a->format->data);
+ if (mtree->fd < 0) {
+ *buff = NULL;
+ *offset = 0;
+ *size = 0;
+ return (ARCHIVE_EOF);
+ }
+ if (mtree->buff == NULL) {
+ mtree->buffsize = 64 * 1024;
+ mtree->buff = malloc(mtree->buffsize);
+ if (mtree->buff == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate memory");
+ return (ARCHIVE_FATAL);
+ }
+ }
+
+ *buff = mtree->buff;
+ *offset = mtree->offset;
+ if ((off_t)mtree->buffsize > mtree->cur_size - mtree->offset)
+ bytes_to_read = mtree->cur_size - mtree->offset;
+ else
+ bytes_to_read = mtree->buffsize;
+ bytes_read = read(mtree->fd, mtree->buff, bytes_to_read);
+ if (bytes_read < 0) {
+ archive_set_error(&a->archive, errno, "Can't read");
+ return (ARCHIVE_WARN);
+ }
+ if (bytes_read == 0) {
+ *size = 0;
+ return (ARCHIVE_EOF);
+ }
+ mtree->offset += bytes_read;
+ *size = bytes_read;
+ return (ARCHIVE_OK);
+}
+
+/* Skip does nothing except possibly close the contents file. */
+static int
+skip(struct archive_read *a)
+{
+ struct mtree *mtree;
+
+ mtree = (struct mtree *)(a->format->data);
+ if (mtree->fd >= 0) {
+ close(mtree->fd);
+ mtree->fd = -1;
+ }
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Since parsing backslash sequences always makes strings shorter,
+ * we can always do this conversion in-place.
+ */
+static void
+parse_escapes(char *src, struct mtree_entry *mentry)
+{
+ char *dest = src;
+ char c;
+
+ if (mentry != NULL && strcmp(src, ".") == 0)
+ mentry->full = 1;
+
+ while (*src != '\0') {
+ c = *src++;
+ if (c == '/' && mentry != NULL)
+ mentry->full = 1;
+ if (c == '\\') {
+ switch (src[0]) {
+ case '0':
+ if (src[1] < '0' || src[1] > '7') {
+ c = 0;
+ ++src;
+ break;
+ }
+ /* FALLTHROUGH */
+ case '1':
+ case '2':
+ case '3':
+ if (src[1] >= '0' && src[1] <= '7' &&
+ src[2] >= '0' && src[2] <= '7') {
+ c = (src[0] - '0') << 6;
+ c |= (src[1] - '0') << 3;
+ c |= (src[2] - '0');
+ src += 3;
+ }
+ break;
+ case 'a':
+ c = '\a';
+ ++src;
+ break;
+ case 'b':
+ c = '\b';
+ ++src;
+ break;
+ case 'f':
+ c = '\f';
+ ++src;
+ break;
+ case 'n':
+ c = '\n';
+ ++src;
+ break;
+ case 'r':
+ c = '\r';
+ ++src;
+ break;
+ case 's':
+ c = ' ';
+ ++src;
+ break;
+ case 't':
+ c = '\t';
+ ++src;
+ break;
+ case 'v':
+ c = '\v';
+ ++src;
+ break;
+ }
+ }
+ *dest++ = c;
+ }
+ *dest = '\0';
+}
+
+/*
+ * Note that this implementation does not (and should not!) obey
+ * locale settings; you cannot simply substitute strtol here, since
+ * it does obey locale.
+ */
+static int64_t
+mtree_atol8(char **p)
+{
+ int64_t l, limit, last_digit_limit;
+ int digit, base;
+
+ base = 8;
+ limit = INT64_MAX / base;
+ last_digit_limit = INT64_MAX % base;
+
+ l = 0;
+ digit = **p - '0';
+ while (digit >= 0 && digit < base) {
+ if (l>limit || (l == limit && digit > last_digit_limit)) {
+ l = INT64_MAX; /* Truncate on overflow. */
+ break;
+ }
+ l = (l * base) + digit;
+ digit = *++(*p) - '0';
+ }
+ return (l);
+}
+
+/*
+ * Note that this implementation does not (and should not!) obey
+ * locale settings; you cannot simply substitute strtol here, since
+ * it does obey locale.
+ */
+static int64_t
+mtree_atol10(char **p)
+{
+ int64_t l, limit, last_digit_limit;
+ int base, digit, sign;
+
+ base = 10;
+ limit = INT64_MAX / base;
+ last_digit_limit = INT64_MAX % base;
+
+ if (**p == '-') {
+ sign = -1;
+ ++(*p);
+ } else
+ sign = 1;
+
+ l = 0;
+ digit = **p - '0';
+ while (digit >= 0 && digit < base) {
+ if (l > limit || (l == limit && digit > last_digit_limit)) {
+ l = INT64_MAX; /* Truncate on overflow. */
+ break;
+ }
+ l = (l * base) + digit;
+ digit = *++(*p) - '0';
+ }
+ return (sign < 0) ? -l : l;
+}
+
+/*
+ * Note that this implementation does not (and should not!) obey
+ * locale settings; you cannot simply substitute strtol here, since
+ * it does obey locale.
+ */
+static int64_t
+mtree_atol16(char **p)
+{
+ int64_t l, limit, last_digit_limit;
+ int base, digit, sign;
+
+ base = 16;
+ limit = INT64_MAX / base;
+ last_digit_limit = INT64_MAX % base;
+
+ if (**p == '-') {
+ sign = -1;
+ ++(*p);
+ } else
+ sign = 1;
+
+ l = 0;
+ if (**p >= '0' && **p <= '9')
+ digit = **p - '0';
+ else if (**p >= 'a' && **p <= 'f')
+ digit = **p - 'a' + 10;
+ else if (**p >= 'A' && **p <= 'F')
+ digit = **p - 'A' + 10;
+ else
+ digit = -1;
+ while (digit >= 0 && digit < base) {
+ if (l > limit || (l == limit && digit > last_digit_limit)) {
+ l = INT64_MAX; /* Truncate on overflow. */
+ break;
+ }
+ l = (l * base) + digit;
+ if (**p >= '0' && **p <= '9')
+ digit = **p - '0';
+ else if (**p >= 'a' && **p <= 'f')
+ digit = **p - 'a' + 10;
+ else if (**p >= 'A' && **p <= 'F')
+ digit = **p - 'A' + 10;
+ else
+ digit = -1;
+ }
+ return (sign < 0) ? -l : l;
+}
+
+static int64_t
+mtree_atol(char **p)
+{
+ if (**p != '0')
+ return mtree_atol10(p);
+ if ((*p)[1] == 'x' || (*p)[1] == 'X') {
+ *p += 2;
+ return mtree_atol16(p);
+ }
+ return mtree_atol8(p);
+}
+
+/*
+ * Returns length of line (including trailing newline)
+ * or negative on error. 'start' argument is updated to
+ * point to first character of line.
+ */
+static ssize_t
+readline(struct archive_read *a, struct mtree *mtree, char **start, ssize_t limit)
+{
+ ssize_t bytes_read;
+ ssize_t total_size = 0;
+ ssize_t find_off = 0;
+ const void *t;
+ const char *s;
+ void *p;
+ char *u;
+
+ /* Accumulate line in a line buffer. */
+ for (;;) {
+ /* Read some more. */
+ t = __archive_read_ahead(a, 1, &bytes_read);
+ if (t == NULL)
+ return (0);
+ if (bytes_read < 0)
+ return (ARCHIVE_FATAL);
+ s = t; /* Start of line? */
+ p = memchr(t, '\n', bytes_read);
+ /* If we found '\n', trim the read. */
+ if (p != NULL) {
+ bytes_read = 1 + ((const char *)p) - s;
+ }
+ if (total_size + bytes_read + 1 > limit) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Line too long");
+ return (ARCHIVE_FATAL);
+ }
+ if (archive_string_ensure(&mtree->line,
+ total_size + bytes_read + 1) == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate working buffer");
+ return (ARCHIVE_FATAL);
+ }
+ memcpy(mtree->line.s + total_size, t, bytes_read);
+ __archive_read_consume(a, bytes_read);
+ total_size += bytes_read;
+ /* Null terminate. */
+ mtree->line.s[total_size] = '\0';
+ /* If we found an unescaped '\n', clean up and return. */
+ for (u = mtree->line.s + find_off; *u; ++u) {
+ if (u[0] == '\n') {
+ *start = mtree->line.s;
+ return total_size;
+ }
+ if (u[0] == '#') {
+ if (p == NULL)
+ break;
+ *start = mtree->line.s;
+ return total_size;
+ }
+ if (u[0] != '\\')
+ continue;
+ if (u[1] == '\\') {
+ ++u;
+ continue;
+ }
+ if (u[1] == '\n') {
+ memmove(u, u + 1,
+ total_size - (u - mtree->line.s) + 1);
+ --total_size;
+ ++u;
+ break;
+ }
+ if (u[1] == '\0')
+ break;
+ }
+ find_off = u - mtree->line.s;
+ }
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c b/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c
new file mode 100644
index 00000000000..dae13dc6e00
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_tar.c
@@ -0,0 +1,2418 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_tar.c 201161 2009-12-29 05:44:39Z kientzle $");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <stddef.h>
+/* #include <stdint.h> */ /* See archive_platform.h */
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+/* Obtain suitable wide-character manipulation functions. */
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#else
+/* Good enough for equality testing, which is all we need. */
+static int wcscmp(const wchar_t *s1, const wchar_t *s2)
+{
+ int diff = *s1 - *s2;
+ while (*s1 && diff == 0)
+ diff = (int)*++s1 - (int)*++s2;
+ return diff;
+}
+/* Good enough for equality testing, which is all we need. */
+static int wcsncmp(const wchar_t *s1, const wchar_t *s2, size_t n)
+{
+ int diff = *s1 - *s2;
+ while (*s1 && diff == 0 && n-- > 0)
+ diff = (int)*++s1 - (int)*++s2;
+ return diff;
+}
+static size_t wcslen(const wchar_t *s)
+{
+ const wchar_t *p = s;
+ while (*p)
+ p++;
+ return p - s;
+}
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+
+#define tar_min(a,b) ((a) < (b) ? (a) : (b))
+
+/*
+ * Layout of POSIX 'ustar' tar header.
+ */
+struct archive_entry_header_ustar {
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char checksum[8];
+ char typeflag[1];
+ char linkname[100]; /* "old format" header ends here */
+ char magic[6]; /* For POSIX: "ustar\0" */
+ char version[2]; /* For POSIX: "00" */
+ char uname[32];
+ char gname[32];
+ char rdevmajor[8];
+ char rdevminor[8];
+ char prefix[155];
+};
+
+/*
+ * Structure of GNU tar header
+ */
+struct gnu_sparse {
+ char offset[12];
+ char numbytes[12];
+};
+
+struct archive_entry_header_gnutar {
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char checksum[8];
+ char typeflag[1];
+ char linkname[100];
+ char magic[8]; /* "ustar \0" (note blank/blank/null at end) */
+ char uname[32];
+ char gname[32];
+ char rdevmajor[8];
+ char rdevminor[8];
+ char atime[12];
+ char ctime[12];
+ char offset[12];
+ char longnames[4];
+ char unused[1];
+ struct gnu_sparse sparse[4];
+ char isextended[1];
+ char realsize[12];
+ /*
+ * Old GNU format doesn't use POSIX 'prefix' field; they use
+ * the 'L' (longname) entry instead.
+ */
+};
+
+/*
+ * Data specific to this format.
+ */
+struct sparse_block {
+ struct sparse_block *next;
+ off_t offset;
+ off_t remaining;
+};
+
+struct tar {
+ struct archive_string acl_text;
+ struct archive_string entry_pathname;
+ /* For "GNU.sparse.name" and other similar path extensions. */
+ struct archive_string entry_pathname_override;
+ struct archive_string entry_linkpath;
+ struct archive_string entry_uname;
+ struct archive_string entry_gname;
+ struct archive_string longlink;
+ struct archive_string longname;
+ struct archive_string pax_header;
+ struct archive_string pax_global;
+ struct archive_string line;
+ int pax_hdrcharset_binary;
+ wchar_t *pax_entry;
+ size_t pax_entry_length;
+ int header_recursion_depth;
+ int64_t entry_bytes_remaining;
+ int64_t entry_offset;
+ int64_t entry_padding;
+ int64_t realsize;
+ struct sparse_block *sparse_list;
+ struct sparse_block *sparse_last;
+ int64_t sparse_offset;
+ int64_t sparse_numbytes;
+ int sparse_gnu_major;
+ int sparse_gnu_minor;
+ char sparse_gnu_pending;
+};
+
+static ssize_t UTF8_mbrtowc(wchar_t *pwc, const char *s, size_t n);
+static int archive_block_is_null(const unsigned char *p);
+static char *base64_decode(const char *, size_t, size_t *);
+static void gnu_add_sparse_entry(struct tar *,
+ off_t offset, off_t remaining);
+static void gnu_clear_sparse_list(struct tar *);
+static int gnu_sparse_old_read(struct archive_read *, struct tar *,
+ const struct archive_entry_header_gnutar *header);
+static void gnu_sparse_old_parse(struct tar *,
+ const struct gnu_sparse *sparse, int length);
+static int gnu_sparse_01_parse(struct tar *, const char *);
+static ssize_t gnu_sparse_10_read(struct archive_read *, struct tar *);
+static int header_Solaris_ACL(struct archive_read *, struct tar *,
+ struct archive_entry *, const void *);
+static int header_common(struct archive_read *, struct tar *,
+ struct archive_entry *, const void *);
+static int header_old_tar(struct archive_read *, struct tar *,
+ struct archive_entry *, const void *);
+static int header_pax_extensions(struct archive_read *, struct tar *,
+ struct archive_entry *, const void *);
+static int header_pax_global(struct archive_read *, struct tar *,
+ struct archive_entry *, const void *h);
+static int header_longlink(struct archive_read *, struct tar *,
+ struct archive_entry *, const void *h);
+static int header_longname(struct archive_read *, struct tar *,
+ struct archive_entry *, const void *h);
+static int header_volume(struct archive_read *, struct tar *,
+ struct archive_entry *, const void *h);
+static int header_ustar(struct archive_read *, struct tar *,
+ struct archive_entry *, const void *h);
+static int header_gnutar(struct archive_read *, struct tar *,
+ struct archive_entry *, const void *h);
+static int archive_read_format_tar_bid(struct archive_read *);
+static int archive_read_format_tar_cleanup(struct archive_read *);
+static int archive_read_format_tar_read_data(struct archive_read *a,
+ const void **buff, size_t *size, off_t *offset);
+static int archive_read_format_tar_skip(struct archive_read *a);
+static int archive_read_format_tar_read_header(struct archive_read *,
+ struct archive_entry *);
+static int checksum(struct archive_read *, const void *);
+static int pax_attribute(struct tar *, struct archive_entry *,
+ char *key, char *value);
+static int pax_header(struct archive_read *, struct tar *,
+ struct archive_entry *, char *attr);
+static void pax_time(const char *, int64_t *sec, long *nanos);
+static ssize_t readline(struct archive_read *, struct tar *, const char **,
+ ssize_t limit);
+static int read_body_to_string(struct archive_read *, struct tar *,
+ struct archive_string *, const void *h);
+static int64_t tar_atol(const char *, unsigned);
+static int64_t tar_atol10(const char *, unsigned);
+static int64_t tar_atol256(const char *, unsigned);
+static int64_t tar_atol8(const char *, unsigned);
+static int tar_read_header(struct archive_read *, struct tar *,
+ struct archive_entry *);
+static int tohex(int c);
+static char *url_decode(const char *);
+static wchar_t *utf8_decode(struct tar *, const char *, size_t length);
+
+int
+archive_read_support_format_gnutar(struct archive *a)
+{
+ return (archive_read_support_format_tar(a));
+}
+
+
+int
+archive_read_support_format_tar(struct archive *_a)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ struct tar *tar;
+ int r;
+
+ tar = (struct tar *)malloc(sizeof(*tar));
+ if (tar == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate tar data");
+ return (ARCHIVE_FATAL);
+ }
+ memset(tar, 0, sizeof(*tar));
+
+ r = __archive_read_register_format(a, tar, "tar",
+ archive_read_format_tar_bid,
+ NULL,
+ archive_read_format_tar_read_header,
+ archive_read_format_tar_read_data,
+ archive_read_format_tar_skip,
+ archive_read_format_tar_cleanup);
+
+ if (r != ARCHIVE_OK)
+ free(tar);
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_read_format_tar_cleanup(struct archive_read *a)
+{
+ struct tar *tar;
+
+ tar = (struct tar *)(a->format->data);
+ gnu_clear_sparse_list(tar);
+ archive_string_free(&tar->acl_text);
+ archive_string_free(&tar->entry_pathname);
+ archive_string_free(&tar->entry_pathname_override);
+ archive_string_free(&tar->entry_linkpath);
+ archive_string_free(&tar->entry_uname);
+ archive_string_free(&tar->entry_gname);
+ archive_string_free(&tar->line);
+ archive_string_free(&tar->pax_global);
+ archive_string_free(&tar->pax_header);
+ archive_string_free(&tar->longname);
+ archive_string_free(&tar->longlink);
+ free(tar->pax_entry);
+ free(tar);
+ (a->format->data) = NULL;
+ return (ARCHIVE_OK);
+}
+
+
+static int
+archive_read_format_tar_bid(struct archive_read *a)
+{
+ int bid;
+ const void *h;
+ const struct archive_entry_header_ustar *header;
+
+ bid = 0;
+
+ /* Now let's look at the actual header and see if it matches. */
+ h = __archive_read_ahead(a, 512, NULL);
+ if (h == NULL)
+ return (-1);
+
+ /* If it's an end-of-archive mark, we can handle it. */
+ if ((*(const char *)h) == 0
+ && archive_block_is_null((const unsigned char *)h)) {
+ /*
+ * Usually, I bid the number of bits verified, but
+ * in this case, 4096 seems excessive so I picked 10 as
+ * an arbitrary but reasonable-seeming value.
+ */
+ return (10);
+ }
+
+ /* If it's not an end-of-archive mark, it must have a valid checksum.*/
+ if (!checksum(a, h))
+ return (0);
+ bid += 48; /* Checksum is usually 6 octal digits. */
+
+ header = (const struct archive_entry_header_ustar *)h;
+
+ /* Recognize POSIX formats. */
+ if ((memcmp(header->magic, "ustar\0", 6) == 0)
+ &&(memcmp(header->version, "00", 2)==0))
+ bid += 56;
+
+ /* Recognize GNU tar format. */
+ if ((memcmp(header->magic, "ustar ", 6) == 0)
+ &&(memcmp(header->version, " \0", 2)==0))
+ bid += 56;
+
+ /* Type flag must be null, digit or A-Z, a-z. */
+ if (header->typeflag[0] != 0 &&
+ !( header->typeflag[0] >= '0' && header->typeflag[0] <= '9') &&
+ !( header->typeflag[0] >= 'A' && header->typeflag[0] <= 'Z') &&
+ !( header->typeflag[0] >= 'a' && header->typeflag[0] <= 'z') )
+ return (0);
+ bid += 2; /* 6 bits of variation in an 8-bit field leaves 2 bits. */
+
+ /* Sanity check: Look at first byte of mode field. */
+ switch (255 & (unsigned)header->mode[0]) {
+ case 0: case 255:
+ /* Base-256 value: No further verification possible! */
+ break;
+ case ' ': /* Not recommended, but not illegal, either. */
+ break;
+ case '0': case '1': case '2': case '3':
+ case '4': case '5': case '6': case '7':
+ /* Octal Value. */
+ /* TODO: Check format of remainder of this field. */
+ break;
+ default:
+ /* Not a valid mode; bail out here. */
+ return (0);
+ }
+ /* TODO: Sanity test uid/gid/size/mtime/rdevmajor/rdevminor fields. */
+
+ return (bid);
+}
+
+/*
+ * The function invoked by archive_read_header(). This
+ * just sets up a few things and then calls the internal
+ * tar_read_header() function below.
+ */
+static int
+archive_read_format_tar_read_header(struct archive_read *a,
+ struct archive_entry *entry)
+{
+ /*
+ * When converting tar archives to cpio archives, it is
+ * essential that each distinct file have a distinct inode
+ * number. To simplify this, we keep a static count here to
+ * assign fake dev/inode numbers to each tar entry. Note that
+ * pax format archives may overwrite this with something more
+ * useful.
+ *
+ * Ideally, we would track every file read from the archive so
+ * that we could assign the same dev/ino pair to hardlinks,
+ * but the memory required to store a complete lookup table is
+ * probably not worthwhile just to support the relatively
+ * obscure tar->cpio conversion case.
+ */
+ static int default_inode;
+ static int default_dev;
+ struct tar *tar;
+ struct sparse_block *sp;
+ const char *p;
+ int r;
+ size_t l;
+
+ /* Assign default device/inode values. */
+ archive_entry_set_dev(entry, 1 + default_dev); /* Don't use zero. */
+ archive_entry_set_ino(entry, ++default_inode); /* Don't use zero. */
+ /* Limit generated st_ino number to 16 bits. */
+ if (default_inode >= 0xffff) {
+ ++default_dev;
+ default_inode = 0;
+ }
+
+ tar = (struct tar *)(a->format->data);
+ tar->entry_offset = 0;
+ while (tar->sparse_list != NULL) {
+ sp = tar->sparse_list;
+ tar->sparse_list = sp->next;
+ free(sp);
+ }
+ tar->sparse_last = NULL;
+ tar->realsize = -1; /* Mark this as "unset" */
+
+ r = tar_read_header(a, tar, entry);
+
+ /*
+ * "non-sparse" files are really just sparse files with
+ * a single block.
+ */
+ if (tar->sparse_list == NULL)
+ gnu_add_sparse_entry(tar, 0, tar->entry_bytes_remaining);
+
+ if (r == ARCHIVE_OK) {
+ /*
+ * "Regular" entry with trailing '/' is really
+ * directory: This is needed for certain old tar
+ * variants and even for some broken newer ones.
+ */
+ p = archive_entry_pathname(entry);
+ l = strlen(p);
+ if (archive_entry_filetype(entry) == AE_IFREG
+ && p[l-1] == '/')
+ archive_entry_set_filetype(entry, AE_IFDIR);
+ }
+ return (r);
+}
+
+static int
+archive_read_format_tar_read_data(struct archive_read *a,
+ const void **buff, size_t *size, off_t *offset)
+{
+ ssize_t bytes_read;
+ struct tar *tar;
+ struct sparse_block *p;
+
+ tar = (struct tar *)(a->format->data);
+
+ if (tar->sparse_gnu_pending) {
+ if (tar->sparse_gnu_major == 1 && tar->sparse_gnu_minor == 0) {
+ tar->sparse_gnu_pending = 0;
+ /* Read initial sparse map. */
+ bytes_read = gnu_sparse_10_read(a, tar);
+ tar->entry_bytes_remaining -= bytes_read;
+ if (bytes_read < 0)
+ return (bytes_read);
+ } else {
+ *size = 0;
+ *offset = 0;
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Unrecognized GNU sparse file format");
+ return (ARCHIVE_WARN);
+ }
+ tar->sparse_gnu_pending = 0;
+ }
+
+ /* Remove exhausted entries from sparse list. */
+ while (tar->sparse_list != NULL &&
+ tar->sparse_list->remaining == 0) {
+ p = tar->sparse_list;
+ tar->sparse_list = p->next;
+ free(p);
+ }
+
+ /* If we're at end of file, return EOF. */
+ if (tar->sparse_list == NULL || tar->entry_bytes_remaining == 0) {
+ if (__archive_read_skip(a, tar->entry_padding) < 0)
+ return (ARCHIVE_FATAL);
+ tar->entry_padding = 0;
+ *buff = NULL;
+ *size = 0;
+ *offset = tar->realsize;
+ return (ARCHIVE_EOF);
+ }
+
+ *buff = __archive_read_ahead(a, 1, &bytes_read);
+ if (bytes_read < 0)
+ return (ARCHIVE_FATAL);
+ if (*buff == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Truncated tar archive");
+ return (ARCHIVE_FATAL);
+ }
+ if (bytes_read > tar->entry_bytes_remaining)
+ bytes_read = tar->entry_bytes_remaining;
+ /* Don't read more than is available in the
+ * current sparse block. */
+ if (tar->sparse_list->remaining < bytes_read)
+ bytes_read = tar->sparse_list->remaining;
+ *size = bytes_read;
+ *offset = tar->sparse_list->offset;
+ tar->sparse_list->remaining -= bytes_read;
+ tar->sparse_list->offset += bytes_read;
+ tar->entry_bytes_remaining -= bytes_read;
+ __archive_read_consume(a, bytes_read);
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_read_format_tar_skip(struct archive_read *a)
+{
+ int64_t bytes_skipped;
+ struct tar* tar;
+
+ tar = (struct tar *)(a->format->data);
+
+ /*
+ * Compression layer skip functions are required to either skip the
+ * length requested or fail, so we can rely upon the entire entry
+ * plus padding being skipped.
+ */
+ bytes_skipped = __archive_read_skip(a,
+ tar->entry_bytes_remaining + tar->entry_padding);
+ if (bytes_skipped < 0)
+ return (ARCHIVE_FATAL);
+
+ tar->entry_bytes_remaining = 0;
+ tar->entry_padding = 0;
+
+ /* Free the sparse list. */
+ gnu_clear_sparse_list(tar);
+
+ return (ARCHIVE_OK);
+}
+
+/*
+ * This function recursively interprets all of the headers associated
+ * with a single entry.
+ */
+static int
+tar_read_header(struct archive_read *a, struct tar *tar,
+ struct archive_entry *entry)
+{
+ ssize_t bytes;
+ int err;
+ const void *h;
+ const struct archive_entry_header_ustar *header;
+
+ /* Read 512-byte header record */
+ h = __archive_read_ahead(a, 512, &bytes);
+ if (bytes < 0)
+ return (bytes);
+ if (bytes < 512) { /* Short read or EOF. */
+ /* Try requesting just one byte and see what happens. */
+ (void)__archive_read_ahead(a, 1, &bytes);
+ if (bytes == 0) {
+ /*
+ * The archive ends at a 512-byte boundary but
+ * without a proper end-of-archive marker.
+ * Yes, there are tar writers that do this;
+ * hold our nose and accept it.
+ */
+ return (ARCHIVE_EOF);
+ }
+ /* Archive ends with a partial block; this is bad. */
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Truncated tar archive");
+ return (ARCHIVE_FATAL);
+ }
+ __archive_read_consume(a, 512);
+
+
+ /* Check for end-of-archive mark. */
+ if (((*(const char *)h)==0) && archive_block_is_null((const unsigned char *)h)) {
+ /* Try to consume a second all-null record, as well. */
+ h = __archive_read_ahead(a, 512, NULL);
+ if (h != NULL)
+ __archive_read_consume(a, 512);
+ archive_set_error(&a->archive, 0, NULL);
+ if (a->archive.archive_format_name == NULL) {
+ a->archive.archive_format = ARCHIVE_FORMAT_TAR;
+ a->archive.archive_format_name = "tar";
+ }
+ return (ARCHIVE_EOF);
+ }
+
+ /*
+ * Note: If the checksum fails and we return ARCHIVE_RETRY,
+ * then the client is likely to just retry. This is a very
+ * crude way to search for the next valid header!
+ *
+ * TODO: Improve this by implementing a real header scan.
+ */
+ if (!checksum(a, h)) {
+ archive_set_error(&a->archive, EINVAL, "Damaged tar archive");
+ return (ARCHIVE_RETRY); /* Retryable: Invalid header */
+ }
+
+ if (++tar->header_recursion_depth > 32) {
+ archive_set_error(&a->archive, EINVAL, "Too many special headers");
+ return (ARCHIVE_WARN);
+ }
+
+ /* Determine the format variant. */
+ header = (const struct archive_entry_header_ustar *)h;
+ switch(header->typeflag[0]) {
+ case 'A': /* Solaris tar ACL */
+ a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
+ a->archive.archive_format_name = "Solaris tar";
+ err = header_Solaris_ACL(a, tar, entry, h);
+ break;
+ case 'g': /* POSIX-standard 'g' header. */
+ a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
+ a->archive.archive_format_name = "POSIX pax interchange format";
+ err = header_pax_global(a, tar, entry, h);
+ break;
+ case 'K': /* Long link name (GNU tar, others) */
+ err = header_longlink(a, tar, entry, h);
+ break;
+ case 'L': /* Long filename (GNU tar, others) */
+ err = header_longname(a, tar, entry, h);
+ break;
+ case 'V': /* GNU volume header */
+ err = header_volume(a, tar, entry, h);
+ break;
+ case 'X': /* Used by SUN tar; same as 'x'. */
+ a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
+ a->archive.archive_format_name =
+ "POSIX pax interchange format (Sun variant)";
+ err = header_pax_extensions(a, tar, entry, h);
+ break;
+ case 'x': /* POSIX-standard 'x' header. */
+ a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
+ a->archive.archive_format_name = "POSIX pax interchange format";
+ err = header_pax_extensions(a, tar, entry, h);
+ break;
+ default:
+ if (memcmp(header->magic, "ustar \0", 8) == 0) {
+ a->archive.archive_format = ARCHIVE_FORMAT_TAR_GNUTAR;
+ a->archive.archive_format_name = "GNU tar format";
+ err = header_gnutar(a, tar, entry, h);
+ } else if (memcmp(header->magic, "ustar", 5) == 0) {
+ if (a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE) {
+ a->archive.archive_format = ARCHIVE_FORMAT_TAR_USTAR;
+ a->archive.archive_format_name = "POSIX ustar format";
+ }
+ err = header_ustar(a, tar, entry, h);
+ } else {
+ a->archive.archive_format = ARCHIVE_FORMAT_TAR;
+ a->archive.archive_format_name = "tar (non-POSIX)";
+ err = header_old_tar(a, tar, entry, h);
+ }
+ }
+ --tar->header_recursion_depth;
+ /* We return warnings or success as-is. Anything else is fatal. */
+ if (err == ARCHIVE_WARN || err == ARCHIVE_OK)
+ return (err);
+ if (err == ARCHIVE_EOF)
+ /* EOF when recursively reading a header is bad. */
+ archive_set_error(&a->archive, EINVAL, "Damaged tar archive");
+ return (ARCHIVE_FATAL);
+}
+
+/*
+ * Return true if block checksum is correct.
+ */
+static int
+checksum(struct archive_read *a, const void *h)
+{
+ const unsigned char *bytes;
+ const struct archive_entry_header_ustar *header;
+ int check, i, sum;
+
+ (void)a; /* UNUSED */
+ bytes = (const unsigned char *)h;
+ header = (const struct archive_entry_header_ustar *)h;
+
+ /*
+ * Test the checksum. Note that POSIX specifies _unsigned_
+ * bytes for this calculation.
+ */
+ sum = tar_atol(header->checksum, sizeof(header->checksum));
+ check = 0;
+ for (i = 0; i < 148; i++)
+ check += (unsigned char)bytes[i];
+ for (; i < 156; i++)
+ check += 32;
+ for (; i < 512; i++)
+ check += (unsigned char)bytes[i];
+ if (sum == check)
+ return (1);
+
+ /*
+ * Repeat test with _signed_ bytes, just in case this archive
+ * was created by an old BSD, Solaris, or HP-UX tar with a
+ * broken checksum calculation.
+ */
+ check = 0;
+ for (i = 0; i < 148; i++)
+ check += (signed char)bytes[i];
+ for (; i < 156; i++)
+ check += 32;
+ for (; i < 512; i++)
+ check += (signed char)bytes[i];
+ if (sum == check)
+ return (1);
+
+ return (0);
+}
+
+/*
+ * Return true if this block contains only nulls.
+ */
+static int
+archive_block_is_null(const unsigned char *p)
+{
+ unsigned i;
+
+ for (i = 0; i < 512; i++)
+ if (*p++)
+ return (0);
+ return (1);
+}
+
+/*
+ * Interpret 'A' Solaris ACL header
+ */
+static int
+header_Solaris_ACL(struct archive_read *a, struct tar *tar,
+ struct archive_entry *entry, const void *h)
+{
+ const struct archive_entry_header_ustar *header;
+ size_t size;
+ int err;
+ int64_t type;
+ char *acl, *p;
+ wchar_t *wp;
+
+ /*
+ * read_body_to_string adds a NUL terminator, but we need a little
+ * more to make sure that we don't overrun acl_text later.
+ */
+ header = (const struct archive_entry_header_ustar *)h;
+ size = tar_atol(header->size, sizeof(header->size));
+ err = read_body_to_string(a, tar, &(tar->acl_text), h);
+ if (err != ARCHIVE_OK)
+ return (err);
+ /* Recursively read next header */
+ err = tar_read_header(a, tar, entry);
+ if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN))
+ return (err);
+
+ /* TODO: Examine the first characters to see if this
+ * is an AIX ACL descriptor. We'll likely never support
+ * them, but it would be polite to recognize and warn when
+ * we do see them. */
+
+ /* Leading octal number indicates ACL type and number of entries. */
+ p = acl = tar->acl_text.s;
+ type = 0;
+ while (*p != '\0' && p < acl + size) {
+ if (*p < '0' || *p > '7') {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Malformed Solaris ACL attribute (invalid digit)");
+ return(ARCHIVE_WARN);
+ }
+ type <<= 3;
+ type += *p - '0';
+ if (type > 077777777) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Malformed Solaris ACL attribute (count too large)");
+ return (ARCHIVE_WARN);
+ }
+ p++;
+ }
+ switch ((int)type & ~0777777) {
+ case 01000000:
+ /* POSIX.1e ACL */
+ break;
+ case 03000000:
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Solaris NFSv4 ACLs not supported");
+ return (ARCHIVE_WARN);
+ default:
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Malformed Solaris ACL attribute (unsupported type %o)",
+ (int)type);
+ return (ARCHIVE_WARN);
+ }
+ p++;
+
+ if (p >= acl + size) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Malformed Solaris ACL attribute (body overflow)");
+ return(ARCHIVE_WARN);
+ }
+
+ /* ACL text is null-terminated; find the end. */
+ size -= (p - acl);
+ acl = p;
+
+ while (*p != '\0' && p < acl + size)
+ p++;
+
+ wp = utf8_decode(tar, acl, p - acl);
+ err = __archive_entry_acl_parse_w(entry, wp,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ if (err != ARCHIVE_OK)
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Malformed Solaris ACL attribute (unparsable)");
+ return (err);
+}
+
+/*
+ * Interpret 'K' long linkname header.
+ */
+static int
+header_longlink(struct archive_read *a, struct tar *tar,
+ struct archive_entry *entry, const void *h)
+{
+ int err;
+
+ err = read_body_to_string(a, tar, &(tar->longlink), h);
+ if (err != ARCHIVE_OK)
+ return (err);
+ err = tar_read_header(a, tar, entry);
+ if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN))
+ return (err);
+ /* Set symlink if symlink already set, else hardlink. */
+ archive_entry_copy_link(entry, tar->longlink.s);
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Interpret 'L' long filename header.
+ */
+static int
+header_longname(struct archive_read *a, struct tar *tar,
+ struct archive_entry *entry, const void *h)
+{
+ int err;
+
+ err = read_body_to_string(a, tar, &(tar->longname), h);
+ if (err != ARCHIVE_OK)
+ return (err);
+ /* Read and parse "real" header, then override name. */
+ err = tar_read_header(a, tar, entry);
+ if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN))
+ return (err);
+ archive_entry_copy_pathname(entry, tar->longname.s);
+ return (ARCHIVE_OK);
+}
+
+
+/*
+ * Interpret 'V' GNU tar volume header.
+ */
+static int
+header_volume(struct archive_read *a, struct tar *tar,
+ struct archive_entry *entry, const void *h)
+{
+ (void)h;
+
+ /* Just skip this and read the next header. */
+ return (tar_read_header(a, tar, entry));
+}
+
+/*
+ * Read body of an archive entry into an archive_string object.
+ */
+static int
+read_body_to_string(struct archive_read *a, struct tar *tar,
+ struct archive_string *as, const void *h)
+{
+ off_t size, padded_size;
+ const struct archive_entry_header_ustar *header;
+ const void *src;
+
+ (void)tar; /* UNUSED */
+ header = (const struct archive_entry_header_ustar *)h;
+ size = tar_atol(header->size, sizeof(header->size));
+ if ((size > 1048576) || (size < 0)) {
+ archive_set_error(&a->archive, EINVAL,
+ "Special header too large");
+ return (ARCHIVE_FATAL);
+ }
+
+ /* Fail if we can't make our buffer big enough. */
+ if (archive_string_ensure(as, size+1) == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "No memory");
+ return (ARCHIVE_FATAL);
+ }
+
+ /* Read the body into the string. */
+ padded_size = (size + 511) & ~ 511;
+ src = __archive_read_ahead(a, padded_size, NULL);
+ if (src == NULL)
+ return (ARCHIVE_FATAL);
+ memcpy(as->s, src, size);
+ __archive_read_consume(a, padded_size);
+ as->s[size] = '\0';
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Parse out common header elements.
+ *
+ * This would be the same as header_old_tar, except that the
+ * filename is handled slightly differently for old and POSIX
+ * entries (POSIX entries support a 'prefix'). This factoring
+ * allows header_old_tar and header_ustar
+ * to handle filenames differently, while still putting most of the
+ * common parsing into one place.
+ */
+static int
+header_common(struct archive_read *a, struct tar *tar,
+ struct archive_entry *entry, const void *h)
+{
+ const struct archive_entry_header_ustar *header;
+ char tartype;
+
+ (void)a; /* UNUSED */
+
+ header = (const struct archive_entry_header_ustar *)h;
+ if (header->linkname[0])
+ archive_strncpy(&(tar->entry_linkpath), header->linkname,
+ sizeof(header->linkname));
+ else
+ archive_string_empty(&(tar->entry_linkpath));
+
+ /* Parse out the numeric fields (all are octal) */
+ archive_entry_set_mode(entry, tar_atol(header->mode, sizeof(header->mode)));
+ archive_entry_set_uid(entry, tar_atol(header->uid, sizeof(header->uid)));
+ archive_entry_set_gid(entry, tar_atol(header->gid, sizeof(header->gid)));
+ tar->entry_bytes_remaining = tar_atol(header->size, sizeof(header->size));
+ tar->realsize = tar->entry_bytes_remaining;
+ archive_entry_set_size(entry, tar->entry_bytes_remaining);
+ archive_entry_set_mtime(entry, tar_atol(header->mtime, sizeof(header->mtime)), 0);
+
+ /* Handle the tar type flag appropriately. */
+ tartype = header->typeflag[0];
+
+ switch (tartype) {
+ case '1': /* Hard link */
+ archive_entry_copy_hardlink(entry, tar->entry_linkpath.s);
+ /*
+ * The following may seem odd, but: Technically, tar
+ * does not store the file type for a "hard link"
+ * entry, only the fact that it is a hard link. So, I
+ * leave the type zero normally. But, pax interchange
+ * format allows hard links to have data, which
+ * implies that the underlying entry is a regular
+ * file.
+ */
+ if (archive_entry_size(entry) > 0)
+ archive_entry_set_filetype(entry, AE_IFREG);
+
+ /*
+ * A tricky point: Traditionally, tar readers have
+ * ignored the size field when reading hardlink
+ * entries, and some writers put non-zero sizes even
+ * though the body is empty. POSIX blessed this
+ * convention in the 1988 standard, but broke with
+ * this tradition in 2001 by permitting hardlink
+ * entries to store valid bodies in pax interchange
+ * format, but not in ustar format. Since there is no
+ * hard and fast way to distinguish pax interchange
+ * from earlier archives (the 'x' and 'g' entries are
+ * optional, after all), we need a heuristic.
+ */
+ if (archive_entry_size(entry) == 0) {
+ /* If the size is already zero, we're done. */
+ } else if (a->archive.archive_format
+ == ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE) {
+ /* Definitely pax extended; must obey hardlink size. */
+ } else if (a->archive.archive_format == ARCHIVE_FORMAT_TAR
+ || a->archive.archive_format == ARCHIVE_FORMAT_TAR_GNUTAR)
+ {
+ /* Old-style or GNU tar: we must ignore the size. */
+ archive_entry_set_size(entry, 0);
+ tar->entry_bytes_remaining = 0;
+ } else if (archive_read_format_tar_bid(a) > 50) {
+ /*
+ * We don't know if it's pax: If the bid
+ * function sees a valid ustar header
+ * immediately following, then let's ignore
+ * the hardlink size.
+ */
+ archive_entry_set_size(entry, 0);
+ tar->entry_bytes_remaining = 0;
+ }
+ /*
+ * TODO: There are still two cases I'd like to handle:
+ * = a ustar non-pax archive with a hardlink entry at
+ * end-of-archive. (Look for block of nulls following?)
+ * = a pax archive that has not seen any pax headers
+ * and has an entry which is a hardlink entry storing
+ * a body containing an uncompressed tar archive.
+ * The first is worth addressing; I don't see any reliable
+ * way to deal with the second possibility.
+ */
+ break;
+ case '2': /* Symlink */
+ archive_entry_set_filetype(entry, AE_IFLNK);
+ archive_entry_set_size(entry, 0);
+ tar->entry_bytes_remaining = 0;
+ archive_entry_copy_symlink(entry, tar->entry_linkpath.s);
+ break;
+ case '3': /* Character device */
+ archive_entry_set_filetype(entry, AE_IFCHR);
+ archive_entry_set_size(entry, 0);
+ tar->entry_bytes_remaining = 0;
+ break;
+ case '4': /* Block device */
+ archive_entry_set_filetype(entry, AE_IFBLK);
+ archive_entry_set_size(entry, 0);
+ tar->entry_bytes_remaining = 0;
+ break;
+ case '5': /* Dir */
+ archive_entry_set_filetype(entry, AE_IFDIR);
+ archive_entry_set_size(entry, 0);
+ tar->entry_bytes_remaining = 0;
+ break;
+ case '6': /* FIFO device */
+ archive_entry_set_filetype(entry, AE_IFIFO);
+ archive_entry_set_size(entry, 0);
+ tar->entry_bytes_remaining = 0;
+ break;
+ case 'D': /* GNU incremental directory type */
+ /*
+ * No special handling is actually required here.
+ * It might be nice someday to preprocess the file list and
+ * provide it to the client, though.
+ */
+ archive_entry_set_filetype(entry, AE_IFDIR);
+ break;
+ case 'M': /* GNU "Multi-volume" (remainder of file from last archive)*/
+ /*
+ * As far as I can tell, this is just like a regular file
+ * entry, except that the contents should be _appended_ to
+ * the indicated file at the indicated offset. This may
+ * require some API work to fully support.
+ */
+ break;
+ case 'N': /* Old GNU "long filename" entry. */
+ /* The body of this entry is a script for renaming
+ * previously-extracted entries. Ugh. It will never
+ * be supported by libarchive. */
+ archive_entry_set_filetype(entry, AE_IFREG);
+ break;
+ case 'S': /* GNU sparse files */
+ /*
+ * Sparse files are really just regular files with
+ * sparse information in the extended area.
+ */
+ /* FALLTHROUGH */
+ default: /* Regular file and non-standard types */
+ /*
+ * Per POSIX: non-recognized types should always be
+ * treated as regular files.
+ */
+ archive_entry_set_filetype(entry, AE_IFREG);
+ break;
+ }
+ return (0);
+}
+
+/*
+ * Parse out header elements for "old-style" tar archives.
+ */
+static int
+header_old_tar(struct archive_read *a, struct tar *tar,
+ struct archive_entry *entry, const void *h)
+{
+ const struct archive_entry_header_ustar *header;
+
+ /* Copy filename over (to ensure null termination). */
+ header = (const struct archive_entry_header_ustar *)h;
+ archive_strncpy(&(tar->entry_pathname), header->name, sizeof(header->name));
+ archive_entry_copy_pathname(entry, tar->entry_pathname.s);
+
+ /* Grab rest of common fields */
+ header_common(a, tar, entry, h);
+
+ tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
+ return (0);
+}
+
+/*
+ * Parse a file header for a pax extended archive entry.
+ */
+static int
+header_pax_global(struct archive_read *a, struct tar *tar,
+ struct archive_entry *entry, const void *h)
+{
+ int err;
+
+ err = read_body_to_string(a, tar, &(tar->pax_global), h);
+ if (err != ARCHIVE_OK)
+ return (err);
+ err = tar_read_header(a, tar, entry);
+ return (err);
+}
+
+static int
+header_pax_extensions(struct archive_read *a, struct tar *tar,
+ struct archive_entry *entry, const void *h)
+{
+ int err, err2;
+
+ err = read_body_to_string(a, tar, &(tar->pax_header), h);
+ if (err != ARCHIVE_OK)
+ return (err);
+
+ /* Parse the next header. */
+ err = tar_read_header(a, tar, entry);
+ if ((err != ARCHIVE_OK) && (err != ARCHIVE_WARN))
+ return (err);
+
+ /*
+ * TODO: Parse global/default options into 'entry' struct here
+ * before handling file-specific options.
+ *
+ * This design (parse standard header, then overwrite with pax
+ * extended attribute data) usually works well, but isn't ideal;
+ * it would be better to parse the pax extended attributes first
+ * and then skip any fields in the standard header that were
+ * defined in the pax header.
+ */
+ err2 = pax_header(a, tar, entry, tar->pax_header.s);
+ err = err_combine(err, err2);
+ tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
+ return (err);
+}
+
+
+/*
+ * Parse a file header for a Posix "ustar" archive entry. This also
+ * handles "pax" or "extended ustar" entries.
+ */
+static int
+header_ustar(struct archive_read *a, struct tar *tar,
+ struct archive_entry *entry, const void *h)
+{
+ const struct archive_entry_header_ustar *header;
+ struct archive_string *as;
+
+ header = (const struct archive_entry_header_ustar *)h;
+
+ /* Copy name into an internal buffer to ensure null-termination. */
+ as = &(tar->entry_pathname);
+ if (header->prefix[0]) {
+ archive_strncpy(as, header->prefix, sizeof(header->prefix));
+ if (as->s[archive_strlen(as) - 1] != '/')
+ archive_strappend_char(as, '/');
+ archive_strncat(as, header->name, sizeof(header->name));
+ } else
+ archive_strncpy(as, header->name, sizeof(header->name));
+
+ archive_entry_copy_pathname(entry, as->s);
+
+ /* Handle rest of common fields. */
+ header_common(a, tar, entry, h);
+
+ /* Handle POSIX ustar fields. */
+ archive_strncpy(&(tar->entry_uname), header->uname,
+ sizeof(header->uname));
+ archive_entry_copy_uname(entry, tar->entry_uname.s);
+
+ archive_strncpy(&(tar->entry_gname), header->gname,
+ sizeof(header->gname));
+ archive_entry_copy_gname(entry, tar->entry_gname.s);
+
+ /* Parse out device numbers only for char and block specials. */
+ if (header->typeflag[0] == '3' || header->typeflag[0] == '4') {
+ archive_entry_set_rdevmajor(entry,
+ tar_atol(header->rdevmajor, sizeof(header->rdevmajor)));
+ archive_entry_set_rdevminor(entry,
+ tar_atol(header->rdevminor, sizeof(header->rdevminor)));
+ }
+
+ tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
+
+ return (0);
+}
+
+
+/*
+ * Parse the pax extended attributes record.
+ *
+ * Returns non-zero if there's an error in the data.
+ */
+static int
+pax_header(struct archive_read *a, struct tar *tar,
+ struct archive_entry *entry, char *attr)
+{
+ size_t attr_length, l, line_length;
+ char *p;
+ char *key, *value;
+ int err, err2;
+
+ attr_length = strlen(attr);
+ tar->pax_hdrcharset_binary = 0;
+ archive_string_empty(&(tar->entry_gname));
+ archive_string_empty(&(tar->entry_linkpath));
+ archive_string_empty(&(tar->entry_pathname));
+ archive_string_empty(&(tar->entry_pathname_override));
+ archive_string_empty(&(tar->entry_uname));
+ err = ARCHIVE_OK;
+ while (attr_length > 0) {
+ /* Parse decimal length field at start of line. */
+ line_length = 0;
+ l = attr_length;
+ p = attr; /* Record start of line. */
+ while (l>0) {
+ if (*p == ' ') {
+ p++;
+ l--;
+ break;
+ }
+ if (*p < '0' || *p > '9') {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Ignoring malformed pax extended attributes");
+ return (ARCHIVE_WARN);
+ }
+ line_length *= 10;
+ line_length += *p - '0';
+ if (line_length > 999999) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Rejecting pax extended attribute > 1MB");
+ return (ARCHIVE_WARN);
+ }
+ p++;
+ l--;
+ }
+
+ /*
+ * Parsed length must be no bigger than available data,
+ * at least 1, and the last character of the line must
+ * be '\n'.
+ */
+ if (line_length > attr_length
+ || line_length < 1
+ || attr[line_length - 1] != '\n')
+ {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Ignoring malformed pax extended attribute");
+ return (ARCHIVE_WARN);
+ }
+
+ /* Null-terminate the line. */
+ attr[line_length - 1] = '\0';
+
+ /* Find end of key and null terminate it. */
+ key = p;
+ if (key[0] == '=')
+ return (-1);
+ while (*p && *p != '=')
+ ++p;
+ if (*p == '\0') {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Invalid pax extended attributes");
+ return (ARCHIVE_WARN);
+ }
+ *p = '\0';
+
+ /* Identify null-terminated 'value' portion. */
+ value = p + 1;
+
+ /* Identify this attribute and set it in the entry. */
+ err2 = pax_attribute(tar, entry, key, value);
+ err = err_combine(err, err2);
+
+ /* Skip to next line */
+ attr += line_length;
+ attr_length -= line_length;
+ }
+ if (archive_strlen(&(tar->entry_gname)) > 0) {
+ value = tar->entry_gname.s;
+ if (tar->pax_hdrcharset_binary)
+ archive_entry_copy_gname(entry, value);
+ else {
+ if (!archive_entry_update_gname_utf8(entry, value)) {
+ err = ARCHIVE_WARN;
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Gname in pax header can't "
+ "be converted to current locale.");
+ }
+ }
+ }
+ if (archive_strlen(&(tar->entry_linkpath)) > 0) {
+ value = tar->entry_linkpath.s;
+ if (tar->pax_hdrcharset_binary)
+ archive_entry_copy_link(entry, value);
+ else {
+ if (!archive_entry_update_link_utf8(entry, value)) {
+ err = ARCHIVE_WARN;
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Linkname in pax header can't "
+ "be converted to current locale.");
+ }
+ }
+ }
+ /*
+ * Some extensions (such as the GNU sparse file extensions)
+ * deliberately store a synthetic name under the regular 'path'
+ * attribute and the real file name under a different attribute.
+ * Since we're supposed to not care about the order, we
+ * have no choice but to store all of the various filenames
+ * we find and figure it all out afterwards. This is the
+ * figuring out part.
+ */
+ value = NULL;
+ if (archive_strlen(&(tar->entry_pathname_override)) > 0)
+ value = tar->entry_pathname_override.s;
+ else if (archive_strlen(&(tar->entry_pathname)) > 0)
+ value = tar->entry_pathname.s;
+ if (value != NULL) {
+ if (tar->pax_hdrcharset_binary)
+ archive_entry_copy_pathname(entry, value);
+ else {
+ if (!archive_entry_update_pathname_utf8(entry, value)) {
+ err = ARCHIVE_WARN;
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Pathname in pax header can't be "
+ "converted to current locale.");
+ }
+ }
+ }
+ if (archive_strlen(&(tar->entry_uname)) > 0) {
+ value = tar->entry_uname.s;
+ if (tar->pax_hdrcharset_binary)
+ archive_entry_copy_uname(entry, value);
+ else {
+ if (!archive_entry_update_uname_utf8(entry, value)) {
+ err = ARCHIVE_WARN;
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Uname in pax header can't "
+ "be converted to current locale.");
+ }
+ }
+ }
+ return (err);
+}
+
+static int
+pax_attribute_xattr(struct archive_entry *entry,
+ char *name, char *value)
+{
+ char *name_decoded;
+ void *value_decoded;
+ size_t value_len;
+
+ if (strlen(name) < 18 || (strncmp(name, "LIBARCHIVE.xattr.", 17)) != 0)
+ return 3;
+
+ name += 17;
+
+ /* URL-decode name */
+ name_decoded = url_decode(name);
+ if (name_decoded == NULL)
+ return 2;
+
+ /* Base-64 decode value */
+ value_decoded = base64_decode(value, strlen(value), &value_len);
+ if (value_decoded == NULL) {
+ free(name_decoded);
+ return 1;
+ }
+
+ archive_entry_xattr_add_entry(entry, name_decoded,
+ value_decoded, value_len);
+
+ free(name_decoded);
+ free(value_decoded);
+ return 0;
+}
+
+/*
+ * Parse a single key=value attribute. key/value pointers are
+ * assumed to point into reasonably long-lived storage.
+ *
+ * Note that POSIX reserves all-lowercase keywords. Vendor-specific
+ * extensions should always have keywords of the form "VENDOR.attribute"
+ * In particular, it's quite feasible to support many different
+ * vendor extensions here. I'm using "LIBARCHIVE" for extensions
+ * unique to this library.
+ *
+ * Investigate other vendor-specific extensions and see if
+ * any of them look useful.
+ */
+static int
+pax_attribute(struct tar *tar, struct archive_entry *entry,
+ char *key, char *value)
+{
+ int64_t s;
+ long n;
+ wchar_t *wp;
+
+ switch (key[0]) {
+ case 'G':
+ /* GNU "0.0" sparse pax format. */
+ if (strcmp(key, "GNU.sparse.numblocks") == 0) {
+ tar->sparse_offset = -1;
+ tar->sparse_numbytes = -1;
+ tar->sparse_gnu_major = 0;
+ tar->sparse_gnu_minor = 0;
+ }
+ if (strcmp(key, "GNU.sparse.offset") == 0) {
+ tar->sparse_offset = tar_atol10(value, strlen(value));
+ if (tar->sparse_numbytes != -1) {
+ gnu_add_sparse_entry(tar,
+ tar->sparse_offset, tar->sparse_numbytes);
+ tar->sparse_offset = -1;
+ tar->sparse_numbytes = -1;
+ }
+ }
+ if (strcmp(key, "GNU.sparse.numbytes") == 0) {
+ tar->sparse_numbytes = tar_atol10(value, strlen(value));
+ if (tar->sparse_numbytes != -1) {
+ gnu_add_sparse_entry(tar,
+ tar->sparse_offset, tar->sparse_numbytes);
+ tar->sparse_offset = -1;
+ tar->sparse_numbytes = -1;
+ }
+ }
+ if (strcmp(key, "GNU.sparse.size") == 0) {
+ tar->realsize = tar_atol10(value, strlen(value));
+ archive_entry_set_size(entry, tar->realsize);
+ }
+
+ /* GNU "0.1" sparse pax format. */
+ if (strcmp(key, "GNU.sparse.map") == 0) {
+ tar->sparse_gnu_major = 0;
+ tar->sparse_gnu_minor = 1;
+ if (gnu_sparse_01_parse(tar, value) != ARCHIVE_OK)
+ return (ARCHIVE_WARN);
+ }
+
+ /* GNU "1.0" sparse pax format */
+ if (strcmp(key, "GNU.sparse.major") == 0) {
+ tar->sparse_gnu_major = tar_atol10(value, strlen(value));
+ tar->sparse_gnu_pending = 1;
+ }
+ if (strcmp(key, "GNU.sparse.minor") == 0) {
+ tar->sparse_gnu_minor = tar_atol10(value, strlen(value));
+ tar->sparse_gnu_pending = 1;
+ }
+ if (strcmp(key, "GNU.sparse.name") == 0) {
+ /*
+ * The real filename; when storing sparse
+ * files, GNU tar puts a synthesized name into
+ * the regular 'path' attribute in an attempt
+ * to limit confusion. ;-)
+ */
+ archive_strcpy(&(tar->entry_pathname_override), value);
+ }
+ if (strcmp(key, "GNU.sparse.realsize") == 0) {
+ tar->realsize = tar_atol10(value, strlen(value));
+ archive_entry_set_size(entry, tar->realsize);
+ }
+ break;
+ case 'L':
+ /* Our extensions */
+/* TODO: Handle arbitrary extended attributes... */
+/*
+ if (strcmp(key, "LIBARCHIVE.xxxxxxx")==0)
+ archive_entry_set_xxxxxx(entry, value);
+*/
+ if (strcmp(key, "LIBARCHIVE.creationtime")==0) {
+ pax_time(value, &s, &n);
+ archive_entry_set_birthtime(entry, s, n);
+ }
+ if (strncmp(key, "LIBARCHIVE.xattr.", 17)==0)
+ pax_attribute_xattr(entry, key, value);
+ break;
+ case 'S':
+ /* We support some keys used by the "star" archiver */
+ if (strcmp(key, "SCHILY.acl.access")==0) {
+ wp = utf8_decode(tar, value, strlen(value));
+ /* TODO: if (wp == NULL) */
+ __archive_entry_acl_parse_w(entry, wp,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ } else if (strcmp(key, "SCHILY.acl.default")==0) {
+ wp = utf8_decode(tar, value, strlen(value));
+ /* TODO: if (wp == NULL) */
+ __archive_entry_acl_parse_w(entry, wp,
+ ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
+ } else if (strcmp(key, "SCHILY.devmajor")==0) {
+ archive_entry_set_rdevmajor(entry,
+ tar_atol10(value, strlen(value)));
+ } else if (strcmp(key, "SCHILY.devminor")==0) {
+ archive_entry_set_rdevminor(entry,
+ tar_atol10(value, strlen(value)));
+ } else if (strcmp(key, "SCHILY.fflags")==0) {
+ archive_entry_copy_fflags_text(entry, value);
+ } else if (strcmp(key, "SCHILY.dev")==0) {
+ archive_entry_set_dev(entry,
+ tar_atol10(value, strlen(value)));
+ } else if (strcmp(key, "SCHILY.ino")==0) {
+ archive_entry_set_ino(entry,
+ tar_atol10(value, strlen(value)));
+ } else if (strcmp(key, "SCHILY.nlink")==0) {
+ archive_entry_set_nlink(entry,
+ tar_atol10(value, strlen(value)));
+ } else if (strcmp(key, "SCHILY.realsize")==0) {
+ tar->realsize = tar_atol10(value, strlen(value));
+ archive_entry_set_size(entry, tar->realsize);
+ }
+ break;
+ case 'a':
+ if (strcmp(key, "atime")==0) {
+ pax_time(value, &s, &n);
+ archive_entry_set_atime(entry, s, n);
+ }
+ break;
+ case 'c':
+ if (strcmp(key, "ctime")==0) {
+ pax_time(value, &s, &n);
+ archive_entry_set_ctime(entry, s, n);
+ } else if (strcmp(key, "charset")==0) {
+ /* TODO: Publish charset information in entry. */
+ } else if (strcmp(key, "comment")==0) {
+ /* TODO: Publish comment in entry. */
+ }
+ break;
+ case 'g':
+ if (strcmp(key, "gid")==0) {
+ archive_entry_set_gid(entry,
+ tar_atol10(value, strlen(value)));
+ } else if (strcmp(key, "gname")==0) {
+ archive_strcpy(&(tar->entry_gname), value);
+ }
+ break;
+ case 'h':
+ if (strcmp(key, "hdrcharset") == 0) {
+ if (strcmp(value, "BINARY") == 0)
+ tar->pax_hdrcharset_binary = 1;
+ else if (strcmp(value, "ISO-IR 10646 2000 UTF-8") == 0)
+ tar->pax_hdrcharset_binary = 0;
+ else {
+ /* TODO: Warn about unsupported hdrcharset */
+ }
+ }
+ break;
+ case 'l':
+ /* pax interchange doesn't distinguish hardlink vs. symlink. */
+ if (strcmp(key, "linkpath")==0) {
+ archive_strcpy(&(tar->entry_linkpath), value);
+ }
+ break;
+ case 'm':
+ if (strcmp(key, "mtime")==0) {
+ pax_time(value, &s, &n);
+ archive_entry_set_mtime(entry, s, n);
+ }
+ break;
+ case 'p':
+ if (strcmp(key, "path")==0) {
+ archive_strcpy(&(tar->entry_pathname), value);
+ }
+ break;
+ case 'r':
+ /* POSIX has reserved 'realtime.*' */
+ break;
+ case 's':
+ /* POSIX has reserved 'security.*' */
+ /* Someday: if (strcmp(key, "security.acl")==0) { ... } */
+ if (strcmp(key, "size")==0) {
+ /* "size" is the size of the data in the entry. */
+ tar->entry_bytes_remaining
+ = tar_atol10(value, strlen(value));
+ /*
+ * But, "size" is not necessarily the size of
+ * the file on disk; if this is a sparse file,
+ * the disk size may have already been set from
+ * GNU.sparse.realsize or GNU.sparse.size or
+ * an old GNU header field or SCHILY.realsize
+ * or ....
+ */
+ if (tar->realsize < 0) {
+ archive_entry_set_size(entry,
+ tar->entry_bytes_remaining);
+ tar->realsize
+ = tar->entry_bytes_remaining;
+ }
+ }
+ break;
+ case 'u':
+ if (strcmp(key, "uid")==0) {
+ archive_entry_set_uid(entry,
+ tar_atol10(value, strlen(value)));
+ } else if (strcmp(key, "uname")==0) {
+ archive_strcpy(&(tar->entry_uname), value);
+ }
+ break;
+ }
+ return (0);
+}
+
+
+
+/*
+ * parse a decimal time value, which may include a fractional portion
+ */
+static void
+pax_time(const char *p, int64_t *ps, long *pn)
+{
+ char digit;
+ int64_t s;
+ unsigned long l;
+ int sign;
+ int64_t limit, last_digit_limit;
+
+ limit = INT64_MAX / 10;
+ last_digit_limit = INT64_MAX % 10;
+
+ s = 0;
+ sign = 1;
+ if (*p == '-') {
+ sign = -1;
+ p++;
+ }
+ while (*p >= '0' && *p <= '9') {
+ digit = *p - '0';
+ if (s > limit ||
+ (s == limit && digit > last_digit_limit)) {
+ s = INT64_MAX;
+ break;
+ }
+ s = (s * 10) + digit;
+ ++p;
+ }
+
+ *ps = s * sign;
+
+ /* Calculate nanoseconds. */
+ *pn = 0;
+
+ if (*p != '.')
+ return;
+
+ l = 100000000UL;
+ do {
+ ++p;
+ if (*p >= '0' && *p <= '9')
+ *pn += (*p - '0') * l;
+ else
+ break;
+ } while (l /= 10);
+}
+
+/*
+ * Parse GNU tar header
+ */
+static int
+header_gnutar(struct archive_read *a, struct tar *tar,
+ struct archive_entry *entry, const void *h)
+{
+ const struct archive_entry_header_gnutar *header;
+
+ (void)a;
+
+ /*
+ * GNU header is like POSIX ustar, except 'prefix' is
+ * replaced with some other fields. This also means the
+ * filename is stored as in old-style archives.
+ */
+
+ /* Grab fields common to all tar variants. */
+ header_common(a, tar, entry, h);
+
+ /* Copy filename over (to ensure null termination). */
+ header = (const struct archive_entry_header_gnutar *)h;
+ archive_strncpy(&(tar->entry_pathname), header->name,
+ sizeof(header->name));
+ archive_entry_copy_pathname(entry, tar->entry_pathname.s);
+
+ /* Fields common to ustar and GNU */
+ /* XXX Can the following be factored out since it's common
+ * to ustar and gnu tar? Is it okay to move it down into
+ * header_common, perhaps? */
+ archive_strncpy(&(tar->entry_uname),
+ header->uname, sizeof(header->uname));
+ archive_entry_copy_uname(entry, tar->entry_uname.s);
+
+ archive_strncpy(&(tar->entry_gname),
+ header->gname, sizeof(header->gname));
+ archive_entry_copy_gname(entry, tar->entry_gname.s);
+
+ /* Parse out device numbers only for char and block specials */
+ if (header->typeflag[0] == '3' || header->typeflag[0] == '4') {
+ archive_entry_set_rdevmajor(entry,
+ tar_atol(header->rdevmajor, sizeof(header->rdevmajor)));
+ archive_entry_set_rdevminor(entry,
+ tar_atol(header->rdevminor, sizeof(header->rdevminor)));
+ } else
+ archive_entry_set_rdev(entry, 0);
+
+ tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
+
+ /* Grab GNU-specific fields. */
+ archive_entry_set_atime(entry,
+ tar_atol(header->atime, sizeof(header->atime)), 0);
+ archive_entry_set_ctime(entry,
+ tar_atol(header->ctime, sizeof(header->ctime)), 0);
+ if (header->realsize[0] != 0) {
+ tar->realsize
+ = tar_atol(header->realsize, sizeof(header->realsize));
+ archive_entry_set_size(entry, tar->realsize);
+ }
+
+ if (header->sparse[0].offset[0] != 0) {
+ gnu_sparse_old_read(a, tar, header);
+ } else {
+ if (header->isextended[0] != 0) {
+ /* XXX WTF? XXX */
+ }
+ }
+
+ return (0);
+}
+
+static void
+gnu_add_sparse_entry(struct tar *tar, off_t offset, off_t remaining)
+{
+ struct sparse_block *p;
+
+ p = (struct sparse_block *)malloc(sizeof(*p));
+ if (p == NULL)
+ __archive_errx(1, "Out of memory");
+ memset(p, 0, sizeof(*p));
+ if (tar->sparse_last != NULL)
+ tar->sparse_last->next = p;
+ else
+ tar->sparse_list = p;
+ tar->sparse_last = p;
+ p->offset = offset;
+ p->remaining = remaining;
+}
+
+static void
+gnu_clear_sparse_list(struct tar *tar)
+{
+ struct sparse_block *p;
+
+ while (tar->sparse_list != NULL) {
+ p = tar->sparse_list;
+ tar->sparse_list = p->next;
+ free(p);
+ }
+ tar->sparse_last = NULL;
+}
+
+/*
+ * GNU tar old-format sparse data.
+ *
+ * GNU old-format sparse data is stored in a fixed-field
+ * format. Offset/size values are 11-byte octal fields (same
+ * format as 'size' field in ustart header). These are
+ * stored in the header, allocating subsequent header blocks
+ * as needed. Extending the header in this way is a pretty
+ * severe POSIX violation; this design has earned GNU tar a
+ * lot of criticism.
+ */
+
+static int
+gnu_sparse_old_read(struct archive_read *a, struct tar *tar,
+ const struct archive_entry_header_gnutar *header)
+{
+ ssize_t bytes_read;
+ const void *data;
+ struct extended {
+ struct gnu_sparse sparse[21];
+ char isextended[1];
+ char padding[7];
+ };
+ const struct extended *ext;
+
+ gnu_sparse_old_parse(tar, header->sparse, 4);
+ if (header->isextended[0] == 0)
+ return (ARCHIVE_OK);
+
+ do {
+ data = __archive_read_ahead(a, 512, &bytes_read);
+ if (bytes_read < 0)
+ return (ARCHIVE_FATAL);
+ if (bytes_read < 512) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Truncated tar archive "
+ "detected while reading sparse file data");
+ return (ARCHIVE_FATAL);
+ }
+ __archive_read_consume(a, 512);
+ ext = (const struct extended *)data;
+ gnu_sparse_old_parse(tar, ext->sparse, 21);
+ } while (ext->isextended[0] != 0);
+ if (tar->sparse_list != NULL)
+ tar->entry_offset = tar->sparse_list->offset;
+ return (ARCHIVE_OK);
+}
+
+static void
+gnu_sparse_old_parse(struct tar *tar,
+ const struct gnu_sparse *sparse, int length)
+{
+ while (length > 0 && sparse->offset[0] != 0) {
+ gnu_add_sparse_entry(tar,
+ tar_atol(sparse->offset, sizeof(sparse->offset)),
+ tar_atol(sparse->numbytes, sizeof(sparse->numbytes)));
+ sparse++;
+ length--;
+ }
+}
+
+/*
+ * GNU tar sparse format 0.0
+ *
+ * Beginning with GNU tar 1.15, sparse files are stored using
+ * information in the pax extended header. The GNU tar maintainers
+ * have gone through a number of variations in the process of working
+ * out this scheme; furtunately, they're all numbered.
+ *
+ * Sparse format 0.0 uses attribute GNU.sparse.numblocks to store the
+ * number of blocks, and GNU.sparse.offset/GNU.sparse.numbytes to
+ * store offset/size for each block. The repeated instances of these
+ * latter fields violate the pax specification (which frowns on
+ * duplicate keys), so this format was quickly replaced.
+ */
+
+/*
+ * GNU tar sparse format 0.1
+ *
+ * This version replaced the offset/numbytes attributes with
+ * a single "map" attribute that stored a list of integers. This
+ * format had two problems: First, the "map" attribute could be very
+ * long, which caused problems for some implementations. More
+ * importantly, the sparse data was lost when extracted by archivers
+ * that didn't recognize this extension.
+ */
+
+static int
+gnu_sparse_01_parse(struct tar *tar, const char *p)
+{
+ const char *e;
+ off_t offset = -1, size = -1;
+
+ for (;;) {
+ e = p;
+ while (*e != '\0' && *e != ',') {
+ if (*e < '0' || *e > '9')
+ return (ARCHIVE_WARN);
+ e++;
+ }
+ if (offset < 0) {
+ offset = tar_atol10(p, e - p);
+ if (offset < 0)
+ return (ARCHIVE_WARN);
+ } else {
+ size = tar_atol10(p, e - p);
+ if (size < 0)
+ return (ARCHIVE_WARN);
+ gnu_add_sparse_entry(tar, offset, size);
+ offset = -1;
+ }
+ if (*e == '\0')
+ return (ARCHIVE_OK);
+ p = e + 1;
+ }
+}
+
+/*
+ * GNU tar sparse format 1.0
+ *
+ * The idea: The offset/size data is stored as a series of base-10
+ * ASCII numbers prepended to the file data, so that dearchivers that
+ * don't support this format will extract the block map along with the
+ * data and a separate post-process can restore the sparseness.
+ *
+ * Unfortunately, GNU tar 1.16 had a bug that added unnecessary
+ * padding to the body of the file when using this format. GNU tar
+ * 1.17 corrected this bug without bumping the version number, so
+ * it's not possible to support both variants. This code supports
+ * the later variant at the expense of not supporting the former.
+ *
+ * This variant also replaced GNU.sparse.size with GNU.sparse.realsize
+ * and introduced the GNU.sparse.major/GNU.sparse.minor attributes.
+ */
+
+/*
+ * Read the next line from the input, and parse it as a decimal
+ * integer followed by '\n'. Returns positive integer value or
+ * negative on error.
+ */
+static int64_t
+gnu_sparse_10_atol(struct archive_read *a, struct tar *tar,
+ ssize_t *remaining)
+{
+ int64_t l, limit, last_digit_limit;
+ const char *p;
+ ssize_t bytes_read;
+ int base, digit;
+
+ base = 10;
+ limit = INT64_MAX / base;
+ last_digit_limit = INT64_MAX % base;
+
+ /*
+ * Skip any lines starting with '#'; GNU tar specs
+ * don't require this, but they should.
+ */
+ do {
+ bytes_read = readline(a, tar, &p, tar_min(*remaining, 100));
+ if (bytes_read <= 0)
+ return (ARCHIVE_FATAL);
+ *remaining -= bytes_read;
+ } while (p[0] == '#');
+
+ l = 0;
+ while (bytes_read > 0) {
+ if (*p == '\n')
+ return (l);
+ if (*p < '0' || *p >= '0' + base)
+ return (ARCHIVE_WARN);
+ digit = *p - '0';
+ if (l > limit || (l == limit && digit > last_digit_limit))
+ l = INT64_MAX; /* Truncate on overflow. */
+ else
+ l = (l * base) + digit;
+ p++;
+ bytes_read--;
+ }
+ /* TODO: Error message. */
+ return (ARCHIVE_WARN);
+}
+
+/*
+ * Returns length (in bytes) of the sparse data description
+ * that was read.
+ */
+static ssize_t
+gnu_sparse_10_read(struct archive_read *a, struct tar *tar)
+{
+ ssize_t remaining, bytes_read;
+ int entries;
+ off_t offset, size, to_skip;
+
+ /* Clear out the existing sparse list. */
+ gnu_clear_sparse_list(tar);
+
+ remaining = tar->entry_bytes_remaining;
+
+ /* Parse entries. */
+ entries = gnu_sparse_10_atol(a, tar, &remaining);
+ if (entries < 0)
+ return (ARCHIVE_FATAL);
+ /* Parse the individual entries. */
+ while (entries-- > 0) {
+ /* Parse offset/size */
+ offset = gnu_sparse_10_atol(a, tar, &remaining);
+ if (offset < 0)
+ return (ARCHIVE_FATAL);
+ size = gnu_sparse_10_atol(a, tar, &remaining);
+ if (size < 0)
+ return (ARCHIVE_FATAL);
+ /* Add a new sparse entry. */
+ gnu_add_sparse_entry(tar, offset, size);
+ }
+ /* Skip rest of block... */
+ bytes_read = tar->entry_bytes_remaining - remaining;
+ to_skip = 0x1ff & -bytes_read;
+ if (to_skip != __archive_read_skip(a, to_skip))
+ return (ARCHIVE_FATAL);
+ return (bytes_read + to_skip);
+}
+
+/*-
+ * Convert text->integer.
+ *
+ * Traditional tar formats (including POSIX) specify base-8 for
+ * all of the standard numeric fields. This is a significant limitation
+ * in practice:
+ * = file size is limited to 8GB
+ * = rdevmajor and rdevminor are limited to 21 bits
+ * = uid/gid are limited to 21 bits
+ *
+ * There are two workarounds for this:
+ * = pax extended headers, which use variable-length string fields
+ * = GNU tar and STAR both allow either base-8 or base-256 in
+ * most fields. The high bit is set to indicate base-256.
+ *
+ * On read, this implementation supports both extensions.
+ */
+static int64_t
+tar_atol(const char *p, unsigned char_cnt)
+{
+ /*
+ * Technically, GNU tar considers a field to be in base-256
+ * only if the first byte is 0xff or 0x80.
+ */
+ if (*p & 0x80)
+ return (tar_atol256(p, char_cnt));
+ return (tar_atol8(p, char_cnt));
+}
+
+/*
+ * Note that this implementation does not (and should not!) obey
+ * locale settings; you cannot simply substitute strtol here, since
+ * it does obey locale.
+ */
+static int64_t
+tar_atol8(const char *p, unsigned char_cnt)
+{
+ int64_t l, limit, last_digit_limit;
+ int digit, sign, base;
+
+ base = 8;
+ limit = INT64_MAX / base;
+ last_digit_limit = INT64_MAX % base;
+
+ while (*p == ' ' || *p == '\t')
+ p++;
+ if (*p == '-') {
+ sign = -1;
+ p++;
+ } else
+ sign = 1;
+
+ l = 0;
+ digit = *p - '0';
+ while (digit >= 0 && digit < base && char_cnt-- > 0) {
+ if (l>limit || (l == limit && digit > last_digit_limit)) {
+ l = INT64_MAX; /* Truncate on overflow. */
+ break;
+ }
+ l = (l * base) + digit;
+ digit = *++p - '0';
+ }
+ return (sign < 0) ? -l : l;
+}
+
+/*
+ * Note that this implementation does not (and should not!) obey
+ * locale settings; you cannot simply substitute strtol here, since
+ * it does obey locale.
+ */
+static int64_t
+tar_atol10(const char *p, unsigned char_cnt)
+{
+ int64_t l, limit, last_digit_limit;
+ int base, digit, sign;
+
+ base = 10;
+ limit = INT64_MAX / base;
+ last_digit_limit = INT64_MAX % base;
+
+ while (*p == ' ' || *p == '\t')
+ p++;
+ if (*p == '-') {
+ sign = -1;
+ p++;
+ } else
+ sign = 1;
+
+ l = 0;
+ digit = *p - '0';
+ while (digit >= 0 && digit < base && char_cnt-- > 0) {
+ if (l > limit || (l == limit && digit > last_digit_limit)) {
+ l = INT64_MAX; /* Truncate on overflow. */
+ break;
+ }
+ l = (l * base) + digit;
+ digit = *++p - '0';
+ }
+ return (sign < 0) ? -l : l;
+}
+
+/*
+ * Parse a base-256 integer. This is just a straight signed binary
+ * value in big-endian order, except that the high-order bit is
+ * ignored.
+ */
+static int64_t
+tar_atol256(const char *_p, unsigned char_cnt)
+{
+ int64_t l, upper_limit, lower_limit;
+ const unsigned char *p = (const unsigned char *)_p;
+
+ upper_limit = INT64_MAX / 256;
+ lower_limit = INT64_MIN / 256;
+
+ /* Pad with 1 or 0 bits, depending on sign. */
+ if ((0x40 & *p) == 0x40)
+ l = (int64_t)-1;
+ else
+ l = 0;
+ l = (l << 6) | (0x3f & *p++);
+ while (--char_cnt > 0) {
+ if (l > upper_limit) {
+ l = INT64_MAX; /* Truncate on overflow */
+ break;
+ } else if (l < lower_limit) {
+ l = INT64_MIN;
+ break;
+ }
+ l = (l << 8) | (0xff & (int64_t)*p++);
+ }
+ return (l);
+}
+
+/*
+ * Returns length of line (including trailing newline)
+ * or negative on error. 'start' argument is updated to
+ * point to first character of line. This avoids copying
+ * when possible.
+ */
+static ssize_t
+readline(struct archive_read *a, struct tar *tar, const char **start,
+ ssize_t limit)
+{
+ ssize_t bytes_read;
+ ssize_t total_size = 0;
+ const void *t;
+ const char *s;
+ void *p;
+
+ t = __archive_read_ahead(a, 1, &bytes_read);
+ if (bytes_read <= 0)
+ return (ARCHIVE_FATAL);
+ s = t; /* Start of line? */
+ p = memchr(t, '\n', bytes_read);
+ /* If we found '\n' in the read buffer, return pointer to that. */
+ if (p != NULL) {
+ bytes_read = 1 + ((const char *)p) - s;
+ if (bytes_read > limit) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Line too long");
+ return (ARCHIVE_FATAL);
+ }
+ __archive_read_consume(a, bytes_read);
+ *start = s;
+ return (bytes_read);
+ }
+ /* Otherwise, we need to accumulate in a line buffer. */
+ for (;;) {
+ if (total_size + bytes_read > limit) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Line too long");
+ return (ARCHIVE_FATAL);
+ }
+ if (archive_string_ensure(&tar->line, total_size + bytes_read) == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate working buffer");
+ return (ARCHIVE_FATAL);
+ }
+ memcpy(tar->line.s + total_size, t, bytes_read);
+ __archive_read_consume(a, bytes_read);
+ total_size += bytes_read;
+ /* If we found '\n', clean up and return. */
+ if (p != NULL) {
+ *start = tar->line.s;
+ return (total_size);
+ }
+ /* Read some more. */
+ t = __archive_read_ahead(a, 1, &bytes_read);
+ if (bytes_read <= 0)
+ return (ARCHIVE_FATAL);
+ s = t; /* Start of line? */
+ p = memchr(t, '\n', bytes_read);
+ /* If we found '\n', trim the read. */
+ if (p != NULL) {
+ bytes_read = 1 + ((const char *)p) - s;
+ }
+ }
+}
+
+static wchar_t *
+utf8_decode(struct tar *tar, const char *src, size_t length)
+{
+ wchar_t *dest;
+ ssize_t n;
+
+ /* Ensure pax_entry buffer is big enough. */
+ if (tar->pax_entry_length <= length) {
+ wchar_t *old_entry;
+
+ if (tar->pax_entry_length <= 0)
+ tar->pax_entry_length = 1024;
+ while (tar->pax_entry_length <= length + 1)
+ tar->pax_entry_length *= 2;
+
+ old_entry = tar->pax_entry;
+ tar->pax_entry = (wchar_t *)realloc(tar->pax_entry,
+ tar->pax_entry_length * sizeof(wchar_t));
+ if (tar->pax_entry == NULL) {
+ free(old_entry);
+ /* TODO: Handle this error. */
+ return (NULL);
+ }
+ }
+
+ dest = tar->pax_entry;
+ while (length > 0) {
+ n = UTF8_mbrtowc(dest, src, length);
+ if (n < 0)
+ return (NULL);
+ if (n == 0)
+ break;
+ dest++;
+ src += n;
+ length -= n;
+ }
+ *dest = L'\0';
+ return (tar->pax_entry);
+}
+
+/*
+ * Copied and simplified from FreeBSD libc/locale.
+ */
+static ssize_t
+UTF8_mbrtowc(wchar_t *pwc, const char *s, size_t n)
+{
+ int ch, i, len, mask;
+ unsigned long wch;
+
+ if (s == NULL || n == 0 || pwc == NULL)
+ return (0);
+
+ /*
+ * Determine the number of octets that make up this character from
+ * the first octet, and a mask that extracts the interesting bits of
+ * the first octet.
+ */
+ ch = (unsigned char)*s;
+ if ((ch & 0x80) == 0) {
+ mask = 0x7f;
+ len = 1;
+ } else if ((ch & 0xe0) == 0xc0) {
+ mask = 0x1f;
+ len = 2;
+ } else if ((ch & 0xf0) == 0xe0) {
+ mask = 0x0f;
+ len = 3;
+ } else if ((ch & 0xf8) == 0xf0) {
+ mask = 0x07;
+ len = 4;
+ } else {
+ /* Invalid first byte. */
+ return (-1);
+ }
+
+ if (n < (size_t)len) {
+ /* Valid first byte but truncated. */
+ return (-2);
+ }
+
+ /*
+ * Decode the octet sequence representing the character in chunks
+ * of 6 bits, most significant first.
+ */
+ wch = (unsigned char)*s++ & mask;
+ i = len;
+ while (--i != 0) {
+ if ((*s & 0xc0) != 0x80) {
+ /* Invalid intermediate byte; consume one byte and
+ * emit '?' */
+ *pwc = '?';
+ return (1);
+ }
+ wch <<= 6;
+ wch |= *s++ & 0x3f;
+ }
+
+ /* Assign the value to the output; out-of-range values
+ * just get truncated. */
+ *pwc = (wchar_t)wch;
+#ifdef WCHAR_MAX
+ /*
+ * If platform has WCHAR_MAX, we can do something
+ * more sensible with out-of-range values.
+ */
+ if (wch >= WCHAR_MAX)
+ *pwc = '?';
+#endif
+ /* Return number of bytes input consumed: 0 for end-of-string. */
+ return (wch == L'\0' ? 0 : len);
+}
+
+
+/*
+ * base64_decode - Base64 decode
+ *
+ * This accepts most variations of base-64 encoding, including:
+ * * with or without line breaks
+ * * with or without the final group padded with '=' or '_' characters
+ * (The most economical Base-64 variant does not pad the last group and
+ * omits line breaks; RFC1341 used for MIME requires both.)
+ */
+static char *
+base64_decode(const char *s, size_t len, size_t *out_len)
+{
+ static const unsigned char digits[64] = {
+ 'A','B','C','D','E','F','G','H','I','J','K','L','M','N',
+ 'O','P','Q','R','S','T','U','V','W','X','Y','Z','a','b',
+ 'c','d','e','f','g','h','i','j','k','l','m','n','o','p',
+ 'q','r','s','t','u','v','w','x','y','z','0','1','2','3',
+ '4','5','6','7','8','9','+','/' };
+ static unsigned char decode_table[128];
+ char *out, *d;
+ const unsigned char *src = (const unsigned char *)s;
+
+ /* If the decode table is not yet initialized, prepare it. */
+ if (decode_table[digits[1]] != 1) {
+ unsigned i;
+ memset(decode_table, 0xff, sizeof(decode_table));
+ for (i = 0; i < sizeof(digits); i++)
+ decode_table[digits[i]] = i;
+ }
+
+ /* Allocate enough space to hold the entire output. */
+ /* Note that we may not use all of this... */
+ out = (char *)malloc(len - len / 4 + 1);
+ if (out == NULL) {
+ *out_len = 0;
+ return (NULL);
+ }
+ d = out;
+
+ while (len > 0) {
+ /* Collect the next group of (up to) four characters. */
+ int v = 0;
+ int group_size = 0;
+ while (group_size < 4 && len > 0) {
+ /* '=' or '_' padding indicates final group. */
+ if (*src == '=' || *src == '_') {
+ len = 0;
+ break;
+ }
+ /* Skip illegal characters (including line breaks) */
+ if (*src > 127 || *src < 32
+ || decode_table[*src] == 0xff) {
+ len--;
+ src++;
+ continue;
+ }
+ v <<= 6;
+ v |= decode_table[*src++];
+ len --;
+ group_size++;
+ }
+ /* Align a short group properly. */
+ v <<= 6 * (4 - group_size);
+ /* Unpack the group we just collected. */
+ switch (group_size) {
+ case 4: d[2] = v & 0xff;
+ /* FALLTHROUGH */
+ case 3: d[1] = (v >> 8) & 0xff;
+ /* FALLTHROUGH */
+ case 2: d[0] = (v >> 16) & 0xff;
+ break;
+ case 1: /* this is invalid! */
+ break;
+ }
+ d += group_size * 3 / 4;
+ }
+
+ *out_len = d - out;
+ return (out);
+}
+
+static char *
+url_decode(const char *in)
+{
+ char *out, *d;
+ const char *s;
+
+ out = (char *)malloc(strlen(in) + 1);
+ if (out == NULL)
+ return (NULL);
+ for (s = in, d = out; *s != '\0'; ) {
+ if (s[0] == '%' && s[1] != '\0' && s[2] != '\0') {
+ /* Try to convert % escape */
+ int digit1 = tohex(s[1]);
+ int digit2 = tohex(s[2]);
+ if (digit1 >= 0 && digit2 >= 0) {
+ /* Looks good, consume three chars */
+ s += 3;
+ /* Convert output */
+ *d++ = ((digit1 << 4) | digit2);
+ continue;
+ }
+ /* Else fall through and treat '%' as normal char */
+ }
+ *d++ = *s++;
+ }
+ *d = '\0';
+ return (out);
+}
+
+static int
+tohex(int c)
+{
+ if (c >= '0' && c <= '9')
+ return (c - '0');
+ else if (c >= 'A' && c <= 'F')
+ return (c - 'A' + 10);
+ else if (c >= 'a' && c <= 'f')
+ return (c - 'a' + 10);
+ else
+ return (-1);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c b/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c
new file mode 100644
index 00000000000..5a85e71125a
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_read_support_format_zip.c
@@ -0,0 +1,903 @@
+/*-
+ * Copyright (c) 2004 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_zip.c 201102 2009-12-28 03:11:36Z kientzle $");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <time.h>
+#ifdef HAVE_ZLIB_H
+#include <zlib.h>
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+#include "archive_endian.h"
+
+#ifndef HAVE_ZLIB_H
+#include "archive_crc32.h"
+#endif
+
+struct zip {
+ /* entry_bytes_remaining is the number of bytes we expect. */
+ int64_t entry_bytes_remaining;
+ int64_t entry_offset;
+
+ /* These count the number of bytes actually read for the entry. */
+ int64_t entry_compressed_bytes_read;
+ int64_t entry_uncompressed_bytes_read;
+
+ /* Running CRC32 of the decompressed data */
+ unsigned long entry_crc32;
+
+ unsigned version;
+ unsigned system;
+ unsigned flags;
+ unsigned compression;
+ const char * compression_name;
+ time_t mtime;
+ time_t ctime;
+ time_t atime;
+ mode_t mode;
+ uid_t uid;
+ gid_t gid;
+
+ /* Flags to mark progress of decompression. */
+ char decompress_init;
+ char end_of_entry;
+
+ unsigned long crc32;
+ ssize_t filename_length;
+ ssize_t extra_length;
+ int64_t uncompressed_size;
+ int64_t compressed_size;
+
+ unsigned char *uncompressed_buffer;
+ size_t uncompressed_buffer_size;
+#ifdef HAVE_ZLIB_H
+ z_stream stream;
+ char stream_valid;
+#endif
+
+ struct archive_string pathname;
+ struct archive_string extra;
+ char format_name[64];
+};
+
+#define ZIP_LENGTH_AT_END 8
+
+struct zip_file_header {
+ char signature[4];
+ char version[2];
+ char flags[2];
+ char compression[2];
+ char timedate[4];
+ char crc32[4];
+ char compressed_size[4];
+ char uncompressed_size[4];
+ char filename_length[2];
+ char extra_length[2];
+};
+
+static const char *compression_names[] = {
+ "uncompressed",
+ "shrinking",
+ "reduced-1",
+ "reduced-2",
+ "reduced-3",
+ "reduced-4",
+ "imploded",
+ "reserved",
+ "deflation"
+};
+
+static int archive_read_format_zip_bid(struct archive_read *);
+static int archive_read_format_zip_cleanup(struct archive_read *);
+static int archive_read_format_zip_read_data(struct archive_read *,
+ const void **, size_t *, off_t *);
+static int archive_read_format_zip_read_data_skip(struct archive_read *a);
+static int archive_read_format_zip_read_header(struct archive_read *,
+ struct archive_entry *);
+static int zip_read_data_deflate(struct archive_read *a, const void **buff,
+ size_t *size, off_t *offset);
+static int zip_read_data_none(struct archive_read *a, const void **buff,
+ size_t *size, off_t *offset);
+static int zip_read_file_header(struct archive_read *a,
+ struct archive_entry *entry, struct zip *zip);
+static time_t zip_time(const char *);
+static void process_extra(const void* extra, struct zip* zip);
+
+int
+archive_read_support_format_zip(struct archive *_a)
+{
+ struct archive_read *a = (struct archive_read *)_a;
+ struct zip *zip;
+ int r;
+
+ zip = (struct zip *)malloc(sizeof(*zip));
+ if (zip == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Can't allocate zip data");
+ return (ARCHIVE_FATAL);
+ }
+ memset(zip, 0, sizeof(*zip));
+
+ r = __archive_read_register_format(a,
+ zip,
+ "zip",
+ archive_read_format_zip_bid,
+ NULL,
+ archive_read_format_zip_read_header,
+ archive_read_format_zip_read_data,
+ archive_read_format_zip_read_data_skip,
+ archive_read_format_zip_cleanup);
+
+ if (r != ARCHIVE_OK)
+ free(zip);
+ return (ARCHIVE_OK);
+}
+
+
+static int
+archive_read_format_zip_bid(struct archive_read *a)
+{
+ const char *p;
+ const void *buff;
+ ssize_t bytes_avail, offset;
+
+ if ((p = __archive_read_ahead(a, 4, NULL)) == NULL)
+ return (-1);
+
+ /*
+ * Bid of 30 here is: 16 bits for "PK",
+ * next 16-bit field has four options (-2 bits).
+ * 16 + 16-2 = 30.
+ */
+ if (p[0] == 'P' && p[1] == 'K') {
+ if ((p[2] == '\001' && p[3] == '\002')
+ || (p[2] == '\003' && p[3] == '\004')
+ || (p[2] == '\005' && p[3] == '\006')
+ || (p[2] == '\007' && p[3] == '\010')
+ || (p[2] == '0' && p[3] == '0'))
+ return (30);
+ }
+
+ /*
+ * Attempt to handle self-extracting archives
+ * by noting a PE header and searching forward
+ * up to 128k for a 'PK\003\004' marker.
+ */
+ if (p[0] == 'M' && p[1] == 'Z') {
+ /*
+ * TODO: Optimize by initializing 'offset' to an
+ * estimate of the likely start of the archive data
+ * based on values in the PE header. Note that we
+ * don't need to be exact, but we mustn't skip too
+ * far. The search below will compensate if we
+ * undershoot.
+ */
+ offset = 0;
+ while (offset < 124000) {
+ /* Get 4k of data beyond where we stopped. */
+ buff = __archive_read_ahead(a, offset + 4096,
+ &bytes_avail);
+ if (bytes_avail < offset + 1)
+ break;
+ p = (const char *)buff + offset;
+ while (p + 9 < (const char *)buff + bytes_avail) {
+ if (p[0] == 'P' && p[1] == 'K' /* signature */
+ && p[2] == 3 && p[3] == 4 /* File entry */
+ && p[8] == 8 /* compression == deflate */
+ && p[9] == 0 /* High byte of compression */
+ )
+ {
+ return (30);
+ }
+ ++p;
+ }
+ offset = p - (const char *)buff;
+ }
+ }
+
+ return (0);
+}
+
+/*
+ * Search forward for a "PK\003\004" file header. This handles the
+ * case of self-extracting archives, where there is an executable
+ * prepended to the ZIP archive.
+ */
+static int
+skip_sfx(struct archive_read *a)
+{
+ const void *h;
+ const char *p, *q;
+ size_t skip;
+ ssize_t bytes;
+
+ /*
+ * TODO: We should be able to skip forward by a bunch
+ * by lifting some values from the PE header. We don't
+ * need to be exact (we're still going to search forward
+ * to find the header), but it will speed things up and
+ * reduce the chance of a false positive.
+ */
+ for (;;) {
+ h = __archive_read_ahead(a, 4, &bytes);
+ if (bytes < 4)
+ return (ARCHIVE_FATAL);
+ p = h;
+ q = p + bytes;
+
+ /*
+ * Scan ahead until we find something that looks
+ * like the zip header.
+ */
+ while (p + 4 < q) {
+ switch (p[3]) {
+ case '\004':
+ /* TODO: Additional verification here. */
+ if (memcmp("PK\003\004", p, 4) == 0) {
+ skip = p - (const char *)h;
+ __archive_read_consume(a, skip);
+ return (ARCHIVE_OK);
+ }
+ p += 4;
+ break;
+ case '\003': p += 1; break;
+ case 'K': p += 2; break;
+ case 'P': p += 3; break;
+ default: p += 4; break;
+ }
+ }
+ skip = p - (const char *)h;
+ __archive_read_consume(a, skip);
+ }
+}
+
+static int
+archive_read_format_zip_read_header(struct archive_read *a,
+ struct archive_entry *entry)
+{
+ const void *h;
+ const char *signature;
+ struct zip *zip;
+ int r = ARCHIVE_OK, r1;
+
+ a->archive.archive_format = ARCHIVE_FORMAT_ZIP;
+ if (a->archive.archive_format_name == NULL)
+ a->archive.archive_format_name = "ZIP";
+
+ zip = (struct zip *)(a->format->data);
+ zip->decompress_init = 0;
+ zip->end_of_entry = 0;
+ zip->entry_uncompressed_bytes_read = 0;
+ zip->entry_compressed_bytes_read = 0;
+ zip->entry_crc32 = crc32(0, NULL, 0);
+ if ((h = __archive_read_ahead(a, 4, NULL)) == NULL)
+ return (ARCHIVE_FATAL);
+
+ signature = (const char *)h;
+ if (signature[0] == 'M' && signature[1] == 'Z') {
+ /* This is an executable? Must be self-extracting... */
+ r = skip_sfx(a);
+ if (r < ARCHIVE_WARN)
+ return (r);
+ if ((h = __archive_read_ahead(a, 4, NULL)) == NULL)
+ return (ARCHIVE_FATAL);
+ signature = (const char *)h;
+ }
+
+ if (signature[0] != 'P' || signature[1] != 'K') {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Bad ZIP file");
+ return (ARCHIVE_FATAL);
+ }
+
+ /*
+ * "PK00" signature is used for "split" archives that
+ * only have a single segment. This means we can just
+ * skip the PK00; the first real file header should follow.
+ */
+ if (signature[2] == '0' && signature[3] == '0') {
+ __archive_read_consume(a, 4);
+ if ((h = __archive_read_ahead(a, 4, NULL)) == NULL)
+ return (ARCHIVE_FATAL);
+ signature = (const char *)h;
+ if (signature[0] != 'P' || signature[1] != 'K') {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Bad ZIP file");
+ return (ARCHIVE_FATAL);
+ }
+ }
+
+ if (signature[2] == '\001' && signature[3] == '\002') {
+ /* Beginning of central directory. */
+ return (ARCHIVE_EOF);
+ }
+
+ if (signature[2] == '\003' && signature[3] == '\004') {
+ /* Regular file entry. */
+ r1 = zip_read_file_header(a, entry, zip);
+ if (r1 != ARCHIVE_OK)
+ return (r1);
+ return (r);
+ }
+
+ if (signature[2] == '\005' && signature[3] == '\006') {
+ /* End-of-archive record. */
+ return (ARCHIVE_EOF);
+ }
+
+ if (signature[2] == '\007' && signature[3] == '\010') {
+ /*
+ * We should never encounter this record here;
+ * see ZIP_LENGTH_AT_END handling below for details.
+ */
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Bad ZIP file: Unexpected end-of-entry record");
+ return (ARCHIVE_FATAL);
+ }
+
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Damaged ZIP file or unsupported format variant (%d,%d)",
+ signature[2], signature[3]);
+ return (ARCHIVE_FATAL);
+}
+
+static int
+zip_read_file_header(struct archive_read *a, struct archive_entry *entry,
+ struct zip *zip)
+{
+ const struct zip_file_header *p;
+ const void *h;
+
+ if ((p = __archive_read_ahead(a, sizeof *p, NULL)) == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Truncated ZIP file header");
+ return (ARCHIVE_FATAL);
+ }
+
+ zip->version = p->version[0];
+ zip->system = p->version[1];
+ zip->flags = archive_le16dec(p->flags);
+ zip->compression = archive_le16dec(p->compression);
+ if (zip->compression <
+ sizeof(compression_names)/sizeof(compression_names[0]))
+ zip->compression_name = compression_names[zip->compression];
+ else
+ zip->compression_name = "??";
+ zip->mtime = zip_time(p->timedate);
+ zip->ctime = 0;
+ zip->atime = 0;
+ zip->mode = 0;
+ zip->uid = 0;
+ zip->gid = 0;
+ zip->crc32 = archive_le32dec(p->crc32);
+ zip->filename_length = archive_le16dec(p->filename_length);
+ zip->extra_length = archive_le16dec(p->extra_length);
+ zip->uncompressed_size = archive_le32dec(p->uncompressed_size);
+ zip->compressed_size = archive_le32dec(p->compressed_size);
+
+ __archive_read_consume(a, sizeof(struct zip_file_header));
+
+
+ /* Read the filename. */
+ if ((h = __archive_read_ahead(a, zip->filename_length, NULL)) == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Truncated ZIP file header");
+ return (ARCHIVE_FATAL);
+ }
+ if (archive_string_ensure(&zip->pathname, zip->filename_length) == NULL)
+ __archive_errx(1, "Out of memory");
+ archive_strncpy(&zip->pathname, h, zip->filename_length);
+ __archive_read_consume(a, zip->filename_length);
+ archive_entry_set_pathname(entry, zip->pathname.s);
+
+ if (zip->pathname.s[archive_strlen(&zip->pathname) - 1] == '/')
+ zip->mode = AE_IFDIR | 0777;
+ else
+ zip->mode = AE_IFREG | 0777;
+
+ /* Read the extra data. */
+ if ((h = __archive_read_ahead(a, zip->extra_length, NULL)) == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Truncated ZIP file header");
+ return (ARCHIVE_FATAL);
+ }
+ process_extra(h, zip);
+ __archive_read_consume(a, zip->extra_length);
+
+ /* Populate some additional entry fields: */
+ archive_entry_set_mode(entry, zip->mode);
+ archive_entry_set_uid(entry, zip->uid);
+ archive_entry_set_gid(entry, zip->gid);
+ archive_entry_set_mtime(entry, zip->mtime, 0);
+ archive_entry_set_ctime(entry, zip->ctime, 0);
+ archive_entry_set_atime(entry, zip->atime, 0);
+ /* Set the size only if it's meaningful. */
+ if (0 == (zip->flags & ZIP_LENGTH_AT_END))
+ archive_entry_set_size(entry, zip->uncompressed_size);
+
+ zip->entry_bytes_remaining = zip->compressed_size;
+ zip->entry_offset = 0;
+
+ /* If there's no body, force read_data() to return EOF immediately. */
+ if (0 == (zip->flags & ZIP_LENGTH_AT_END)
+ && zip->entry_bytes_remaining < 1)
+ zip->end_of_entry = 1;
+
+ /* Set up a more descriptive format name. */
+ sprintf(zip->format_name, "ZIP %d.%d (%s)",
+ zip->version / 10, zip->version % 10,
+ zip->compression_name);
+ a->archive.archive_format_name = zip->format_name;
+
+ return (ARCHIVE_OK);
+}
+
+/* Convert an MSDOS-style date/time into Unix-style time. */
+static time_t
+zip_time(const char *p)
+{
+ int msTime, msDate;
+ struct tm ts;
+
+ msTime = (0xff & (unsigned)p[0]) + 256 * (0xff & (unsigned)p[1]);
+ msDate = (0xff & (unsigned)p[2]) + 256 * (0xff & (unsigned)p[3]);
+
+ memset(&ts, 0, sizeof(ts));
+ ts.tm_year = ((msDate >> 9) & 0x7f) + 80; /* Years since 1900. */
+ ts.tm_mon = ((msDate >> 5) & 0x0f) - 1; /* Month number. */
+ ts.tm_mday = msDate & 0x1f; /* Day of month. */
+ ts.tm_hour = (msTime >> 11) & 0x1f;
+ ts.tm_min = (msTime >> 5) & 0x3f;
+ ts.tm_sec = (msTime << 1) & 0x3e;
+ ts.tm_isdst = -1;
+ return mktime(&ts);
+}
+
+static int
+archive_read_format_zip_read_data(struct archive_read *a,
+ const void **buff, size_t *size, off_t *offset)
+{
+ int r;
+ struct zip *zip;
+
+ zip = (struct zip *)(a->format->data);
+
+ /*
+ * If we hit end-of-entry last time, clean up and return
+ * ARCHIVE_EOF this time.
+ */
+ if (zip->end_of_entry) {
+ *offset = zip->entry_uncompressed_bytes_read;
+ *size = 0;
+ *buff = NULL;
+ return (ARCHIVE_EOF);
+ }
+
+ switch(zip->compression) {
+ case 0: /* No compression. */
+ r = zip_read_data_none(a, buff, size, offset);
+ break;
+ case 8: /* Deflate compression. */
+ r = zip_read_data_deflate(a, buff, size, offset);
+ break;
+ default: /* Unsupported compression. */
+ *buff = NULL;
+ *size = 0;
+ *offset = 0;
+ /* Return a warning. */
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Unsupported ZIP compression method (%s)",
+ zip->compression_name);
+ if (zip->flags & ZIP_LENGTH_AT_END) {
+ /*
+ * ZIP_LENGTH_AT_END requires us to
+ * decompress the entry in order to
+ * skip it, but we don't know this
+ * compression method, so we give up.
+ */
+ r = ARCHIVE_FATAL;
+ } else {
+ /* We can't decompress this entry, but we will
+ * be able to skip() it and try the next entry. */
+ r = ARCHIVE_WARN;
+ }
+ break;
+ }
+ if (r != ARCHIVE_OK)
+ return (r);
+ /* Update checksum */
+ if (*size)
+ zip->entry_crc32 = crc32(zip->entry_crc32, *buff, *size);
+ /* If we hit the end, swallow any end-of-data marker. */
+ if (zip->end_of_entry) {
+ if (zip->flags & ZIP_LENGTH_AT_END) {
+ const char *p;
+
+ if ((p = __archive_read_ahead(a, 16, NULL)) == NULL) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Truncated ZIP end-of-file record");
+ return (ARCHIVE_FATAL);
+ }
+ zip->crc32 = archive_le32dec(p + 4);
+ zip->compressed_size = archive_le32dec(p + 8);
+ zip->uncompressed_size = archive_le32dec(p + 12);
+ __archive_read_consume(a, 16);
+ }
+ /* Check file size, CRC against these values. */
+ if (zip->compressed_size != zip->entry_compressed_bytes_read) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "ZIP compressed data is wrong size");
+ return (ARCHIVE_WARN);
+ }
+ /* Size field only stores the lower 32 bits of the actual size. */
+ if ((zip->uncompressed_size & UINT32_MAX)
+ != (zip->entry_uncompressed_bytes_read & UINT32_MAX)) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "ZIP uncompressed data is wrong size");
+ return (ARCHIVE_WARN);
+ }
+ /* Check computed CRC against header */
+ if (zip->crc32 != zip->entry_crc32) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "ZIP bad CRC: 0x%lx should be 0x%lx",
+ zip->entry_crc32, zip->crc32);
+ return (ARCHIVE_WARN);
+ }
+ }
+
+ /* Return EOF immediately if this is a non-regular file. */
+ if (AE_IFREG != (zip->mode & AE_IFMT))
+ return (ARCHIVE_EOF);
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Read "uncompressed" data. According to the current specification,
+ * if ZIP_LENGTH_AT_END is specified, then the size fields in the
+ * initial file header are supposed to be set to zero. This would, of
+ * course, make it impossible for us to read the archive, since we
+ * couldn't determine the end of the file data. Info-ZIP seems to
+ * include the real size fields both before and after the data in this
+ * case (the CRC only appears afterwards), so this works as you would
+ * expect.
+ *
+ * Returns ARCHIVE_OK if successful, ARCHIVE_FATAL otherwise, sets
+ * zip->end_of_entry if it consumes all of the data.
+ */
+static int
+zip_read_data_none(struct archive_read *a, const void **buff,
+ size_t *size, off_t *offset)
+{
+ struct zip *zip;
+ ssize_t bytes_avail;
+
+ zip = (struct zip *)(a->format->data);
+
+ if (zip->entry_bytes_remaining == 0) {
+ *buff = NULL;
+ *size = 0;
+ *offset = zip->entry_offset;
+ zip->end_of_entry = 1;
+ return (ARCHIVE_OK);
+ }
+ /*
+ * Note: '1' here is a performance optimization.
+ * Recall that the decompression layer returns a count of
+ * available bytes; asking for more than that forces the
+ * decompressor to combine reads by copying data.
+ */
+ *buff = __archive_read_ahead(a, 1, &bytes_avail);
+ if (bytes_avail <= 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Truncated ZIP file data");
+ return (ARCHIVE_FATAL);
+ }
+ if (bytes_avail > zip->entry_bytes_remaining)
+ bytes_avail = zip->entry_bytes_remaining;
+ __archive_read_consume(a, bytes_avail);
+ *size = bytes_avail;
+ *offset = zip->entry_offset;
+ zip->entry_offset += *size;
+ zip->entry_bytes_remaining -= *size;
+ zip->entry_uncompressed_bytes_read += *size;
+ zip->entry_compressed_bytes_read += *size;
+ return (ARCHIVE_OK);
+}
+
+#ifdef HAVE_ZLIB_H
+static int
+zip_read_data_deflate(struct archive_read *a, const void **buff,
+ size_t *size, off_t *offset)
+{
+ struct zip *zip;
+ ssize_t bytes_avail;
+ const void *compressed_buff;
+ int r;
+
+ zip = (struct zip *)(a->format->data);
+
+ /* If the buffer hasn't been allocated, allocate it now. */
+ if (zip->uncompressed_buffer == NULL) {
+ zip->uncompressed_buffer_size = 32 * 1024;
+ zip->uncompressed_buffer
+ = (unsigned char *)malloc(zip->uncompressed_buffer_size);
+ if (zip->uncompressed_buffer == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "No memory for ZIP decompression");
+ return (ARCHIVE_FATAL);
+ }
+ }
+
+ /* If we haven't yet read any data, initialize the decompressor. */
+ if (!zip->decompress_init) {
+ if (zip->stream_valid)
+ r = inflateReset(&zip->stream);
+ else
+ r = inflateInit2(&zip->stream,
+ -15 /* Don't check for zlib header */);
+ if (r != Z_OK) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Can't initialize ZIP decompression.");
+ return (ARCHIVE_FATAL);
+ }
+ /* Stream structure has been set up. */
+ zip->stream_valid = 1;
+ /* We've initialized decompression for this stream. */
+ zip->decompress_init = 1;
+ }
+
+ /*
+ * Note: '1' here is a performance optimization.
+ * Recall that the decompression layer returns a count of
+ * available bytes; asking for more than that forces the
+ * decompressor to combine reads by copying data.
+ */
+ compressed_buff = __archive_read_ahead(a, 1, &bytes_avail);
+ if (bytes_avail <= 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Truncated ZIP file body");
+ return (ARCHIVE_FATAL);
+ }
+
+ /*
+ * A bug in zlib.h: stream.next_in should be marked 'const'
+ * but isn't (the library never alters data through the
+ * next_in pointer, only reads it). The result: this ugly
+ * cast to remove 'const'.
+ */
+ zip->stream.next_in = (Bytef *)(uintptr_t)(const void *)compressed_buff;
+ zip->stream.avail_in = bytes_avail;
+ zip->stream.total_in = 0;
+ zip->stream.next_out = zip->uncompressed_buffer;
+ zip->stream.avail_out = zip->uncompressed_buffer_size;
+ zip->stream.total_out = 0;
+
+ r = inflate(&zip->stream, 0);
+ switch (r) {
+ case Z_OK:
+ break;
+ case Z_STREAM_END:
+ zip->end_of_entry = 1;
+ break;
+ case Z_MEM_ERROR:
+ archive_set_error(&a->archive, ENOMEM,
+ "Out of memory for ZIP decompression");
+ return (ARCHIVE_FATAL);
+ default:
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "ZIP decompression failed (%d)", r);
+ return (ARCHIVE_FATAL);
+ }
+
+ /* Consume as much as the compressor actually used. */
+ bytes_avail = zip->stream.total_in;
+ __archive_read_consume(a, bytes_avail);
+ zip->entry_bytes_remaining -= bytes_avail;
+ zip->entry_compressed_bytes_read += bytes_avail;
+
+ *offset = zip->entry_offset;
+ *size = zip->stream.total_out;
+ zip->entry_uncompressed_bytes_read += *size;
+ *buff = zip->uncompressed_buffer;
+ zip->entry_offset += *size;
+ return (ARCHIVE_OK);
+}
+#else
+static int
+zip_read_data_deflate(struct archive_read *a, const void **buff,
+ size_t *size, off_t *offset)
+{
+ *buff = NULL;
+ *size = 0;
+ *offset = 0;
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "libarchive compiled without deflate support (no libz)");
+ return (ARCHIVE_FATAL);
+}
+#endif
+
+static int
+archive_read_format_zip_read_data_skip(struct archive_read *a)
+{
+ struct zip *zip;
+ const void *buff = NULL;
+ off_t bytes_skipped;
+
+ zip = (struct zip *)(a->format->data);
+
+ /* If we've already read to end of data, we're done. */
+ if (zip->end_of_entry)
+ return (ARCHIVE_OK);
+
+ /*
+ * If the length is at the end, we have no choice but
+ * to decompress all the data to find the end marker.
+ */
+ if (zip->flags & ZIP_LENGTH_AT_END) {
+ size_t size;
+ off_t offset;
+ int r;
+ do {
+ r = archive_read_format_zip_read_data(a, &buff,
+ &size, &offset);
+ } while (r == ARCHIVE_OK);
+ return (r);
+ }
+
+ /*
+ * If the length is at the beginning, we can skip the
+ * compressed data much more quickly.
+ */
+ bytes_skipped = __archive_read_skip(a, zip->entry_bytes_remaining);
+ if (bytes_skipped < 0)
+ return (ARCHIVE_FATAL);
+
+ /* This entry is finished and done. */
+ zip->end_of_entry = 1;
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_read_format_zip_cleanup(struct archive_read *a)
+{
+ struct zip *zip;
+
+ zip = (struct zip *)(a->format->data);
+#ifdef HAVE_ZLIB_H
+ if (zip->stream_valid)
+ inflateEnd(&zip->stream);
+#endif
+ free(zip->uncompressed_buffer);
+ archive_string_free(&(zip->pathname));
+ archive_string_free(&(zip->extra));
+ free(zip);
+ (a->format->data) = NULL;
+ return (ARCHIVE_OK);
+}
+
+/*
+ * The extra data is stored as a list of
+ * id1+size1+data1 + id2+size2+data2 ...
+ * triplets. id and size are 2 bytes each.
+ */
+static void
+process_extra(const void* extra, struct zip* zip)
+{
+ int offset = 0;
+ const char *p = (const char *)extra;
+ while (offset < zip->extra_length - 4)
+ {
+ unsigned short headerid = archive_le16dec(p + offset);
+ unsigned short datasize = archive_le16dec(p + offset + 2);
+ offset += 4;
+ if (offset + datasize > zip->extra_length)
+ break;
+#ifdef DEBUG
+ fprintf(stderr, "Header id 0x%04x, length %d\n",
+ headerid, datasize);
+#endif
+ switch (headerid) {
+ case 0x0001:
+ /* Zip64 extended information extra field. */
+ if (datasize >= 8)
+ zip->uncompressed_size = archive_le64dec(p + offset);
+ if (datasize >= 16)
+ zip->compressed_size = archive_le64dec(p + offset + 8);
+ break;
+ case 0x5455:
+ {
+ /* Extended time field "UT". */
+ int flags = p[offset];
+ offset++;
+ datasize--;
+ /* Flag bits indicate which dates are present. */
+ if (flags & 0x01)
+ {
+#ifdef DEBUG
+ fprintf(stderr, "mtime: %lld -> %d\n",
+ (long long)zip->mtime,
+ archive_le32dec(p + offset));
+#endif
+ if (datasize < 4)
+ break;
+ zip->mtime = archive_le32dec(p + offset);
+ offset += 4;
+ datasize -= 4;
+ }
+ if (flags & 0x02)
+ {
+ if (datasize < 4)
+ break;
+ zip->atime = archive_le32dec(p + offset);
+ offset += 4;
+ datasize -= 4;
+ }
+ if (flags & 0x04)
+ {
+ if (datasize < 4)
+ break;
+ zip->ctime = archive_le32dec(p + offset);
+ offset += 4;
+ datasize -= 4;
+ }
+ break;
+ }
+ case 0x7855:
+ /* Info-ZIP Unix Extra Field (type 2) "Ux". */
+#ifdef DEBUG
+ fprintf(stderr, "uid %d gid %d\n",
+ archive_le16dec(p + offset),
+ archive_le16dec(p + offset + 2));
+#endif
+ if (datasize >= 2)
+ zip->uid = archive_le16dec(p + offset);
+ if (datasize >= 4)
+ zip->gid = archive_le16dec(p + offset + 2);
+ break;
+ default:
+ break;
+ }
+ offset += datasize;
+ }
+#ifdef DEBUG
+ if (offset != zip->extra_length)
+ {
+ fprintf(stderr,
+ "Extra data field contents do not match reported size!");
+ }
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/archive_string.c b/archivers/libarchive/files/libarchive/archive_string.c
new file mode 100644
index 00000000000..4e57d62e138
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_string.c
@@ -0,0 +1,453 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_string.c 201095 2009-12-28 02:33:22Z kientzle $");
+
+/*
+ * Basic resizable string support, to simplify manipulating arbitrary-sized
+ * strings while minimizing heap activity.
+ */
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#include <windows.h>
+#endif
+
+#include "archive_private.h"
+#include "archive_string.h"
+
+struct archive_string *
+__archive_string_append(struct archive_string *as, const char *p, size_t s)
+{
+ if (__archive_string_ensure(as, as->length + s + 1) == NULL)
+ __archive_errx(1, "Out of memory");
+ memcpy(as->s + as->length, p, s);
+ as->s[as->length + s] = 0;
+ as->length += s;
+ return (as);
+}
+
+void
+__archive_string_copy(struct archive_string *dest, struct archive_string *src)
+{
+ if (src->length == 0)
+ dest->length = 0;
+ else {
+ if (__archive_string_ensure(dest, src->length + 1) == NULL)
+ __archive_errx(1, "Out of memory");
+ memcpy(dest->s, src->s, src->length);
+ dest->length = src->length;
+ dest->s[dest->length] = 0;
+ }
+}
+
+void
+__archive_string_concat(struct archive_string *dest, struct archive_string *src)
+{
+ if (src->length > 0) {
+ if (__archive_string_ensure(dest, dest->length + src->length + 1) == NULL)
+ __archive_errx(1, "Out of memory");
+ memcpy(dest->s + dest->length, src->s, src->length);
+ dest->length += src->length;
+ dest->s[dest->length] = 0;
+ }
+}
+
+void
+__archive_string_free(struct archive_string *as)
+{
+ as->length = 0;
+ as->buffer_length = 0;
+ if (as->s != NULL) {
+ free(as->s);
+ as->s = NULL;
+ }
+}
+
+/* Returns NULL on any allocation failure. */
+struct archive_string *
+__archive_string_ensure(struct archive_string *as, size_t s)
+{
+ /* If buffer is already big enough, don't reallocate. */
+ if (as->s && (s <= as->buffer_length))
+ return (as);
+
+ /*
+ * Growing the buffer at least exponentially ensures that
+ * append operations are always linear in the number of
+ * characters appended. Using a smaller growth rate for
+ * larger buffers reduces memory waste somewhat at the cost of
+ * a larger constant factor.
+ */
+ if (as->buffer_length < 32)
+ /* Start with a minimum 32-character buffer. */
+ as->buffer_length = 32;
+ else if (as->buffer_length < 8192)
+ /* Buffers under 8k are doubled for speed. */
+ as->buffer_length += as->buffer_length;
+ else {
+ /* Buffers 8k and over grow by at least 25% each time. */
+ size_t old_length = as->buffer_length;
+ as->buffer_length += as->buffer_length / 4;
+ /* Be safe: If size wraps, release buffer and return NULL. */
+ if (as->buffer_length < old_length) {
+ free(as->s);
+ as->s = NULL;
+ return (NULL);
+ }
+ }
+ /*
+ * The computation above is a lower limit to how much we'll
+ * grow the buffer. In any case, we have to grow it enough to
+ * hold the request.
+ */
+ if (as->buffer_length < s)
+ as->buffer_length = s;
+ /* Now we can reallocate the buffer. */
+ as->s = (char *)realloc(as->s, as->buffer_length);
+ if (as->s == NULL)
+ return (NULL);
+ return (as);
+}
+
+struct archive_string *
+__archive_strncat(struct archive_string *as, const void *_p, size_t n)
+{
+ size_t s;
+ const char *p, *pp;
+
+ p = (const char *)_p;
+
+ /* Like strlen(p), except won't examine positions beyond p[n]. */
+ s = 0;
+ pp = p;
+ while (*pp && s < n) {
+ pp++;
+ s++;
+ }
+ return (__archive_string_append(as, p, s));
+}
+
+struct archive_string *
+__archive_strappend_char(struct archive_string *as, char c)
+{
+ return (__archive_string_append(as, &c, 1));
+}
+
+/*
+ * Translates a wide character string into UTF-8 and appends
+ * to the archive_string. Note: returns NULL if conversion fails,
+ * but still leaves a best-effort conversion in the argument as.
+ */
+struct archive_string *
+__archive_strappend_w_utf8(struct archive_string *as, const wchar_t *w)
+{
+ char *p;
+ unsigned wc;
+ char buff[256];
+ struct archive_string *return_val = as;
+
+ /*
+ * Convert one wide char at a time into 'buff', whenever that
+ * fills, append it to the string.
+ */
+ p = buff;
+ while (*w != L'\0') {
+ /* Flush the buffer when we have <=16 bytes free. */
+ /* (No encoding has a single character >16 bytes.) */
+ if ((size_t)(p - buff) >= (size_t)(sizeof(buff) - 16)) {
+ *p = '\0';
+ archive_strcat(as, buff);
+ p = buff;
+ }
+ wc = *w++;
+ /* If this is a surrogate pair, assemble the full code point.*/
+ /* Note: wc must not be wchar_t here, because the full code
+ * point can be more than 16 bits! */
+ if (wc >= 0xD800 && wc <= 0xDBff
+ && *w >= 0xDC00 && *w <= 0xDFFF) {
+ wc -= 0xD800;
+ wc *= 0x400;
+ wc += (*w - 0xDC00);
+ wc += 0x10000;
+ ++w;
+ }
+ /* Translate code point to UTF8 */
+ if (wc <= 0x7f) {
+ *p++ = (char)wc;
+ } else if (wc <= 0x7ff) {
+ *p++ = 0xc0 | ((wc >> 6) & 0x1f);
+ *p++ = 0x80 | (wc & 0x3f);
+ } else if (wc <= 0xffff) {
+ *p++ = 0xe0 | ((wc >> 12) & 0x0f);
+ *p++ = 0x80 | ((wc >> 6) & 0x3f);
+ *p++ = 0x80 | (wc & 0x3f);
+ } else if (wc <= 0x1fffff) {
+ *p++ = 0xf0 | ((wc >> 18) & 0x07);
+ *p++ = 0x80 | ((wc >> 12) & 0x3f);
+ *p++ = 0x80 | ((wc >> 6) & 0x3f);
+ *p++ = 0x80 | (wc & 0x3f);
+ } else {
+ /* Unicode has no codes larger than 0x1fffff. */
+ /* TODO: use \uXXXX escape here instead of ? */
+ *p++ = '?';
+ return_val = NULL;
+ }
+ }
+ *p = '\0';
+ archive_strcat(as, buff);
+ return (return_val);
+}
+
+static int
+utf8_to_unicode(int *pwc, const char *s, size_t n)
+{
+ int ch;
+
+ /*
+ * Decode 1-4 bytes depending on the value of the first byte.
+ */
+ ch = (unsigned char)*s;
+ if (ch == 0) {
+ return (0); /* Standard: return 0 for end-of-string. */
+ }
+ if ((ch & 0x80) == 0) {
+ *pwc = ch & 0x7f;
+ return (1);
+ }
+ if ((ch & 0xe0) == 0xc0) {
+ if (n < 2)
+ return (-1);
+ if ((s[1] & 0xc0) != 0x80) return (-1);
+ *pwc = ((ch & 0x1f) << 6) | (s[1] & 0x3f);
+ return (2);
+ }
+ if ((ch & 0xf0) == 0xe0) {
+ if (n < 3)
+ return (-1);
+ if ((s[1] & 0xc0) != 0x80) return (-1);
+ if ((s[2] & 0xc0) != 0x80) return (-1);
+ *pwc = ((ch & 0x0f) << 12)
+ | ((s[1] & 0x3f) << 6)
+ | (s[2] & 0x3f);
+ return (3);
+ }
+ if ((ch & 0xf8) == 0xf0) {
+ if (n < 4)
+ return (-1);
+ if ((s[1] & 0xc0) != 0x80) return (-1);
+ if ((s[2] & 0xc0) != 0x80) return (-1);
+ if ((s[3] & 0xc0) != 0x80) return (-1);
+ *pwc = ((ch & 0x07) << 18)
+ | ((s[1] & 0x3f) << 12)
+ | ((s[2] & 0x3f) << 6)
+ | (s[3] & 0x3f);
+ return (4);
+ }
+ /* Invalid first byte. */
+ return (-1);
+}
+
+/*
+ * Return a wide-character Unicode string by converting this archive_string
+ * from UTF-8. We assume that systems with 16-bit wchar_t always use
+ * UTF16 and systems with 32-bit wchar_t can accept UCS4.
+ */
+wchar_t *
+__archive_string_utf8_w(struct archive_string *as)
+{
+ wchar_t *ws, *dest;
+ int wc, wc2;/* Must be large enough for a 21-bit Unicode code point. */
+ const char *src;
+ int n;
+
+ ws = (wchar_t *)malloc((as->length + 1) * sizeof(wchar_t));
+ if (ws == NULL)
+ __archive_errx(1, "Out of memory");
+ dest = ws;
+ src = as->s;
+ while (*src != '\0') {
+ n = utf8_to_unicode(&wc, src, 8);
+ if (n == 0)
+ break;
+ if (n < 0) {
+ free(ws);
+ return (NULL);
+ }
+ src += n;
+ if (wc >= 0xDC00 && wc <= 0xDBFF) {
+ /* This is a leading surrogate; some idiot
+ * has translated UTF16 to UTF8 without combining
+ * surrogates; rebuild the full code point before
+ * continuing. */
+ n = utf8_to_unicode(&wc2, src, 8);
+ if (n < 0) {
+ free(ws);
+ return (NULL);
+ }
+ if (n == 0) /* Ignore the leading surrogate */
+ break;
+ if (wc2 < 0xDC00 || wc2 > 0xDFFF) {
+ /* If the second character isn't a
+ * trailing surrogate, then someone
+ * has really screwed up and this is
+ * invalid. */
+ free(ws);
+ return (NULL);
+ } else {
+ src += n;
+ wc -= 0xD800;
+ wc *= 0x400;
+ wc += wc2 - 0xDC00;
+ wc += 0x10000;
+ }
+ }
+ if ((sizeof(wchar_t) < 4) && (wc > 0xffff)) {
+ /* We have a code point that won't fit into a
+ * wchar_t; convert it to a surrogate pair. */
+ wc -= 0x10000;
+ *dest++ = ((wc >> 10) & 0x3ff) + 0xD800;
+ *dest++ = (wc & 0x3ff) + 0xDC00;
+ } else
+ *dest++ = wc;
+ }
+ *dest = L'\0';
+ return (ws);
+}
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+
+/*
+ * Translates a wide character string into current locale character set
+ * and appends to the archive_string. Note: returns NULL if conversion
+ * fails.
+ *
+ * Win32 builds use WideCharToMultiByte from the Windows API.
+ * (Maybe Cygwin should too? WideCharToMultiByte will know a
+ * lot more about local character encodings than the wcrtomb()
+ * wrapper is going to know.)
+ */
+struct archive_string *
+__archive_strappend_w_mbs(struct archive_string *as, const wchar_t *w)
+{
+ char *p;
+ int l, wl;
+ BOOL useDefaultChar = FALSE;
+
+ wl = (int)wcslen(w);
+ l = wl * 4 + 4;
+ p = malloc(l);
+ if (p == NULL)
+ __archive_errx(1, "Out of memory");
+ /* To check a useDefaultChar is to simulate error handling of
+ * the my_wcstombs() which is running on non Windows system with
+ * wctomb().
+ * And to set NULL for last argument is necessary when a codepage
+ * is not CP_ACP(current locale).
+ */
+ l = WideCharToMultiByte(CP_ACP, 0, w, wl, p, l, NULL, &useDefaultChar);
+ if (l == 0) {
+ free(p);
+ return (NULL);
+ }
+ __archive_string_append(as, p, l);
+ free(p);
+ return (as);
+}
+
+#else
+
+/*
+ * Translates a wide character string into current locale character set
+ * and appends to the archive_string. Note: returns NULL if conversion
+ * fails.
+ *
+ * Non-Windows uses ISO C wcrtomb() or wctomb() to perform the conversion
+ * one character at a time. If a non-Windows platform doesn't have
+ * either of these, fall back to the built-in UTF8 conversion.
+ */
+struct archive_string *
+__archive_strappend_w_mbs(struct archive_string *as, const wchar_t *w)
+{
+#if !defined(HAVE_WCTOMB) && !defined(HAVE_WCRTOMB)
+ /* If there's no built-in locale support, fall back to UTF8 always. */
+ return __archive_strappend_w_utf8(as, w);
+#else
+ /* We cannot use the standard wcstombs() here because it
+ * cannot tell us how big the output buffer should be. So
+ * I've built a loop around wcrtomb() or wctomb() that
+ * converts a character at a time and resizes the string as
+ * needed. We prefer wcrtomb() when it's available because
+ * it's thread-safe. */
+ int n;
+ char *p;
+ char buff[256];
+#if HAVE_WCRTOMB
+ mbstate_t shift_state;
+
+ memset(&shift_state, 0, sizeof(shift_state));
+#else
+ /* Clear the shift state before starting. */
+ wctomb(NULL, L'\0');
+#endif
+
+ /*
+ * Convert one wide char at a time into 'buff', whenever that
+ * fills, append it to the string.
+ */
+ p = buff;
+ while (*w != L'\0') {
+ /* Flush the buffer when we have <=16 bytes free. */
+ /* (No encoding has a single character >16 bytes.) */
+ if ((size_t)(p - buff) >= (size_t)(sizeof(buff) - MB_CUR_MAX)) {
+ *p = '\0';
+ archive_strcat(as, buff);
+ p = buff;
+ }
+#if HAVE_WCRTOMB
+ n = wcrtomb(p, *w++, &shift_state);
+#else
+ n = wctomb(p, *w++);
+#endif
+ if (n == -1)
+ return (NULL);
+ p += n;
+ }
+ *p = '\0';
+ archive_strcat(as, buff);
+ return (as);
+#endif
+}
+
+#endif /* _WIN32 && ! __CYGWIN__ */
diff --git a/archivers/libarchive/files/libarchive/archive_string.h b/archivers/libarchive/files/libarchive/archive_string.h
new file mode 100644
index 00000000000..25d7a8b1e61
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_string.h
@@ -0,0 +1,148 @@
+/*-
+ * 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: head/lib/libarchive/archive_string.h 201092 2009-12-28 02:26:06Z kientzle $
+ *
+ */
+
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
+
+#ifndef ARCHIVE_STRING_H_INCLUDED
+#define ARCHIVE_STRING_H_INCLUDED
+
+#include <stdarg.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h> /* required for wchar_t on some systems */
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_WCHAR_H
+#include <wchar.h>
+#endif
+
+/*
+ * Basic resizable/reusable string support a la Java's "StringBuffer."
+ *
+ * Unlike sbuf(9), the buffers here are fully reusable and track the
+ * length throughout.
+ *
+ * Note that all visible symbols here begin with "__archive" as they
+ * are internal symbols not intended for anyone outside of this library
+ * to see or use.
+ */
+
+struct archive_string {
+ char *s; /* Pointer to the storage */
+ size_t length; /* Length of 's' */
+ size_t buffer_length; /* Length of malloc-ed storage */
+};
+
+/* Initialize an archive_string object on the stack or elsewhere. */
+#define archive_string_init(a) \
+ do { (a)->s = NULL; (a)->length = 0; (a)->buffer_length = 0; } while(0)
+
+/* Append a C char to an archive_string, resizing as necessary. */
+struct archive_string *
+__archive_strappend_char(struct archive_string *, char);
+#define archive_strappend_char __archive_strappend_char
+
+/* Convert a wide-char string to UTF-8 and append the result. */
+struct archive_string *
+__archive_strappend_w_utf8(struct archive_string *, const wchar_t *);
+#define archive_strappend_w_utf8 __archive_strappend_w_utf8
+
+/* Convert a wide-char string to current locale and append the result. */
+/* Returns NULL if conversion fails. */
+struct archive_string *
+__archive_strappend_w_mbs(struct archive_string *, const wchar_t *);
+#define archive_strappend_w_mbs __archive_strappend_w_mbs
+
+/* Basic append operation. */
+struct archive_string *
+__archive_string_append(struct archive_string *as, const char *p, size_t s);
+
+/* Copy one archive_string to another */
+void
+__archive_string_copy(struct archive_string *dest, struct archive_string *src);
+#define archive_string_copy(dest, src) \
+ __archive_string_copy(dest, src)
+
+/* Concatenate one archive_string to another */
+void
+__archive_string_concat(struct archive_string *dest, struct archive_string *src);
+#define archive_string_concat(dest, src) \
+ __archive_string_concat(dest, src)
+
+/* Ensure that the underlying buffer is at least as large as the request. */
+struct archive_string *
+__archive_string_ensure(struct archive_string *, size_t);
+#define archive_string_ensure __archive_string_ensure
+
+/* Append C string, which may lack trailing \0. */
+/* The source is declared void * here because this gets used with
+ * "signed char *", "unsigned char *" and "char *" arguments.
+ * Declaring it "char *" as with some of the other functions just
+ * leads to a lot of extra casts. */
+struct archive_string *
+__archive_strncat(struct archive_string *, const void *, size_t);
+#define archive_strncat __archive_strncat
+
+/* Append a C string to an archive_string, resizing as necessary. */
+#define archive_strcat(as,p) __archive_string_append((as),(p),strlen(p))
+
+/* Copy a C string to an archive_string, resizing as necessary. */
+#define archive_strcpy(as,p) \
+ ((as)->length = 0, __archive_string_append((as), (p), p == NULL ? 0 : strlen(p)))
+
+/* Copy a C string to an archive_string with limit, resizing as necessary. */
+#define archive_strncpy(as,p,l) \
+ ((as)->length=0, archive_strncat((as), (p), (l)))
+
+/* Return length of string. */
+#define archive_strlen(a) ((a)->length)
+
+/* Set string length to zero. */
+#define archive_string_empty(a) ((a)->length = 0)
+
+/* Release any allocated storage resources. */
+void __archive_string_free(struct archive_string *);
+#define archive_string_free __archive_string_free
+
+/* Like 'vsprintf', but resizes the underlying string as necessary. */
+void __archive_string_vsprintf(struct archive_string *, const char *,
+ va_list);
+#define archive_string_vsprintf __archive_string_vsprintf
+
+void __archive_string_sprintf(struct archive_string *, const char *, ...);
+#define archive_string_sprintf __archive_string_sprintf
+
+/* Allocates a fresh buffer and converts as (assumed to be UTF-8) into it.
+ * Returns NULL if conversion failed in any way. */
+wchar_t *__archive_string_utf8_w(struct archive_string *as);
+
+
+#endif
diff --git a/archivers/libarchive/files/libarchive/archive_string_sprintf.c b/archivers/libarchive/files/libarchive/archive_string_sprintf.c
new file mode 100644
index 00000000000..6d3d8edded8
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_string_sprintf.c
@@ -0,0 +1,164 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_string_sprintf.c 189435 2009-03-06 05:14:55Z kientzle $");
+
+/*
+ * The use of printf()-family functions can be troublesome
+ * for space-constrained applications. In addition, correctly
+ * implementing this function in terms of vsnprintf() requires
+ * two calls (one to determine the size, another to format the
+ * result), which in turn requires duplicating the argument list
+ * using va_copy, which isn't yet universally available. <sigh>
+ *
+ * So, I've implemented a bare minimum of printf()-like capability
+ * here. This is only used to format error messages, so doesn't
+ * require any floating-point support or field-width handling.
+ */
+
+#include <stdio.h>
+
+#include "archive_string.h"
+#include "archive_private.h"
+
+/*
+ * Utility functions to format signed/unsigned integers and append
+ * them to an archive_string.
+ */
+static void
+append_uint(struct archive_string *as, uintmax_t d, unsigned base)
+{
+ static const char *digits = "0123456789abcdef";
+ if (d >= base)
+ append_uint(as, d/base, base);
+ archive_strappend_char(as, digits[d % base]);
+}
+
+static void
+append_int(struct archive_string *as, intmax_t d, unsigned base)
+{
+ if (d < 0) {
+ archive_strappend_char(as, '-');
+ d = -d;
+ }
+ append_uint(as, d, base);
+}
+
+
+void
+__archive_string_sprintf(struct archive_string *as, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ archive_string_vsprintf(as, fmt, ap);
+ va_end(ap);
+}
+
+/*
+ * Like 'vsprintf', but ensures the target is big enough, resizing if
+ * necessary.
+ */
+void
+__archive_string_vsprintf(struct archive_string *as, const char *fmt,
+ va_list ap)
+{
+ char long_flag;
+ intmax_t s; /* Signed integer temp. */
+ uintmax_t u; /* Unsigned integer temp. */
+ const char *p, *p2;
+
+ if (__archive_string_ensure(as, 64) == NULL)
+ __archive_errx(1, "Out of memory");
+
+ if (fmt == NULL) {
+ as->s[0] = 0;
+ return;
+ }
+
+ for (p = fmt; *p != '\0'; p++) {
+ const char *saved_p = p;
+
+ if (*p != '%') {
+ archive_strappend_char(as, *p);
+ continue;
+ }
+
+ p++;
+
+ long_flag = '\0';
+ switch(*p) {
+ case 'j':
+ long_flag = 'j';
+ p++;
+ break;
+ case 'l':
+ long_flag = 'l';
+ p++;
+ break;
+ }
+
+ switch (*p) {
+ case '%':
+ __archive_strappend_char(as, '%');
+ break;
+ case 'c':
+ s = va_arg(ap, int);
+ __archive_strappend_char(as, s);
+ break;
+ case 'd':
+ switch(long_flag) {
+ case 'j': s = va_arg(ap, intmax_t); break;
+ case 'l': s = va_arg(ap, long); break;
+ default: s = va_arg(ap, int); break;
+ }
+ append_int(as, s, 10);
+ break;
+ case 's':
+ p2 = va_arg(ap, char *);
+ archive_strcat(as, p2);
+ break;
+ case 'o': case 'u': case 'x': case 'X':
+ /* Common handling for unsigned integer formats. */
+ switch(long_flag) {
+ case 'j': u = va_arg(ap, uintmax_t); break;
+ case 'l': u = va_arg(ap, unsigned long); break;
+ default: u = va_arg(ap, unsigned int); break;
+ }
+ /* Format it in the correct base. */
+ switch (*p) {
+ case 'o': append_uint(as, u, 8); break;
+ case 'u': append_uint(as, u, 10); break;
+ default: append_uint(as, u, 16); break;
+ }
+ break;
+ default:
+ /* Rewind and print the initial '%' literally. */
+ p = saved_p;
+ archive_strappend_char(as, *p);
+ }
+ }
+}
diff --git a/archivers/libarchive/files/libarchive/archive_util.3 b/archivers/libarchive/files/libarchive/archive_util.3
new file mode 100644
index 00000000000..98609e565a7
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_util.3
@@ -0,0 +1,160 @@
+.\" 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 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: head/lib/libarchive/archive_util.3 201098 2009-12-28 02:58:14Z kientzle $
+.\"
+.Dd January 8, 2005
+.Dt archive_util 3
+.Os
+.Sh NAME
+.Nm archive_clear_error ,
+.Nm archive_compression ,
+.Nm archive_compression_name ,
+.Nm archive_copy_error ,
+.Nm archive_errno ,
+.Nm archive_error_string ,
+.Nm archive_file_count ,
+.Nm archive_format ,
+.Nm archive_format_name ,
+.Nm archive_set_error
+.Nd libarchive utility functions
+.Sh SYNOPSIS
+.In archive.h
+.Ft void
+.Fn archive_clear_error "struct archive *"
+.Ft int
+.Fn archive_compression "struct archive *"
+.Ft const char *
+.Fn archive_compression_name "struct archive *"
+.Ft void
+.Fn archive_copy_error "struct archive *" "struct archive *"
+.Ft int
+.Fn archive_errno "struct archive *"
+.Ft const char *
+.Fn archive_error_string "struct archive *"
+.Ft int
+.Fn archive_file_count "struct archive *"
+.Ft int
+.Fn archive_format "struct archive *"
+.Ft const char *
+.Fn archive_format_name "struct archive *"
+.Ft void
+.Fo archive_set_error
+.Fa "struct archive *"
+.Fa "int error_code"
+.Fa "const char *fmt"
+.Fa "..."
+.Fc
+.Sh DESCRIPTION
+These functions provide access to various information about the
+.Tn struct archive
+object used in the
+.Xr libarchive 3
+library.
+.Bl -tag -compact -width indent
+.It Fn archive_clear_error
+Clears any error information left over from a previous call.
+Not generally used in client code.
+.It Fn archive_compression
+Returns a numeric code indicating the current compression.
+This value is set by
+.Fn archive_read_open .
+.It Fn archive_compression_name
+Returns a text description of the current compression suitable for display.
+.It Fn archive_copy_error
+Copies error information from one archive to another.
+.It Fn archive_errno
+Returns a numeric error code (see
+.Xr errno 2 )
+indicating the reason for the most recent error return.
+.It Fn archive_error_string
+Returns a textual error message suitable for display.
+The error message here is usually more specific than that
+obtained from passing the result of
+.Fn archive_errno
+to
+.Xr strerror 3 .
+.It Fn archive_file_count
+Returns a count of the number of files processed by this archive object.
+The count is incremented by calls to
+.Xr archive_write_header
+or
+.Xr archive_read_next_header .
+.It Fn archive_format
+Returns a numeric code indicating the format of the current
+archive entry.
+This value is set by a successful call to
+.Fn archive_read_next_header .
+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.
+.It Fn archive_format_name
+A textual description of the format of the current entry.
+.It Fn archive_set_error
+Sets the numeric error code and error description that will be returned
+by
+.Fn archive_errno
+and
+.Fn archive_error_string .
+This function should be used within I/O callbacks to set system-specific
+error codes and error descriptions.
+This function accepts a printf-like format string and arguments.
+However, you should be careful to use only the following printf
+format specifiers:
+.Dq %c ,
+.Dq %d ,
+.Dq %jd ,
+.Dq %jo ,
+.Dq %ju ,
+.Dq %jx ,
+.Dq %ld ,
+.Dq %lo ,
+.Dq %lu ,
+.Dq %lx ,
+.Dq %o ,
+.Dq %u ,
+.Dq %s ,
+.Dq %x ,
+.Dq %% .
+Field-width specifiers and other printf features are
+not uniformly supported and should not be used.
+.El
+.Sh SEE ALSO
+.Xr archive_read 3 ,
+.Xr archive_write 3 ,
+.Xr libarchive 3 ,
+.Xr printf 3
+.Sh HISTORY
+The
+.Nm libarchive
+library first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm libarchive
+library was written by
+.An Tim Kientzle Aq kientzle@acm.org .
diff --git a/archivers/libarchive/files/libarchive/archive_util.c b/archivers/libarchive/files/libarchive/archive_util.c
new file mode 100644
index 00000000000..c945d5fa71a
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_util.c
@@ -0,0 +1,391 @@
+/*-
+ * Copyright (c) 2009 Michihiro NAKAJIMA
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_util.c 201098 2009-12-28 02:58:14Z kientzle $");
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive.h"
+#include "archive_private.h"
+#include "archive_string.h"
+
+#if ARCHIVE_VERSION_NUMBER < 3000000
+/* These disappear in libarchive 3.0 */
+/* Deprecated. */
+int
+archive_api_feature(void)
+{
+ return (ARCHIVE_API_FEATURE);
+}
+
+/* Deprecated. */
+int
+archive_api_version(void)
+{
+ return (ARCHIVE_API_VERSION);
+}
+
+/* Deprecated synonym for archive_version_number() */
+int
+archive_version_stamp(void)
+{
+ return (archive_version_number());
+}
+
+/* Deprecated synonym for archive_version_string() */
+const char *
+archive_version(void)
+{
+ return (archive_version_string());
+}
+#endif
+
+int
+archive_version_number(void)
+{
+ return (ARCHIVE_VERSION_NUMBER);
+}
+
+const char *
+archive_version_string(void)
+{
+ return (ARCHIVE_VERSION_STRING);
+}
+
+int
+archive_errno(struct archive *a)
+{
+ return (a->archive_error_number);
+}
+
+const char *
+archive_error_string(struct archive *a)
+{
+
+ if (a->error != NULL && *a->error != '\0')
+ return (a->error);
+ else
+ return ("(Empty error message)");
+}
+
+int
+archive_file_count(struct archive *a)
+{
+ return (a->file_count);
+}
+
+int
+archive_format(struct archive *a)
+{
+ return (a->archive_format);
+}
+
+const char *
+archive_format_name(struct archive *a)
+{
+ return (a->archive_format_name);
+}
+
+
+int
+archive_compression(struct archive *a)
+{
+ return (a->compression_code);
+}
+
+const char *
+archive_compression_name(struct archive *a)
+{
+ return (a->compression_name);
+}
+
+
+/*
+ * Return a count of the number of compressed bytes processed.
+ */
+int64_t
+archive_position_compressed(struct archive *a)
+{
+ return (a->raw_position);
+}
+
+/*
+ * Return a count of the number of uncompressed bytes processed.
+ */
+int64_t
+archive_position_uncompressed(struct archive *a)
+{
+ return (a->file_position);
+}
+
+void
+archive_clear_error(struct archive *a)
+{
+ archive_string_empty(&a->error_string);
+ a->error = NULL;
+}
+
+void
+archive_set_error(struct archive *a, int error_number, const char *fmt, ...)
+{
+ va_list ap;
+
+ a->archive_error_number = error_number;
+ if (fmt == NULL) {
+ a->error = NULL;
+ return;
+ }
+
+ va_start(ap, fmt);
+ archive_string_vsprintf(&(a->error_string), fmt, ap);
+ va_end(ap);
+ a->error = a->error_string.s;
+}
+
+void
+archive_copy_error(struct archive *dest, struct archive *src)
+{
+ dest->archive_error_number = src->archive_error_number;
+
+ archive_string_copy(&dest->error_string, &src->error_string);
+ dest->error = dest->error_string.s;
+}
+
+void
+__archive_errx(int retvalue, const char *msg)
+{
+ static const char *msg1 = "Fatal Internal Error in libarchive: ";
+ size_t s;
+
+ s = write(2, msg1, strlen(msg1));
+ (void)s; /* UNUSED */
+ s = write(2, msg, strlen(msg));
+ (void)s; /* UNUSED */
+ s = write(2, "\n", 1);
+ (void)s; /* UNUSED */
+ exit(retvalue);
+}
+
+/*
+ * Parse option strings
+ * Detail of option format.
+ * - The option can accept:
+ * "opt-name", "!opt-name", "opt-name=value".
+ *
+ * - The option entries are separated by comma.
+ * e.g "compression=9,opt=XXX,opt-b=ZZZ"
+ *
+ * - The name of option string consist of '-' and alphabet
+ * but character '-' cannot be used for the first character.
+ * (Regular expression is [a-z][-a-z]+)
+ *
+ * - For a specfic format/filter, using the format name with ':'.
+ * e.g "zip:compression=9"
+ * (This "compression=9" option entry is for "zip" format only)
+ *
+ * If another entries follow it, those are not for
+ * the specfic format/filter.
+ * e.g handle "zip:compression=9,opt=XXX,opt-b=ZZZ"
+ * "zip" format/filter handler will get "compression=9"
+ * all format/filter handler will get "opt=XXX"
+ * all format/filter handler will get "opt-b=ZZZ"
+ *
+ * - Whitespace and tab are bypassed.
+ *
+ */
+int
+__archive_parse_options(const char *p, const char *fn, int keysize, char *key,
+ int valsize, char *val)
+{
+ const char *p_org;
+ int apply;
+ int kidx, vidx;
+ int negative;
+ enum {
+ /* Requested for initialization. */
+ INIT,
+ /* Finding format/filter-name and option-name. */
+ F_BOTH,
+ /* Finding option-name only.
+ * (already detected format/filter-name) */
+ F_NAME,
+ /* Getting option-value. */
+ G_VALUE,
+ } state;
+
+ p_org = p;
+ state = INIT;
+ kidx = vidx = negative = 0;
+ apply = 1;
+ while (*p) {
+ switch (state) {
+ case INIT:
+ kidx = vidx = 0;
+ negative = 0;
+ apply = 1;
+ state = F_BOTH;
+ break;
+ case F_BOTH:
+ case F_NAME:
+ if ((*p >= 'a' && *p <= 'z') ||
+ (*p >= '0' && *p <= '9') || *p == '-') {
+ if (kidx == 0 && !(*p >= 'a' && *p <= 'z'))
+ /* Illegal sequence. */
+ return (-1);
+ if (kidx >= keysize -1)
+ /* Too many characters. */
+ return (-1);
+ key[kidx++] = *p++;
+ } else if (*p == '!') {
+ if (kidx != 0)
+ /* Illegal sequence. */
+ return (-1);
+ negative = 1;
+ ++p;
+ } else if (*p == ',') {
+ if (kidx == 0)
+ /* Illegal sequence. */
+ return (-1);
+ if (!negative)
+ val[vidx++] = '1';
+ /* We have got boolean option data. */
+ ++p;
+ if (apply)
+ goto complete;
+ else
+ /* This option does not apply to the
+ * format which the fn variable
+ * indicate. */
+ state = INIT;
+ } else if (*p == ':') {
+ /* obuf data is format name */
+ if (state == F_NAME)
+ /* We already found it. */
+ return (-1);
+ if (kidx == 0)
+ /* Illegal sequence. */
+ return (-1);
+ if (negative)
+ /* We cannot accept "!format-name:". */
+ return (-1);
+ key[kidx] = '\0';
+ if (strcmp(fn, key) != 0)
+ /* This option does not apply to the
+ * format which the fn variable
+ * indicate. */
+ apply = 0;
+ kidx = 0;
+ ++p;
+ state = F_NAME;
+ } else if (*p == '=') {
+ if (kidx == 0)
+ /* Illegal sequence. */
+ return (-1);
+ if (negative)
+ /* We cannot accept "!opt-name=value". */
+ return (-1);
+ ++p;
+ state = G_VALUE;
+ } else if (*p == ' ') {
+ /* Pass the space character */
+ ++p;
+ } else {
+ /* Illegal character. */
+ return (-1);
+ }
+ break;
+ case G_VALUE:
+ if (*p == ',') {
+ if (vidx == 0)
+ /* Illegal sequence. */
+ return (-1);
+ /* We have got option data. */
+ ++p;
+ if (apply)
+ goto complete;
+ else
+ /* This option does not apply to the
+ * format which the fn variable
+ * indicate. */
+ state = INIT;
+ } else if (*p == ' ') {
+ /* Pass the space character */
+ ++p;
+ } else {
+ if (vidx >= valsize -1)
+ /* Too many characters. */
+ return (-1);
+ val[vidx++] = *p++;
+ }
+ break;
+ }
+ }
+
+ switch (state) {
+ case F_BOTH:
+ case F_NAME:
+ if (kidx != 0) {
+ if (!negative)
+ val[vidx++] = '1';
+ /* We have got boolean option. */
+ if (apply)
+ /* This option apply to the format which the
+ * fn variable indicate. */
+ goto complete;
+ }
+ break;
+ case G_VALUE:
+ if (vidx == 0)
+ /* Illegal sequence. */
+ return (-1);
+ /* We have got option value. */
+ if (apply)
+ /* This option apply to the format which the fn
+ * variable indicate. */
+ goto complete;
+ break;
+ case INIT:/* nothing */
+ break;
+ }
+
+ /* End of Option string. */
+ return (0);
+
+complete:
+ key[kidx] = '\0';
+ val[vidx] = '\0';
+ /* Return a size which we've consumed for detecting option */
+ return ((int)(p - p_org));
+}
diff --git a/archivers/libarchive/files/libarchive/archive_virtual.c b/archivers/libarchive/files/libarchive/archive_virtual.c
new file mode 100644
index 00000000000..a5c0b39b9cc
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_virtual.c
@@ -0,0 +1,94 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_virtual.c 201098 2009-12-28 02:58:14Z kientzle $");
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+
+int
+archive_write_close(struct archive *a)
+{
+ return ((a->vtable->archive_close)(a));
+}
+
+int
+archive_read_close(struct archive *a)
+{
+ return ((a->vtable->archive_close)(a));
+}
+
+#if ARCHIVE_API_VERSION > 1
+int
+archive_write_finish(struct archive *a)
+{
+ return ((a->vtable->archive_finish)(a));
+}
+#else
+/* Temporarily allow library to compile with either 1.x or 2.0 API. */
+void
+archive_write_finish(struct archive *a)
+{
+ (void)(a->vtable->archive_finish)(a);
+}
+#endif
+
+int
+archive_read_finish(struct archive *a)
+{
+ return ((a->vtable->archive_finish)(a));
+}
+
+int
+archive_write_header(struct archive *a, struct archive_entry *entry)
+{
+ ++a->file_count;
+ return ((a->vtable->archive_write_header)(a, entry));
+}
+
+int
+archive_write_finish_entry(struct archive *a)
+{
+ return ((a->vtable->archive_write_finish_entry)(a));
+}
+
+#if ARCHIVE_API_VERSION > 1
+ssize_t
+#else
+/* Temporarily allow library to compile with either 1.x or 2.0 API. */
+int
+#endif
+archive_write_data(struct archive *a, const void *buff, size_t s)
+{
+ return ((a->vtable->archive_write_data)(a, buff, s));
+}
+
+ssize_t
+archive_write_data_block(struct archive *a, const void *buff, size_t s, off_t o)
+{
+ return ((a->vtable->archive_write_data_block)(a, buff, s, o));
+}
diff --git a/archivers/libarchive/files/libarchive/archive_windows.c b/archivers/libarchive/files/libarchive/archive_windows.c
new file mode 100644
index 00000000000..03a459e7c49
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_windows.c
@@ -0,0 +1,1280 @@
+/*-
+ * Copyright (c) 2009 Michihiro NAKAJIMA
+ * Copyright (c) 2003-2007 Kees Zeelenberg
+ * 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$
+ */
+
+/*
+ * A set of compatibility glue for building libarchive on Windows platforms.
+ *
+ * Originally created as "libarchive-nonposix.c" by Kees Zeelenberg
+ * for the GnuWin32 project, trimmed significantly by Tim Kientzle.
+ *
+ * Much of the original file was unnecessary for libarchive, because
+ * many of the features it emulated were not strictly necessary for
+ * libarchive. I hope for this to shrink further as libarchive
+ * internals are gradually reworked to sit more naturally on both
+ * POSIX and Windows. Any ideas for this are greatly appreciated.
+ *
+ * The biggest remaining issue is the dev/ino emulation; libarchive
+ * has a couple of public APIs that rely on dev/ino uniquely
+ * identifying a file. This doesn't match well with Windows. I'm
+ * considering alternative APIs.
+ */
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+
+#include "archive_platform.h"
+#include "archive_private.h"
+#include <ctype.h>
+#include <errno.h>
+#include <stddef.h>
+#ifdef HAVE_SYS_UTIME_H
+#include <sys/utime.h>
+#endif
+#include <sys/stat.h>
+#include <process.h>
+#include <stdlib.h>
+#include <wchar.h>
+#include <windows.h>
+
+#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000)
+
+#if defined(_MSC_VER) && _MSC_VER < 1300
+/* VS 6 does not provide SetFilePointerEx, so define it here. */
+static BOOL SetFilePointerEx(HANDLE hFile,
+ LARGE_INTEGER liDistanceToMove,
+ PLARGE_INTEGER lpNewFilePointer,
+ DWORD dwMoveMethod)
+{
+ LARGE_INTEGER li;
+ li.QuadPart = liDistanceToMove.QuadPart;
+ li.LowPart = SetFilePointer(
+ hFile, li.LowPart, &li.HighPart, dwMoveMethod);
+ if(lpNewFilePointer) {
+ lpNewFilePointer->QuadPart = li.QuadPart;
+ }
+ return li.LowPart != -1 || GetLastError() == NO_ERROR;
+}
+#endif
+
+struct ustat {
+ int64_t st_atime;
+ uint32_t st_atime_nsec;
+ int64_t st_ctime;
+ uint32_t st_ctime_nsec;
+ int64_t st_mtime;
+ uint32_t st_mtime_nsec;
+ gid_t st_gid;
+ /* 64bits ino */
+ int64_t st_ino;
+ mode_t st_mode;
+ uint32_t st_nlink;
+ uint64_t st_size;
+ uid_t st_uid;
+ dev_t st_dev;
+ dev_t st_rdev;
+};
+
+/* Local replacement for undocumented Windows CRT function. */
+static void la_dosmaperr(unsigned long e);
+
+/* Transform 64-bits ino into 32-bits by hashing.
+ * You do not forget that really unique number size is 64-bits.
+ */
+#define INOSIZE (8*sizeof(ino_t)) /* 32 */
+static __inline ino_t
+getino(struct ustat *ub)
+{
+ ULARGE_INTEGER ino64;
+ ino64.QuadPart = ub->st_ino;
+ /* I don't know this hashing is correct way */
+ return (ino64.LowPart ^ (ino64.LowPart >> INOSIZE));
+}
+
+/*
+ * Prepend "\\?\" to the path name and convert it to unicode to permit
+ * an extended-length path for a maximum total path length of 32767
+ * characters.
+ * see also http://msdn.microsoft.com/en-us/library/aa365247.aspx
+ */
+static wchar_t *
+permissive_name(const char *name)
+{
+ wchar_t *wn, *wnp;
+ wchar_t *ws, *wsp;
+ DWORD l, len, slen;
+ int unc;
+
+ len = (DWORD)strlen(name);
+ wn = malloc((len + 1) * sizeof(wchar_t));
+ if (wn == NULL)
+ return (NULL);
+ l = MultiByteToWideChar(CP_ACP, 0, name, (int)len, wn, (int)len);
+ if (l == 0) {
+ free(wn);
+ return (NULL);
+ }
+ wn[l] = L'\0';
+
+ /* Get a full path names */
+ l = GetFullPathNameW(wn, 0, NULL, NULL);
+ if (l == 0) {
+ free(wn);
+ return (NULL);
+ }
+ wnp = malloc(l * sizeof(wchar_t));
+ if (wnp == NULL) {
+ free(wn);
+ return (NULL);
+ }
+ len = GetFullPathNameW(wn, l, wnp, NULL);
+ free(wn);
+ wn = wnp;
+
+ if (wnp[0] == L'\\' && wnp[1] == L'\\' &&
+ wnp[2] == L'?' && wnp[3] == L'\\')
+ /* We have already permissive names. */
+ return (wn);
+
+ if (wnp[0] == L'\\' && wnp[1] == L'\\' &&
+ wnp[2] == L'.' && wnp[3] == L'\\') {
+ /* Device names */
+ if (((wnp[4] >= L'a' && wnp[4] <= L'z') ||
+ (wnp[4] >= L'A' && wnp[4] <= L'Z')) &&
+ wnp[5] == L':' && wnp[6] == L'\\')
+ wnp[2] = L'?';/* Not device names. */
+ return (wn);
+ }
+
+ unc = 0;
+ if (wnp[0] == L'\\' && wnp[1] == L'\\' && wnp[2] != L'\\') {
+ wchar_t *p = &wnp[2];
+
+ /* Skip server-name letters. */
+ while (*p != L'\\' && *p != L'\0')
+ ++p;
+ if (*p == L'\\') {
+ wchar_t *rp = ++p;
+ /* Skip share-name letters. */
+ while (*p != L'\\' && *p != L'\0')
+ ++p;
+ if (*p == L'\\' && p != rp) {
+ /* Now, match patterns such as
+ * "\\server-name\share-name\" */
+ wnp += 2;
+ len -= 2;
+ unc = 1;
+ }
+ }
+ }
+
+ slen = 4 + (unc * 4) + len + 1;
+ ws = wsp = malloc(slen * sizeof(wchar_t));
+ if (ws == NULL) {
+ free(wn);
+ return (NULL);
+ }
+ /* prepend "\\?\" */
+ wcsncpy(wsp, L"\\\\?\\", 4);
+ wsp += 4;
+ slen -= 4;
+ if (unc) {
+ /* append "UNC\" ---> "\\?\UNC\" */
+ wcsncpy(wsp, L"UNC\\", 4);
+ wsp += 4;
+ slen -= 4;
+ }
+ wcsncpy(wsp, wnp, slen);
+ wsp[slen - 1] = L'\0'; /* Ensure null termination. */
+ free(wn);
+ return (ws);
+}
+
+static HANDLE
+la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
+ LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition,
+ DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
+{
+ wchar_t *wpath;
+ HANDLE handle;
+
+ handle = CreateFileA(path, dwDesiredAccess, dwShareMode,
+ lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
+ hTemplateFile);
+ if (handle != INVALID_HANDLE_VALUE)
+ return (handle);
+ if (GetLastError() != ERROR_PATH_NOT_FOUND)
+ return (handle);
+ wpath = permissive_name(path);
+ if (wpath == NULL)
+ return (handle);
+ handle = CreateFileW(wpath, dwDesiredAccess, dwShareMode,
+ lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
+ hTemplateFile);
+ free(wpath);
+ return (handle);
+}
+
+static void *
+la_GetFunctionKernel32(const char *name)
+{
+ static HINSTANCE lib;
+ static int set;
+ if (!set) {
+ set = 1;
+ lib = LoadLibrary("kernel32.dll");
+ }
+ if (lib == NULL) {
+ fprintf(stderr, "Can't load kernel32.dll?!\n");
+ exit(1);
+ }
+ return (void *)GetProcAddress(lib, name);
+}
+
+static int
+la_CreateHardLinkW(wchar_t *linkname, wchar_t *target)
+{
+ static BOOLEAN (WINAPI *f)(LPWSTR, LPWSTR, LPSECURITY_ATTRIBUTES);
+ static int set;
+ if (!set) {
+ set = 1;
+ f = la_GetFunctionKernel32("CreateHardLinkW");
+ }
+ return f == NULL ? 0 : (*f)(linkname, target, NULL);
+}
+
+
+/* Make a link to src called dst. */
+static int
+__link(const char *src, const char *dst)
+{
+ wchar_t *wsrc, *wdst;
+ int res, retval;
+ DWORD attr;
+
+ if (src == NULL || dst == NULL) {
+ set_errno (EINVAL);
+ return -1;
+ }
+
+ wsrc = permissive_name(src);
+ wdst = permissive_name(dst);
+ if (wsrc == NULL || wdst == NULL) {
+ free(wsrc);
+ free(wdst);
+ set_errno (EINVAL);
+ return -1;
+ }
+
+ if ((attr = GetFileAttributesW(wsrc)) != (DWORD)-1) {
+ res = la_CreateHardLinkW(wdst, wsrc);
+ } else {
+ /* wsrc does not exist; try src prepend it with the dirname of wdst */
+ wchar_t *wnewsrc, *slash;
+ int i, n, slen, wlen;
+
+ if (strlen(src) >= 3 && isalpha((unsigned char)src[0]) &&
+ src[1] == ':' && src[2] == '\\') {
+ /* Original src name is already full-path */
+ retval = -1;
+ goto exit;
+ }
+ if (src[0] == '\\') {
+ /* Original src name is almost full-path
+ * (maybe src name is without drive) */
+ retval = -1;
+ goto exit;
+ }
+
+ wnewsrc = malloc ((wcslen(wsrc) + wcslen(wdst) + 1) * sizeof(wchar_t));
+ if (wnewsrc == NULL) {
+ errno = ENOMEM;
+ retval = -1;
+ goto exit;
+ }
+ /* Copying a dirname of wdst */
+ wcscpy(wnewsrc, wdst);
+ slash = wcsrchr(wnewsrc, L'\\');
+ if (slash != NULL)
+ *++slash = L'\0';
+ else
+ wcscat(wnewsrc, L"\\");
+ /* Converting multi-byte src to wide-char src */
+ wlen = (int)wcslen(wsrc);
+ slen = (int)strlen(src);
+ n = MultiByteToWideChar(CP_ACP, 0, src, slen, wsrc, wlen);
+ if (n == 0) {
+ free (wnewsrc);
+ retval = -1;
+ goto exit;
+ }
+ for (i = 0; i < n; i++)
+ if (wsrc[i] == L'/')
+ wsrc[i] = L'\\';
+ wcsncat(wnewsrc, wsrc, n);
+ /* Check again */
+ attr = GetFileAttributesW(wnewsrc);
+ if (attr == (DWORD)-1 || (attr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
+ if (attr == (DWORD)-1)
+ la_dosmaperr(GetLastError());
+ else
+ errno = EPERM;
+ free (wnewsrc);
+ retval = -1;
+ goto exit;
+ }
+ res = la_CreateHardLinkW(wdst, wnewsrc);
+ free (wnewsrc);
+ }
+ if (res == 0) {
+ la_dosmaperr(GetLastError());
+ retval = -1;
+ } else
+ retval = 0;
+exit:
+ free(wsrc);
+ free(wdst);
+ return (retval);
+}
+
+/* Make a hard link to src called dst. */
+int
+__la_link(const char *src, const char *dst)
+{
+ return __link(src, dst);
+}
+
+int
+__la_ftruncate(int fd, off_t length)
+{
+ LARGE_INTEGER distance;
+ HANDLE handle;
+
+ if (fd < 0) {
+ errno = EBADF;
+ return (-1);
+ }
+ handle = (HANDLE)_get_osfhandle(fd);
+ if (GetFileType(handle) != FILE_TYPE_DISK) {
+ errno = EBADF;
+ return (-1);
+ }
+ distance.QuadPart = length;
+ if (!SetFilePointerEx(handle, distance, NULL, FILE_BEGIN)) {
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ if (!SetEndOfFile(handle)) {
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ return (0);
+}
+
+#define WINTIME(sec, usec) ((Int32x32To64(sec, 10000000) + EPOC_TIME) + (usec * 10))
+static int
+__hutimes(HANDLE handle, const struct __timeval *times)
+{
+ ULARGE_INTEGER wintm;
+ FILETIME fatime, fmtime;
+
+ wintm.QuadPart = WINTIME(times[0].tv_sec, times[0].tv_usec);
+ fatime.dwLowDateTime = wintm.LowPart;
+ fatime.dwHighDateTime = wintm.HighPart;
+ wintm.QuadPart = WINTIME(times[1].tv_sec, times[1].tv_usec);
+ fmtime.dwLowDateTime = wintm.LowPart;
+ fmtime.dwHighDateTime = wintm.HighPart;
+ if (SetFileTime(handle, NULL, &fatime, &fmtime) == 0) {
+ errno = EINVAL;
+ return (-1);
+ }
+ return (0);
+}
+
+int
+__la_futimes(int fd, const struct __timeval *times)
+{
+
+ return (__hutimes((HANDLE)_get_osfhandle(fd), times));
+}
+
+int
+__la_utimes(const char *name, const struct __timeval *times)
+{
+ int ret;
+ HANDLE handle;
+
+ handle = la_CreateFile(name, GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS, NULL);
+ if (handle == INVALID_HANDLE_VALUE) {
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ ret = __hutimes(handle, times);
+ CloseHandle(handle);
+ return (ret);
+}
+
+int
+__la_chdir(const char *path)
+{
+ wchar_t *ws;
+ int r;
+
+ r = SetCurrentDirectoryA(path);
+ if (r == 0) {
+ if (GetLastError() != ERROR_FILE_NOT_FOUND) {
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ } else
+ return (0);
+ ws = permissive_name(path);
+ if (ws == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+ r = SetCurrentDirectoryW(ws);
+ free(ws);
+ if (r == 0) {
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ return (0);
+}
+
+int
+__la_chmod(const char *path, mode_t mode)
+{
+ wchar_t *ws;
+ DWORD attr;
+ BOOL r;
+
+ ws = NULL;
+ attr = GetFileAttributesA(path);
+ if (attr == (DWORD)-1) {
+ if (GetLastError() != ERROR_FILE_NOT_FOUND) {
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ ws = permissive_name(path);
+ if (ws == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+ attr = GetFileAttributesW(ws);
+ if (attr == (DWORD)-1) {
+ free(ws);
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ }
+ if (mode & _S_IWRITE)
+ attr &= ~FILE_ATTRIBUTE_READONLY;
+ else
+ attr |= FILE_ATTRIBUTE_READONLY;
+ if (ws == NULL)
+ r = SetFileAttributesA(path, attr);
+ else {
+ r = SetFileAttributesW(ws, attr);
+ free(ws);
+ }
+ if (r == 0) {
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ return (0);
+}
+
+/*
+ * This fcntl is limited implemention.
+ */
+int
+__la_fcntl(int fd, int cmd, int val)
+{
+ HANDLE handle;
+
+ handle = (HANDLE)_get_osfhandle(fd);
+ if (GetFileType(handle) == FILE_TYPE_PIPE) {
+ if (cmd == F_SETFL && val == 0) {
+ DWORD mode = PIPE_WAIT;
+ if (SetNamedPipeHandleState(
+ handle, &mode, NULL, NULL) != 0)
+ return (0);
+ }
+ }
+ errno = EINVAL;
+ return (-1);
+}
+
+__int64
+__la_lseek(int fd, __int64 offset, int whence)
+{
+ LARGE_INTEGER distance;
+ LARGE_INTEGER newpointer;
+ HANDLE handle;
+
+ if (fd < 0) {
+ errno = EBADF;
+ return (-1);
+ }
+ handle = (HANDLE)_get_osfhandle(fd);
+ if (GetFileType(handle) != FILE_TYPE_DISK) {
+ errno = EBADF;
+ return (-1);
+ }
+ distance.QuadPart = offset;
+ if (!SetFilePointerEx(handle, distance, &newpointer, whence)) {
+ DWORD lasterr;
+
+ lasterr = GetLastError();
+ if (lasterr == ERROR_BROKEN_PIPE)
+ return (0);
+ if (lasterr == ERROR_ACCESS_DENIED)
+ errno = EBADF;
+ else
+ la_dosmaperr(lasterr);
+ return (-1);
+ }
+ return (newpointer.QuadPart);
+}
+
+int
+__la_mkdir(const char *path, mode_t mode)
+{
+ wchar_t *ws;
+ int r;
+
+ (void)mode;/* UNUSED */
+ r = CreateDirectoryA(path, NULL);
+ if (r == 0) {
+ DWORD lasterr = GetLastError();
+ if (lasterr != ERROR_FILENAME_EXCED_RANGE &&
+ lasterr != ERROR_PATH_NOT_FOUND) {
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ } else
+ return (0);
+ ws = permissive_name(path);
+ if (ws == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+ r = CreateDirectoryW(ws, NULL);
+ free(ws);
+ if (r == 0) {
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ return (0);
+}
+
+/* Windows' mbstowcs is differrent error handling from other unix mbstowcs.
+ * That one is using MultiByteToWideChar function with MB_PRECOMPOSED and
+ * MB_ERR_INVALID_CHARS flags.
+ * This implements for only to pass libarchive_test.
+ */
+size_t
+__la_mbstowcs(wchar_t *wcstr, const char *mbstr, size_t nwchars)
+{
+
+ return (MultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS,
+ mbstr, (int)strlen(mbstr), wcstr,
+ (int)nwchars));
+}
+
+int
+__la_open(const char *path, int flags, ...)
+{
+ va_list ap;
+ wchar_t *ws;
+ int r, pmode;
+ DWORD attr;
+
+ va_start(ap, flags);
+ pmode = va_arg(ap, int);
+ va_end(ap);
+ ws = NULL;
+ if ((flags & ~O_BINARY) == O_RDONLY) {
+ /*
+ * When we open a directory, _open function returns
+ * "Permission denied" error.
+ */
+ attr = GetFileAttributesA(path);
+ if (attr == (DWORD)-1 && GetLastError() == ERROR_PATH_NOT_FOUND) {
+ ws = permissive_name(path);
+ if (ws == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+ attr = GetFileAttributesW(ws);
+ }
+ if (attr == (DWORD)-1) {
+ la_dosmaperr(GetLastError());
+ free(ws);
+ return (-1);
+ }
+ if (attr & FILE_ATTRIBUTE_DIRECTORY) {
+ HANDLE handle;
+
+ if (ws != NULL)
+ handle = CreateFileW(ws, 0, 0, NULL,
+ OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS |
+ FILE_ATTRIBUTE_READONLY,
+ NULL);
+ else
+ handle = CreateFileA(path, 0, 0, NULL,
+ OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS |
+ FILE_ATTRIBUTE_READONLY,
+ NULL);
+ free(ws);
+ if (handle == INVALID_HANDLE_VALUE) {
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ r = _open_osfhandle((intptr_t)handle, _O_RDONLY);
+ return (r);
+ }
+ }
+ if (ws == NULL) {
+#if defined(__BORLANDC__)
+ /* Borland has no mode argument.
+ TODO: Fix mode of new file. */
+ r = _open(path, flags);
+#else
+ r = _open(path, flags, pmode);
+#endif
+ if (r < 0 && errno == EACCES && (flags & O_CREAT) != 0) {
+ /* simular other POSIX system action to pass a test */
+ attr = GetFileAttributesA(path);
+ if (attr == (DWORD)-1)
+ la_dosmaperr(GetLastError());
+ else if (attr & FILE_ATTRIBUTE_DIRECTORY)
+ errno = EISDIR;
+ else
+ errno = EACCES;
+ return (-1);
+ }
+ if (r >= 0 || errno != ENOENT)
+ return (r);
+ ws = permissive_name(path);
+ if (ws == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+ }
+ r = _wopen(ws, flags, pmode);
+ if (r < 0 && errno == EACCES && (flags & O_CREAT) != 0) {
+ /* simular other POSIX system action to pass a test */
+ attr = GetFileAttributesW(ws);
+ if (attr == (DWORD)-1)
+ la_dosmaperr(GetLastError());
+ else if (attr & FILE_ATTRIBUTE_DIRECTORY)
+ errno = EISDIR;
+ else
+ errno = EACCES;
+ }
+ free(ws);
+ return (r);
+}
+
+ssize_t
+__la_read(int fd, void *buf, size_t nbytes)
+{
+ HANDLE handle;
+ DWORD bytes_read, lasterr;
+ int r;
+
+#ifdef _WIN64
+ if (nbytes > UINT32_MAX)
+ nbytes = UINT32_MAX;
+#endif
+ if (fd < 0) {
+ errno = EBADF;
+ return (-1);
+ }
+ handle = (HANDLE)_get_osfhandle(fd);
+ if (GetFileType(handle) == FILE_TYPE_PIPE) {
+ DWORD sta;
+ if (GetNamedPipeHandleState(
+ handle, &sta, NULL, NULL, NULL, NULL, 0) != 0 &&
+ (sta & PIPE_NOWAIT) == 0) {
+ DWORD avail = -1;
+ int cnt = 3;
+
+ while (PeekNamedPipe(
+ handle, NULL, 0, NULL, &avail, NULL) != 0 &&
+ avail == 0 && --cnt)
+ Sleep(100);
+ if (avail == 0)
+ return (0);
+ }
+ }
+ r = ReadFile(handle, buf, (uint32_t)nbytes,
+ &bytes_read, NULL);
+ if (r == 0) {
+ lasterr = GetLastError();
+ if (lasterr == ERROR_NO_DATA) {
+ errno = EAGAIN;
+ return (-1);
+ }
+ if (lasterr == ERROR_BROKEN_PIPE)
+ return (0);
+ if (lasterr == ERROR_ACCESS_DENIED)
+ errno = EBADF;
+ else
+ la_dosmaperr(lasterr);
+ return (-1);
+ }
+ return ((ssize_t)bytes_read);
+}
+
+/* Remove directory */
+int
+__la_rmdir(const char *path)
+{
+ wchar_t *ws;
+ int r;
+
+ r = _rmdir(path);
+ if (r >= 0 || errno != ENOENT)
+ return (r);
+ ws = permissive_name(path);
+ if (ws == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+ r = _wrmdir(ws);
+ free(ws);
+ return (r);
+}
+
+/* Convert Windows FILETIME to UTC */
+__inline static void
+fileTimeToUTC(const FILETIME *filetime, time_t *time, long *ns)
+{
+ ULARGE_INTEGER utc;
+
+ utc.HighPart = filetime->dwHighDateTime;
+ utc.LowPart = filetime->dwLowDateTime;
+ if (utc.QuadPart >= EPOC_TIME) {
+ utc.QuadPart -= EPOC_TIME;
+ *time = (time_t)(utc.QuadPart / 10000000); /* milli seconds base */
+ *ns = (long)(utc.QuadPart % 10000000) * 100;/* nano seconds base */
+ } else {
+ *time = 0;
+ *ns = 0;
+ }
+}
+
+/* Stat by handle
+ * Windows' stat() does not accept path which is added "\\?\" especially "?"
+ * character.
+ * It means we cannot access a long name path(which is longer than MAX_PATH).
+ * So I've implemented simular Windows' stat() to access the long name path.
+ * And I've added some feature.
+ * 1. set st_ino by nFileIndexHigh and nFileIndexLow of
+ * BY_HANDLE_FILE_INFORMATION.
+ * 2. set st_nlink by nNumberOfLinks of BY_HANDLE_FILE_INFORMATION.
+ * 3. set st_dev by dwVolumeSerialNumber by BY_HANDLE_FILE_INFORMATION.
+ */
+static int
+__hstat(HANDLE handle, struct ustat *st)
+{
+ BY_HANDLE_FILE_INFORMATION info;
+ ULARGE_INTEGER ino64;
+ DWORD ftype;
+ mode_t mode;
+ time_t time;
+ long ns;
+
+ switch (ftype = GetFileType(handle)) {
+ case FILE_TYPE_UNKNOWN:
+ errno = EBADF;
+ return (-1);
+ case FILE_TYPE_CHAR:
+ case FILE_TYPE_PIPE:
+ if (ftype == FILE_TYPE_CHAR) {
+ st->st_mode = S_IFCHR;
+ st->st_size = 0;
+ } else {
+ DWORD avail;
+
+ st->st_mode = S_IFIFO;
+ if (PeekNamedPipe(handle, NULL, 0, NULL, &avail, NULL))
+ st->st_size = avail;
+ else
+ st->st_size = 0;
+ }
+ st->st_atime = 0;
+ st->st_atime_nsec = 0;
+ st->st_mtime = 0;
+ st->st_mtime_nsec = 0;
+ st->st_ctime = 0;
+ st->st_ctime_nsec = 0;
+ st->st_ino = 0;
+ st->st_nlink = 1;
+ st->st_uid = 0;
+ st->st_gid = 0;
+ st->st_rdev = 0;
+ st->st_dev = 0;
+ return (0);
+ case FILE_TYPE_DISK:
+ break;
+ default:
+ /* This ftype is undocumented type. */
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+
+ ZeroMemory(&info, sizeof(info));
+ if (!GetFileInformationByHandle (handle, &info)) {
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+
+ mode = S_IRUSR | S_IRGRP | S_IROTH;
+ if ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0)
+ mode |= S_IWUSR | S_IWGRP | S_IWOTH;
+ if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH;
+ else
+ mode |= S_IFREG;
+ st->st_mode = mode;
+
+ fileTimeToUTC(&info.ftLastAccessTime, &time, &ns);
+ st->st_atime = time;
+ st->st_atime_nsec = ns;
+ fileTimeToUTC(&info.ftLastWriteTime, &time, &ns);
+ st->st_mtime = time;
+ st->st_mtime_nsec = ns;
+ fileTimeToUTC(&info.ftCreationTime, &time, &ns);
+ st->st_ctime = time;
+ st->st_ctime_nsec = ns;
+ st->st_size =
+ ((int64_t)(info.nFileSizeHigh) * ((int64_t)MAXDWORD + 1))
+ + (int64_t)(info.nFileSizeLow);
+#ifdef SIMULATE_WIN_STAT
+ st->st_ino = 0;
+ st->st_nlink = 1;
+ st->st_dev = 0;
+#else
+ /* Getting FileIndex as i-node. We have to remove a sequence which
+ * is high-16-bits of nFileIndexHigh. */
+ ino64.HighPart = info.nFileIndexHigh & 0x0000FFFFUL;
+ ino64.LowPart = info.nFileIndexLow;
+ st->st_ino = ino64.QuadPart;
+ st->st_nlink = info.nNumberOfLinks;
+ if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ ++st->st_nlink;/* Add parent directory. */
+ st->st_dev = info.dwVolumeSerialNumber;
+#endif
+ st->st_uid = 0;
+ st->st_gid = 0;
+ st->st_rdev = 0;
+ return (0);
+}
+
+static void
+copy_stat(struct stat *st, struct ustat *us)
+{
+ st->st_atime = us->st_atime;
+ st->st_ctime = us->st_ctime;
+ st->st_mtime = us->st_mtime;
+ st->st_gid = us->st_gid;
+ st->st_ino = getino(us);
+ st->st_mode = us->st_mode;
+ st->st_nlink = us->st_nlink;
+ st->st_size = us->st_size;
+ st->st_uid = us->st_uid;
+ st->st_dev = us->st_dev;
+ st->st_rdev = us->st_rdev;
+}
+
+int
+__la_fstat(int fd, struct stat *st)
+{
+ struct ustat u;
+ int ret;
+
+ if (fd < 0) {
+ errno = EBADF;
+ return (-1);
+ }
+ ret = __hstat((HANDLE)_get_osfhandle(fd), &u);
+ if (ret >= 0) {
+ copy_stat(st, &u);
+ if (u.st_mode & (S_IFCHR | S_IFIFO)) {
+ st->st_dev = fd;
+ st->st_rdev = fd;
+ }
+ }
+ return (ret);
+}
+
+int
+__la_stat(const char *path, struct stat *st)
+{
+ HANDLE handle;
+ struct ustat u;
+ int ret;
+
+ handle = la_CreateFile(path, 0, 0, NULL, OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS | FILE_ATTRIBUTE_READONLY,
+ NULL);
+ if (handle == INVALID_HANDLE_VALUE) {
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ ret = __hstat(handle, &u);
+ CloseHandle(handle);
+ if (ret >= 0) {
+ char *p;
+
+ copy_stat(st, &u);
+ p = strrchr(path, '.');
+ if (p != NULL && strlen(p) == 4) {
+ char exttype[4];
+
+ ++ p;
+ exttype[0] = toupper(*p++);
+ exttype[1] = toupper(*p++);
+ exttype[2] = toupper(*p++);
+ exttype[3] = '\0';
+ if (!strcmp(exttype, "EXE") || !strcmp(exttype, "CMD") ||
+ !strcmp(exttype, "BAT") || !strcmp(exttype, "COM"))
+ st->st_mode |= S_IXUSR | S_IXGRP | S_IXOTH;
+ }
+ }
+ return (ret);
+}
+
+int
+__la_unlink(const char *path)
+{
+ wchar_t *ws;
+ int r;
+
+ r = _unlink(path);
+ if (r >= 0 || errno != ENOENT)
+ return (r);
+ ws = permissive_name(path);
+ if (ws == NULL) {
+ errno = EINVAL;
+ return (-1);
+ }
+ r = _wunlink(ws);
+ free(ws);
+ return (r);
+}
+
+/*
+ * This waitpid is limited implemention.
+ */
+pid_t
+__la_waitpid(pid_t wpid, int *status, int option)
+{
+ HANDLE child;
+ DWORD cs, ret;
+
+ (void)option;/* UNUSED */
+ child = OpenProcess(PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, wpid);
+ if (child == NULL) {
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ ret = WaitForSingleObject(child, INFINITE);
+ if (ret == WAIT_FAILED) {
+ CloseHandle(child);
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ if (GetExitCodeProcess(child, &cs) == 0) {
+ CloseHandle(child);
+ la_dosmaperr(GetLastError());
+ return (-1);
+ }
+ if (cs == STILL_ACTIVE)
+ *status = 0x100;
+ else
+ *status = (int)(cs & 0xff);
+ CloseHandle(child);
+ return (wpid);
+}
+
+ssize_t
+__la_write(int fd, const void *buf, size_t nbytes)
+{
+ DWORD bytes_written;
+
+#ifdef _WIN64
+ if (nbytes > UINT32_MAX)
+ nbytes = UINT32_MAX;
+#endif
+ if (fd < 0) {
+ errno = EBADF;
+ return (-1);
+ }
+ if (!WriteFile((HANDLE)_get_osfhandle(fd), buf, (uint32_t)nbytes,
+ &bytes_written, NULL)) {
+ DWORD lasterr;
+
+ lasterr = GetLastError();
+ if (lasterr == ERROR_ACCESS_DENIED)
+ errno = EBADF;
+ else
+ la_dosmaperr(lasterr);
+ return (-1);
+ }
+ return (bytes_written);
+}
+
+/*
+ * The following function was modified from PostgreSQL sources and is
+ * subject to the copyright below.
+ */
+/*-------------------------------------------------------------------------
+ *
+ * win32error.c
+ * Map win32 error codes to errno values
+ *
+ * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
+ *
+ * IDENTIFICATION
+ * $PostgreSQL: pgsql/src/port/win32error.c,v 1.4 2008/01/01 19:46:00 momjian Exp $
+ *
+ *-------------------------------------------------------------------------
+ */
+/*
+PostgreSQL Database Management System
+(formerly known as Postgres, then as Postgres95)
+
+Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
+
+Portions Copyright (c) 1994, The Regents of the University of California
+
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose, without fee, and without a written agreement
+is hereby granted, provided that the above copyright notice and this
+paragraph and the following two paragraphs appear in all copies.
+
+IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
+DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING
+LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS
+DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO
+PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+*/
+
+static const struct {
+ DWORD winerr;
+ int doserr;
+} doserrors[] =
+{
+ { ERROR_INVALID_FUNCTION, EINVAL },
+ { ERROR_FILE_NOT_FOUND, ENOENT },
+ { ERROR_PATH_NOT_FOUND, ENOENT },
+ { ERROR_TOO_MANY_OPEN_FILES, EMFILE },
+ { ERROR_ACCESS_DENIED, EACCES },
+ { ERROR_INVALID_HANDLE, EBADF },
+ { ERROR_ARENA_TRASHED, ENOMEM },
+ { ERROR_NOT_ENOUGH_MEMORY, ENOMEM },
+ { ERROR_INVALID_BLOCK, ENOMEM },
+ { ERROR_BAD_ENVIRONMENT, E2BIG },
+ { ERROR_BAD_FORMAT, ENOEXEC },
+ { ERROR_INVALID_ACCESS, EINVAL },
+ { ERROR_INVALID_DATA, EINVAL },
+ { ERROR_INVALID_DRIVE, ENOENT },
+ { ERROR_CURRENT_DIRECTORY, EACCES },
+ { ERROR_NOT_SAME_DEVICE, EXDEV },
+ { ERROR_NO_MORE_FILES, ENOENT },
+ { ERROR_LOCK_VIOLATION, EACCES },
+ { ERROR_SHARING_VIOLATION, EACCES },
+ { ERROR_BAD_NETPATH, ENOENT },
+ { ERROR_NETWORK_ACCESS_DENIED, EACCES },
+ { ERROR_BAD_NET_NAME, ENOENT },
+ { ERROR_FILE_EXISTS, EEXIST },
+ { ERROR_CANNOT_MAKE, EACCES },
+ { ERROR_FAIL_I24, EACCES },
+ { ERROR_INVALID_PARAMETER, EINVAL },
+ { ERROR_NO_PROC_SLOTS, EAGAIN },
+ { ERROR_DRIVE_LOCKED, EACCES },
+ { ERROR_BROKEN_PIPE, EPIPE },
+ { ERROR_DISK_FULL, ENOSPC },
+ { ERROR_INVALID_TARGET_HANDLE, EBADF },
+ { ERROR_INVALID_HANDLE, EINVAL },
+ { ERROR_WAIT_NO_CHILDREN, ECHILD },
+ { ERROR_CHILD_NOT_COMPLETE, ECHILD },
+ { ERROR_DIRECT_ACCESS_HANDLE, EBADF },
+ { ERROR_NEGATIVE_SEEK, EINVAL },
+ { ERROR_SEEK_ON_DEVICE, EACCES },
+ { ERROR_DIR_NOT_EMPTY, ENOTEMPTY },
+ { ERROR_NOT_LOCKED, EACCES },
+ { ERROR_BAD_PATHNAME, ENOENT },
+ { ERROR_MAX_THRDS_REACHED, EAGAIN },
+ { ERROR_LOCK_FAILED, EACCES },
+ { ERROR_ALREADY_EXISTS, EEXIST },
+ { ERROR_FILENAME_EXCED_RANGE, ENOENT },
+ { ERROR_NESTING_NOT_ALLOWED, EAGAIN },
+ { ERROR_NOT_ENOUGH_QUOTA, ENOMEM }
+};
+
+static void
+la_dosmaperr(unsigned long e)
+{
+ int i;
+
+ if (e == 0)
+ {
+ errno = 0;
+ return;
+ }
+
+ for (i = 0; i < sizeof(doserrors); i++)
+ {
+ if (doserrors[i].winerr == e)
+ {
+ errno = doserrors[i].doserr;
+ return;
+ }
+ }
+
+ /* fprintf(stderr, "unrecognized win32 error code: %lu", e); */
+ errno = EINVAL;
+ return;
+}
+
+#if !defined(HAVE_OPENSSL_MD5_H) && !defined(HAVE_OPENSSL_SHA_H)
+/*
+ * Message digest functions.
+ */
+static void
+Digest_Init(Digest_CTX *ctx, ALG_ID algId)
+{
+
+ ctx->valid = 0;
+ if (!CryptAcquireContext(&ctx->cryptProv, NULL, NULL,
+ PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
+ if (GetLastError() != (DWORD)NTE_BAD_KEYSET)
+ return;
+ if (!CryptAcquireContext(&ctx->cryptProv, NULL, NULL,
+ PROV_RSA_FULL, CRYPT_NEWKEYSET))
+ return;
+ }
+
+ if (!CryptCreateHash(ctx->cryptProv, algId, 0, 0, &ctx->hash)) {
+ CryptReleaseContext(ctx->cryptProv, 0);
+ return;
+ }
+
+ ctx->valid = 1;
+}
+
+static void
+Digest_Update(Digest_CTX *ctx, const unsigned char *buf, size_t len)
+{
+
+ if (!ctx->valid)
+ return;
+
+ CryptHashData(ctx->hash,
+ (unsigned char *)(uintptr_t)buf,
+ (DWORD)len, 0);
+}
+
+static void
+Digest_Final(unsigned char *buf, int bufsize, Digest_CTX *ctx)
+{
+ DWORD siglen = bufsize;
+
+ if (!ctx->valid)
+ return;
+
+ CryptGetHashParam(ctx->hash, HP_HASHVAL, buf, &siglen, 0);
+ CryptDestroyHash(ctx->hash);
+ CryptReleaseContext(ctx->cryptProv, 0);
+ ctx->valid = 0;
+}
+
+#define DIGEST_INIT(name, algid) \
+void name ## _Init(Digest_CTX *ctx)\
+{\
+ Digest_Init(ctx, algid);\
+}
+
+#define DIGEST_UPDATE(name) \
+void name ## _Update(Digest_CTX *ctx, const unsigned char *buf, size_t len)\
+{\
+ Digest_Update(ctx, buf, len);\
+}
+
+#define DIGEST_FINAL(name, size) \
+void name ## _Final(unsigned char *buf, Digest_CTX *ctx)\
+{\
+ Digest_Final(buf, size, ctx);\
+}
+
+DIGEST_INIT(MD5, CALG_MD5)
+DIGEST_UPDATE(MD5)
+DIGEST_FINAL(MD5, MD5_DIGEST_LENGTH)
+
+DIGEST_INIT(SHA1, CALG_SHA1)
+DIGEST_UPDATE(SHA1)
+DIGEST_FINAL(SHA1, SHA1_DIGEST_LENGTH)
+
+/*
+ * SHA256 nor SHA384 nor SHA512 are not supported on Windows XP and Windows 2000.
+ */
+#ifdef CALG_SHA_256
+DIGEST_INIT(SHA256, CALG_SHA_256)
+DIGEST_UPDATE(SHA256)
+DIGEST_FINAL(SHA256, SHA256_DIGEST_LENGTH)
+#endif
+
+#ifdef CALG_SHA_384
+DIGEST_INIT(SHA384, CALG_SHA_384)
+DIGEST_UPDATE(SHA384)
+DIGEST_FINAL(SHA384, SHA384_DIGEST_LENGTH)
+#endif
+
+#ifdef CALG_SHA_512
+DIGEST_INIT(SHA512, CALG_SHA_512)
+DIGEST_UPDATE(SHA512)
+DIGEST_FINAL(SHA512, SHA384_DIGEST_LENGTH)
+#endif
+
+#endif /* !HAVE_OPENSSL_MD5_H && !HAVE_OPENSSL_SHA_H */
+
+#endif /* _WIN32 && !__CYGWIN__ */
diff --git a/archivers/libarchive/files/libarchive/archive_windows.h b/archivers/libarchive/files/libarchive/archive_windows.h
new file mode 100644
index 00000000000..b68e72e9870
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_windows.h
@@ -0,0 +1,422 @@
+/*-
+ * Copyright (c) 2009 Michihiro NAKAJIMA
+ * 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
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
+
+/*
+ * TODO: A lot of stuff in here isn't actually used by libarchive and
+ * can be trimmed out. Note that this file is used by libarchive and
+ * libarchive_test but nowhere else. (But note that it gets compiled
+ * with many different Windows environments, including MinGW, Visual
+ * Studio, and Cygwin. Significant changes should be tested in all three.)
+ */
+
+/*
+ * TODO: Don't use off_t in here. Use __int64 instead. Note that
+ * Visual Studio and the Windows SDK define off_t as 32 bits; Win32's
+ * more modern file handling APIs all use __int64 instead of off_t.
+ */
+
+#ifndef LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED
+#define LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED
+
+/* Start of configuration for native Win32 */
+
+#include <errno.h>
+#define set_errno(val) ((errno)=val)
+#include <io.h>
+#include <stdlib.h> //brings in NULL
+#if defined(HAVE_STDINT_H)
+#include <stdint.h>
+#endif
+#include <stdio.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <process.h>
+#include <direct.h>
+#define NOCRYPT
+#include <windows.h>
+//#define EFTYPE 7
+
+#if !defined(STDIN_FILENO)
+#define STDIN_FILENO 0
+#endif
+
+#if !defined(STDOUT_FILENO)
+#define STDOUT_FILENO 1
+#endif
+
+#if !defined(STDERR_FILENO)
+#define STDERR_FILENO 2
+#endif
+
+
+#if defined(_MSC_VER)
+/* TODO: Fix the code, don't suppress the warnings. */
+#pragma warning(disable:4244) /* 'conversion' conversion from 'type1' to 'type2', possible loss of data */
+#endif
+#if defined(__BORLANDC__)
+#pragma warn -8068 /* Constant out of range in comparison. */
+#pragma warn -8072 /* Suspicious pointer arithmetic. */
+#endif
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+/* Alias the Windows _function to the POSIX equivalent. */
+#define access _access
+#define chdir __la_chdir
+#define chmod __la_chmod
+#define close _close
+#define fcntl __la_fcntl
+#ifndef fileno
+#define fileno _fileno
+#endif
+#define fstat __la_fstat
+#define ftruncate __la_ftruncate
+#define futimes __la_futimes
+#define getcwd _getcwd
+#define link __la_link
+#define lseek __la_lseek
+#define lstat __la_stat
+#define mbstowcs __la_mbstowcs
+#define mkdir(d,m) __la_mkdir(d, m)
+#define mktemp _mktemp
+#define open __la_open
+#define read __la_read
+#define rmdir __la_rmdir
+#if !defined(__BORLANDC__)
+#define setmode _setmode
+#endif
+#define stat(path,stref) __la_stat(path,stref)
+#if !defined(__BORLANDC__)
+#define strdup _strdup
+#endif
+#define tzset _tzset
+#if !defined(__BORLANDC__)
+#define umask _umask
+#endif
+#define unlink __la_unlink
+#define utimes __la_utimes
+#define waitpid __la_waitpid
+#define write __la_write
+
+#ifndef O_RDONLY
+#define O_RDONLY _O_RDONLY
+#define O_WRONLY _O_WRONLY
+#define O_TRUNC _O_TRUNC
+#define O_CREAT _O_CREAT
+#define O_EXCL _O_EXCL
+#define O_BINARY _O_BINARY
+#endif
+
+#ifndef _S_IFIFO
+ #define _S_IFIFO 0010000 /* pipe */
+#endif
+#ifndef _S_IFCHR
+ #define _S_IFCHR 0020000 /* character special */
+#endif
+#ifndef _S_IFDIR
+ #define _S_IFDIR 0040000 /* directory */
+#endif
+#ifndef _S_IFBLK
+ #define _S_IFBLK 0060000 /* block special */
+#endif
+#ifndef _S_IFLNK
+ #define _S_IFLNK 0120000 /* symbolic link */
+#endif
+#ifndef _S_IFSOCK
+ #define _S_IFSOCK 0140000 /* socket */
+#endif
+#ifndef _S_IFREG
+ #define _S_IFREG 0100000 /* regular */
+#endif
+#ifndef _S_IFMT
+ #define _S_IFMT 0170000 /* file type mask */
+#endif
+
+#ifndef S_IFIFO
+#define S_IFIFO _S_IFIFO
+#endif
+//#define S_IFCHR _S_IFCHR
+//#define S_IFDIR _S_IFDIR
+#ifndef S_IFBLK
+#define S_IFBLK _S_IFBLK
+#endif
+#ifndef S_IFLNK
+#define S_IFLNK _S_IFLNK
+#endif
+#ifndef S_IFSOCK
+#define S_IFSOCK _S_IFSOCK
+#endif
+//#define S_IFREG _S_IFREG
+//#define S_IFMT _S_IFMT
+
+#ifndef S_ISBLK
+#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* block special */
+#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo or socket */
+#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* char special */
+#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */
+#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */
+#endif
+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* Symbolic link */
+#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) /* Socket */
+
+#define _S_ISUID 0004000 /* set user id on execution */
+#define _S_ISGID 0002000 /* set group id on execution */
+#define _S_ISVTX 0001000 /* save swapped text even after use */
+
+#define S_ISUID _S_ISUID
+#define S_ISGID _S_ISGID
+#define S_ISVTX _S_ISVTX
+
+#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC)
+#define _S_IXUSR _S_IEXEC /* read permission, user */
+#define _S_IWUSR _S_IWRITE /* write permission, user */
+#define _S_IRUSR _S_IREAD /* execute/search permission, user */
+#define _S_IRWXG (_S_IRWXU >> 3)
+#define _S_IXGRP (_S_IXUSR >> 3) /* read permission, group */
+#define _S_IWGRP (_S_IWUSR >> 3) /* write permission, group */
+#define _S_IRGRP (_S_IRUSR >> 3) /* execute/search permission, group */
+#define _S_IRWXO (_S_IRWXG >> 3)
+#define _S_IXOTH (_S_IXGRP >> 3) /* read permission, other */
+#define _S_IWOTH (_S_IWGRP >> 3) /* write permission, other */
+#define _S_IROTH (_S_IRGRP >> 3) /* execute/search permission, other */
+
+#ifndef S_IRWXU
+#define S_IRWXU _S_IRWXU
+#define S_IXUSR _S_IXUSR
+#define S_IWUSR _S_IWUSR
+#define S_IRUSR _S_IRUSR
+#endif
+#define S_IRWXG _S_IRWXG
+#define S_IXGRP _S_IXGRP
+#define S_IWGRP _S_IWGRP
+#define S_IRGRP _S_IRGRP
+#define S_IRWXO _S_IRWXO
+#define S_IXOTH _S_IXOTH
+#define S_IWOTH _S_IWOTH
+#define S_IROTH _S_IROTH
+
+#define F_DUPFD 0 /* Duplicate file descriptor. */
+#define F_GETFD 1 /* Get file descriptor flags. */
+#define F_SETFD 2 /* Set file descriptor flags. */
+#define F_GETFL 3 /* Get file status flags. */
+#define F_SETFL 4 /* Set file status flags. */
+#define F_GETOWN 5 /* Get owner (receiver of SIGIO). */
+#define F_SETOWN 6 /* Set owner (receiver of SIGIO). */
+#define F_GETLK 7 /* Get record locking info. */
+#define F_SETLK 8 /* Set record locking info (non-blocking). */
+#define F_SETLKW 9 /* Set record locking info (blocking). */
+
+/* XXX missing */
+#define F_GETLK64 7 /* Get record locking info. */
+#define F_SETLK64 8 /* Set record locking info (non-blocking). */
+#define F_SETLKW64 9 /* Set record locking info (blocking). */
+
+/* File descriptor flags used with F_GETFD and F_SETFD. */
+#define FD_CLOEXEC 1 /* Close on exec. */
+
+//NOT SURE IF O_NONBLOCK is OK here but at least the 0x0004 flag is not used by anything else...
+#define O_NONBLOCK 0x0004 /* Non-blocking I/O. */
+//#define O_NDELAY O_NONBLOCK
+
+/* Symbolic constants for the access() function */
+#if !defined(F_OK)
+ #define R_OK 4 /* Test for read permission */
+ #define W_OK 2 /* Test for write permission */
+ #define X_OK 1 /* Test for execute permission */
+ #define F_OK 0 /* Test for existence of file */
+#endif
+
+
+#ifdef _LARGEFILE_SOURCE
+# define __USE_LARGEFILE 1 /* declare fseeko and ftello */
+#endif
+
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64
+# define __USE_FILE_OFFSET64 1 /* replace 32-bit functions by 64-bit ones */
+#endif
+
+#if __USE_LARGEFILE && __USE_FILE_OFFSET64
+/* replace stat and seek by their large-file equivalents */
+#undef stat
+#define stat _stati64
+
+#undef lseek
+#define lseek _lseeki64
+#define lseek64 _lseeki64
+#define tell _telli64
+#define tell64 _telli64
+
+#ifdef __MINGW32__
+# define fseek fseeko64
+# define fseeko fseeko64
+# define ftell ftello64
+# define ftello ftello64
+# define ftell64 ftello64
+#endif /* __MINGW32__ */
+#endif /* LARGE_FILES */
+
+#ifdef USE_WINSOCK_TIMEVAL
+/* Winsock timeval has long size tv_sec. */
+#define __timeval timeval
+#else
+struct _timeval64i32 {
+ time_t tv_sec;
+ long tv_usec;
+};
+#define __timeval _timeval64i32
+#endif
+
+/* Message digest define */
+#if !defined(HAVE_OPENSSL_MD5_H) && !defined(HAVE_OPENSSL_SHA_H)
+# if defined(_MSC_VER) && _MSC_VER < 1300
+# define _WIN32_WINNT 0x0400
+# endif
+#include <wincrypt.h>
+typedef struct {
+ int valid;
+ HCRYPTPROV cryptProv;
+ HCRYPTHASH hash;
+} Digest_CTX;
+#endif
+
+#if !defined(HAVE_OPENSSL_MD5_H) && defined(CALG_MD5)
+#define MD5_DIGEST_LENGTH 16
+#define HAVE_MD5 1
+#define MD5_CTX Digest_CTX
+#endif
+#ifndef HAVE_OPENSSL_SHA_H
+#ifdef CALG_SHA1
+#define SHA1_DIGEST_LENGTH 20
+#define HAVE_SHA1 1
+#define SHA1_CTX Digest_CTX
+#endif
+#ifdef CALG_SHA_256
+#define SHA256_DIGEST_LENGTH 32
+#define HAVE_SHA256 1
+#define SHA256_CTX Digest_CTX
+#endif
+#ifdef CALG_SHA_384
+#define SHA384_DIGEST_LENGTH 48
+#define HAVE_SHA384 1
+#define SHA384_CTX Digest_CTX
+#endif
+#ifdef CALG_SHA_512
+#define SHA512_DIGEST_LENGTH 64
+#define HAVE_SHA512 1
+#define SHA512_CTX Digest_CTX
+#endif
+#endif /* HAVE_OPENSSL_SHA_H */
+
+/* End of Win32 definitions. */
+
+/* Tell libarchive code that we have simulations for these. */
+#ifndef HAVE_FTRUNCATE
+#define HAVE_FTRUNCATE 1
+#endif
+#ifndef HAVE_FUTIMES
+#define HAVE_FUTIMES 1
+#endif
+#ifndef HAVE_UTIMES
+#define HAVE_UTIMES 1
+#endif
+#ifndef HAVE_LINK
+#define HAVE_LINK 1
+#endif
+
+/* Replacement POSIX function */
+extern int __la_chdir(const char *path);
+extern int __la_chmod(const char *path, mode_t mode);
+extern int __la_fcntl(int fd, int cmd, int val);
+extern int __la_fstat(int fd, struct stat *st);
+extern int __la_ftruncate(int fd, off_t length);
+extern int __la_futimes(int fd, const struct __timeval *times);
+extern int __la_link(const char *src, const char *dst);
+extern __int64 __la_lseek(int fd, __int64 offset, int whence);
+extern size_t __la_mbstowcs(wchar_t *wcstr, const char *mbstr, size_t nwchars);
+extern int __la_mkdir(const char *path, mode_t mode);
+extern int __la_open(const char *path, int flags, ...);
+extern ssize_t __la_read(int fd, void *buf, size_t nbytes);
+extern int __la_rmdir(const char *path);
+extern int __la_stat(const char *path, struct stat *st);
+extern int __la_unlink(const char *path);
+extern int __la_utimes(const char *name, const struct __timeval *times);
+extern pid_t __la_waitpid(pid_t wpid, int *status, int option);
+extern ssize_t __la_write(int fd, const void *buf, size_t nbytes);
+
+#define _stat64i32(path, st) __la_stat(path, st)
+#define _stat64(path, st) __la_stat(path, st)
+/* for status returned by la_waitpid */
+#define WIFEXITED(sts) ((sts & 0x100) == 0)
+#define WEXITSTATUS(sts) (sts & 0x0FF)
+
+/* Message digest function */
+#if !defined(HAVE_OPENSSL_MD5_H) && !defined(HAVE_OPENSSL_SHA_H)
+#ifdef MD5_DIGEST_LENGTH
+extern void MD5_Init(Digest_CTX *ctx);
+extern void MD5_Update(Digest_CTX *ctx, const unsigned char *buf,
+ size_t len);
+extern void MD5_Final(unsigned char *buf, Digest_CTX *ctx);
+#endif
+#ifdef SHA1_DIGEST_LENGTH
+extern void SHA1_Init(Digest_CTX *ctx);
+extern void SHA1_Update(Digest_CTX *ctx, const unsigned char *buf,
+ size_t len);
+extern void SHA1_Final(unsigned char *buf, Digest_CTX *ctx);
+#endif
+#ifdef SHA256_DIGEST_LENGTH
+extern void SHA256_Init(Digest_CTX *ctx);
+extern void SHA256_Update(Digest_CTX *ctx, const unsigned char *buf,
+ size_t len);
+extern void SHA256_Final(unsigned char *buf, Digest_CTX *ctx);
+#endif
+#ifdef SHA384_DIGEST_LENGTH
+extern void SHA384_Init(Digest_CTX *ctx);
+extern void SHA384_Update(Digest_CTX *ctx, const unsigned char *buf,
+ size_t len);
+extern void SHA384_Final(unsigned char *buf, Digest_CTX *ctx);
+#endif
+#ifdef SHA512_DIGEST_LENGTH
+extern void SHA512_Init(Digest_CTX *ctx);
+extern void SHA512_Update(Digest_CTX *ctx, const unsigned char *buf,
+ size_t len);
+extern void SHA512_Final(unsigned char *buf, Digest_CTX *ctx);
+#endif
+#endif
+
+#endif /* LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED */
diff --git a/archivers/libarchive/files/libarchive/archive_write.3 b/archivers/libarchive/files/libarchive/archive_write.3
new file mode 100644
index 00000000000..ffe0c9b45f0
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write.3
@@ -0,0 +1,629 @@
+.\" 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 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: head/lib/libarchive/archive_write.3 201110 2009-12-28 03:31:29Z kientzle $
+.\"
+.Dd May 11, 2008
+.Dt archive_write 3
+.Os
+.Sh NAME
+.Nm archive_write_new ,
+.Nm archive_write_set_format_cpio ,
+.Nm archive_write_set_format_pax ,
+.Nm archive_write_set_format_pax_restricted ,
+.Nm archive_write_set_format_shar ,
+.Nm archive_write_set_format_shar_binary ,
+.Nm archive_write_set_format_ustar ,
+.Nm archive_write_get_bytes_per_block ,
+.Nm archive_write_set_bytes_per_block ,
+.Nm archive_write_set_bytes_in_last_block ,
+.Nm archive_write_set_compression_bzip2 ,
+.Nm archive_write_set_compression_compress ,
+.Nm archive_write_set_compression_gzip ,
+.Nm archive_write_set_compression_none ,
+.Nm archive_write_set_compression_program ,
+.Nm archive_write_set_compressor_options ,
+.Nm archive_write_set_format_options ,
+.Nm archive_write_set_options ,
+.Nm archive_write_open ,
+.Nm archive_write_open_fd ,
+.Nm archive_write_open_FILE ,
+.Nm archive_write_open_filename ,
+.Nm archive_write_open_memory ,
+.Nm archive_write_header ,
+.Nm archive_write_data ,
+.Nm archive_write_finish_entry ,
+.Nm archive_write_close ,
+.Nm archive_write_finish
+.Nd functions for creating archives
+.Sh SYNOPSIS
+.In archive.h
+.Ft struct archive *
+.Fn archive_write_new "void"
+.Ft int
+.Fn archive_write_get_bytes_per_block "struct archive *"
+.Ft int
+.Fn archive_write_set_bytes_per_block "struct archive *" "int bytes_per_block"
+.Ft int
+.Fn archive_write_set_bytes_in_last_block "struct archive *" "int"
+.Ft int
+.Fn archive_write_set_compression_bzip2 "struct archive *"
+.Ft int
+.Fn archive_write_set_compression_compress "struct archive *"
+.Ft int
+.Fn archive_write_set_compression_gzip "struct archive *"
+.Ft int
+.Fn archive_write_set_compression_none "struct archive *"
+.Ft int
+.Fn archive_write_set_compression_program "struct archive *" "const char * cmd"
+.Ft int
+.Fn archive_write_set_format_cpio "struct archive *"
+.Ft int
+.Fn archive_write_set_format_pax "struct archive *"
+.Ft int
+.Fn archive_write_set_format_pax_restricted "struct archive *"
+.Ft int
+.Fn archive_write_set_format_shar "struct archive *"
+.Ft int
+.Fn archive_write_set_format_shar_binary "struct archive *"
+.Ft int
+.Fn archive_write_set_format_ustar "struct archive *"
+.Ft int
+.Fn archive_write_set_format_options "struct archive *" "const char *"
+.Ft int
+.Fn archive_write_set_compressor_options "struct archive *" "const char *"
+.Ft int
+.Fn archive_write_set_options "struct archive *" "const char *"
+.Ft int
+.Fo archive_write_open
+.Fa "struct archive *"
+.Fa "void *client_data"
+.Fa "archive_open_callback *"
+.Fa "archive_write_callback *"
+.Fa "archive_close_callback *"
+.Fc
+.Ft int
+.Fn archive_write_open_fd "struct archive *" "int fd"
+.Ft int
+.Fn archive_write_open_FILE "struct archive *" "FILE *file"
+.Ft int
+.Fn archive_write_open_filename "struct archive *" "const char *filename"
+.Ft int
+.Fo archive_write_open_memory
+.Fa "struct archive *"
+.Fa "void *buffer"
+.Fa "size_t bufferSize"
+.Fa "size_t *outUsed"
+.Fc
+.Ft int
+.Fn archive_write_header "struct archive *" "struct archive_entry *"
+.Ft ssize_t
+.Fn archive_write_data "struct archive *" "const void *" "size_t"
+.Ft int
+.Fn archive_write_finish_entry "struct archive *"
+.Ft int
+.Fn archive_write_close "struct archive *"
+.Ft int
+.Fn archive_write_finish "struct archive *"
+.Sh DESCRIPTION
+These functions provide a complete API for creating streaming
+archive files.
+The general process is to first create the
+.Tn struct archive
+object, set any desired options, initialize the archive, append entries, then
+close the archive and release all resources.
+The following summary describes the functions in approximately
+the order they are ordinarily used:
+.Bl -tag -width indent
+.It Fn archive_write_new
+Allocates and initializes a
+.Tn struct archive
+object suitable for writing a tar archive.
+.It Fn archive_write_set_bytes_per_block
+Sets the block size used for writing the archive data.
+Every call to the write callback function, except possibly the last one, will
+use this value for the length.
+The third parameter is a boolean that specifies whether or not the final block
+written will be padded to the full block size.
+If it is zero, the last block will not be padded.
+If it is non-zero, padding will be added both before and after compression.
+The default is to use a block size of 10240 bytes and to pad the last block.
+Note that a block size of zero will suppress internal blocking
+and cause writes to be sent directly to the write callback as they occur.
+.It Fn archive_write_get_bytes_per_block
+Retrieve the block size to be used for writing.
+A value of -1 here indicates that the library should use default values.
+A value of zero indicates that internal blocking is suppressed.
+.It Fn archive_write_set_bytes_in_last_block
+Sets the block size used for writing the last block.
+If this value is zero, the last block will be padded to the same size
+as the other blocks.
+Otherwise, the final block will be padded to a multiple of this size.
+In particular, setting it to 1 will cause the final block to not be padded.
+For compressed output, any padding generated by this option
+is applied only after the compression.
+The uncompressed data is always unpadded.
+The default is to pad the last block to the full block size (note that
+.Fn archive_write_open_filename
+will set this based on the file type).
+Unlike the other
+.Dq set
+functions, this function can be called after the archive is opened.
+.It Fn archive_write_get_bytes_in_last_block
+Retrieve the currently-set value for last block size.
+A value of -1 here indicates that the library should use default values.
+.It Xo
+.Fn archive_write_set_format_cpio ,
+.Fn archive_write_set_format_pax ,
+.Fn archive_write_set_format_pax_restricted ,
+.Fn archive_write_set_format_shar ,
+.Fn archive_write_set_format_shar_binary ,
+.Fn archive_write_set_format_ustar
+.Xc
+Sets the format that will be used for the archive.
+The library can write
+POSIX octet-oriented cpio format archives,
+POSIX-standard
+.Dq pax interchange
+format archives,
+traditional
+.Dq shar
+archives,
+enhanced
+.Dq binary
+shar archives that store a variety of file attributes and handle binary files,
+and
+POSIX-standard
+.Dq ustar
+archives.
+The pax interchange format is a backwards-compatible tar format that
+adds key/value attributes to each entry and supports arbitrary
+filenames, linknames, uids, sizes, etc.
+.Dq Restricted pax interchange format
+is the library default; this is the same as pax format, but suppresses
+the pax extended header for most normal files.
+In most cases, this will result in ordinary ustar archives.
+.It Xo
+.Fn archive_write_set_compression_bzip2 ,
+.Fn archive_write_set_compression_compress ,
+.Fn archive_write_set_compression_gzip ,
+.Fn archive_write_set_compression_none
+.Xc
+The resulting archive will be compressed as specified.
+Note that the compressed output is always properly blocked.
+.It Fn archive_write_set_compression_program
+The archive will be fed into the specified compression program.
+The output of that program is blocked and written to the client
+write callbacks.
+.It Xo
+.Fn archive_write_set_compressor_options ,
+.Fn archive_write_set_format_options ,
+.Fn archive_write_set_options
+.Xc
+Specifies options that will be passed to the currently-enabled
+compressor and/or format writer.
+The argument is a comma-separated list of individual options.
+Individual options have one of the following forms:
+.Bl -tag -compact -width indent
+.It Ar option=value
+The option/value pair will be provided to every module.
+Modules that do not accept an option with this name will ignore it.
+.It Ar option
+The option will be provided to every module with a value of
+.Dq 1 .
+.It Ar !option
+The option will be provided to every module with a NULL value.
+.It Ar module:option=value , Ar module:option , Ar module:!option
+As above, but the corresponding option and value will be provided
+only to modules whose name matches
+.Ar module .
+.El
+The return value will be
+.Cm ARCHIVE_OK
+if any module accepts the option, or
+.Cm ARCHIVE_WARN
+if no module accepted the option, or
+.Cm ARCHIVE_FATAL
+if there was a fatal error while attempting to process the option.
+.Pp
+The currently supported options are:
+.Bl -tag -compact -width indent
+.It Compressor gzip
+.Bl -tag -compact -width indent
+.It Cm compression-level
+The value is interpreted as a decimal integer specifying the
+gzip compression level.
+.El
+.It Compressor xz
+.Bl -tag -compact -width indent
+.It Cm compression-level
+The value is interpreted as a decimal integer specifying the
+compression level.
+.El
+.It Format mtree
+.Bl -tag -compact -width indent
+.It Cm cksum , Cm device , Cm flags , Cm gid , Cm gname , Cm indent , Cm link , Cm md5 , Cm mode , Cm nlink , Cm rmd160 , Cm sha1 , Cm sha256 , Cm sha384 , Cm sha512 , Cm size , Cm time , Cm uid , Cm uname
+Enable a particular keyword in the mtree output.
+Prefix with an exclamation mark to disable the corresponding keyword.
+The default is equivalent to
+.Dq device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname .
+.It Cm all
+Enables all of the above keywords.
+.It Cm use-set
+Enables generation of
+.Cm /set
+lines that specify default values for the following files and/or directories.
+.It Cm indent
+XXX needs explanation XXX
+.El
+.El
+.It Fn archive_write_open
+Freeze the settings, open the archive, and prepare for writing entries.
+This is the most generic form of this function, which accepts
+pointers to three callback functions which will be invoked by
+the compression layer to write the constructed archive.
+.It Fn archive_write_open_fd
+A convenience form of
+.Fn archive_write_open
+that accepts a file descriptor.
+The
+.Fn archive_write_open_fd
+function is safe for use with tape drives or other
+block-oriented devices.
+.It Fn archive_write_open_FILE
+A convenience form of
+.Fn archive_write_open
+that accepts a
+.Ft "FILE *"
+pointer.
+Note that
+.Fn archive_write_open_FILE
+is not safe for writing to tape drives or other devices
+that require correct blocking.
+.It Fn archive_write_open_file
+A deprecated synonym for
+.Fn archive_write_open_filename .
+.It Fn archive_write_open_filename
+A convenience form of
+.Fn archive_write_open
+that accepts a filename.
+A NULL argument indicates that the output should be written to standard output;
+an argument of
+.Dq -
+will open a file with that name.
+If you have not invoked
+.Fn archive_write_set_bytes_in_last_block ,
+then
+.Fn archive_write_open_filename
+will adjust the last-block padding depending on the file:
+it will enable padding when writing to standard output or
+to a character or block device node, it will disable padding otherwise.
+You can override this by manually invoking
+.Fn archive_write_set_bytes_in_last_block
+before calling
+.Fn archive_write_open .
+The
+.Fn archive_write_open_filename
+function is safe for use with tape drives or other
+block-oriented devices.
+.It Fn archive_write_open_memory
+A convenience form of
+.Fn archive_write_open
+that accepts a pointer to a block of memory that will receive
+the archive.
+The final
+.Ft "size_t *"
+argument points to a variable that will be updated
+after each write to reflect how much of the buffer
+is currently in use.
+You should be careful to ensure that this variable
+remains allocated until after the archive is
+closed.
+.It Fn archive_write_header
+Build and write a header using the data in the provided
+.Tn struct archive_entry
+structure.
+See
+.Xr archive_entry 3
+for information on creating and populating
+.Tn struct archive_entry
+objects.
+.It Fn archive_write_data
+Write data corresponding to the header just written.
+Returns number of bytes written or -1 on error.
+.It Fn archive_write_finish_entry
+Close out the entry just written.
+In particular, this writes out the final padding required by some formats.
+Ordinarily, clients never need to call this, as it
+is called automatically by
+.Fn archive_write_next_header
+and
+.Fn archive_write_close
+as needed.
+.It Fn archive_write_close
+Complete the archive and invoke the close callback.
+.It Fn archive_write_finish
+Invokes
+.Fn archive_write_close
+if it was not invoked manually, then releases all resources.
+Note that this function was declared to return
+.Ft void
+in libarchive 1.x, which made it impossible to detect errors when
+.Fn archive_write_close
+was invoked implicitly from this function.
+This is corrected beginning with libarchive 2.0.
+.El
+More information about the
+.Va struct archive
+object and the overall design of the library can be found in the
+.Xr libarchive 3
+overview.
+.Sh IMPLEMENTATION
+Compression support is built-in to libarchive, which uses zlib and bzlib
+to handle gzip and bzip2 compression, respectively.
+.Sh CLIENT CALLBACKS
+To use this library, you will need to define and register
+callback functions that will be invoked to write data to the
+resulting archive.
+These functions are registered by calling
+.Fn archive_write_open :
+.Bl -item -offset indent
+.It
+.Ft typedef int
+.Fn archive_open_callback "struct archive *" "void *client_data"
+.El
+.Pp
+The open callback is invoked by
+.Fn archive_write_open .
+It should return
+.Cm ARCHIVE_OK
+if the underlying file or data source is successfully
+opened.
+If the open fails, it should call
+.Fn archive_set_error
+to register an error code and message and return
+.Cm ARCHIVE_FATAL .
+.Bl -item -offset indent
+.It
+.Ft typedef ssize_t
+.Fo archive_write_callback
+.Fa "struct archive *"
+.Fa "void *client_data"
+.Fa "const void *buffer"
+.Fa "size_t length"
+.Fc
+.El
+.Pp
+The write callback is invoked whenever the library
+needs to write raw bytes to the archive.
+For correct blocking, each call to the write callback function
+should translate into a single
+.Xr write 2
+system call.
+This is especially critical when writing archives to tape drives.
+On success, the write callback should return the
+number of bytes actually written.
+On error, the callback should invoke
+.Fn archive_set_error
+to register an error code and message and return -1.
+.Bl -item -offset indent
+.It
+.Ft typedef int
+.Fn archive_close_callback "struct archive *" "void *client_data"
+.El
+.Pp
+The close callback is invoked by archive_close when
+the archive processing is complete.
+The callback should return
+.Cm ARCHIVE_OK
+on success.
+On failure, the callback should invoke
+.Fn archive_set_error
+to register an error code and message and
+return
+.Cm ARCHIVE_FATAL.
+.Sh EXAMPLE
+The following sketch illustrates basic usage of the library.
+In this example,
+the callback functions are simply wrappers around the standard
+.Xr open 2 ,
+.Xr write 2 ,
+and
+.Xr close 2
+system calls.
+.Bd -literal -offset indent
+#ifdef __linux__
+#define _FILE_OFFSET_BITS 64
+#endif
+#include <sys/stat.h>
+#include <archive.h>
+#include <archive_entry.h>
+#include <fcntl.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+struct mydata {
+ const char *name;
+ int fd;
+};
+
+int
+myopen(struct archive *a, void *client_data)
+{
+ struct mydata *mydata = client_data;
+
+ mydata->fd = open(mydata->name, O_WRONLY | O_CREAT, 0644);
+ if (mydata->fd >= 0)
+ return (ARCHIVE_OK);
+ else
+ return (ARCHIVE_FATAL);
+}
+
+ssize_t
+mywrite(struct archive *a, void *client_data, const void *buff, size_t n)
+{
+ struct mydata *mydata = client_data;
+
+ return (write(mydata->fd, buff, n));
+}
+
+int
+myclose(struct archive *a, void *client_data)
+{
+ struct mydata *mydata = client_data;
+
+ if (mydata->fd > 0)
+ close(mydata->fd);
+ return (0);
+}
+
+void
+write_archive(const char *outname, const char **filename)
+{
+ struct mydata *mydata = malloc(sizeof(struct mydata));
+ struct archive *a;
+ struct archive_entry *entry;
+ struct stat st;
+ char buff[8192];
+ int len;
+ int fd;
+
+ a = archive_write_new();
+ mydata->name = outname;
+ archive_write_set_compression_gzip(a);
+ archive_write_set_format_ustar(a);
+ archive_write_open(a, mydata, myopen, mywrite, myclose);
+ while (*filename) {
+ stat(*filename, &st);
+ entry = archive_entry_new();
+ archive_entry_copy_stat(entry, &st);
+ archive_entry_set_pathname(entry, *filename);
+ archive_write_header(a, entry);
+ fd = open(*filename, O_RDONLY);
+ len = read(fd, buff, sizeof(buff));
+ while ( len > 0 ) {
+ archive_write_data(a, buff, len);
+ len = read(fd, buff, sizeof(buff));
+ }
+ archive_entry_free(entry);
+ filename++;
+ }
+ archive_write_finish(a);
+}
+
+int main(int argc, const char **argv)
+{
+ const char *outname;
+ argv++;
+ outname = argv++;
+ write_archive(outname, argv);
+ return 0;
+}
+.Ed
+.Sh RETURN VALUES
+Most functions return
+.Cm ARCHIVE_OK
+(zero) on success, or one of several non-zero
+error codes for errors.
+Specific error codes include:
+.Cm ARCHIVE_RETRY
+for operations that might succeed if retried,
+.Cm ARCHIVE_WARN
+for unusual conditions that do not prevent further operations, and
+.Cm ARCHIVE_FATAL
+for serious errors that make remaining operations impossible.
+The
+.Fn archive_errno
+and
+.Fn archive_error_string
+functions can be used to retrieve an appropriate error code and a
+textual error message.
+.Pp
+.Fn archive_write_new
+returns a pointer to a newly-allocated
+.Tn struct archive
+object.
+.Pp
+.Fn archive_write_data
+returns a count of the number of bytes actually written.
+On error, -1 is returned and the
+.Fn archive_errno
+and
+.Fn archive_error_string
+functions will return appropriate values.
+Note that if the client-provided write callback function
+returns a non-zero value, that error will be propagated back to the caller
+through whatever API function resulted in that call, which
+may include
+.Fn archive_write_header ,
+.Fn archive_write_data ,
+.Fn archive_write_close ,
+or
+.Fn archive_write_finish .
+The client callback can call
+.Fn archive_set_error
+to provide values that can then be retrieved by
+.Fn archive_errno
+and
+.Fn archive_error_string .
+.Sh SEE ALSO
+.Xr tar 1 ,
+.Xr libarchive 3 ,
+.Xr tar 5
+.Sh HISTORY
+The
+.Nm libarchive
+library first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm libarchive
+library was written by
+.An Tim Kientzle Aq kientzle@acm.org .
+.Sh BUGS
+There are many peculiar bugs in historic tar implementations that may cause
+certain programs to reject archives written by this library.
+For example, several historic implementations calculated header checksums
+incorrectly and will thus reject valid archives; GNU tar does not fully support
+pax interchange format; some old tar implementations required specific
+field terminations.
+.Pp
+The default pax interchange format eliminates most of the historic
+tar limitations and provides a generic key/value attribute facility
+for vendor-defined extensions.
+One oversight in POSIX is the failure to provide a standard attribute
+for large device numbers.
+This library uses
+.Dq SCHILY.devminor
+and
+.Dq SCHILY.devmajor
+for device numbers that exceed the range supported by the backwards-compatible
+ustar header.
+These keys are compatible with Joerg Schilling's
+.Nm star
+archiver.
+Other implementations may not recognize these keys and will thus be unable
+to correctly restore device nodes with large device numbers from archives
+created by this library.
diff --git a/archivers/libarchive/files/libarchive/archive_write.c b/archivers/libarchive/files/libarchive/archive_write.c
new file mode 100644
index 00000000000..e0d942b0754
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write.c
@@ -0,0 +1,466 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write.c 201099 2009-12-28 03:03:00Z kientzle $");
+
+/*
+ * This file contains the "essential" portions of the write API, that
+ * is, stuff that will essentially always be used by any client that
+ * actually needs to write a archive. Optional pieces have been, as
+ * far as possible, separated out into separate files to reduce
+ * needlessly bloating statically-linked clients.
+ */
+
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#include <time.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_write_private.h"
+
+static struct archive_vtable *archive_write_vtable(void);
+
+static int _archive_write_close(struct archive *);
+static int _archive_write_finish(struct archive *);
+static int _archive_write_header(struct archive *, struct archive_entry *);
+static int _archive_write_finish_entry(struct archive *);
+static ssize_t _archive_write_data(struct archive *, const void *, size_t);
+
+static struct archive_vtable *
+archive_write_vtable(void)
+{
+ static struct archive_vtable av;
+ static int inited = 0;
+
+ if (!inited) {
+ av.archive_close = _archive_write_close;
+ av.archive_finish = _archive_write_finish;
+ av.archive_write_header = _archive_write_header;
+ av.archive_write_finish_entry = _archive_write_finish_entry;
+ av.archive_write_data = _archive_write_data;
+ }
+ return (&av);
+}
+
+/*
+ * Allocate, initialize and return an archive object.
+ */
+struct archive *
+archive_write_new(void)
+{
+ struct archive_write *a;
+ unsigned char *nulls;
+
+ a = (struct archive_write *)malloc(sizeof(*a));
+ if (a == NULL)
+ return (NULL);
+ memset(a, 0, sizeof(*a));
+ a->archive.magic = ARCHIVE_WRITE_MAGIC;
+ a->archive.state = ARCHIVE_STATE_NEW;
+ a->archive.vtable = archive_write_vtable();
+ /*
+ * The value 10240 here matches the traditional tar default,
+ * but is otherwise arbitrary.
+ * TODO: Set the default block size from the format selected.
+ */
+ a->bytes_per_block = 10240;
+ a->bytes_in_last_block = -1; /* Default */
+
+ /* Initialize a block of nulls for padding purposes. */
+ a->null_length = 1024;
+ nulls = (unsigned char *)malloc(a->null_length);
+ if (nulls == NULL) {
+ free(a);
+ return (NULL);
+ }
+ memset(nulls, 0, a->null_length);
+ a->nulls = nulls;
+ /*
+ * Set default compression, but don't set a default format.
+ * Were we to set a default format here, we would force every
+ * client to link in support for that format, even if they didn't
+ * ever use it.
+ */
+ archive_write_set_compression_none(&a->archive);
+ return (&a->archive);
+}
+
+/*
+ * Set write options for the format. Returns 0 if successful.
+ */
+int
+archive_write_set_format_options(struct archive *_a, const char *s)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ char key[64], val[64];
+ int len, r, ret = ARCHIVE_OK;
+
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_write_set_format_options");
+ archive_clear_error(&a->archive);
+
+ if (s == NULL || *s == '\0')
+ return (ARCHIVE_OK);
+ if (a->format_options == NULL)
+ /* This format does not support option. */
+ return (ARCHIVE_OK);
+
+ while ((len = __archive_parse_options(s, a->format_name,
+ sizeof(key), key, sizeof(val), val)) > 0) {
+ if (val[0] == '\0')
+ r = a->format_options(a, key, NULL);
+ else
+ r = a->format_options(a, key, val);
+ if (r == ARCHIVE_FATAL)
+ return (r);
+ if (r < ARCHIVE_OK) { /* This key was not handled. */
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Unsupported option ``%s''", key);
+ ret = ARCHIVE_WARN;
+ }
+ s += len;
+ }
+ if (len < 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Malformed options string.");
+ return (ARCHIVE_WARN);
+ }
+ return (ret);
+}
+
+/*
+ * Set write options for the compressor. Returns 0 if successful.
+ */
+int
+archive_write_set_compressor_options(struct archive *_a, const char *s)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ char key[64], val[64];
+ int len, r;
+ int ret = ARCHIVE_OK;
+
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_write_set_compressor_options");
+ archive_clear_error(&a->archive);
+
+ if (s == NULL || *s == '\0')
+ return (ARCHIVE_OK);
+ if (a->compressor.options == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Unsupported option ``%s''", s);
+ /* This compressor does not support option. */
+ return (ARCHIVE_WARN);
+ }
+
+ while ((len = __archive_parse_options(s, a->archive.compression_name,
+ sizeof(key), key, sizeof(val), val)) > 0) {
+ if (val[0] == '\0')
+ r = a->compressor.options(a, key, NULL);
+ else
+ r = a->compressor.options(a, key, val);
+ if (r == ARCHIVE_FATAL)
+ return (r);
+ if (r < ARCHIVE_OK) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Unsupported option ``%s''", key);
+ ret = ARCHIVE_WARN;
+ }
+ s += len;
+ }
+ if (len < 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Illegal format options.");
+ return (ARCHIVE_WARN);
+ }
+ return (ret);
+}
+
+/*
+ * Set write options for the format and the compressor. Returns 0 if successful.
+ */
+int
+archive_write_set_options(struct archive *_a, const char *s)
+{
+ int r1, r2;
+
+ r1 = archive_write_set_format_options(_a, s);
+ if (r1 < ARCHIVE_WARN)
+ return (r1);
+ r2 = archive_write_set_compressor_options(_a, s);
+ if (r2 < ARCHIVE_WARN)
+ return (r2);
+ if (r1 == ARCHIVE_WARN && r2 == ARCHIVE_WARN)
+ return (ARCHIVE_WARN);
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Set the block size. Returns 0 if successful.
+ */
+int
+archive_write_set_bytes_per_block(struct archive *_a, int bytes_per_block)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_write_set_bytes_per_block");
+ a->bytes_per_block = bytes_per_block;
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Get the current block size. -1 if it has never been set.
+ */
+int
+archive_write_get_bytes_per_block(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_ANY, "archive_write_get_bytes_per_block");
+ return (a->bytes_per_block);
+}
+
+/*
+ * Set the size for the last block.
+ * Returns 0 if successful.
+ */
+int
+archive_write_set_bytes_in_last_block(struct archive *_a, int bytes)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_ANY, "archive_write_set_bytes_in_last_block");
+ a->bytes_in_last_block = bytes;
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Return the value set above. -1 indicates it has not been set.
+ */
+int
+archive_write_get_bytes_in_last_block(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_ANY, "archive_write_get_bytes_in_last_block");
+ return (a->bytes_in_last_block);
+}
+
+
+/*
+ * dev/ino of a file to be rejected. Used to prevent adding
+ * an archive to itself recursively.
+ */
+int
+archive_write_set_skip_file(struct archive *_a, dev_t d, ino_t i)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_ANY, "archive_write_set_skip_file");
+ a->skip_file_dev = d;
+ a->skip_file_ino = i;
+ return (ARCHIVE_OK);
+}
+
+
+/*
+ * Open the archive using the current settings.
+ */
+int
+archive_write_open(struct archive *_a, void *client_data,
+ archive_open_callback *opener, archive_write_callback *writer,
+ archive_close_callback *closer)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ int ret;
+
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_write_open");
+ archive_clear_error(&a->archive);
+ a->archive.state = ARCHIVE_STATE_HEADER;
+ a->client_data = client_data;
+ a->client_writer = writer;
+ a->client_opener = opener;
+ a->client_closer = closer;
+ ret = (a->compressor.init)(a);
+ if (a->format_init && ret == ARCHIVE_OK)
+ ret = (a->format_init)(a);
+ return (ret);
+}
+
+
+/*
+ * Close out the archive.
+ *
+ * Be careful: user might just call write_new and then write_finish.
+ * Don't assume we actually wrote anything or performed any non-trivial
+ * initialization.
+ */
+static int
+_archive_write_close(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ int r = ARCHIVE_OK, r1 = ARCHIVE_OK;
+
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_ANY, "archive_write_close");
+
+ /* Finish the last entry. */
+ if (a->archive.state & ARCHIVE_STATE_DATA)
+ r = ((a->format_finish_entry)(a));
+
+ /* Finish off the archive. */
+ if (a->format_finish != NULL) {
+ r1 = (a->format_finish)(a);
+ if (r1 < r)
+ r = r1;
+ }
+
+ /* Release format resources. */
+ if (a->format_destroy != NULL) {
+ r1 = (a->format_destroy)(a);
+ if (r1 < r)
+ r = r1;
+ }
+
+ /* Finish the compression and close the stream. */
+ if (a->compressor.finish != NULL) {
+ r1 = (a->compressor.finish)(a);
+ if (r1 < r)
+ r = r1;
+ }
+
+ /* Close out the client stream. */
+ if (a->client_closer != NULL) {
+ r1 = (a->client_closer)(&a->archive, a->client_data);
+ if (r1 < r)
+ r = r1;
+ }
+
+ a->archive.state = ARCHIVE_STATE_CLOSED;
+ return (r);
+}
+
+/*
+ * Destroy the archive structure.
+ */
+static int
+_archive_write_finish(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ int r = ARCHIVE_OK;
+
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_ANY, "archive_write_finish");
+ if (a->archive.state != ARCHIVE_STATE_CLOSED)
+ r = archive_write_close(&a->archive);
+
+ /* Release various dynamic buffers. */
+ free((void *)(uintptr_t)(const void *)a->nulls);
+ archive_string_free(&a->archive.error_string);
+ a->archive.magic = 0;
+ free(a);
+ return (r);
+}
+
+/*
+ * Write the appropriate header.
+ */
+static int
+_archive_write_header(struct archive *_a, struct archive_entry *entry)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ int ret, r2;
+
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_DATA | ARCHIVE_STATE_HEADER, "archive_write_header");
+ archive_clear_error(&a->archive);
+
+ /* In particular, "retry" and "fatal" get returned immediately. */
+ ret = archive_write_finish_entry(&a->archive);
+ if (ret < ARCHIVE_OK && ret != ARCHIVE_WARN)
+ return (ret);
+
+ if (a->skip_file_dev != 0 &&
+ archive_entry_dev(entry) == a->skip_file_dev &&
+ a->skip_file_ino != 0 &&
+ archive_entry_ino64(entry) == a->skip_file_ino) {
+ archive_set_error(&a->archive, 0,
+ "Can't add archive to itself");
+ return (ARCHIVE_FAILED);
+ }
+
+ /* Format and write header. */
+ r2 = ((a->format_write_header)(a, entry));
+ if (r2 < ret)
+ ret = r2;
+
+ a->archive.state = ARCHIVE_STATE_DATA;
+ return (ret);
+}
+
+static int
+_archive_write_finish_entry(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ int ret = ARCHIVE_OK;
+
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA,
+ "archive_write_finish_entry");
+ if (a->archive.state & ARCHIVE_STATE_DATA)
+ ret = (a->format_finish_entry)(a);
+ a->archive.state = ARCHIVE_STATE_HEADER;
+ return (ret);
+}
+
+/*
+ * Note that the compressor is responsible for blocking.
+ */
+static ssize_t
+_archive_write_data(struct archive *_a, const void *buff, size_t s)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_DATA, "archive_write_data");
+ archive_clear_error(&a->archive);
+ return ((a->format_write_data)(a, buff, s));
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_disk.3 b/archivers/libarchive/files/libarchive/archive_write_disk.3
new file mode 100644
index 00000000000..5ed4a5038f1
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_disk.3
@@ -0,0 +1,375 @@
+.\" 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 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: src/lib/libarchive/archive_write_disk.3,v 1.4 2008/09/04 05:22:00 kientzle Exp $
+.\"
+.Dd August 5, 2008
+.Dt archive_write_disk 3
+.Os
+.Sh NAME
+.Nm archive_write_disk_new ,
+.Nm archive_write_disk_set_options ,
+.Nm archive_write_disk_set_skip_file ,
+.Nm archive_write_disk_set_group_lookup ,
+.Nm archive_write_disk_set_standard_lookup ,
+.Nm archive_write_disk_set_user_lookup ,
+.Nm archive_write_header ,
+.Nm archive_write_data ,
+.Nm archive_write_finish_entry ,
+.Nm archive_write_close ,
+.Nm archive_write_finish
+.Nd functions for creating objects on disk
+.Sh SYNOPSIS
+.In archive.h
+.Ft struct archive *
+.Fn archive_write_disk_new "void"
+.Ft int
+.Fn archive_write_disk_set_options "struct archive *" "int flags"
+.Ft int
+.Fn archive_write_disk_set_skip_file "struct archive *" "dev_t" "ino_t"
+.Ft int
+.Fo archive_write_disk_set_group_lookup
+.Fa "struct archive *"
+.Fa "void *"
+.Fa "gid_t (*)(void *, const char *gname, gid_t gid)"
+.Fa "void (*cleanup)(void *)"
+.Fc
+.Ft int
+.Fn archive_write_disk_set_standard_lookup "struct archive *"
+.Ft int
+.Fo archive_write_disk_set_user_lookup
+.Fa "struct archive *"
+.Fa "void *"
+.Fa "uid_t (*)(void *, const char *uname, uid_t uid)"
+.Fa "void (*cleanup)(void *)"
+.Fc
+.Ft int
+.Fn archive_write_header "struct archive *" "struct archive_entry *"
+.Ft ssize_t
+.Fn archive_write_data "struct archive *" "const void *" "size_t"
+.Ft int
+.Fn archive_write_finish_entry "struct archive *"
+.Ft int
+.Fn archive_write_close "struct archive *"
+.Ft int
+.Fn archive_write_finish "struct archive *"
+.Sh DESCRIPTION
+These functions provide a complete API for creating objects on
+disk from
+.Tn struct archive_entry
+descriptions.
+They are most naturally used when extracting objects from an archive
+using the
+.Fn archive_read
+interface.
+The general process is to read
+.Tn struct archive_entry
+objects from an archive, then write those objects to a
+.Tn struct archive
+object created using the
+.Fn archive_write_disk
+family functions.
+This interface is deliberately very similar to the
+.Fn archive_write
+interface used to write objects to a streaming archive.
+.Bl -tag -width indent
+.It Fn archive_write_disk_new
+Allocates and initializes a
+.Tn struct archive
+object suitable for writing objects to disk.
+.It Fn archive_write_disk_set_skip_file
+Records the device and inode numbers of a file that should not be
+overwritten.
+This is typically used to ensure that an extraction process does not
+overwrite the archive from which objects are being read.
+This capability is technically unnecessary but can be a significant
+performance optimization in practice.
+.It Fn archive_write_disk_set_options
+The options field consists of a bitwise OR of one or more of the
+following values:
+.Bl -tag -compact -width "indent"
+.It Cm ARCHIVE_EXTRACT_OWNER
+The user and group IDs should be set on the restored file.
+By default, the user and group IDs are not restored.
+.It Cm ARCHIVE_EXTRACT_PERM
+Full permissions (including SGID, SUID, and sticky bits) should
+be restored exactly as specified, without obeying the
+current umask.
+Note that SUID and SGID bits can only be restored if the
+user and group ID of the object on disk are correct.
+If
+.Cm ARCHIVE_EXTRACT_OWNER
+is not specified, then SUID and SGID bits will only be restored
+if the default user and group IDs of newly-created objects on disk
+happen to match those specified in the archive entry.
+By default, only basic permissions are restored, and umask is obeyed.
+.It Cm ARCHIVE_EXTRACT_TIME
+The timestamps (mtime, ctime, and atime) should be restored.
+By default, they are ignored.
+Note that restoring of atime is not currently supported.
+.It Cm ARCHIVE_EXTRACT_NO_OVERWRITE
+Existing files on disk will not be overwritten.
+By default, existing regular files are truncated and overwritten;
+existing directories will have their permissions updated;
+other pre-existing objects are unlinked and recreated from scratch.
+.It Cm ARCHIVE_EXTRACT_UNLINK
+Existing files on disk will be unlinked before any attempt to
+create them.
+In some cases, this can prove to be a significant performance improvement.
+By default, existing files are truncated and rewritten, but
+the file is not recreated.
+In particular, the default behavior does not break existing hard links.
+.It Cm ARCHIVE_EXTRACT_ACL
+Attempt to restore ACLs.
+By default, extended ACLs are ignored.
+.It Cm ARCHIVE_EXTRACT_FFLAGS
+Attempt to restore extended file flags.
+By default, file flags are ignored.
+.It Cm ARCHIVE_EXTRACT_XATTR
+Attempt to restore POSIX.1e extended attributes.
+By default, they are ignored.
+.It Cm ARCHIVE_EXTRACT_SECURE_SYMLINKS
+Refuse to extract any object whose final location would be altered
+by a symlink on disk.
+This is intended to help guard against a variety of mischief
+caused by archives that (deliberately or otherwise) extract
+files outside of the current directory.
+The default is not to perform this check.
+If
+.Cm ARCHIVE_EXTRACT_UNLINK
+is specified together with this option, the library will
+remove any intermediate symlinks it finds and return an
+error only if such symlink could not be removed.
+.It Cm ARCHIVE_EXTRACT_SECURE_NODOTDOT
+Refuse to extract a path that contains a
+.Pa ..
+element anywhere within it.
+The default is to not refuse such paths.
+Note that paths ending in
+.Pa ..
+always cause an error, regardless of this flag.
+.It Cm ARCHIVE_EXTRACT_SPARSE
+Scan data for blocks of NUL bytes and try to recreate them with holes.
+This results in sparse files, independent of whether the archive format
+supports or uses them.
+.El
+.It Xo
+.Fn archive_write_disk_set_group_lookup ,
+.Fn archive_write_disk_set_user_lookup
+.Xc
+The
+.Tn struct archive_entry
+objects contain both names and ids that can be used to identify users
+and groups.
+These names and ids describe the ownership of the file itself and
+also appear in ACL lists.
+By default, the library uses the ids and ignores the names, but
+this can be overridden by registering user and group lookup functions.
+To register, you must provide a lookup function which
+accepts both a name and id and returns a suitable id.
+You may also provide a
+.Tn void *
+pointer to a private data structure and a cleanup function for
+that data.
+The cleanup function will be invoked when the
+.Tn struct archive
+object is destroyed.
+.It Fn archive_write_disk_set_standard_lookup
+This convenience function installs a standard set of user
+and group lookup functions.
+These functions use
+.Xr getpwnam 3
+and
+.Xr getgrnam 3
+to convert names to ids, defaulting to the ids if the names cannot
+be looked up.
+These functions also implement a simple memory cache to reduce
+the number of calls to
+.Xr getpwnam 3
+and
+.Xr getgrnam 3 .
+.It Fn archive_write_header
+Build and write a header using the data in the provided
+.Tn struct archive_entry
+structure.
+See
+.Xr archive_entry 3
+for information on creating and populating
+.Tn struct archive_entry
+objects.
+.It Fn archive_write_data
+Write data corresponding to the header just written.
+Returns number of bytes written or -1 on error.
+.It Fn archive_write_finish_entry
+Close out the entry just written.
+Ordinarily, clients never need to call this, as it
+is called automatically by
+.Fn archive_write_next_header
+and
+.Fn archive_write_close
+as needed.
+.It Fn archive_write_close
+Set any attributes that could not be set during the initial restore.
+For example, directory timestamps are not restored initially because
+restoring a subsequent file would alter that timestamp.
+Similarly, non-writable directories are initially created with
+write permissions (so that their contents can be restored).
+The
+.Nm
+library maintains a list of all such deferred attributes and
+sets them when this function is invoked.
+.It Fn archive_write_finish
+Invokes
+.Fn archive_write_close
+if it was not invoked manually, then releases all resources.
+.El
+More information about the
+.Va struct archive
+object and the overall design of the library can be found in the
+.Xr libarchive 3
+overview.
+Many of these functions are also documented under
+.Xr archive_write 3 .
+.Sh RETURN VALUES
+Most functions return
+.Cm ARCHIVE_OK
+(zero) on success, or one of several non-zero
+error codes for errors.
+Specific error codes include:
+.Cm ARCHIVE_RETRY
+for operations that might succeed if retried,
+.Cm ARCHIVE_WARN
+for unusual conditions that do not prevent further operations, and
+.Cm ARCHIVE_FATAL
+for serious errors that make remaining operations impossible.
+The
+.Fn archive_errno
+and
+.Fn archive_error_string
+functions can be used to retrieve an appropriate error code and a
+textual error message.
+.Pp
+.Fn archive_write_disk_new
+returns a pointer to a newly-allocated
+.Tn struct archive
+object.
+.Pp
+.Fn archive_write_data
+returns a count of the number of bytes actually written.
+On error, -1 is returned and the
+.Fn archive_errno
+and
+.Fn archive_error_string
+functions will return appropriate values.
+.Sh SEE ALSO
+.Xr archive_read 3 ,
+.Xr archive_write 3 ,
+.Xr tar 1 ,
+.Xr libarchive 3
+.Sh HISTORY
+The
+.Nm libarchive
+library first appeared in
+.Fx 5.3 .
+The
+.Nm archive_write_disk
+interface was added to
+.Nm libarchive 2.0
+and first appeared in
+.Fx 6.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm libarchive
+library was written by
+.An Tim Kientzle Aq kientzle@acm.org .
+.Sh BUGS
+Directories are actually extracted in two distinct phases.
+Directories are created during
+.Fn archive_write_header ,
+but final permissions are not set until
+.Fn archive_write_close .
+This separation is necessary to correctly handle borderline
+cases such as a non-writable directory containing
+files, but can cause unexpected results.
+In particular, directory permissions are not fully
+restored until the archive is closed.
+If you use
+.Xr chdir 2
+to change the current directory between calls to
+.Fn archive_read_extract
+or before calling
+.Fn archive_read_close ,
+you may confuse the permission-setting logic with
+the result that directory permissions are restored
+incorrectly.
+.Pp
+The library attempts to create objects with filenames longer than
+.Cm PATH_MAX
+by creating prefixes of the full path and changing the current directory.
+Currently, this logic is limited in scope; the fixup pass does
+not work correctly for such objects and the symlink security check
+option disables the support for very long pathnames.
+.Pp
+Restoring the path
+.Pa aa/../bb
+does create each intermediate directory.
+In particular, the directory
+.Pa aa
+is created as well as the final object
+.Pa bb .
+In theory, this can be exploited to create an entire directory heirarchy
+with a single request.
+Of course, this does not work if the
+.Cm ARCHIVE_EXTRACT_NODOTDOT
+option is specified.
+.Pp
+Implicit directories are always created obeying the current umask.
+Explicit objects are created obeying the current umask unless
+.Cm ARCHIVE_EXTRACT_PERM
+is specified, in which case they current umask is ignored.
+.Pp
+SGID and SUID bits are restored only if the correct user and
+group could be set.
+If
+.Cm ARCHIVE_EXTRACT_OWNER
+is not specified, then no attempt is made to set the ownership.
+In this case, SGID and SUID bits are restored only if the
+user and group of the final object happen to match those specified
+in the entry.
+.Pp
+The
+.Dq standard
+user-id and group-id lookup functions are not the defaults because
+.Xr getgrnam 3
+and
+.Xr getpwnam 3
+are sometimes too large for particular applications.
+The current design allows the application author to use a more
+compact implementation when appropriate.
+.Pp
+There should be a corresponding
+.Nm archive_read_disk
+interface that walks a directory heirarchy and returns archive
+entry objects. \ No newline at end of file
diff --git a/archivers/libarchive/files/libarchive/archive_write_disk.c b/archivers/libarchive/files/libarchive/archive_write_disk.c
new file mode 100644
index 00000000000..f61ae175925
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_disk.c
@@ -0,0 +1,2628 @@
+/*-
+ * 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
+ * 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.
+ */
+
+#include "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_disk.c 201159 2009-12-29 05:35:40Z kientzle $");
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_ACL_H
+#include <sys/acl.h>
+#endif
+#ifdef HAVE_SYS_EXTATTR_H
+#include <sys/extattr.h>
+#endif
+#ifdef HAVE_SYS_XATTR_H
+#include <sys/xattr.h>
+#endif
+#ifdef HAVE_ATTR_XATTR_H
+#include <attr/xattr.h>
+#endif
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+#ifdef HAVE_SYS_UTIME_H
+#include <sys/utime.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
+#ifdef HAVE_LINUX_FS_H
+#include <linux/fs.h> /* for Linux file flags */
+#endif
+/*
+ * Some Linux distributions have both linux/ext2_fs.h and ext2fs/ext2_fs.h.
+ * As the include guards don't agree, the order of include is important.
+ */
+#ifdef HAVE_LINUX_EXT2_FS_H
+#include <linux/ext2_fs.h> /* for Linux file flags */
+#endif
+#if defined(HAVE_EXT2FS_EXT2_FS_H) && !defined(__CYGWIN__)
+#include <ext2fs/ext2_fs.h> /* Linux file flags, broken on Cygwin */
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_UTIME_H
+#include <utime.h>
+#endif
+
+#include "archive.h"
+#include "archive_string.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+struct fixup_entry {
+ struct fixup_entry *next;
+ mode_t mode;
+ int64_t atime;
+ int64_t birthtime;
+ int64_t mtime;
+ unsigned long atime_nanos;
+ unsigned long birthtime_nanos;
+ unsigned long mtime_nanos;
+ unsigned long fflags_set;
+ int fixup; /* bitmask of what needs fixing */
+ char *name;
+};
+
+/*
+ * We use a bitmask to track which operations remain to be done for
+ * this file. In particular, this helps us avoid unnecessary
+ * operations when it's possible to take care of one step as a
+ * side-effect of another. For example, mkdir() can specify the mode
+ * for the newly-created object but symlink() cannot. This means we
+ * can skip chmod() if mkdir() succeeded, but we must explicitly
+ * chmod() if we're trying to create a directory that already exists
+ * (mkdir() failed) or if we're restoring a symlink. Similarly, we
+ * need to verify UID/GID before trying to restore SUID/SGID bits;
+ * that verification can occur explicitly through a stat() call or
+ * implicitly because of a successful chown() call.
+ */
+#define TODO_MODE_FORCE 0x40000000
+#define TODO_MODE_BASE 0x20000000
+#define TODO_SUID 0x10000000
+#define TODO_SUID_CHECK 0x08000000
+#define TODO_SGID 0x04000000
+#define TODO_SGID_CHECK 0x02000000
+#define TODO_MODE (TODO_MODE_BASE|TODO_SUID|TODO_SGID)
+#define TODO_TIMES ARCHIVE_EXTRACT_TIME
+#define TODO_OWNER ARCHIVE_EXTRACT_OWNER
+#define TODO_FFLAGS ARCHIVE_EXTRACT_FFLAGS
+#define TODO_ACLS ARCHIVE_EXTRACT_ACL
+#define TODO_XATTR ARCHIVE_EXTRACT_XATTR
+
+struct archive_write_disk {
+ struct archive archive;
+
+ mode_t user_umask;
+ struct fixup_entry *fixup_list;
+ struct fixup_entry *current_fixup;
+ uid_t user_uid;
+ dev_t skip_file_dev;
+ ino_t skip_file_ino;
+ time_t start_time;
+
+ gid_t (*lookup_gid)(void *private, const char *gname, gid_t gid);
+ void (*cleanup_gid)(void *private);
+ void *lookup_gid_data;
+ uid_t (*lookup_uid)(void *private, const char *gname, gid_t gid);
+ void (*cleanup_uid)(void *private);
+ void *lookup_uid_data;
+
+ /*
+ * Full path of last file to satisfy symlink checks.
+ */
+ struct archive_string path_safe;
+
+ /*
+ * Cached stat data from disk for the current entry.
+ * If this is valid, pst points to st. Otherwise,
+ * pst is null.
+ */
+ struct stat st;
+ struct stat *pst;
+
+ /* Information about the object being restored right now. */
+ struct archive_entry *entry; /* Entry being extracted. */
+ char *name; /* Name of entry, possibly edited. */
+ struct archive_string _name_data; /* backing store for 'name' */
+ /* Tasks remaining for this object. */
+ int todo;
+ /* Tasks deferred until end-of-archive. */
+ int deferred;
+ /* Options requested by the client. */
+ int flags;
+ /* Handle for the file we're restoring. */
+ int fd;
+ /* Current offset for writing data to the file. */
+ off_t offset;
+ /* Last offset actually written to disk. */
+ off_t fd_offset;
+ /* Maximum size of file, -1 if unknown. */
+ off_t filesize;
+ /* Dir we were in before this restore; only for deep paths. */
+ int restore_pwd;
+ /* Mode we should use for this entry; affected by _PERM and umask. */
+ mode_t mode;
+ /* UID/GID to use in restoring this entry. */
+ uid_t uid;
+ gid_t gid;
+};
+
+/*
+ * Default mode for dirs created automatically (will be modified by umask).
+ * Note that POSIX specifies 0777 for implicity-created dirs, "modified
+ * by the process' file creation mask."
+ */
+#define DEFAULT_DIR_MODE 0777
+/*
+ * Dir modes are restored in two steps: During the extraction, the permissions
+ * in the archive are modified to match the following limits. During
+ * the post-extract fixup pass, the permissions from the archive are
+ * applied.
+ */
+#define MINIMUM_DIR_MODE 0700
+#define MAXIMUM_DIR_MODE 0775
+
+static int check_symlinks(struct archive_write_disk *);
+static int create_filesystem_object(struct archive_write_disk *);
+static struct fixup_entry *current_fixup(struct archive_write_disk *, const char *pathname);
+#ifdef HAVE_FCHDIR
+static void edit_deep_directories(struct archive_write_disk *ad);
+#endif
+static int cleanup_pathname(struct archive_write_disk *);
+static int create_dir(struct archive_write_disk *, char *);
+static int create_parent_dir(struct archive_write_disk *, char *);
+static int older(struct stat *, struct archive_entry *);
+static int restore_entry(struct archive_write_disk *);
+#ifdef HAVE_POSIX_ACL
+static int set_acl(struct archive_write_disk *, int fd, struct archive_entry *,
+ acl_type_t, int archive_entry_acl_type, const char *tn);
+#endif
+static int set_acls(struct archive_write_disk *);
+static int set_xattrs(struct archive_write_disk *);
+static int set_fflags(struct archive_write_disk *);
+static int set_fflags_platform(struct archive_write_disk *, int fd,
+ const char *name, mode_t mode,
+ unsigned long fflags_set, unsigned long fflags_clear);
+static int set_ownership(struct archive_write_disk *);
+static int set_mode(struct archive_write_disk *, int mode);
+static int set_time(int, int, const char *, time_t, long, time_t, long);
+static int set_times(struct archive_write_disk *);
+static struct fixup_entry *sort_dir_list(struct fixup_entry *p);
+static gid_t trivial_lookup_gid(void *, const char *, gid_t);
+static uid_t trivial_lookup_uid(void *, const char *, uid_t);
+static ssize_t write_data_block(struct archive_write_disk *,
+ const char *, size_t);
+
+static struct archive_vtable *archive_write_disk_vtable(void);
+
+static int _archive_write_close(struct archive *);
+static int _archive_write_finish(struct archive *);
+static int _archive_write_header(struct archive *, struct archive_entry *);
+static int _archive_write_finish_entry(struct archive *);
+static ssize_t _archive_write_data(struct archive *, const void *, size_t);
+static ssize_t _archive_write_data_block(struct archive *, const void *, size_t, off_t);
+
+static int
+_archive_write_disk_lazy_stat(struct archive_write_disk *a)
+{
+ if (a->pst != NULL) {
+ /* Already have stat() data available. */
+ return (ARCHIVE_OK);
+ }
+#ifdef HAVE_FSTAT
+ if (a->fd >= 0 && fstat(a->fd, &a->st) == 0) {
+ a->pst = &a->st;
+ return (ARCHIVE_OK);
+ }
+#endif
+ /*
+ * XXX At this point, symlinks should not be hit, otherwise
+ * XXX a race occured. Do we want to check explicitly for that?
+ */
+ if (lstat(a->name, &a->st) == 0) {
+ a->pst = &a->st;
+ return (ARCHIVE_OK);
+ }
+ archive_set_error(&a->archive, errno, "Couldn't stat file");
+ return (ARCHIVE_WARN);
+}
+
+static struct archive_vtable *
+archive_write_disk_vtable(void)
+{
+ static struct archive_vtable av;
+ static int inited = 0;
+
+ if (!inited) {
+ av.archive_close = _archive_write_close;
+ av.archive_finish = _archive_write_finish;
+ av.archive_write_header = _archive_write_header;
+ av.archive_write_finish_entry = _archive_write_finish_entry;
+ av.archive_write_data = _archive_write_data;
+ av.archive_write_data_block = _archive_write_data_block;
+ }
+ return (&av);
+}
+
+
+int
+archive_write_disk_set_options(struct archive *_a, int flags)
+{
+ struct archive_write_disk *a = (struct archive_write_disk *)_a;
+
+ a->flags = flags;
+ return (ARCHIVE_OK);
+}
+
+
+/*
+ * Extract this entry to disk.
+ *
+ * TODO: Validate hardlinks. According to the standards, we're
+ * supposed to check each extracted hardlink and squawk if it refers
+ * to a file that we didn't restore. I'm not entirely convinced this
+ * is a good idea, but more importantly: Is there any way to validate
+ * hardlinks without keeping a complete list of filenames from the
+ * entire archive?? Ugh.
+ *
+ */
+static int
+_archive_write_header(struct archive *_a, struct archive_entry *entry)
+{
+ struct archive_write_disk *a = (struct archive_write_disk *)_a;
+ struct fixup_entry *fe;
+ int ret, r;
+
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
+ ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA,
+ "archive_write_disk_header");
+ archive_clear_error(&a->archive);
+ if (a->archive.state & ARCHIVE_STATE_DATA) {
+ r = _archive_write_finish_entry(&a->archive);
+ if (r == ARCHIVE_FATAL)
+ return (r);
+ }
+
+ /* Set up for this particular entry. */
+ a->pst = NULL;
+ a->current_fixup = NULL;
+ a->deferred = 0;
+ if (a->entry) {
+ archive_entry_free(a->entry);
+ a->entry = NULL;
+ }
+ a->entry = archive_entry_clone(entry);
+ a->fd = -1;
+ a->fd_offset = 0;
+ a->offset = 0;
+ a->uid = a->user_uid;
+ a->mode = archive_entry_mode(a->entry);
+ if (archive_entry_size_is_set(a->entry))
+ a->filesize = archive_entry_size(a->entry);
+ else
+ a->filesize = -1;
+ archive_strcpy(&(a->_name_data), archive_entry_pathname(a->entry));
+ a->name = a->_name_data.s;
+ archive_clear_error(&a->archive);
+
+ /*
+ * Clean up the requested path. This is necessary for correct
+ * dir restores; the dir restore logic otherwise gets messed
+ * up by nonsense like "dir/.".
+ */
+ ret = cleanup_pathname(a);
+ if (ret != ARCHIVE_OK)
+ return (ret);
+
+ /*
+ * Set the umask to zero so we get predictable mode settings.
+ * This gets done on every call to _write_header in case the
+ * user edits their umask during the extraction for some
+ * reason. This will be reset before we return. Note that we
+ * don't need to do this in _finish_entry, as the chmod(), etc,
+ * system calls don't obey umask.
+ */
+ a->user_umask = umask(0);
+ /* From here on, early exit requires "goto done" to clean up. */
+
+ /* Figure out what we need to do for this entry. */
+ a->todo = TODO_MODE_BASE;
+ if (a->flags & ARCHIVE_EXTRACT_PERM) {
+ a->todo |= TODO_MODE_FORCE; /* Be pushy about permissions. */
+ /*
+ * SGID requires an extra "check" step because we
+ * cannot easily predict the GID that the system will
+ * assign. (Different systems assign GIDs to files
+ * based on a variety of criteria, including process
+ * credentials and the gid of the enclosing
+ * directory.) We can only restore the SGID bit if
+ * the file has the right GID, and we only know the
+ * GID if we either set it (see set_ownership) or if
+ * we've actually called stat() on the file after it
+ * was restored. Since there are several places at
+ * which we might verify the GID, we need a TODO bit
+ * to keep track.
+ */
+ if (a->mode & S_ISGID)
+ a->todo |= TODO_SGID | TODO_SGID_CHECK;
+ /*
+ * Verifying the SUID is simpler, but can still be
+ * done in multiple ways, hence the separate "check" bit.
+ */
+ if (a->mode & S_ISUID)
+ a->todo |= TODO_SUID | TODO_SUID_CHECK;
+ } else {
+ /*
+ * User didn't request full permissions, so don't
+ * restore SUID, SGID bits and obey umask.
+ */
+ a->mode &= ~S_ISUID;
+ a->mode &= ~S_ISGID;
+ a->mode &= ~S_ISVTX;
+ a->mode &= ~a->user_umask;
+ }
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ if (a->flags & ARCHIVE_EXTRACT_OWNER)
+ a->todo |= TODO_OWNER;
+#endif
+ if (a->flags & ARCHIVE_EXTRACT_TIME)
+ a->todo |= TODO_TIMES;
+ if (a->flags & ARCHIVE_EXTRACT_ACL)
+ a->todo |= TODO_ACLS;
+ if (a->flags & ARCHIVE_EXTRACT_XATTR)
+ a->todo |= TODO_XATTR;
+ if (a->flags & ARCHIVE_EXTRACT_FFLAGS)
+ a->todo |= TODO_FFLAGS;
+ if (a->flags & ARCHIVE_EXTRACT_SECURE_SYMLINKS) {
+ ret = check_symlinks(a);
+ if (ret != ARCHIVE_OK)
+ goto done;
+ }
+#ifdef HAVE_FCHDIR
+ /* If path exceeds PATH_MAX, shorten the path. */
+ edit_deep_directories(a);
+#endif
+
+ ret = restore_entry(a);
+
+ /*
+ * TODO: There are rumours that some extended attributes must
+ * be restored before file data is written. If this is true,
+ * then we either need to write all extended attributes both
+ * before and after restoring the data, or find some rule for
+ * determining which must go first and which last. Due to the
+ * many ways people are using xattrs, this may prove to be an
+ * intractable problem.
+ */
+
+#ifdef HAVE_FCHDIR
+ /* If we changed directory above, restore it here. */
+ if (a->restore_pwd >= 0) {
+ r = fchdir(a->restore_pwd);
+ if (r != 0) {
+ archive_set_error(&a->archive, errno, "chdir() failure");
+ ret = ARCHIVE_FATAL;
+ }
+ close(a->restore_pwd);
+ a->restore_pwd = -1;
+ }
+#endif
+
+ /*
+ * Fixup uses the unedited pathname from archive_entry_pathname(),
+ * because it is relative to the base dir and the edited path
+ * might be relative to some intermediate dir as a result of the
+ * deep restore logic.
+ */
+ if (a->deferred & TODO_MODE) {
+ fe = current_fixup(a, archive_entry_pathname(entry));
+ fe->fixup |= TODO_MODE_BASE;
+ fe->mode = a->mode;
+ }
+
+ if ((a->deferred & TODO_TIMES)
+ && (archive_entry_mtime_is_set(entry)
+ || archive_entry_atime_is_set(entry))) {
+ fe = current_fixup(a, archive_entry_pathname(entry));
+ fe->fixup |= TODO_TIMES;
+ if (archive_entry_atime_is_set(entry)) {
+ fe->atime = archive_entry_atime(entry);
+ fe->atime_nanos = archive_entry_atime_nsec(entry);
+ } else {
+ /* If atime is unset, use start time. */
+ fe->atime = a->start_time;
+ fe->atime_nanos = 0;
+ }
+ if (archive_entry_mtime_is_set(entry)) {
+ fe->mtime = archive_entry_mtime(entry);
+ fe->mtime_nanos = archive_entry_mtime_nsec(entry);
+ } else {
+ /* If mtime is unset, use start time. */
+ fe->mtime = a->start_time;
+ fe->mtime_nanos = 0;
+ }
+ if (archive_entry_birthtime_is_set(entry)) {
+ fe->birthtime = archive_entry_birthtime(entry);
+ fe->birthtime_nanos = archive_entry_birthtime_nsec(entry);
+ } else {
+ /* If birthtime is unset, use mtime. */
+ fe->birthtime = fe->mtime;
+ fe->birthtime_nanos = fe->mtime_nanos;
+ }
+ }
+
+ if (a->deferred & TODO_FFLAGS) {
+ fe = current_fixup(a, archive_entry_pathname(entry));
+ fe->fixup |= TODO_FFLAGS;
+ /* TODO: Complete this.. defer fflags from below. */
+ }
+
+ /* We've created the object and are ready to pour data into it. */
+ if (ret >= ARCHIVE_WARN)
+ a->archive.state = ARCHIVE_STATE_DATA;
+ /*
+ * If it's not open, tell our client not to try writing.
+ * In particular, dirs, links, etc, don't get written to.
+ */
+ if (a->fd < 0) {
+ archive_entry_set_size(entry, 0);
+ a->filesize = 0;
+ }
+done:
+ /* Restore the user's umask before returning. */
+ umask(a->user_umask);
+
+ return (ret);
+}
+
+int
+archive_write_disk_set_skip_file(struct archive *_a, dev_t d, ino_t i)
+{
+ struct archive_write_disk *a = (struct archive_write_disk *)_a;
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
+ ARCHIVE_STATE_ANY, "archive_write_disk_set_skip_file");
+ a->skip_file_dev = d;
+ a->skip_file_ino = i;
+ return (ARCHIVE_OK);
+}
+
+static ssize_t
+write_data_block(struct archive_write_disk *a, const char *buff, size_t size)
+{
+ uint64_t start_size = size;
+ ssize_t bytes_written = 0;
+ ssize_t block_size = 0, bytes_to_write;
+
+ if (size == 0)
+ return (ARCHIVE_OK);
+
+ if (a->filesize == 0 || a->fd < 0) {
+ archive_set_error(&a->archive, 0,
+ "Attempt to write to an empty file");
+ return (ARCHIVE_WARN);
+ }
+
+ if (a->flags & ARCHIVE_EXTRACT_SPARSE) {
+#if HAVE_STRUCT_STAT_ST_BLKSIZE
+ int r;
+ if ((r = _archive_write_disk_lazy_stat(a)) != ARCHIVE_OK)
+ return (r);
+ block_size = a->pst->st_blksize;
+#else
+ /* XXX TODO XXX Is there a more appropriate choice here ? */
+ /* This needn't match the filesystem allocation size. */
+ block_size = 16*1024;
+#endif
+ }
+
+ /* If this write would run beyond the file size, truncate it. */
+ if (a->filesize >= 0 && (off_t)(a->offset + size) > a->filesize)
+ start_size = size = (size_t)(a->filesize - a->offset);
+
+ /* Write the data. */
+ while (size > 0) {
+ if (block_size == 0) {
+ bytes_to_write = size;
+ } else {
+ /* We're sparsifying the file. */
+ const char *p, *end;
+ off_t block_end;
+
+ /* Skip leading zero bytes. */
+ for (p = buff, end = buff + size; p < end; ++p) {
+ if (*p != '\0')
+ break;
+ }
+ a->offset += p - buff;
+ size -= p - buff;
+ buff = p;
+ if (size == 0)
+ break;
+
+ /* Calculate next block boundary after offset. */
+ block_end
+ = (a->offset / block_size + 1) * block_size;
+
+ /* If the adjusted write would cross block boundary,
+ * truncate it to the block boundary. */
+ bytes_to_write = size;
+ if (a->offset + bytes_to_write > block_end)
+ bytes_to_write = block_end - a->offset;
+ }
+ /* Seek if necessary to the specified offset. */
+ if (a->offset != a->fd_offset) {
+ if (lseek(a->fd, a->offset, SEEK_SET) < 0) {
+ archive_set_error(&a->archive, errno,
+ "Seek failed");
+ return (ARCHIVE_FATAL);
+ }
+ a->fd_offset = a->offset;
+ a->archive.file_position = a->offset;
+ a->archive.raw_position = a->offset;
+ }
+ bytes_written = write(a->fd, buff, bytes_to_write);
+ if (bytes_written < 0) {
+ archive_set_error(&a->archive, errno, "Write failed");
+ return (ARCHIVE_WARN);
+ }
+ buff += bytes_written;
+ size -= bytes_written;
+ a->offset += bytes_written;
+ a->archive.file_position += bytes_written;
+ a->archive.raw_position += bytes_written;
+ a->fd_offset = a->offset;
+ }
+ return (start_size - size);
+}
+
+static ssize_t
+_archive_write_data_block(struct archive *_a,
+ const void *buff, size_t size, off_t offset)
+{
+ struct archive_write_disk *a = (struct archive_write_disk *)_a;
+ ssize_t r;
+
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
+ ARCHIVE_STATE_DATA, "archive_write_disk_block");
+
+ a->offset = offset;
+ r = write_data_block(a, buff, size);
+ if (r < ARCHIVE_OK)
+ return (r);
+ if ((size_t)r < size) {
+ archive_set_error(&a->archive, 0,
+ "Write request too large");
+ return (ARCHIVE_WARN);
+ }
+ return (ARCHIVE_OK);
+}
+
+static ssize_t
+_archive_write_data(struct archive *_a, const void *buff, size_t size)
+{
+ struct archive_write_disk *a = (struct archive_write_disk *)_a;
+
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
+ ARCHIVE_STATE_DATA, "archive_write_data");
+
+ return (write_data_block(a, buff, size));
+}
+
+static int
+_archive_write_finish_entry(struct archive *_a)
+{
+ struct archive_write_disk *a = (struct archive_write_disk *)_a;
+ int ret = ARCHIVE_OK;
+
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
+ ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA,
+ "archive_write_finish_entry");
+ if (a->archive.state & ARCHIVE_STATE_HEADER)
+ return (ARCHIVE_OK);
+ archive_clear_error(&a->archive);
+
+ /* Pad or truncate file to the right size. */
+ if (a->fd < 0) {
+ /* There's no file. */
+ } else if (a->filesize < 0) {
+ /* File size is unknown, so we can't set the size. */
+ } else if (a->fd_offset == a->filesize) {
+ /* Last write ended at exactly the filesize; we're done. */
+ /* Hopefully, this is the common case. */
+ } else {
+#if HAVE_FTRUNCATE
+ if (ftruncate(a->fd, a->filesize) == -1 &&
+ a->filesize == 0) {
+ archive_set_error(&a->archive, errno,
+ "File size could not be restored");
+ return (ARCHIVE_FAILED);
+ }
+#endif
+ /*
+ * Not all platforms implement the XSI option to
+ * extend files via ftruncate. Stat() the file again
+ * to see what happened.
+ */
+ a->pst = NULL;
+ if ((ret = _archive_write_disk_lazy_stat(a)) != ARCHIVE_OK)
+ return (ret);
+ /* We can use lseek()/write() to extend the file if
+ * ftruncate didn't work or isn't available. */
+ if (a->st.st_size < a->filesize) {
+ const char nul = '\0';
+ if (lseek(a->fd, a->filesize - 1, SEEK_SET) < 0) {
+ archive_set_error(&a->archive, errno,
+ "Seek failed");
+ return (ARCHIVE_FATAL);
+ }
+ if (write(a->fd, &nul, 1) < 0) {
+ archive_set_error(&a->archive, errno,
+ "Write to restore size failed");
+ return (ARCHIVE_FATAL);
+ }
+ a->pst = NULL;
+ }
+ }
+
+ /* Restore metadata. */
+
+ /*
+ * Look up the "real" UID only if we're going to need it.
+ * TODO: the TODO_SGID condition can be dropped here, can't it?
+ */
+ if (a->todo & (TODO_OWNER | TODO_SUID | TODO_SGID)) {
+ a->uid = a->lookup_uid(a->lookup_uid_data,
+ archive_entry_uname(a->entry),
+ archive_entry_uid(a->entry));
+ }
+ /* Look up the "real" GID only if we're going to need it. */
+ /* TODO: the TODO_SUID condition can be dropped here, can't it? */
+ if (a->todo & (TODO_OWNER | TODO_SGID | TODO_SUID)) {
+ a->gid = a->lookup_gid(a->lookup_gid_data,
+ archive_entry_gname(a->entry),
+ archive_entry_gid(a->entry));
+ }
+ /*
+ * If restoring ownership, do it before trying to restore suid/sgid
+ * bits. If we set the owner, we know what it is and can skip
+ * a stat() call to examine the ownership of the file on disk.
+ */
+ if (a->todo & TODO_OWNER)
+ ret = set_ownership(a);
+ if (a->todo & TODO_MODE) {
+ int r2 = set_mode(a, a->mode);
+ if (r2 < ret) ret = r2;
+ }
+ if (a->todo & TODO_ACLS) {
+ int r2 = set_acls(a);
+ if (r2 < ret) ret = r2;
+ }
+
+ /*
+ * Security-related extended attributes (such as
+ * security.capability on Linux) have to be restored last,
+ * since they're implicitly removed by other file changes.
+ */
+ if (a->todo & TODO_XATTR) {
+ int r2 = set_xattrs(a);
+ if (r2 < ret) ret = r2;
+ }
+
+ /*
+ * Some flags prevent file modification; they must be restored after
+ * file contents are written.
+ */
+ if (a->todo & TODO_FFLAGS) {
+ int r2 = set_fflags(a);
+ if (r2 < ret) ret = r2;
+ }
+ /*
+ * Time has to be restored after all other metadata;
+ * otherwise atime will get changed.
+ */
+ if (a->todo & TODO_TIMES) {
+ int r2 = set_times(a);
+ if (r2 < ret) ret = r2;
+ }
+
+ /* If there's an fd, we can close it now. */
+ if (a->fd >= 0) {
+ close(a->fd);
+ a->fd = -1;
+ }
+ /* If there's an entry, we can release it now. */
+ if (a->entry) {
+ archive_entry_free(a->entry);
+ a->entry = NULL;
+ }
+ a->archive.state = ARCHIVE_STATE_HEADER;
+ return (ret);
+}
+
+int
+archive_write_disk_set_group_lookup(struct archive *_a,
+ void *private_data,
+ gid_t (*lookup_gid)(void *private, const char *gname, gid_t gid),
+ void (*cleanup_gid)(void *private))
+{
+ struct archive_write_disk *a = (struct archive_write_disk *)_a;
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
+ ARCHIVE_STATE_ANY, "archive_write_disk_set_group_lookup");
+
+ a->lookup_gid = lookup_gid;
+ a->cleanup_gid = cleanup_gid;
+ a->lookup_gid_data = private_data;
+ return (ARCHIVE_OK);
+}
+
+int
+archive_write_disk_set_user_lookup(struct archive *_a,
+ void *private_data,
+ uid_t (*lookup_uid)(void *private, const char *uname, uid_t uid),
+ void (*cleanup_uid)(void *private))
+{
+ struct archive_write_disk *a = (struct archive_write_disk *)_a;
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
+ ARCHIVE_STATE_ANY, "archive_write_disk_set_user_lookup");
+
+ a->lookup_uid = lookup_uid;
+ a->cleanup_uid = cleanup_uid;
+ a->lookup_uid_data = private_data;
+ return (ARCHIVE_OK);
+}
+
+
+/*
+ * Create a new archive_write_disk object and initialize it with global state.
+ */
+struct archive *
+archive_write_disk_new(void)
+{
+ struct archive_write_disk *a;
+
+ a = (struct archive_write_disk *)malloc(sizeof(*a));
+ if (a == NULL)
+ return (NULL);
+ memset(a, 0, sizeof(*a));
+ a->archive.magic = ARCHIVE_WRITE_DISK_MAGIC;
+ /* We're ready to write a header immediately. */
+ a->archive.state = ARCHIVE_STATE_HEADER;
+ a->archive.vtable = archive_write_disk_vtable();
+ a->lookup_uid = trivial_lookup_uid;
+ a->lookup_gid = trivial_lookup_gid;
+ a->start_time = time(NULL);
+#ifdef HAVE_GETEUID
+ a->user_uid = geteuid();
+#endif /* HAVE_GETEUID */
+ if (archive_string_ensure(&a->path_safe, 512) == NULL) {
+ free(a);
+ return (NULL);
+ }
+ return (&a->archive);
+}
+
+
+/*
+ * If pathname is longer than PATH_MAX, chdir to a suitable
+ * intermediate dir and edit the path down to a shorter suffix. Note
+ * that this routine never returns an error; if the chdir() attempt
+ * fails for any reason, we just go ahead with the long pathname. The
+ * object creation is likely to fail, but any error will get handled
+ * at that time.
+ */
+#ifdef HAVE_FCHDIR
+static void
+edit_deep_directories(struct archive_write_disk *a)
+{
+ int ret;
+ char *tail = a->name;
+
+ a->restore_pwd = -1;
+
+ /* If path is short, avoid the open() below. */
+ if (strlen(tail) <= PATH_MAX)
+ return;
+
+ /* Try to record our starting dir. */
+ a->restore_pwd = open(".", O_RDONLY | O_BINARY);
+ if (a->restore_pwd < 0)
+ return;
+
+ /* As long as the path is too long... */
+ while (strlen(tail) > PATH_MAX) {
+ /* Locate a dir prefix shorter than PATH_MAX. */
+ tail += PATH_MAX - 8;
+ while (tail > a->name && *tail != '/')
+ tail--;
+ /* Exit if we find a too-long path component. */
+ if (tail <= a->name)
+ return;
+ /* Create the intermediate dir and chdir to it. */
+ *tail = '\0'; /* Terminate dir portion */
+ ret = create_dir(a, a->name);
+ if (ret == ARCHIVE_OK && chdir(a->name) != 0)
+ ret = ARCHIVE_FAILED;
+ *tail = '/'; /* Restore the / we removed. */
+ if (ret != ARCHIVE_OK)
+ return;
+ tail++;
+ /* The chdir() succeeded; we've now shortened the path. */
+ a->name = tail;
+ }
+ return;
+}
+#endif
+
+/*
+ * The main restore function.
+ */
+static int
+restore_entry(struct archive_write_disk *a)
+{
+ int ret = ARCHIVE_OK, en;
+
+ if (a->flags & ARCHIVE_EXTRACT_UNLINK && !S_ISDIR(a->mode)) {
+ /*
+ * TODO: Fix this. Apparently, there are platforms
+ * that still allow root to hose the entire filesystem
+ * by unlinking a dir. The S_ISDIR() test above
+ * prevents us from using unlink() here if the new
+ * object is a dir, but that doesn't mean the old
+ * object isn't a dir.
+ */
+ if (unlink(a->name) == 0) {
+ /* We removed it, reset cached stat. */
+ a->pst = NULL;
+ } else if (errno == ENOENT) {
+ /* File didn't exist, that's just as good. */
+ } else if (rmdir(a->name) == 0) {
+ /* It was a dir, but now it's gone. */
+ a->pst = NULL;
+ } else {
+ /* We tried, but couldn't get rid of it. */
+ archive_set_error(&a->archive, errno,
+ "Could not unlink");
+ return(ARCHIVE_FAILED);
+ }
+ }
+
+ /* Try creating it first; if this fails, we'll try to recover. */
+ en = create_filesystem_object(a);
+
+ if ((en == ENOTDIR || en == ENOENT)
+ && !(a->flags & ARCHIVE_EXTRACT_NO_AUTODIR)) {
+ /* If the parent dir doesn't exist, try creating it. */
+ create_parent_dir(a, a->name);
+ /* Now try to create the object again. */
+ en = create_filesystem_object(a);
+ }
+
+ if ((en == EISDIR || en == EEXIST)
+ && (a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE)) {
+ /* If we're not overwriting, we're done. */
+ archive_set_error(&a->archive, en, "Already exists");
+ return (ARCHIVE_FAILED);
+ }
+
+ /*
+ * Some platforms return EISDIR if you call
+ * open(O_WRONLY | O_EXCL | O_CREAT) on a directory, some
+ * return EEXIST. POSIX is ambiguous, requiring EISDIR
+ * for open(O_WRONLY) on a dir and EEXIST for open(O_EXCL | O_CREAT)
+ * on an existing item.
+ */
+ if (en == EISDIR) {
+ /* A dir is in the way of a non-dir, rmdir it. */
+ if (rmdir(a->name) != 0) {
+ archive_set_error(&a->archive, errno,
+ "Can't remove already-existing dir");
+ return (ARCHIVE_FAILED);
+ }
+ a->pst = NULL;
+ /* Try again. */
+ en = create_filesystem_object(a);
+ } else if (en == EEXIST) {
+ /*
+ * We know something is in the way, but we don't know what;
+ * we need to find out before we go any further.
+ */
+ int r = 0;
+ /*
+ * The SECURE_SYMLINK logic has already removed a
+ * symlink to a dir if the client wants that. So
+ * follow the symlink if we're creating a dir.
+ */
+ if (S_ISDIR(a->mode))
+ r = stat(a->name, &a->st);
+ /*
+ * If it's not a dir (or it's a broken symlink),
+ * then don't follow it.
+ */
+ if (r != 0 || !S_ISDIR(a->mode))
+ r = lstat(a->name, &a->st);
+ if (r != 0) {
+ archive_set_error(&a->archive, errno,
+ "Can't stat existing object");
+ return (ARCHIVE_FAILED);
+ }
+
+ /*
+ * NO_OVERWRITE_NEWER doesn't apply to directories.
+ */
+ if ((a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER)
+ && !S_ISDIR(a->st.st_mode)) {
+ if (!older(&(a->st), a->entry)) {
+ archive_set_error(&a->archive, 0,
+ "File on disk is not older; skipping.");
+ return (ARCHIVE_FAILED);
+ }
+ }
+
+ /* If it's our archive, we're done. */
+ if (a->skip_file_dev > 0 &&
+ a->skip_file_ino > 0 &&
+ a->st.st_dev == a->skip_file_dev &&
+ a->st.st_ino == a->skip_file_ino) {
+ archive_set_error(&a->archive, 0, "Refusing to overwrite archive");
+ return (ARCHIVE_FAILED);
+ }
+
+ if (!S_ISDIR(a->st.st_mode)) {
+ /* A non-dir is in the way, unlink it. */
+ if (unlink(a->name) != 0) {
+ archive_set_error(&a->archive, errno,
+ "Can't unlink already-existing object");
+ return (ARCHIVE_FAILED);
+ }
+ a->pst = NULL;
+ /* Try again. */
+ en = create_filesystem_object(a);
+ } else if (!S_ISDIR(a->mode)) {
+ /* A dir is in the way of a non-dir, rmdir it. */
+ if (rmdir(a->name) != 0) {
+ archive_set_error(&a->archive, errno,
+ "Can't remove already-existing dir");
+ return (ARCHIVE_FAILED);
+ }
+ /* Try again. */
+ en = create_filesystem_object(a);
+ } else {
+ /*
+ * There's a dir in the way of a dir. Don't
+ * waste time with rmdir()/mkdir(), just fix
+ * up the permissions on the existing dir.
+ * Note that we don't change perms on existing
+ * dirs unless _EXTRACT_PERM is specified.
+ */
+ if ((a->mode != a->st.st_mode)
+ && (a->todo & TODO_MODE_FORCE))
+ a->deferred |= (a->todo & TODO_MODE);
+ /* Ownership doesn't need deferred fixup. */
+ en = 0; /* Forget the EEXIST. */
+ }
+ }
+
+ if (en) {
+ /* Everything failed; give up here. */
+ archive_set_error(&a->archive, en, "Can't create '%s'",
+ a->name);
+ return (ARCHIVE_FAILED);
+ }
+
+ a->pst = NULL; /* Cached stat data no longer valid. */
+ return (ret);
+}
+
+/*
+ * Returns 0 if creation succeeds, or else returns errno value from
+ * the failed system call. Note: This function should only ever perform
+ * a single system call.
+ */
+static int
+create_filesystem_object(struct archive_write_disk *a)
+{
+ /* Create the entry. */
+ const char *linkname;
+ mode_t final_mode, mode;
+ int r;
+
+ /* We identify hard/symlinks according to the link names. */
+ /* Since link(2) and symlink(2) don't handle modes, we're done here. */
+ linkname = archive_entry_hardlink(a->entry);
+ if (linkname != NULL) {
+#if !HAVE_LINK
+ return (EPERM);
+#else
+ r = link(linkname, a->name) ? errno : 0;
+ /*
+ * New cpio and pax formats allow hardlink entries
+ * to carry data, so we may have to open the file
+ * for hardlink entries.
+ *
+ * If the hardlink was successfully created and
+ * the archive doesn't have carry data for it,
+ * consider it to be non-authoritive for meta data.
+ * This is consistent with GNU tar and BSD pax.
+ * If the hardlink does carry data, let the last
+ * archive entry decide ownership.
+ */
+ if (r == 0 && a->filesize <= 0) {
+ a->todo = 0;
+ a->deferred = 0;
+ } if (r == 0 && a->filesize > 0) {
+ a->fd = open(a->name, O_WRONLY | O_TRUNC | O_BINARY);
+ if (a->fd < 0)
+ r = errno;
+ }
+ return (r);
+#endif
+ }
+ linkname = archive_entry_symlink(a->entry);
+ if (linkname != NULL) {
+#if HAVE_SYMLINK
+ return symlink(linkname, a->name) ? errno : 0;
+#else
+ return (EPERM);
+#endif
+ }
+
+ /*
+ * The remaining system calls all set permissions, so let's
+ * try to take advantage of that to avoid an extra chmod()
+ * call. (Recall that umask is set to zero right now!)
+ */
+
+ /* Mode we want for the final restored object (w/o file type bits). */
+ final_mode = a->mode & 07777;
+ /*
+ * The mode that will actually be restored in this step. Note
+ * that SUID, SGID, etc, require additional work to ensure
+ * security, so we never restore them at this point.
+ */
+ mode = final_mode & 0777;
+
+ switch (a->mode & AE_IFMT) {
+ default:
+ /* POSIX requires that we fall through here. */
+ /* FALLTHROUGH */
+ case AE_IFREG:
+ a->fd = open(a->name,
+ O_WRONLY | O_CREAT | O_EXCL | O_BINARY, mode);
+ r = (a->fd < 0);
+ break;
+ case AE_IFCHR:
+#ifdef HAVE_MKNOD
+ /* Note: we use AE_IFCHR for the case label, and
+ * S_IFCHR for the mknod() call. This is correct. */
+ r = mknod(a->name, mode | S_IFCHR,
+ archive_entry_rdev(a->entry));
+ break;
+#else
+ /* TODO: Find a better way to warn about our inability
+ * to restore a char device node. */
+ return (EINVAL);
+#endif /* HAVE_MKNOD */
+ case AE_IFBLK:
+#ifdef HAVE_MKNOD
+ r = mknod(a->name, mode | S_IFBLK,
+ archive_entry_rdev(a->entry));
+ break;
+#else
+ /* TODO: Find a better way to warn about our inability
+ * to restore a block device node. */
+ return (EINVAL);
+#endif /* HAVE_MKNOD */
+ case AE_IFDIR:
+ mode = (mode | MINIMUM_DIR_MODE) & MAXIMUM_DIR_MODE;
+ r = mkdir(a->name, mode);
+ if (r == 0) {
+ /* Defer setting dir times. */
+ a->deferred |= (a->todo & TODO_TIMES);
+ a->todo &= ~TODO_TIMES;
+ /* Never use an immediate chmod(). */
+ /* We can't avoid the chmod() entirely if EXTRACT_PERM
+ * because of SysV SGID inheritance. */
+ if ((mode != final_mode)
+ || (a->flags & ARCHIVE_EXTRACT_PERM))
+ a->deferred |= (a->todo & TODO_MODE);
+ a->todo &= ~TODO_MODE;
+ }
+ break;
+ case AE_IFIFO:
+#ifdef HAVE_MKFIFO
+ r = mkfifo(a->name, mode);
+ break;
+#else
+ /* TODO: Find a better way to warn about our inability
+ * to restore a fifo. */
+ return (EINVAL);
+#endif /* HAVE_MKFIFO */
+ }
+
+ /* All the system calls above set errno on failure. */
+ if (r)
+ return (errno);
+
+ /* If we managed to set the final mode, we've avoided a chmod(). */
+ if (mode == final_mode)
+ a->todo &= ~TODO_MODE;
+ return (0);
+}
+
+/*
+ * Cleanup function for archive_extract. Mostly, this involves processing
+ * the fixup list, which is used to address a number of problems:
+ * * Dir permissions might prevent us from restoring a file in that
+ * dir, so we restore the dir with minimum 0700 permissions first,
+ * then correct the mode at the end.
+ * * Similarly, the act of restoring a file touches the directory
+ * and changes the timestamp on the dir, so we have to touch-up dir
+ * timestamps at the end as well.
+ * * Some file flags can interfere with the restore by, for example,
+ * preventing the creation of hardlinks to those files.
+ *
+ * Note that tar/cpio do not require that archives be in a particular
+ * order; there is no way to know when the last file has been restored
+ * within a directory, so there's no way to optimize the memory usage
+ * here by fixing up the directory any earlier than the
+ * end-of-archive.
+ *
+ * XXX TODO: Directory ACLs should be restored here, for the same
+ * reason we set directory perms here. XXX
+ */
+static int
+_archive_write_close(struct archive *_a)
+{
+ struct archive_write_disk *a = (struct archive_write_disk *)_a;
+ struct fixup_entry *next, *p;
+ int ret;
+
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
+ ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA,
+ "archive_write_disk_close");
+ ret = _archive_write_finish_entry(&a->archive);
+
+ /* Sort dir list so directories are fixed up in depth-first order. */
+ p = sort_dir_list(a->fixup_list);
+
+ while (p != NULL) {
+ a->pst = NULL; /* Mark stat cache as out-of-date. */
+ if (p->fixup & TODO_TIMES) {
+#ifdef HAVE_UTIMES
+ /* {f,l,}utimes() are preferred, when available. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ struct __timeval times[2];
+#else
+ struct timeval times[2];
+#endif
+ times[0].tv_sec = p->atime;
+ times[0].tv_usec = p->atime_nanos / 1000;
+#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME
+ /* if it's valid and not mtime, push the birthtime first */
+ if (((times[1].tv_sec = p->birthtime) < p->mtime) &&
+ (p->birthtime > 0))
+ {
+ times[1].tv_usec = p->birthtime_nanos / 1000;
+ utimes(p->name, times);
+ }
+#endif
+ times[1].tv_sec = p->mtime;
+ times[1].tv_usec = p->mtime_nanos / 1000;
+#ifdef HAVE_LUTIMES
+ lutimes(p->name, times);
+#else
+ utimes(p->name, times);
+#endif
+#else
+ /* utime() is more portable, but less precise. */
+ struct utimbuf times;
+ times.modtime = p->mtime;
+ times.actime = p->atime;
+
+ utime(p->name, &times);
+#endif
+ }
+ if (p->fixup & TODO_MODE_BASE)
+ chmod(p->name, p->mode);
+
+ if (p->fixup & TODO_FFLAGS)
+ set_fflags_platform(a, -1, p->name,
+ p->mode, p->fflags_set, 0);
+
+ next = p->next;
+ free(p->name);
+ free(p);
+ p = next;
+ }
+ a->fixup_list = NULL;
+ return (ret);
+}
+
+static int
+_archive_write_finish(struct archive *_a)
+{
+ struct archive_write_disk *a = (struct archive_write_disk *)_a;
+ int ret;
+ ret = _archive_write_close(&a->archive);
+ if (a->cleanup_gid != NULL && a->lookup_gid_data != NULL)
+ (a->cleanup_gid)(a->lookup_gid_data);
+ if (a->cleanup_uid != NULL && a->lookup_uid_data != NULL)
+ (a->cleanup_uid)(a->lookup_uid_data);
+ if (a->entry)
+ archive_entry_free(a->entry);
+ archive_string_free(&a->_name_data);
+ archive_string_free(&a->archive.error_string);
+ archive_string_free(&a->path_safe);
+ free(a);
+ return (ret);
+}
+
+/*
+ * Simple O(n log n) merge sort to order the fixup list. In
+ * particular, we want to restore dir timestamps depth-first.
+ */
+static struct fixup_entry *
+sort_dir_list(struct fixup_entry *p)
+{
+ struct fixup_entry *a, *b, *t;
+
+ if (p == NULL)
+ return (NULL);
+ /* A one-item list is already sorted. */
+ if (p->next == NULL)
+ return (p);
+
+ /* Step 1: split the list. */
+ t = p;
+ a = p->next->next;
+ while (a != NULL) {
+ /* Step a twice, t once. */
+ a = a->next;
+ if (a != NULL)
+ a = a->next;
+ t = t->next;
+ }
+ /* Now, t is at the mid-point, so break the list here. */
+ b = t->next;
+ t->next = NULL;
+ a = p;
+
+ /* Step 2: Recursively sort the two sub-lists. */
+ a = sort_dir_list(a);
+ b = sort_dir_list(b);
+
+ /* Step 3: Merge the returned lists. */
+ /* Pick the first element for the merged list. */
+ if (strcmp(a->name, b->name) > 0) {
+ t = p = a;
+ a = a->next;
+ } else {
+ t = p = b;
+ b = b->next;
+ }
+
+ /* Always put the later element on the list first. */
+ while (a != NULL && b != NULL) {
+ if (strcmp(a->name, b->name) > 0) {
+ t->next = a;
+ a = a->next;
+ } else {
+ t->next = b;
+ b = b->next;
+ }
+ t = t->next;
+ }
+
+ /* Only one list is non-empty, so just splice it on. */
+ if (a != NULL)
+ t->next = a;
+ if (b != NULL)
+ t->next = b;
+
+ return (p);
+}
+
+/*
+ * Returns a new, initialized fixup entry.
+ *
+ * TODO: Reduce the memory requirements for this list by using a tree
+ * structure rather than a simple list of names.
+ */
+static struct fixup_entry *
+new_fixup(struct archive_write_disk *a, const char *pathname)
+{
+ struct fixup_entry *fe;
+
+ fe = (struct fixup_entry *)malloc(sizeof(struct fixup_entry));
+ if (fe == NULL)
+ return (NULL);
+ fe->next = a->fixup_list;
+ a->fixup_list = fe;
+ fe->fixup = 0;
+ fe->name = strdup(pathname);
+ return (fe);
+}
+
+/*
+ * Returns a fixup structure for the current entry.
+ */
+static struct fixup_entry *
+current_fixup(struct archive_write_disk *a, const char *pathname)
+{
+ if (a->current_fixup == NULL)
+ a->current_fixup = new_fixup(a, pathname);
+ return (a->current_fixup);
+}
+
+/* TODO: Make this work. */
+/*
+ * TODO: The deep-directory support bypasses this; disable deep directory
+ * support if we're doing symlink checks.
+ */
+/*
+ * TODO: Someday, integrate this with the deep dir support; they both
+ * scan the path and both can be optimized by comparing against other
+ * recent paths.
+ */
+/* TODO: Extend this to support symlinks on Windows Vista and later. */
+static int
+check_symlinks(struct archive_write_disk *a)
+{
+#if !defined(HAVE_LSTAT)
+ /* Platform doesn't have lstat, so we can't look for symlinks. */
+ (void)a; /* UNUSED */
+ return (ARCHIVE_OK);
+#else
+ char *pn, *p;
+ char c;
+ int r;
+ struct stat st;
+
+ /*
+ * Guard against symlink tricks. Reject any archive entry whose
+ * destination would be altered by a symlink.
+ */
+ /* Whatever we checked last time doesn't need to be re-checked. */
+ pn = a->name;
+ p = a->path_safe.s;
+ while ((*pn != '\0') && (*p == *pn))
+ ++p, ++pn;
+ c = pn[0];
+ /* Keep going until we've checked the entire name. */
+ while (pn[0] != '\0' && (pn[0] != '/' || pn[1] != '\0')) {
+ /* Skip the next path element. */
+ while (*pn != '\0' && *pn != '/')
+ ++pn;
+ c = pn[0];
+ pn[0] = '\0';
+ /* Check that we haven't hit a symlink. */
+ r = lstat(a->name, &st);
+ if (r != 0) {
+ /* We've hit a dir that doesn't exist; stop now. */
+ if (errno == ENOENT)
+ break;
+ } else if (S_ISLNK(st.st_mode)) {
+ if (c == '\0') {
+ /*
+ * Last element is symlink; remove it
+ * so we can overwrite it with the
+ * item being extracted.
+ */
+ if (unlink(a->name)) {
+ archive_set_error(&a->archive, errno,
+ "Could not remove symlink %s",
+ a->name);
+ pn[0] = c;
+ return (ARCHIVE_FAILED);
+ }
+ a->pst = NULL;
+ /*
+ * Even if we did remove it, a warning
+ * is in order. The warning is silly,
+ * though, if we're just replacing one
+ * symlink with another symlink.
+ */
+ if (!S_ISLNK(a->mode)) {
+ archive_set_error(&a->archive, 0,
+ "Removing symlink %s",
+ a->name);
+ }
+ /* Symlink gone. No more problem! */
+ pn[0] = c;
+ return (0);
+ } else if (a->flags & ARCHIVE_EXTRACT_UNLINK) {
+ /* User asked us to remove problems. */
+ if (unlink(a->name) != 0) {
+ archive_set_error(&a->archive, 0,
+ "Cannot remove intervening symlink %s",
+ a->name);
+ pn[0] = c;
+ return (ARCHIVE_FAILED);
+ }
+ a->pst = NULL;
+ } else {
+ archive_set_error(&a->archive, 0,
+ "Cannot extract through symlink %s",
+ a->name);
+ pn[0] = c;
+ return (ARCHIVE_FAILED);
+ }
+ }
+ }
+ pn[0] = c;
+ /* We've checked and/or cleaned the whole path, so remember it. */
+ archive_strcpy(&a->path_safe, a->name);
+ return (ARCHIVE_OK);
+#endif
+}
+
+#if defined(_WIN32) || defined(__CYGWIN__)
+/*
+ * 1. Convert a path separator from '\' to '/' .
+ * We shouldn't check multi-byte character directly because some
+ * character-set have been using the '\' character for a part of
+ * its multibyte character code.
+ * 2. Replace unusable characters in Windows with underscore('_').
+ * See also : http://msdn.microsoft.com/en-us/library/aa365247.aspx
+ */
+static void
+cleanup_pathname_win(struct archive_write_disk *a)
+{
+ wchar_t wc;
+ char *p;
+ size_t alen, l;
+
+ alen = 0;
+ l = 0;
+ for (p = a->name; *p != '\0'; p++) {
+ ++alen;
+ if (*p == '\\')
+ l = 1;
+ /* Rewrite the path name if its character is a unusable. */
+ if (*p == ':' || *p == '*' || *p == '?' || *p == '"' ||
+ *p == '<' || *p == '>' || *p == '|')
+ *p = '_';
+ }
+ if (alen == 0 || l == 0)
+ return;
+ /*
+ * Convert path separator.
+ */
+ p = a->name;
+ while (*p != '\0' && alen) {
+ l = mbtowc(&wc, p, alen);
+ if (l == -1) {
+ while (*p != '\0') {
+ if (*p == '\\')
+ *p = '/';
+ ++p;
+ }
+ break;
+ }
+ if (l == 1 && wc == L'\\')
+ *p = '/';
+ p += l;
+ alen -= l;
+ }
+}
+#endif
+
+/*
+ * Canonicalize the pathname. In particular, this strips duplicate
+ * '/' characters, '.' elements, and trailing '/'. It also raises an
+ * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is
+ * set) any '..' in the path.
+ */
+static int
+cleanup_pathname(struct archive_write_disk *a)
+{
+ char *dest, *src;
+ char separator = '\0';
+
+ dest = src = a->name;
+ if (*src == '\0') {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Invalid empty pathname");
+ return (ARCHIVE_FAILED);
+ }
+
+#if defined(_WIN32) || defined(__CYGWIN__)
+ cleanup_pathname_win(a);
+#endif
+ /* Skip leading '/'. */
+ if (*src == '/')
+ separator = *src++;
+
+ /* Scan the pathname one element at a time. */
+ for (;;) {
+ /* src points to first char after '/' */
+ if (src[0] == '\0') {
+ break;
+ } else if (src[0] == '/') {
+ /* Found '//', ignore second one. */
+ src++;
+ continue;
+ } else if (src[0] == '.') {
+ if (src[1] == '\0') {
+ /* Ignore trailing '.' */
+ break;
+ } else if (src[1] == '/') {
+ /* Skip './'. */
+ src += 2;
+ continue;
+ } else if (src[1] == '.') {
+ if (src[2] == '/' || src[2] == '\0') {
+ /* Conditionally warn about '..' */
+ if (a->flags & ARCHIVE_EXTRACT_SECURE_NODOTDOT) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_MISC,
+ "Path contains '..'");
+ return (ARCHIVE_FAILED);
+ }
+ }
+ /*
+ * Note: Under no circumstances do we
+ * remove '..' elements. In
+ * particular, restoring
+ * '/foo/../bar/' should create the
+ * 'foo' dir as a side-effect.
+ */
+ }
+ }
+
+ /* Copy current element, including leading '/'. */
+ if (separator)
+ *dest++ = '/';
+ while (*src != '\0' && *src != '/') {
+ *dest++ = *src++;
+ }
+
+ if (*src == '\0')
+ break;
+
+ /* Skip '/' separator. */
+ separator = *src++;
+ }
+ /*
+ * We've just copied zero or more path elements, not including the
+ * final '/'.
+ */
+ if (dest == a->name) {
+ /*
+ * Nothing got copied. The path must have been something
+ * like '.' or '/' or './' or '/././././/./'.
+ */
+ if (separator)
+ *dest++ = '/';
+ else
+ *dest++ = '.';
+ }
+ /* Terminate the result. */
+ *dest = '\0';
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Create the parent directory of the specified path, assuming path
+ * is already in mutable storage.
+ */
+static int
+create_parent_dir(struct archive_write_disk *a, char *path)
+{
+ char *slash;
+ int r;
+
+ /* Remove tail element to obtain parent name. */
+ slash = strrchr(path, '/');
+ if (slash == NULL)
+ return (ARCHIVE_OK);
+ *slash = '\0';
+ r = create_dir(a, path);
+ *slash = '/';
+ return (r);
+}
+
+/*
+ * Create the specified dir, recursing to create parents as necessary.
+ *
+ * Returns ARCHIVE_OK if the path exists when we're done here.
+ * Otherwise, returns ARCHIVE_FAILED.
+ * Assumes path is in mutable storage; path is unchanged on exit.
+ */
+static int
+create_dir(struct archive_write_disk *a, char *path)
+{
+ struct stat st;
+ struct fixup_entry *le;
+ char *slash, *base;
+ mode_t mode_final, mode;
+ int r;
+
+ /* Check for special names and just skip them. */
+ slash = strrchr(path, '/');
+ if (slash == NULL)
+ base = path;
+ else
+ base = slash + 1;
+
+ if (base[0] == '\0' ||
+ (base[0] == '.' && base[1] == '\0') ||
+ (base[0] == '.' && base[1] == '.' && base[2] == '\0')) {
+ /* Don't bother trying to create null path, '.', or '..'. */
+ if (slash != NULL) {
+ *slash = '\0';
+ r = create_dir(a, path);
+ *slash = '/';
+ return (r);
+ }
+ return (ARCHIVE_OK);
+ }
+
+ /*
+ * Yes, this should be stat() and not lstat(). Using lstat()
+ * here loses the ability to extract through symlinks. Also note
+ * that this should not use the a->st cache.
+ */
+ if (stat(path, &st) == 0) {
+ if (S_ISDIR(st.st_mode))
+ return (ARCHIVE_OK);
+ if ((a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE)) {
+ archive_set_error(&a->archive, EEXIST,
+ "Can't create directory '%s'", path);
+ return (ARCHIVE_FAILED);
+ }
+ if (unlink(path) != 0) {
+ archive_set_error(&a->archive, errno,
+ "Can't create directory '%s': "
+ "Conflicting file cannot be removed");
+ return (ARCHIVE_FAILED);
+ }
+ } else if (errno != ENOENT && errno != ENOTDIR) {
+ /* Stat failed? */
+ archive_set_error(&a->archive, errno, "Can't test directory '%s'", path);
+ return (ARCHIVE_FAILED);
+ } else if (slash != NULL) {
+ *slash = '\0';
+ r = create_dir(a, path);
+ *slash = '/';
+ if (r != ARCHIVE_OK)
+ return (r);
+ }
+
+ /*
+ * Mode we want for the final restored directory. Per POSIX,
+ * implicitly-created dirs must be created obeying the umask.
+ * There's no mention whether this is different for privileged
+ * restores (which the rest of this code handles by pretending
+ * umask=0). I've chosen here to always obey the user's umask for
+ * implicit dirs, even if _EXTRACT_PERM was specified.
+ */
+ mode_final = DEFAULT_DIR_MODE & ~a->user_umask;
+ /* Mode we want on disk during the restore process. */
+ mode = mode_final;
+ mode |= MINIMUM_DIR_MODE;
+ mode &= MAXIMUM_DIR_MODE;
+ if (mkdir(path, mode) == 0) {
+ if (mode != mode_final) {
+ le = new_fixup(a, path);
+ le->fixup |=TODO_MODE_BASE;
+ le->mode = mode_final;
+ }
+ return (ARCHIVE_OK);
+ }
+
+ /*
+ * Without the following check, a/b/../b/c/d fails at the
+ * second visit to 'b', so 'd' can't be created. Note that we
+ * don't add it to the fixup list here, as it's already been
+ * added.
+ */
+ if (stat(path, &st) == 0 && S_ISDIR(st.st_mode))
+ return (ARCHIVE_OK);
+
+ archive_set_error(&a->archive, errno, "Failed to create dir '%s'",
+ path);
+ return (ARCHIVE_FAILED);
+}
+
+/*
+ * Note: Although we can skip setting the user id if the desired user
+ * id matches the current user, we cannot skip setting the group, as
+ * many systems set the gid based on the containing directory. So
+ * we have to perform a chown syscall if we want to set the SGID
+ * bit. (The alternative is to stat() and then possibly chown(); it's
+ * more efficient to skip the stat() and just always chown().) Note
+ * that a successful chown() here clears the TODO_SGID_CHECK bit, which
+ * allows set_mode to skip the stat() check for the GID.
+ */
+static int
+set_ownership(struct archive_write_disk *a)
+{
+#ifndef __CYGWIN__
+/* unfortunately, on win32 there is no 'root' user with uid 0,
+ so we just have to try the chown and see if it works */
+
+ /* If we know we can't change it, don't bother trying. */
+ if (a->user_uid != 0 && a->user_uid != a->uid) {
+ archive_set_error(&a->archive, errno,
+ "Can't set UID=%d", a->uid);
+ return (ARCHIVE_WARN);
+ }
+#endif
+
+#ifdef HAVE_FCHOWN
+ /* If we have an fd, we can avoid a race. */
+ if (a->fd >= 0 && fchown(a->fd, a->uid, a->gid) == 0) {
+ /* We've set owner and know uid/gid are correct. */
+ a->todo &= ~(TODO_OWNER | TODO_SGID_CHECK | TODO_SUID_CHECK);
+ return (ARCHIVE_OK);
+ }
+#endif
+
+ /* We prefer lchown() but will use chown() if that's all we have. */
+ /* Of course, if we have neither, this will always fail. */
+#ifdef HAVE_LCHOWN
+ if (lchown(a->name, a->uid, a->gid) == 0) {
+ /* We've set owner and know uid/gid are correct. */
+ a->todo &= ~(TODO_OWNER | TODO_SGID_CHECK | TODO_SUID_CHECK);
+ return (ARCHIVE_OK);
+ }
+#elif HAVE_CHOWN
+ if (!S_ISLNK(a->mode) && chown(a->name, a->uid, a->gid) == 0) {
+ /* We've set owner and know uid/gid are correct. */
+ a->todo &= ~(TODO_OWNER | TODO_SGID_CHECK | TODO_SUID_CHECK);
+ return (ARCHIVE_OK);
+ }
+#endif
+
+ archive_set_error(&a->archive, errno,
+ "Can't set user=%d/group=%d for %s", a->uid, a->gid,
+ a->name);
+ return (ARCHIVE_WARN);
+}
+
+
+#if defined(HAVE_UTIMENSAT) && defined(HAVE_FUTIMENS)
+/*
+ * utimensat() and futimens() are defined in POSIX.1-2008. They provide ns
+ * resolution and setting times on fd and on symlinks, too.
+ */
+static int
+set_time(int fd, int mode, const char *name,
+ time_t atime, long atime_nsec,
+ time_t mtime, long mtime_nsec)
+{
+ struct timespec ts[2];
+ ts[0].tv_sec = atime;
+ ts[0].tv_nsec = atime_nsec;
+ ts[1].tv_sec = mtime;
+ ts[1].tv_nsec = mtime_nsec;
+ if (fd >= 0)
+ return futimens(fd, ts);
+ return utimensat(AT_FDCWD, name, ts, AT_SYMLINK_NOFOLLOW);
+}
+#elif HAVE_UTIMES
+/*
+ * The utimes()-family functions provide µs-resolution and
+ * a way to set time on an fd or a symlink. We prefer them
+ * when they're available and utimensat/futimens aren't there.
+ */
+static int
+set_time(int fd, int mode, const char *name,
+ time_t atime, long atime_nsec,
+ time_t mtime, long mtime_nsec)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ struct __timeval times[2];
+#else
+ struct timeval times[2];
+#endif
+
+ times[0].tv_sec = atime;
+ times[0].tv_usec = atime_nsec / 1000;
+ times[1].tv_sec = mtime;
+ times[1].tv_usec = mtime_nsec / 1000;
+
+#ifdef HAVE_FUTIMES
+ if (fd >= 0)
+ return (futimes(fd, times));
+#else
+ (void)fd; /* UNUSED */
+#endif
+#ifdef HAVE_LUTIMES
+ (void)mode; /* UNUSED */
+ return (lutimes(name, times));
+#else
+ if (S_ISLNK(mode))
+ return (0);
+ return (utimes(name, times));
+#endif
+}
+#elif defined(HAVE_UTIME)
+/*
+ * utime() is an older, more standard interface that we'll use
+ * if utimes() isn't available.
+ */
+static int
+set_time(int fd, int mode, const char *name,
+ time_t atime, long atime_nsec,
+ time_t mtime, long mtime_nsec)
+{
+ struct utimbuf times;
+ (void)fd; /* UNUSED */
+ (void)name; /* UNUSED */
+ (void)atime_nsec; /* UNUSED */
+ (void)mtime_nsec; /* UNUSED */
+ times.actime = atime;
+ times.modtime = mtime;
+ if (S_ISLNK(mode))
+ return (ARCHIVE_OK);
+ return (utime(name, &times));
+}
+#else
+static int
+set_time(int fd, int mode, const char *name,
+ time_t atime, long atime_nsec,
+ time_t mtime, long mtime_nsec)
+{
+ return (ARCHIVE_WARN);
+}
+#endif
+
+static int
+set_times(struct archive_write_disk *a)
+{
+ time_t atime = a->start_time, mtime = a->start_time;
+ long atime_nsec = 0, mtime_nsec = 0;
+
+ /* If no time was provided, we're done. */
+ if (!archive_entry_atime_is_set(a->entry)
+#if HAVE_STRUCT_STAT_ST_BIRTHTIME
+ && !archive_entry_birthtime_is_set(a->entry)
+#endif
+ && !archive_entry_mtime_is_set(a->entry))
+ return (ARCHIVE_OK);
+
+ /* If no atime was specified, use start time instead. */
+ /* In theory, it would be marginally more correct to use
+ * time(NULL) here, but that would cost us an extra syscall
+ * for little gain. */
+ if (archive_entry_atime_is_set(a->entry)) {
+ atime = archive_entry_atime(a->entry);
+ atime_nsec = archive_entry_atime_nsec(a->entry);
+ }
+
+ /*
+ * If you have struct stat.st_birthtime, we assume BSD birthtime
+ * semantics, in which {f,l,}utimes() updates birthtime to earliest
+ * mtime. So we set the time twice, first using the birthtime,
+ * then using the mtime.
+ */
+#if HAVE_STRUCT_STAT_ST_BIRTHTIME
+ /* If birthtime is set, flush that through to disk first. */
+ if (archive_entry_birthtime_is_set(a->entry))
+ if (set_time(a->fd, a->mode, a->name, atime, atime_nsec,
+ archive_entry_birthtime(a->entry),
+ archive_entry_birthtime_nsec(a->entry))) {
+ archive_set_error(&a->archive, errno,
+ "Can't update time for %s",
+ a->name);
+ return (ARCHIVE_WARN);
+ }
+#endif
+
+ if (archive_entry_mtime_is_set(a->entry)) {
+ mtime = archive_entry_mtime(a->entry);
+ mtime_nsec = archive_entry_mtime_nsec(a->entry);
+ }
+ if (set_time(a->fd, a->mode, a->name,
+ atime, atime_nsec, mtime, mtime_nsec)) {
+ archive_set_error(&a->archive, errno,
+ "Can't update time for %s",
+ a->name);
+ return (ARCHIVE_WARN);
+ }
+
+ /*
+ * Note: POSIX does not provide a portable way to restore ctime.
+ * (Apart from resetting the system clock, which is distasteful.)
+ * So, any restoration of ctime will necessarily be OS-specific.
+ */
+
+ return (ARCHIVE_OK);
+}
+
+static int
+set_mode(struct archive_write_disk *a, int mode)
+{
+ int r = ARCHIVE_OK;
+ mode &= 07777; /* Strip off file type bits. */
+
+ if (a->todo & TODO_SGID_CHECK) {
+ /*
+ * If we don't know the GID is right, we must stat()
+ * to verify it. We can't just check the GID of this
+ * process, since systems sometimes set GID from
+ * the enclosing dir or based on ACLs.
+ */
+ if ((r = _archive_write_disk_lazy_stat(a)) != ARCHIVE_OK)
+ return (r);
+ if (a->pst->st_gid != a->gid) {
+ mode &= ~ S_ISGID;
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ if (a->flags & ARCHIVE_EXTRACT_OWNER) {
+ /*
+ * This is only an error if you
+ * requested owner restore. If you
+ * didn't, we'll try to restore
+ * sgid/suid, but won't consider it a
+ * problem if we can't.
+ */
+ archive_set_error(&a->archive, -1,
+ "Can't restore SGID bit");
+ r = ARCHIVE_WARN;
+ }
+#endif
+ }
+ /* While we're here, double-check the UID. */
+ if (a->pst->st_uid != a->uid
+ && (a->todo & TODO_SUID)) {
+ mode &= ~ S_ISUID;
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ if (a->flags & ARCHIVE_EXTRACT_OWNER) {
+ archive_set_error(&a->archive, -1,
+ "Can't restore SUID bit");
+ r = ARCHIVE_WARN;
+ }
+#endif
+ }
+ a->todo &= ~TODO_SGID_CHECK;
+ a->todo &= ~TODO_SUID_CHECK;
+ } else if (a->todo & TODO_SUID_CHECK) {
+ /*
+ * If we don't know the UID is right, we can just check
+ * the user, since all systems set the file UID from
+ * the process UID.
+ */
+ if (a->user_uid != a->uid) {
+ mode &= ~ S_ISUID;
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ if (a->flags & ARCHIVE_EXTRACT_OWNER) {
+ archive_set_error(&a->archive, -1,
+ "Can't make file SUID");
+ r = ARCHIVE_WARN;
+ }
+#endif
+ }
+ a->todo &= ~TODO_SUID_CHECK;
+ }
+
+ if (S_ISLNK(a->mode)) {
+#ifdef HAVE_LCHMOD
+ /*
+ * If this is a symlink, use lchmod(). If the
+ * platform doesn't support lchmod(), just skip it. A
+ * platform that doesn't provide a way to set
+ * permissions on symlinks probably ignores
+ * permissions on symlinks, so a failure here has no
+ * impact.
+ */
+ if (lchmod(a->name, mode) != 0) {
+ archive_set_error(&a->archive, errno,
+ "Can't set permissions to 0%o", (int)mode);
+ r = ARCHIVE_WARN;
+ }
+#endif
+ } else if (!S_ISDIR(a->mode)) {
+ /*
+ * If it's not a symlink and not a dir, then use
+ * fchmod() or chmod(), depending on whether we have
+ * an fd. Dirs get their perms set during the
+ * post-extract fixup, which is handled elsewhere.
+ */
+#ifdef HAVE_FCHMOD
+ if (a->fd >= 0) {
+ if (fchmod(a->fd, mode) != 0) {
+ archive_set_error(&a->archive, errno,
+ "Can't set permissions to 0%o", (int)mode);
+ r = ARCHIVE_WARN;
+ }
+ } else
+#endif
+ /* If this platform lacks fchmod(), then
+ * we'll just use chmod(). */
+ if (chmod(a->name, mode) != 0) {
+ archive_set_error(&a->archive, errno,
+ "Can't set permissions to 0%o", (int)mode);
+ r = ARCHIVE_WARN;
+ }
+ }
+ return (r);
+}
+
+static int
+set_fflags(struct archive_write_disk *a)
+{
+ struct fixup_entry *le;
+ unsigned long set, clear;
+ int r;
+ int critical_flags;
+ mode_t mode = archive_entry_mode(a->entry);
+
+ /*
+ * Make 'critical_flags' hold all file flags that can't be
+ * immediately restored. For example, on BSD systems,
+ * SF_IMMUTABLE prevents hardlinks from being created, so
+ * should not be set until after any hardlinks are created. To
+ * preserve some semblance of portability, this uses #ifdef
+ * extensively. Ugly, but it works.
+ *
+ * Yes, Virginia, this does create a security race. It's mitigated
+ * somewhat by the practice of creating dirs 0700 until the extract
+ * is done, but it would be nice if we could do more than that.
+ * People restoring critical file systems should be wary of
+ * other programs that might try to muck with files as they're
+ * being restored.
+ */
+ /* Hopefully, the compiler will optimize this mess into a constant. */
+ critical_flags = 0;
+#ifdef SF_IMMUTABLE
+ critical_flags |= SF_IMMUTABLE;
+#endif
+#ifdef UF_IMMUTABLE
+ critical_flags |= UF_IMMUTABLE;
+#endif
+#ifdef SF_APPEND
+ critical_flags |= SF_APPEND;
+#endif
+#ifdef UF_APPEND
+ critical_flags |= UF_APPEND;
+#endif
+#ifdef EXT2_APPEND_FL
+ critical_flags |= EXT2_APPEND_FL;
+#endif
+#ifdef EXT2_IMMUTABLE_FL
+ critical_flags |= EXT2_IMMUTABLE_FL;
+#endif
+
+ if (a->todo & TODO_FFLAGS) {
+ archive_entry_fflags(a->entry, &set, &clear);
+
+ /*
+ * The first test encourages the compiler to eliminate
+ * all of this if it's not necessary.
+ */
+ if ((critical_flags != 0) && (set & critical_flags)) {
+ le = current_fixup(a, a->name);
+ le->fixup |= TODO_FFLAGS;
+ le->fflags_set = set;
+ /* Store the mode if it's not already there. */
+ if ((le->fixup & TODO_MODE) == 0)
+ le->mode = mode;
+ } else {
+ r = set_fflags_platform(a, a->fd,
+ a->name, mode, set, clear);
+ if (r != ARCHIVE_OK)
+ return (r);
+ }
+ }
+ return (ARCHIVE_OK);
+}
+
+
+#if ( defined(HAVE_LCHFLAGS) || defined(HAVE_CHFLAGS) || defined(HAVE_FCHFLAGS) ) && defined(HAVE_STRUCT_STAT_ST_FLAGS)
+/*
+ * BSD reads flags using stat() and sets them with one of {f,l,}chflags()
+ */
+static int
+set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
+ mode_t mode, unsigned long set, unsigned long clear)
+{
+ int r;
+
+ (void)mode; /* UNUSED */
+ if (set == 0 && clear == 0)
+ return (ARCHIVE_OK);
+
+ /*
+ * XXX Is the stat here really necessary? Or can I just use
+ * the 'set' flags directly? In particular, I'm not sure
+ * about the correct approach if we're overwriting an existing
+ * file that already has flags on it. XXX
+ */
+ if ((r = _archive_write_disk_lazy_stat(a)) != ARCHIVE_OK)
+ return (r);
+
+ a->st.st_flags &= ~clear;
+ a->st.st_flags |= set;
+#ifdef HAVE_FCHFLAGS
+ /* If platform has fchflags() and we were given an fd, use it. */
+ if (fd >= 0 && fchflags(fd, a->st.st_flags) == 0)
+ return (ARCHIVE_OK);
+#endif
+ /*
+ * If we can't use the fd to set the flags, we'll use the
+ * pathname to set flags. We prefer lchflags() but will use
+ * chflags() if we must.
+ */
+#ifdef HAVE_LCHFLAGS
+ if (lchflags(name, a->st.st_flags) == 0)
+ return (ARCHIVE_OK);
+#elif defined(HAVE_CHFLAGS)
+ if (S_ISLNK(a->st.st_mode)) {
+ archive_set_error(&a->archive, errno,
+ "Can't set file flags on symlink.");
+ return (ARCHIVE_WARN);
+ }
+ if (chflags(name, a->st.st_flags) == 0)
+ return (ARCHIVE_OK);
+#endif
+ archive_set_error(&a->archive, errno,
+ "Failed to set file flags");
+ return (ARCHIVE_WARN);
+}
+
+#elif defined(EXT2_IOC_GETFLAGS) && defined(EXT2_IOC_SETFLAGS)
+/*
+ * Linux uses ioctl() to read and write file flags.
+ */
+static int
+set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
+ mode_t mode, unsigned long set, unsigned long clear)
+{
+ int ret;
+ int myfd = fd;
+ unsigned long newflags, oldflags;
+ unsigned long sf_mask = 0;
+
+ if (set == 0 && clear == 0)
+ return (ARCHIVE_OK);
+ /* Only regular files and dirs can have flags. */
+ if (!S_ISREG(mode) && !S_ISDIR(mode))
+ return (ARCHIVE_OK);
+
+ /* If we weren't given an fd, open it ourselves. */
+ if (myfd < 0)
+ myfd = open(name, O_RDONLY | O_NONBLOCK | O_BINARY);
+ if (myfd < 0)
+ return (ARCHIVE_OK);
+
+ /*
+ * Linux has no define for the flags that are only settable by
+ * the root user. This code may seem a little complex, but
+ * there seem to be some Linux systems that lack these
+ * defines. (?) The code below degrades reasonably gracefully
+ * if sf_mask is incomplete.
+ */
+#ifdef EXT2_IMMUTABLE_FL
+ sf_mask |= EXT2_IMMUTABLE_FL;
+#endif
+#ifdef EXT2_APPEND_FL
+ sf_mask |= EXT2_APPEND_FL;
+#endif
+ /*
+ * XXX As above, this would be way simpler if we didn't have
+ * to read the current flags from disk. XXX
+ */
+ ret = ARCHIVE_OK;
+ /* Try setting the flags as given. */
+ if (ioctl(myfd, EXT2_IOC_GETFLAGS, &oldflags) >= 0) {
+ newflags = (oldflags & ~clear) | set;
+ if (ioctl(myfd, EXT2_IOC_SETFLAGS, &newflags) >= 0)
+ goto cleanup;
+ if (errno != EPERM)
+ goto fail;
+ }
+ /* If we couldn't set all the flags, try again with a subset. */
+ if (ioctl(myfd, EXT2_IOC_GETFLAGS, &oldflags) >= 0) {
+ newflags &= ~sf_mask;
+ oldflags &= sf_mask;
+ newflags |= oldflags;
+ if (ioctl(myfd, EXT2_IOC_SETFLAGS, &newflags) >= 0)
+ goto cleanup;
+ }
+ /* We couldn't set the flags, so report the failure. */
+fail:
+ archive_set_error(&a->archive, errno,
+ "Failed to set file flags");
+ ret = ARCHIVE_WARN;
+cleanup:
+ if (fd < 0)
+ close(myfd);
+ return (ret);
+}
+
+#else
+
+/*
+ * Of course, some systems have neither BSD chflags() nor Linux' flags
+ * support through ioctl().
+ */
+static int
+set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
+ mode_t mode, unsigned long set, unsigned long clear)
+{
+ (void)a; /* UNUSED */
+ (void)fd; /* UNUSED */
+ (void)name; /* UNUSED */
+ (void)mode; /* UNUSED */
+ (void)set; /* UNUSED */
+ (void)clear; /* UNUSED */
+ return (ARCHIVE_OK);
+}
+
+#endif /* __linux */
+
+#ifndef HAVE_POSIX_ACL
+/* Default empty function body to satisfy mainline code. */
+static int
+set_acls(struct archive_write_disk *a)
+{
+ (void)a; /* UNUSED */
+ return (ARCHIVE_OK);
+}
+
+#else
+
+/*
+ * XXX TODO: What about ACL types other than ACCESS and DEFAULT?
+ */
+static int
+set_acls(struct archive_write_disk *a)
+{
+ int ret;
+
+ ret = set_acl(a, a->fd, a->entry, ACL_TYPE_ACCESS,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
+ if (ret != ARCHIVE_OK)
+ return (ret);
+ ret = set_acl(a, a->fd, a->entry, ACL_TYPE_DEFAULT,
+ ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
+ return (ret);
+}
+
+
+static int
+set_acl(struct archive_write_disk *a, int fd, struct archive_entry *entry,
+ acl_type_t acl_type, int ae_requested_type, const char *tname)
+{
+ acl_t acl;
+ acl_entry_t acl_entry;
+ acl_permset_t acl_permset;
+ int ret;
+ int ae_type, ae_permset, ae_tag, ae_id;
+ uid_t ae_uid;
+ gid_t ae_gid;
+ const char *ae_name;
+ int entries;
+ const char *name;
+
+ ret = ARCHIVE_OK;
+ entries = archive_entry_acl_reset(entry, ae_requested_type);
+ if (entries == 0)
+ return (ARCHIVE_OK);
+ acl = acl_init(entries);
+ while (archive_entry_acl_next(entry, ae_requested_type, &ae_type,
+ &ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) {
+ acl_create_entry(&acl, &acl_entry);
+
+ switch (ae_tag) {
+ case ARCHIVE_ENTRY_ACL_USER:
+ acl_set_tag_type(acl_entry, ACL_USER);
+ ae_uid = a->lookup_uid(a->lookup_uid_data,
+ ae_name, ae_id);
+ acl_set_qualifier(acl_entry, &ae_uid);
+ break;
+ case ARCHIVE_ENTRY_ACL_GROUP:
+ acl_set_tag_type(acl_entry, ACL_GROUP);
+ ae_gid = a->lookup_gid(a->lookup_gid_data,
+ ae_name, ae_id);
+ acl_set_qualifier(acl_entry, &ae_gid);
+ break;
+ case ARCHIVE_ENTRY_ACL_USER_OBJ:
+ acl_set_tag_type(acl_entry, ACL_USER_OBJ);
+ break;
+ case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
+ acl_set_tag_type(acl_entry, ACL_GROUP_OBJ);
+ break;
+ case ARCHIVE_ENTRY_ACL_MASK:
+ acl_set_tag_type(acl_entry, ACL_MASK);
+ break;
+ case ARCHIVE_ENTRY_ACL_OTHER:
+ acl_set_tag_type(acl_entry, ACL_OTHER);
+ break;
+ default:
+ /* XXX */
+ break;
+ }
+
+ acl_get_permset(acl_entry, &acl_permset);
+ acl_clear_perms(acl_permset);
+ if (ae_permset & ARCHIVE_ENTRY_ACL_EXECUTE)
+ acl_add_perm(acl_permset, ACL_EXECUTE);
+ if (ae_permset & ARCHIVE_ENTRY_ACL_WRITE)
+ acl_add_perm(acl_permset, ACL_WRITE);
+ if (ae_permset & ARCHIVE_ENTRY_ACL_READ)
+ acl_add_perm(acl_permset, ACL_READ);
+ }
+
+ name = archive_entry_pathname(entry);
+
+ /* Try restoring the ACL through 'fd' if we can. */
+#if HAVE_ACL_SET_FD
+ if (fd >= 0 && acl_type == ACL_TYPE_ACCESS && acl_set_fd(fd, acl) == 0)
+ ret = ARCHIVE_OK;
+ else
+#else
+#if HAVE_ACL_SET_FD_NP
+ if (fd >= 0 && acl_set_fd_np(fd, acl, acl_type) == 0)
+ ret = ARCHIVE_OK;
+ else
+#endif
+#endif
+ if (acl_set_file(name, acl_type, acl) != 0) {
+ archive_set_error(&a->archive, errno, "Failed to set %s acl", tname);
+ ret = ARCHIVE_WARN;
+ }
+ acl_free(acl);
+ return (ret);
+}
+#endif
+
+#if HAVE_LSETXATTR
+/*
+ * Restore extended attributes - Linux implementation
+ */
+static int
+set_xattrs(struct archive_write_disk *a)
+{
+ struct archive_entry *entry = a->entry;
+ static int warning_done = 0;
+ int ret = ARCHIVE_OK;
+ int i = archive_entry_xattr_reset(entry);
+
+ while (i--) {
+ const char *name;
+ const void *value;
+ size_t size;
+ archive_entry_xattr_next(entry, &name, &value, &size);
+ if (name != NULL &&
+ strncmp(name, "xfsroot.", 8) != 0 &&
+ strncmp(name, "system.", 7) != 0) {
+ int e;
+#if HAVE_FSETXATTR
+ if (a->fd >= 0)
+ e = fsetxattr(a->fd, name, value, size, 0);
+ else
+#endif
+ {
+ e = lsetxattr(archive_entry_pathname(entry),
+ name, value, size, 0);
+ }
+ if (e == -1) {
+ if (errno == ENOTSUP) {
+ if (!warning_done) {
+ warning_done = 1;
+ archive_set_error(&a->archive, errno,
+ "Cannot restore extended "
+ "attributes on this file "
+ "system");
+ }
+ } else
+ archive_set_error(&a->archive, errno,
+ "Failed to set extended attribute");
+ ret = ARCHIVE_WARN;
+ }
+ } else {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Invalid extended attribute encountered");
+ ret = ARCHIVE_WARN;
+ }
+ }
+ return (ret);
+}
+#elif HAVE_EXTATTR_SET_FILE
+/*
+ * Restore extended attributes - FreeBSD implementation
+ */
+static int
+set_xattrs(struct archive_write_disk *a)
+{
+ struct archive_entry *entry = a->entry;
+ static int warning_done = 0;
+ int ret = ARCHIVE_OK;
+ int i = archive_entry_xattr_reset(entry);
+
+ while (i--) {
+ const char *name;
+ const void *value;
+ size_t size;
+ archive_entry_xattr_next(entry, &name, &value, &size);
+ if (name != NULL) {
+ int e;
+ int namespace;
+
+ if (strncmp(name, "user.", 5) == 0) {
+ /* "user." attributes go to user namespace */
+ name += 5;
+ namespace = EXTATTR_NAMESPACE_USER;
+ } else {
+ /* Warn about other extended attributes. */
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Can't restore extended attribute ``%s''",
+ name);
+ ret = ARCHIVE_WARN;
+ continue;
+ }
+ errno = 0;
+#if HAVE_EXTATTR_SET_FD
+ if (a->fd >= 0)
+ e = extattr_set_fd(a->fd, namespace, name, value, size);
+ else
+#endif
+ /* TODO: should we use extattr_set_link() instead? */
+ {
+ e = extattr_set_file(archive_entry_pathname(entry),
+ namespace, name, value, size);
+ }
+ if (e != (int)size) {
+ if (errno == ENOTSUP) {
+ if (!warning_done) {
+ warning_done = 1;
+ archive_set_error(&a->archive, errno,
+ "Cannot restore extended "
+ "attributes on this file "
+ "system");
+ }
+ } else {
+ archive_set_error(&a->archive, errno,
+ "Failed to set extended attribute");
+ }
+
+ ret = ARCHIVE_WARN;
+ }
+ }
+ }
+ return (ret);
+}
+#else
+/*
+ * Restore extended attributes - stub implementation for unsupported systems
+ */
+static int
+set_xattrs(struct archive_write_disk *a)
+{
+ static int warning_done = 0;
+
+ /* If there aren't any extended attributes, then it's okay not
+ * to extract them, otherwise, issue a single warning. */
+ if (archive_entry_xattr_count(a->entry) != 0 && !warning_done) {
+ warning_done = 1;
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Cannot restore extended attributes on this system");
+ return (ARCHIVE_WARN);
+ }
+ /* Warning was already emitted; suppress further warnings. */
+ return (ARCHIVE_OK);
+}
+#endif
+
+
+/*
+ * Trivial implementations of gid/uid lookup functions.
+ * These are normally overridden by the client, but these stub
+ * versions ensure that we always have something that works.
+ */
+static gid_t
+trivial_lookup_gid(void *private_data, const char *gname, gid_t gid)
+{
+ (void)private_data; /* UNUSED */
+ (void)gname; /* UNUSED */
+ return (gid);
+}
+
+static uid_t
+trivial_lookup_uid(void *private_data, const char *uname, uid_t uid)
+{
+ (void)private_data; /* UNUSED */
+ (void)uname; /* UNUSED */
+ return (uid);
+}
+
+/*
+ * Test if file on disk is older than entry.
+ */
+static int
+older(struct stat *st, struct archive_entry *entry)
+{
+ /* First, test the seconds and return if we have a definite answer. */
+ /* Definitely older. */
+ if (st->st_mtime < archive_entry_mtime(entry))
+ return (1);
+ /* Definitely younger. */
+ if (st->st_mtime > archive_entry_mtime(entry))
+ return (0);
+ /* If this platform supports fractional seconds, try those. */
+#if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
+ /* Definitely older. */
+ if (st->st_mtimespec.tv_nsec < archive_entry_mtime_nsec(entry))
+ return (1);
+#elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
+ /* Definitely older. */
+ if (st->st_mtim.tv_nsec < archive_entry_mtime_nsec(entry))
+ return (1);
+#elif HAVE_STRUCT_STAT_ST_MTIME_N
+ /* older. */
+ if (st->st_mtime_n < archive_entry_mtime_nsec(entry))
+ return (1);
+#elif HAVE_STRUCT_STAT_ST_UMTIME
+ /* older. */
+ if (st->st_umtime * 1000 < archive_entry_mtime_nsec(entry))
+ return (1);
+#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
+ /* older. */
+ if (st->st_mtime_usec * 1000 < archive_entry_mtime_nsec(entry))
+ return (1);
+#else
+ /* This system doesn't have high-res timestamps. */
+#endif
+ /* Same age or newer, so not older. */
+ return (0);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_disk_private.h b/archivers/libarchive/files/libarchive/archive_write_disk_private.h
new file mode 100644
index 00000000000..707c0cf03b2
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_disk_private.h
@@ -0,0 +1,38 @@
+/*-
+ * 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
+ * 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.
+ *
+ * $FreeBSD: head/lib/libarchive/archive_write_disk_private.h 201086 2009-12-28 02:17:53Z kientzle $
+ */
+
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
+
+#ifndef ARCHIVE_WRITE_DISK_PRIVATE_H_INCLUDED
+#define ARCHIVE_WRITE_DISK_PRIVATE_H_INCLUDED
+
+struct archive_write_disk;
+
+#endif
diff --git a/archivers/libarchive/files/libarchive/archive_write_disk_set_standard_lookup.c b/archivers/libarchive/files/libarchive/archive_write_disk_set_standard_lookup.c
new file mode 100644
index 00000000000..cfa06e84547
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_disk_set_standard_lookup.c
@@ -0,0 +1,242 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_disk_set_standard_lookup.c 201083 2009-12-28 02:09:57Z kientzle $");
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive.h"
+#include "archive_private.h"
+#include "archive_read_private.h"
+#include "archive_write_disk_private.h"
+
+struct bucket {
+ char *name;
+ int hash;
+ id_t id;
+};
+
+static const size_t cache_size = 127;
+static unsigned int hash(const char *);
+static gid_t lookup_gid(void *, const char *uname, gid_t);
+static uid_t lookup_uid(void *, const char *uname, uid_t);
+static void cleanup(void *);
+
+/*
+ * Installs functions that use getpwnam()/getgrnam()---along with
+ * a simple cache to accelerate such lookups---into the archive_write_disk
+ * object. This is in a separate file because getpwnam()/getgrnam()
+ * can pull in a LOT of library code (including NIS/LDAP functions, which
+ * pull in DNS resolveers, etc). This can easily top 500kB, which makes
+ * it inappropriate for some space-constrained applications.
+ *
+ * Applications that are size-sensitive may want to just use the
+ * real default functions (defined in archive_write_disk.c) that just
+ * use the uid/gid without the lookup. Or define your own custom functions
+ * if you prefer.
+ *
+ * TODO: Replace these hash tables with simpler move-to-front LRU
+ * lists with a bounded size (128 items?). The hash is a bit faster,
+ * but has a bad pathology in which it thrashes a single bucket. Even
+ * walking a list of 128 items is a lot faster than calling
+ * getpwnam()!
+ */
+int
+archive_write_disk_set_standard_lookup(struct archive *a)
+{
+ struct bucket *ucache = malloc(cache_size * sizeof(struct bucket));
+ struct bucket *gcache = malloc(cache_size * sizeof(struct bucket));
+ memset(ucache, 0, cache_size * sizeof(struct bucket));
+ memset(gcache, 0, cache_size * sizeof(struct bucket));
+ archive_write_disk_set_group_lookup(a, gcache, lookup_gid, cleanup);
+ archive_write_disk_set_user_lookup(a, ucache, lookup_uid, cleanup);
+ return (ARCHIVE_OK);
+}
+
+static gid_t
+lookup_gid(void *private_data, const char *gname, gid_t gid)
+{
+ int h;
+ struct bucket *b;
+ struct bucket *gcache = (struct bucket *)private_data;
+
+ /* If no gname, just use the gid provided. */
+ if (gname == NULL || *gname == '\0')
+ return (gid);
+
+ /* Try to find gname in the cache. */
+ h = hash(gname);
+ b = &gcache[h % cache_size ];
+ if (b->name != NULL && b->hash == h && strcmp(gname, b->name) == 0)
+ return ((gid_t)b->id);
+
+ /* Free the cache slot for a new entry. */
+ if (b->name != NULL)
+ free(b->name);
+ b->name = strdup(gname);
+ /* Note: If strdup fails, that's okay; we just won't cache. */
+ b->hash = h;
+#if HAVE_GRP_H
+ {
+ char _buffer[128];
+ size_t bufsize = 128;
+ char *buffer = _buffer;
+ struct group grent, *result;
+ int r;
+
+ for (;;) {
+ result = &grent; /* Old getgrnam_r ignores last arg. */
+ r = getgrnam_r(gname, &grent, buffer, bufsize, &result);
+ if (r == 0)
+ break;
+ if (r != ERANGE)
+ break;
+ bufsize *= 2;
+ if (buffer != _buffer)
+ free(buffer);
+ buffer = malloc(bufsize);
+ if (buffer == NULL)
+ break;
+ }
+ if (result != NULL)
+ gid = result->gr_gid;
+ if (buffer != _buffer)
+ free(buffer);
+ }
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+ /* TODO: do a gname->gid lookup for Windows. */
+#else
+ #error No way to perform gid lookups on this platform
+#endif
+ b->id = gid;
+
+ return (gid);
+}
+
+static uid_t
+lookup_uid(void *private_data, const char *uname, uid_t uid)
+{
+ int h;
+ struct bucket *b;
+ struct bucket *ucache = (struct bucket *)private_data;
+
+ /* If no uname, just use the uid provided. */
+ if (uname == NULL || *uname == '\0')
+ return (uid);
+
+ /* Try to find uname in the cache. */
+ h = hash(uname);
+ b = &ucache[h % cache_size ];
+ if (b->name != NULL && b->hash == h && strcmp(uname, b->name) == 0)
+ return ((uid_t)b->id);
+
+ /* Free the cache slot for a new entry. */
+ if (b->name != NULL)
+ free(b->name);
+ b->name = strdup(uname);
+ /* Note: If strdup fails, that's okay; we just won't cache. */
+ b->hash = h;
+#if HAVE_PWD_H
+ {
+ char _buffer[128];
+ size_t bufsize = 128;
+ char *buffer = _buffer;
+ struct passwd pwent, *result;
+ int r;
+
+ for (;;) {
+ result = &pwent; /* Old getpwnam_r ignores last arg. */
+ r = getpwnam_r(uname, &pwent, buffer, bufsize, &result);
+ if (r == 0)
+ break;
+ if (r != ERANGE)
+ break;
+ bufsize *= 2;
+ if (buffer != _buffer)
+ free(buffer);
+ buffer = malloc(bufsize);
+ if (buffer == NULL)
+ break;
+ }
+ if (result != NULL)
+ uid = result->pw_uid;
+ if (buffer != _buffer)
+ free(buffer);
+ }
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+ /* TODO: do a uname->uid lookup for Windows. */
+#else
+ #error No way to look up uids on this platform
+#endif
+ b->id = uid;
+
+ return (uid);
+}
+
+static void
+cleanup(void *private)
+{
+ size_t i;
+ struct bucket *cache = (struct bucket *)private;
+
+ for (i = 0; i < cache_size; i++)
+ free(cache[i].name);
+ free(cache);
+}
+
+
+static unsigned int
+hash(const char *p)
+{
+ /* A 32-bit version of Peter Weinberger's (PJW) hash algorithm,
+ as used by ELF for hashing function names. */
+ unsigned g, h = 0;
+ while (*p != '\0') {
+ h = (h << 4) + *p++;
+ if ((g = h & 0xF0000000) != 0) {
+ h ^= g >> 24;
+ h &= 0x0FFFFFFF;
+ }
+ }
+ return h;
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_open_fd.c b/archivers/libarchive/files/libarchive/archive_write_open_fd.c
new file mode 100644
index 00000000000..3a60398710b
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_open_fd.c
@@ -0,0 +1,141 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_open_fd.c 201093 2009-12-28 02:28:44Z kientzle $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "archive.h"
+
+struct write_fd_data {
+ off_t offset;
+ int fd;
+};
+
+static int file_close(struct archive *, void *);
+static int file_open(struct archive *, void *);
+static ssize_t file_write(struct archive *, void *, const void *buff, size_t);
+
+int
+archive_write_open_fd(struct archive *a, int fd)
+{
+ struct write_fd_data *mine;
+
+ mine = (struct write_fd_data *)malloc(sizeof(*mine));
+ if (mine == NULL) {
+ archive_set_error(a, ENOMEM, "No memory");
+ return (ARCHIVE_FATAL);
+ }
+ mine->fd = fd;
+#if defined(__CYGWIN__) || defined(_WIN32)
+ setmode(mine->fd, O_BINARY);
+#endif
+ return (archive_write_open(a, mine,
+ file_open, file_write, file_close));
+}
+
+static int
+file_open(struct archive *a, void *client_data)
+{
+ struct write_fd_data *mine;
+ struct stat st;
+
+ mine = (struct write_fd_data *)client_data;
+
+ if (fstat(mine->fd, &st) != 0) {
+ archive_set_error(a, errno, "Couldn't stat fd %d", mine->fd);
+ return (ARCHIVE_FATAL);
+ }
+
+ /*
+ * If this is a regular file, don't add it to itself.
+ */
+ if (S_ISREG(st.st_mode))
+ archive_write_set_skip_file(a, st.st_dev, st.st_ino);
+
+ /*
+ * If client hasn't explicitly set the last block handling,
+ * then set it here.
+ */
+ if (archive_write_get_bytes_in_last_block(a) < 0) {
+ /* If the output is a block or character device, fifo,
+ * or stdout, pad the last block, otherwise leave it
+ * unpadded. */
+ if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode) ||
+ S_ISFIFO(st.st_mode) || (mine->fd == 1))
+ /* Last block will be fully padded. */
+ archive_write_set_bytes_in_last_block(a, 0);
+ else
+ archive_write_set_bytes_in_last_block(a, 1);
+ }
+
+ return (ARCHIVE_OK);
+}
+
+static ssize_t
+file_write(struct archive *a, void *client_data, const void *buff, size_t length)
+{
+ struct write_fd_data *mine;
+ ssize_t bytesWritten;
+
+ mine = (struct write_fd_data *)client_data;
+ bytesWritten = write(mine->fd, buff, length);
+ if (bytesWritten <= 0) {
+ archive_set_error(a, errno, "Write error");
+ return (-1);
+ }
+ return (bytesWritten);
+}
+
+static int
+file_close(struct archive *a, void *client_data)
+{
+ struct write_fd_data *mine = (struct write_fd_data *)client_data;
+
+ (void)a; /* UNUSED */
+ free(mine);
+ return (ARCHIVE_OK);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_open_file.c b/archivers/libarchive/files/libarchive/archive_write_open_file.c
new file mode 100644
index 00000000000..5c0c737f858
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_open_file.c
@@ -0,0 +1,105 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_open_file.c,v 1.19 2007/01/09 08:05:56 kientzle Exp $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "archive.h"
+
+struct write_FILE_data {
+ FILE *f;
+};
+
+static int file_close(struct archive *, void *);
+static int file_open(struct archive *, void *);
+static ssize_t file_write(struct archive *, void *, const void *buff, size_t);
+
+int
+archive_write_open_FILE(struct archive *a, FILE *f)
+{
+ struct write_FILE_data *mine;
+
+ mine = (struct write_FILE_data *)malloc(sizeof(*mine));
+ if (mine == NULL) {
+ archive_set_error(a, ENOMEM, "No memory");
+ return (ARCHIVE_FATAL);
+ }
+ mine->f = f;
+ return (archive_write_open(a, mine,
+ file_open, file_write, file_close));
+}
+
+static int
+file_open(struct archive *a, void *client_data)
+{
+ (void)a; /* UNUSED */
+ (void)client_data; /* UNUSED */
+
+ return (ARCHIVE_OK);
+}
+
+static ssize_t
+file_write(struct archive *a, void *client_data, const void *buff, size_t length)
+{
+ struct write_FILE_data *mine;
+ size_t bytesWritten;
+
+ mine = client_data;
+ bytesWritten = fwrite(buff, 1, length, mine->f);
+ if (bytesWritten < length) {
+ archive_set_error(a, errno, "Write error");
+ return (-1);
+ }
+ return (bytesWritten);
+}
+
+static int
+file_close(struct archive *a, void *client_data)
+{
+ struct write_FILE_data *mine = client_data;
+
+ (void)a; /* UNUSED */
+ free(mine);
+ return (ARCHIVE_OK);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_open_filename.c b/archivers/libarchive/files/libarchive/archive_write_open_filename.c
new file mode 100644
index 00000000000..6a9c77816fd
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_open_filename.c
@@ -0,0 +1,162 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_open_filename.c 191165 2009-04-17 00:39:35Z kientzle $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "archive.h"
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+struct write_file_data {
+ int fd;
+ char filename[1];
+};
+
+static int file_close(struct archive *, void *);
+static int file_open(struct archive *, void *);
+static ssize_t file_write(struct archive *, void *, const void *buff, size_t);
+
+int
+archive_write_open_file(struct archive *a, const char *filename)
+{
+ return (archive_write_open_filename(a, filename));
+}
+
+int
+archive_write_open_filename(struct archive *a, const char *filename)
+{
+ struct write_file_data *mine;
+
+ if (filename == NULL || filename[0] == '\0')
+ return (archive_write_open_fd(a, 1));
+
+ mine = (struct write_file_data *)malloc(sizeof(*mine) + strlen(filename));
+ if (mine == NULL) {
+ archive_set_error(a, ENOMEM, "No memory");
+ return (ARCHIVE_FATAL);
+ }
+ strcpy(mine->filename, filename);
+ mine->fd = -1;
+ return (archive_write_open(a, mine,
+ file_open, file_write, file_close));
+}
+
+static int
+file_open(struct archive *a, void *client_data)
+{
+ int flags;
+ struct write_file_data *mine;
+ struct stat st;
+
+ mine = (struct write_file_data *)client_data;
+ flags = O_WRONLY | O_CREAT | O_TRUNC | O_BINARY;
+
+ /*
+ * Open the file.
+ */
+ mine->fd = open(mine->filename, flags, 0666);
+ if (mine->fd < 0) {
+ archive_set_error(a, errno, "Failed to open '%s'",
+ mine->filename);
+ return (ARCHIVE_FATAL);
+ }
+
+ if (fstat(mine->fd, &st) != 0) {
+ archive_set_error(a, errno, "Couldn't stat '%s'",
+ mine->filename);
+ return (ARCHIVE_FATAL);
+ }
+
+ /*
+ * Set up default last block handling.
+ */
+ if (archive_write_get_bytes_in_last_block(a) < 0) {
+ if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode) ||
+ S_ISFIFO(st.st_mode))
+ /* Pad last block when writing to device or FIFO. */
+ archive_write_set_bytes_in_last_block(a, 0);
+ else
+ /* Don't pad last block otherwise. */
+ archive_write_set_bytes_in_last_block(a, 1);
+ }
+
+ /*
+ * If the output file is a regular file, don't add it to
+ * itself. If it's a device file, it's okay to add the device
+ * entry to the output archive.
+ */
+ if (S_ISREG(st.st_mode))
+ archive_write_set_skip_file(a, st.st_dev, st.st_ino);
+
+ return (ARCHIVE_OK);
+}
+
+static ssize_t
+file_write(struct archive *a, void *client_data, const void *buff, size_t length)
+{
+ struct write_file_data *mine;
+ ssize_t bytesWritten;
+
+ mine = (struct write_file_data *)client_data;
+ bytesWritten = write(mine->fd, buff, length);
+ if (bytesWritten <= 0) {
+ archive_set_error(a, errno, "Write error");
+ return (-1);
+ }
+ return (bytesWritten);
+}
+
+static int
+file_close(struct archive *a, void *client_data)
+{
+ struct write_file_data *mine = (struct write_file_data *)client_data;
+
+ (void)a; /* UNUSED */
+ close(mine->fd);
+ free(mine);
+ return (ARCHIVE_OK);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_open_memory.c b/archivers/libarchive/files/libarchive/archive_write_open_memory.c
new file mode 100644
index 00000000000..d235ca01dc8
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_open_memory.c
@@ -0,0 +1,126 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: src/lib/libarchive/archive_write_open_memory.c,v 1.3 2007/01/09 08:05:56 kientzle Exp $");
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "archive.h"
+
+/*
+ * This is a little tricky. I used to allow the
+ * compression handling layer to fork the compressor,
+ * which means this write function gets invoked in
+ * a separate process. That would, of course, make it impossible
+ * to actually use the data stored into memory here.
+ * Fortunately, none of the compressors fork today and
+ * I'm reluctant to use that route in the future but, if
+ * forking compressors ever do reappear, this will have
+ * to get a lot more complicated.
+ */
+
+struct write_memory_data {
+ size_t used;
+ size_t size;
+ size_t * client_size;
+ unsigned char * buff;
+};
+
+static int memory_write_close(struct archive *, void *);
+static int memory_write_open(struct archive *, void *);
+static ssize_t memory_write(struct archive *, void *, const void *buff, size_t);
+
+/*
+ * Client provides a pointer to a block of memory to receive
+ * the data. The 'size' param both tells us the size of the
+ * client buffer and lets us tell the client the final size.
+ */
+int
+archive_write_open_memory(struct archive *a, void *buff, size_t buffSize, size_t *used)
+{
+ struct write_memory_data *mine;
+
+ mine = (struct write_memory_data *)malloc(sizeof(*mine));
+ if (mine == NULL) {
+ archive_set_error(a, ENOMEM, "No memory");
+ return (ARCHIVE_FATAL);
+ }
+ memset(mine, 0, sizeof(*mine));
+ mine->buff = buff;
+ mine->size = buffSize;
+ mine->client_size = used;
+ return (archive_write_open(a, mine,
+ memory_write_open, memory_write, memory_write_close));
+}
+
+static int
+memory_write_open(struct archive *a, void *client_data)
+{
+ struct write_memory_data *mine;
+ mine = client_data;
+ mine->used = 0;
+ if (mine->client_size != NULL)
+ *mine->client_size = mine->used;
+ /* Disable padding if it hasn't been set explicitly. */
+ if (-1 == archive_write_get_bytes_in_last_block(a))
+ archive_write_set_bytes_in_last_block(a, 1);
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Copy the data into the client buffer.
+ * Note that we update mine->client_size on every write.
+ * In particular, this means the client can follow exactly
+ * how much has been written into their buffer at any time.
+ */
+static ssize_t
+memory_write(struct archive *a, void *client_data, const void *buff, size_t length)
+{
+ struct write_memory_data *mine;
+ mine = client_data;
+
+ if (mine->used + length > mine->size) {
+ archive_set_error(a, ENOMEM, "Buffer exhausted");
+ return (ARCHIVE_FATAL);
+ }
+ memcpy(mine->buff + mine->used, buff, length);
+ mine->used += length;
+ if (mine->client_size != NULL)
+ *mine->client_size = mine->used;
+ return (length);
+}
+
+static int
+memory_write_close(struct archive *a, void *client_data)
+{
+ struct write_memory_data *mine;
+ (void)a; /* UNUSED */
+ mine = client_data;
+ free(mine);
+ return (ARCHIVE_OK);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_private.h b/archivers/libarchive/files/libarchive/archive_write_private.h
new file mode 100644
index 00000000000..f9b656555b3
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_private.h
@@ -0,0 +1,122 @@
+/*-
+ * 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: head/lib/libarchive/archive_write_private.h 201155 2009-12-29 05:20:12Z kientzle $
+ */
+
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
+
+#ifndef ARCHIVE_WRITE_PRIVATE_H_INCLUDED
+#define ARCHIVE_WRITE_PRIVATE_H_INCLUDED
+
+#include "archive.h"
+#include "archive_string.h"
+#include "archive_private.h"
+
+struct archive_write {
+ struct archive archive;
+
+ /* Dev/ino of the archive being written. */
+ dev_t skip_file_dev;
+ int64_t skip_file_ino;
+
+ /* Utility: Pointer to a block of nulls. */
+ const unsigned char *nulls;
+ size_t null_length;
+
+ /* Callbacks to open/read/write/close archive stream. */
+ archive_open_callback *client_opener;
+ archive_write_callback *client_writer;
+ archive_close_callback *client_closer;
+ void *client_data;
+
+ /*
+ * Blocking information. Note that bytes_in_last_block is
+ * misleadingly named; I should find a better name. These
+ * control the final output from all compressors, including
+ * compression_none.
+ */
+ int bytes_per_block;
+ int bytes_in_last_block;
+
+ /*
+ * These control whether data within a gzip/bzip2 compressed
+ * stream gets padded or not. If pad_uncompressed is set,
+ * the data will be padded to a full block before being
+ * compressed. The pad_uncompressed_byte determines the value
+ * that will be used for padding. Note that these have no
+ * effect on compression "none."
+ */
+ int pad_uncompressed;
+ int pad_uncompressed_byte; /* TODO: Support this. */
+
+ /*
+ * On write, the client just invokes an archive_write_set function
+ * which sets up the data here directly.
+ */
+ struct {
+ void *data;
+ void *config;
+ int (*init)(struct archive_write *);
+ int (*options)(struct archive_write *,
+ const char *key, const char *value);
+ int (*finish)(struct archive_write *);
+ int (*write)(struct archive_write *, const void *, size_t);
+ } compressor;
+
+ /*
+ * Pointers to format-specific functions for writing. They're
+ * initialized by archive_write_set_format_XXX() calls.
+ */
+ void *format_data;
+ const char *format_name;
+ int (*format_init)(struct archive_write *);
+ int (*format_options)(struct archive_write *,
+ const char *key, const char *value);
+ int (*format_finish)(struct archive_write *);
+ int (*format_destroy)(struct archive_write *);
+ int (*format_finish_entry)(struct archive_write *);
+ int (*format_write_header)(struct archive_write *,
+ struct archive_entry *);
+ ssize_t (*format_write_data)(struct archive_write *,
+ const void *buff, size_t);
+};
+
+/*
+ * Utility function to format a USTAR header into a buffer. If
+ * "strict" is set, this tries to create the absolutely most portable
+ * version of a ustar header. If "strict" is set to 0, then it will
+ * relax certain requirements.
+ *
+ * Generally, format-specific declarations don't belong in this
+ * header; this is a rare example of a function that is shared by
+ * two very similar formats (ustar and pax).
+ */
+int
+__archive_write_format_header_ustar(struct archive_write *, char buff[512],
+ struct archive_entry *, int tartype, int strict);
+
+#endif
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_compression_bzip2.c b/archivers/libarchive/files/libarchive/archive_write_set_compression_bzip2.c
new file mode 100644
index 00000000000..beb2379e5e4
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_set_compression_bzip2.c
@@ -0,0 +1,408 @@
+/*-
+ * 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 "archive_platform.h"
+
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_compression_bzip2.c 201091 2009-12-28 02:22:41Z kientzle $");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_BZLIB_H
+#include <bzlib.h>
+#endif
+
+#include "archive.h"
+#include "archive_private.h"
+#include "archive_write_private.h"
+
+#ifndef HAVE_BZLIB_H
+int
+archive_write_set_compression_bzip2(struct archive *a)
+{
+ archive_set_error(a, ARCHIVE_ERRNO_MISC,
+ "bzip2 compression not supported on this platform");
+ return (ARCHIVE_FATAL);
+}
+#else
+/* Don't compile this if we don't have bzlib. */
+
+struct private_data {
+ bz_stream stream;
+ int64_t total_in;
+ char *compressed;
+ size_t compressed_buffer_size;
+};
+
+struct private_config {
+ int compression_level;
+};
+
+/*
+ * Yuck. bzlib.h is not const-correct, so I need this one bit
+ * of ugly hackery to convert a const * pointer to a non-const pointer.
+ */
+#define SET_NEXT_IN(st,src) \
+ (st)->stream.next_in = (char *)(uintptr_t)(const void *)(src)
+
+static int archive_compressor_bzip2_finish(struct archive_write *);
+static int archive_compressor_bzip2_init(struct archive_write *);
+static int archive_compressor_bzip2_options(struct archive_write *,
+ const char *, const char *);
+static int archive_compressor_bzip2_write(struct archive_write *,
+ const void *, size_t);
+static int drive_compressor(struct archive_write *, struct private_data *,
+ int finishing);
+
+/*
+ * Allocate, initialize and return an archive object.
+ */
+int
+archive_write_set_compression_bzip2(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ struct private_config *config;
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_write_set_compression_bzip2");
+ config = malloc(sizeof(*config));
+ if (config == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Out of memory");
+ return (ARCHIVE_FATAL);
+ }
+ a->compressor.config = config;
+ a->compressor.finish = archive_compressor_bzip2_finish;
+ config->compression_level = 9; /* default */
+ a->compressor.init = &archive_compressor_bzip2_init;
+ a->compressor.options = &archive_compressor_bzip2_options;
+ a->archive.compression_code = ARCHIVE_COMPRESSION_BZIP2;
+ a->archive.compression_name = "bzip2";
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Setup callback.
+ */
+static int
+archive_compressor_bzip2_init(struct archive_write *a)
+{
+ int ret;
+ struct private_data *state;
+ struct private_config *config;
+
+ config = (struct private_config *)a->compressor.config;
+ if (a->client_opener != NULL) {
+ ret = (a->client_opener)(&a->archive, a->client_data);
+ if (ret != 0)
+ return (ret);
+ }
+
+ state = (struct private_data *)malloc(sizeof(*state));
+ if (state == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate data for compression");
+ return (ARCHIVE_FATAL);
+ }
+ memset(state, 0, sizeof(*state));
+
+ state->compressed_buffer_size = a->bytes_per_block;
+ state->compressed = (char *)malloc(state->compressed_buffer_size);
+
+ if (state->compressed == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate data for compression buffer");
+ free(state);
+ return (ARCHIVE_FATAL);
+ }
+
+ state->stream.next_out = state->compressed;
+ state->stream.avail_out = state->compressed_buffer_size;
+ a->compressor.write = archive_compressor_bzip2_write;
+
+ /* Initialize compression library */
+ ret = BZ2_bzCompressInit(&(state->stream),
+ config->compression_level, 0, 30);
+ if (ret == BZ_OK) {
+ a->compressor.data = state;
+ return (ARCHIVE_OK);
+ }
+
+ /* Library setup failed: clean up. */
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Internal error initializing compression library");
+ free(state->compressed);
+ free(state);
+
+ /* Override the error message if we know what really went wrong. */
+ switch (ret) {
+ case BZ_PARAM_ERROR:
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Internal error initializing compression library: "
+ "invalid setup parameter");
+ break;
+ case BZ_MEM_ERROR:
+ archive_set_error(&a->archive, ENOMEM,
+ "Internal error initializing compression library: "
+ "out of memory");
+ break;
+ case BZ_CONFIG_ERROR:
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Internal error initializing compression library: "
+ "mis-compiled library");
+ break;
+ }
+
+ return (ARCHIVE_FATAL);
+
+}
+
+/*
+ * Set write options.
+ */
+static int
+archive_compressor_bzip2_options(struct archive_write *a, const char *key,
+ const char *value)
+{
+ struct private_config *config;
+
+ config = (struct private_config *)a->compressor.config;
+ if (strcmp(key, "compression-level") == 0) {
+ if (value == NULL || !(value[0] >= '0' && value[0] <= '9') ||
+ value[1] != '\0')
+ return (ARCHIVE_WARN);
+ config->compression_level = value[0] - '0';
+ /* Make '0' be a synonym for '1'. */
+ /* This way, bzip2 compressor supports the same 0..9
+ * range of levels as gzip. */
+ if (config->compression_level < 1)
+ config->compression_level = 1;
+ return (ARCHIVE_OK);
+ }
+
+ return (ARCHIVE_WARN);
+}
+
+/*
+ * Write data to the compressed stream.
+ *
+ * Returns ARCHIVE_OK if all data written, error otherwise.
+ */
+static int
+archive_compressor_bzip2_write(struct archive_write *a, const void *buff,
+ size_t length)
+{
+ struct private_data *state;
+
+ state = (struct private_data *)a->compressor.data;
+ if (a->client_writer == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
+ "No write callback is registered? "
+ "This is probably an internal programming error.");
+ return (ARCHIVE_FATAL);
+ }
+
+ /* Update statistics */
+ state->total_in += length;
+
+ /* Compress input data to output buffer */
+ SET_NEXT_IN(state, buff);
+ state->stream.avail_in = length;
+ if (drive_compressor(a, state, 0))
+ return (ARCHIVE_FATAL);
+ a->archive.file_position += length;
+ return (ARCHIVE_OK);
+}
+
+
+/*
+ * Finish the compression.
+ */
+static int
+archive_compressor_bzip2_finish(struct archive_write *a)
+{
+ ssize_t block_length;
+ int ret;
+ struct private_data *state;
+ ssize_t target_block_length;
+ ssize_t bytes_written;
+ unsigned tocopy;
+
+ ret = ARCHIVE_OK;
+ state = (struct private_data *)a->compressor.data;
+ if (state != NULL) {
+ if (a->client_writer == NULL) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_PROGRAMMER,
+ "No write callback is registered?\n"
+ "This is probably an internal programming error.");
+ ret = ARCHIVE_FATAL;
+ goto cleanup;
+ }
+
+ /* By default, always pad the uncompressed data. */
+ if (a->pad_uncompressed) {
+ tocopy = a->bytes_per_block -
+ (state->total_in % a->bytes_per_block);
+ while (tocopy > 0 && tocopy < (unsigned)a->bytes_per_block) {
+ SET_NEXT_IN(state, a->nulls);
+ state->stream.avail_in = tocopy < a->null_length ?
+ tocopy : a->null_length;
+ state->total_in += state->stream.avail_in;
+ tocopy -= state->stream.avail_in;
+ ret = drive_compressor(a, state, 0);
+ if (ret != ARCHIVE_OK)
+ goto cleanup;
+ }
+ }
+
+ /* Finish compression cycle. */
+ if ((ret = drive_compressor(a, state, 1)))
+ goto cleanup;
+
+ /* Optionally, pad the final compressed block. */
+ block_length = state->stream.next_out - state->compressed;
+
+ /* Tricky calculation to determine size of last block. */
+ if (a->bytes_in_last_block <= 0)
+ /* Default or Zero: pad to full block */
+ target_block_length = a->bytes_per_block;
+ else
+ /* Round length to next multiple of bytes_in_last_block. */
+ target_block_length = a->bytes_in_last_block *
+ ( (block_length + a->bytes_in_last_block - 1) /
+ a->bytes_in_last_block);
+ if (target_block_length > a->bytes_per_block)
+ target_block_length = a->bytes_per_block;
+ if (block_length < target_block_length) {
+ memset(state->stream.next_out, 0,
+ target_block_length - block_length);
+ block_length = target_block_length;
+ }
+
+ /* Write the last block */
+ bytes_written = (a->client_writer)(&a->archive, a->client_data,
+ state->compressed, block_length);
+
+ /* TODO: Handle short write of final block. */
+ if (bytes_written <= 0)
+ ret = ARCHIVE_FATAL;
+ else {
+ a->archive.raw_position += ret;
+ ret = ARCHIVE_OK;
+ }
+
+ /* Cleanup: shut down compressor, release memory, etc. */
+cleanup:
+ switch (BZ2_bzCompressEnd(&(state->stream))) {
+ case BZ_OK:
+ break;
+ default:
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
+ "Failed to clean up compressor");
+ ret = ARCHIVE_FATAL;
+ }
+
+ free(state->compressed);
+ free(state);
+ }
+ /* Free configuration data even if we were never fully initialized. */
+ free(a->compressor.config);
+ a->compressor.config = NULL;
+ return (ret);
+}
+
+/*
+ * Utility function to push input data through compressor, writing
+ * full output blocks as necessary.
+ *
+ * Note that this handles both the regular write case (finishing ==
+ * false) and the end-of-archive case (finishing == true).
+ */
+static int
+drive_compressor(struct archive_write *a, struct private_data *state, int finishing)
+{
+ ssize_t bytes_written;
+ int ret;
+
+ for (;;) {
+ if (state->stream.avail_out == 0) {
+ bytes_written = (a->client_writer)(&a->archive,
+ a->client_data, state->compressed,
+ state->compressed_buffer_size);
+ if (bytes_written <= 0) {
+ /* TODO: Handle this write failure */
+ return (ARCHIVE_FATAL);
+ } else if ((size_t)bytes_written < state->compressed_buffer_size) {
+ /* Short write: Move remainder to
+ * front and keep filling */
+ memmove(state->compressed,
+ state->compressed + bytes_written,
+ state->compressed_buffer_size - bytes_written);
+ }
+
+ a->archive.raw_position += bytes_written;
+ state->stream.next_out = state->compressed +
+ state->compressed_buffer_size - bytes_written;
+ state->stream.avail_out = bytes_written;
+ }
+
+ /* If there's nothing to do, we're done. */
+ if (!finishing && state->stream.avail_in == 0)
+ return (ARCHIVE_OK);
+
+ ret = BZ2_bzCompress(&(state->stream),
+ finishing ? BZ_FINISH : BZ_RUN);
+
+ switch (ret) {
+ case BZ_RUN_OK:
+ /* In non-finishing case, did compressor
+ * consume everything? */
+ if (!finishing && state->stream.avail_in == 0)
+ return (ARCHIVE_OK);
+ break;
+ case BZ_FINISH_OK: /* Finishing: There's more work to do */
+ break;
+ case BZ_STREAM_END: /* Finishing: all done */
+ /* Only occurs in finishing case */
+ return (ARCHIVE_OK);
+ default:
+ /* Any other return value indicates an error */
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_PROGRAMMER,
+ "Bzip2 compression failed;"
+ " BZ2_bzCompress() returned %d",
+ ret);
+ return (ARCHIVE_FATAL);
+ }
+ }
+}
+
+#endif /* HAVE_BZLIB_H */
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_compression_compress.c b/archivers/libarchive/files/libarchive/archive_write_set_compression_compress.c
new file mode 100644
index 00000000000..77c73ee5f27
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_set_compression_compress.c
@@ -0,0 +1,492 @@
+/*-
+ * Copyright (c) 2008 Joerg Sonnenberger
+ * 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.
+ */
+
+/*-
+ * Copyright (c) 1985, 1986, 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Diomidis Spinellis and James A. Woods, derived from original
+ * work by Spencer Thomas and Joseph Orost.
+ *
+ * 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.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+ */
+
+#include "archive_platform.h"
+
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_compression_compress.c 201111 2009-12-28 03:33:05Z kientzle $");
+
+#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 "archive.h"
+#include "archive_private.h"
+#include "archive_write_private.h"
+
+#define HSIZE 69001 /* 95% occupancy */
+#define HSHIFT 8 /* 8 - trunc(log2(HSIZE / 65536)) */
+#define CHECK_GAP 10000 /* Ratio check interval. */
+
+#define MAXCODE(bits) ((1 << (bits)) - 1)
+
+/*
+ * the next two codes should not be changed lightly, as they must not
+ * lie within the contiguous general code space.
+ */
+#define FIRST 257 /* First free entry. */
+#define CLEAR 256 /* Table clear output code. */
+
+struct private_data {
+ off_t in_count, out_count, checkpoint;
+
+ int code_len; /* Number of bits/code. */
+ int cur_maxcode; /* Maximum code, given n_bits. */
+ int max_maxcode; /* Should NEVER generate this code. */
+ int hashtab [HSIZE];
+ unsigned short codetab [HSIZE];
+ int first_free; /* First unused entry. */
+ int compress_ratio;
+
+ int cur_code, cur_fcode;
+
+ int bit_offset;
+ unsigned char bit_buf;
+
+ unsigned char *compressed;
+ size_t compressed_buffer_size;
+ size_t compressed_offset;
+};
+
+static int archive_compressor_compress_finish(struct archive_write *);
+static int archive_compressor_compress_init(struct archive_write *);
+static int archive_compressor_compress_write(struct archive_write *,
+ const void *, size_t);
+
+/*
+ * Allocate, initialize and return a archive object.
+ */
+int
+archive_write_set_compression_compress(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_write_set_compression_compress");
+ a->compressor.init = &archive_compressor_compress_init;
+ a->archive.compression_code = ARCHIVE_COMPRESSION_COMPRESS;
+ a->archive.compression_name = "compress";
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Setup callback.
+ */
+static int
+archive_compressor_compress_init(struct archive_write *a)
+{
+ int ret;
+ struct private_data *state;
+
+ a->archive.compression_code = ARCHIVE_COMPRESSION_COMPRESS;
+ a->archive.compression_name = "compress";
+
+ if (a->bytes_per_block < 4) {
+ archive_set_error(&a->archive, EINVAL,
+ "Can't write Compress header as single block");
+ return (ARCHIVE_FATAL);
+ }
+
+ if (a->client_opener != NULL) {
+ ret = (a->client_opener)(&a->archive, a->client_data);
+ if (ret != ARCHIVE_OK)
+ return (ret);
+ }
+
+ state = (struct private_data *)malloc(sizeof(*state));
+ if (state == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate data for compression");
+ return (ARCHIVE_FATAL);
+ }
+ memset(state, 0, sizeof(*state));
+
+ state->compressed_buffer_size = a->bytes_per_block;
+ state->compressed = malloc(state->compressed_buffer_size);
+
+ if (state->compressed == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate data for compression buffer");
+ free(state);
+ return (ARCHIVE_FATAL);
+ }
+
+ a->compressor.write = archive_compressor_compress_write;
+ a->compressor.finish = archive_compressor_compress_finish;
+
+ state->max_maxcode = 0x10000; /* Should NEVER generate this code. */
+ state->in_count = 0; /* Length of input. */
+ state->bit_buf = 0;
+ state->bit_offset = 0;
+ state->out_count = 3; /* Includes 3-byte header mojo. */
+ state->compress_ratio = 0;
+ state->checkpoint = CHECK_GAP;
+ state->code_len = 9;
+ state->cur_maxcode = MAXCODE(state->code_len);
+ state->first_free = FIRST;
+
+ memset(state->hashtab, 0xff, sizeof(state->hashtab));
+
+ /* Prime output buffer with a gzip header. */
+ state->compressed[0] = 0x1f; /* Compress */
+ state->compressed[1] = 0x9d;
+ state->compressed[2] = 0x90; /* Block mode, 16bit max */
+ state->compressed_offset = 3;
+
+ a->compressor.data = state;
+ return (0);
+}
+
+/*-
+ * Output the given code.
+ * Inputs:
+ * code: A n_bits-bit integer. If == -1, then EOF. This assumes
+ * that n_bits =< (long)wordsize - 1.
+ * Outputs:
+ * Outputs code to the file.
+ * Assumptions:
+ * Chars are 8 bits long.
+ * Algorithm:
+ * Maintain a BITS character long buffer (so that 8 codes will
+ * fit in it exactly). Use the VAX insv instruction to insert each
+ * code in turn. When the buffer fills up empty it and start over.
+ */
+
+static unsigned char rmask[9] =
+ {0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff};
+
+static int
+output_byte(struct archive_write *a, unsigned char c)
+{
+ struct private_data *state = a->compressor.data;
+ ssize_t bytes_written;
+
+ state->compressed[state->compressed_offset++] = c;
+ ++state->out_count;
+
+ if (state->compressed_buffer_size == state->compressed_offset) {
+ bytes_written = (a->client_writer)(&a->archive,
+ a->client_data,
+ state->compressed, state->compressed_buffer_size);
+ if (bytes_written <= 0)
+ return ARCHIVE_FATAL;
+ a->archive.raw_position += bytes_written;
+ state->compressed_offset = 0;
+ }
+
+ return ARCHIVE_OK;
+}
+
+static int
+output_code(struct archive_write *a, int ocode)
+{
+ struct private_data *state = a->compressor.data;
+ int bits, ret, clear_flg, bit_offset;
+
+ clear_flg = ocode == CLEAR;
+
+ /*
+ * Since ocode is always >= 8 bits, only need to mask the first
+ * hunk on the left.
+ */
+ bit_offset = state->bit_offset % 8;
+ state->bit_buf |= (ocode << bit_offset) & 0xff;
+ output_byte(a, state->bit_buf);
+
+ bits = state->code_len - (8 - bit_offset);
+ ocode >>= 8 - bit_offset;
+ /* Get any 8 bit parts in the middle (<=1 for up to 16 bits). */
+ if (bits >= 8) {
+ output_byte(a, ocode & 0xff);
+ ocode >>= 8;
+ bits -= 8;
+ }
+ /* Last bits. */
+ state->bit_offset += state->code_len;
+ state->bit_buf = ocode & rmask[bits];
+ if (state->bit_offset == state->code_len * 8)
+ state->bit_offset = 0;
+
+ /*
+ * If the next entry is going to be too big for the ocode size,
+ * then increase it, if possible.
+ */
+ if (clear_flg || state->first_free > state->cur_maxcode) {
+ /*
+ * Write the whole buffer, because the input side won't
+ * discover the size increase until after it has read it.
+ */
+ if (state->bit_offset > 0) {
+ while (state->bit_offset < state->code_len * 8) {
+ ret = output_byte(a, state->bit_buf);
+ if (ret != ARCHIVE_OK)
+ return ret;
+ state->bit_offset += 8;
+ state->bit_buf = 0;
+ }
+ }
+ state->bit_buf = 0;
+ state->bit_offset = 0;
+
+ if (clear_flg) {
+ state->code_len = 9;
+ state->cur_maxcode = MAXCODE(state->code_len);
+ } else {
+ state->code_len++;
+ if (state->code_len == 16)
+ state->cur_maxcode = state->max_maxcode;
+ else
+ state->cur_maxcode = MAXCODE(state->code_len);
+ }
+ }
+
+ return (ARCHIVE_OK);
+}
+
+static int
+output_flush(struct archive_write *a)
+{
+ struct private_data *state = a->compressor.data;
+ int ret;
+
+ /* At EOF, write the rest of the buffer. */
+ if (state->bit_offset % 8) {
+ state->code_len = (state->bit_offset % 8 + 7) / 8;
+ ret = output_byte(a, state->bit_buf);
+ if (ret != ARCHIVE_OK)
+ return ret;
+ }
+
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Write data to the compressed stream.
+ */
+static int
+archive_compressor_compress_write(struct archive_write *a, const void *buff,
+ size_t length)
+{
+ struct private_data *state;
+ int i;
+ int ratio;
+ int c, disp, ret;
+ const unsigned char *bp;
+
+ state = (struct private_data *)a->compressor.data;
+ if (a->client_writer == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
+ "No write callback is registered? "
+ "This is probably an internal programming error.");
+ return (ARCHIVE_FATAL);
+ }
+
+ if (length == 0)
+ return ARCHIVE_OK;
+
+ bp = buff;
+
+ if (state->in_count == 0) {
+ state->cur_code = *bp++;
+ ++state->in_count;
+ --length;
+ }
+
+ while (length--) {
+ c = *bp++;
+ state->in_count++;
+ state->cur_fcode = (c << 16) + state->cur_code;
+ i = ((c << HSHIFT) ^ state->cur_code); /* Xor hashing. */
+
+ if (state->hashtab[i] == state->cur_fcode) {
+ state->cur_code = state->codetab[i];
+ continue;
+ }
+ if (state->hashtab[i] < 0) /* Empty slot. */
+ goto nomatch;
+ /* Secondary hash (after G. Knott). */
+ if (i == 0)
+ disp = 1;
+ else
+ disp = HSIZE - i;
+ probe:
+ if ((i -= disp) < 0)
+ i += HSIZE;
+
+ if (state->hashtab[i] == state->cur_fcode) {
+ state->cur_code = state->codetab[i];
+ continue;
+ }
+ if (state->hashtab[i] >= 0)
+ goto probe;
+ nomatch:
+ ret = output_code(a, state->cur_code);
+ if (ret != ARCHIVE_OK)
+ return ret;
+ state->cur_code = c;
+ if (state->first_free < state->max_maxcode) {
+ state->codetab[i] = state->first_free++; /* code -> hashtable */
+ state->hashtab[i] = state->cur_fcode;
+ continue;
+ }
+ if (state->in_count < state->checkpoint)
+ continue;
+
+ state->checkpoint = state->in_count + CHECK_GAP;
+
+ if (state->in_count <= 0x007fffff)
+ ratio = state->in_count * 256 / state->out_count;
+ else if ((ratio = state->out_count / 256) == 0)
+ ratio = 0x7fffffff;
+ else
+ ratio = state->in_count / ratio;
+
+ if (ratio > state->compress_ratio)
+ state->compress_ratio = ratio;
+ else {
+ state->compress_ratio = 0;
+ memset(state->hashtab, 0xff, sizeof(state->hashtab));
+ state->first_free = FIRST;
+ ret = output_code(a, CLEAR);
+ if (ret != ARCHIVE_OK)
+ return ret;
+ }
+ }
+
+ return (ARCHIVE_OK);
+}
+
+
+/*
+ * Finish the compression...
+ */
+static int
+archive_compressor_compress_finish(struct archive_write *a)
+{
+ ssize_t block_length, target_block_length, bytes_written;
+ int ret;
+ struct private_data *state;
+ size_t tocopy;
+
+ state = (struct private_data *)a->compressor.data;
+ if (a->client_writer == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
+ "No write callback is registered? "
+ "This is probably an internal programming error.");
+ ret = ARCHIVE_FATAL;
+ goto cleanup;
+ }
+
+ /* By default, always pad the uncompressed data. */
+ if (a->pad_uncompressed) {
+ while (state->in_count % a->bytes_per_block != 0) {
+ tocopy = a->bytes_per_block -
+ (state->in_count % a->bytes_per_block);
+ if (tocopy > a->null_length)
+ tocopy = a->null_length;
+ ret = archive_compressor_compress_write(a, a->nulls,
+ tocopy);
+ if (ret != ARCHIVE_OK)
+ goto cleanup;
+ }
+ }
+
+ ret = output_code(a, state->cur_code);
+ if (ret != ARCHIVE_OK)
+ goto cleanup;
+ ret = output_flush(a);
+ if (ret != ARCHIVE_OK)
+ goto cleanup;
+
+ /* Optionally, pad the final compressed block. */
+ block_length = state->compressed_offset;
+
+ /* Tricky calculation to determine size of last block. */
+ if (a->bytes_in_last_block <= 0)
+ /* Default or Zero: pad to full block */
+ target_block_length = a->bytes_per_block;
+ else
+ /* Round length to next multiple of bytes_in_last_block. */
+ target_block_length = a->bytes_in_last_block *
+ ( (block_length + a->bytes_in_last_block - 1) /
+ a->bytes_in_last_block);
+ if (target_block_length > a->bytes_per_block)
+ target_block_length = a->bytes_per_block;
+ if (block_length < target_block_length) {
+ memset(state->compressed + state->compressed_offset, 0,
+ target_block_length - block_length);
+ block_length = target_block_length;
+ }
+
+ /* Write the last block */
+ bytes_written = (a->client_writer)(&a->archive, a->client_data,
+ state->compressed, block_length);
+ if (bytes_written <= 0)
+ ret = ARCHIVE_FATAL;
+ else
+ a->archive.raw_position += bytes_written;
+
+cleanup:
+ free(state->compressed);
+ free(state);
+ return (ret);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_compression_gzip.c b/archivers/libarchive/files/libarchive/archive_write_set_compression_gzip.c
new file mode 100644
index 00000000000..f0176e25f74
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_set_compression_gzip.c
@@ -0,0 +1,477 @@
+/*-
+ * 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 "archive_platform.h"
+
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_compression_gzip.c 201081 2009-12-28 02:04:42Z kientzle $");
+
+#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 <time.h>
+#ifdef HAVE_ZLIB_H
+#include <zlib.h>
+#endif
+
+#include "archive.h"
+#include "archive_private.h"
+#include "archive_write_private.h"
+
+#ifndef HAVE_ZLIB_H
+int
+archive_write_set_compression_gzip(struct archive *a)
+{
+ archive_set_error(a, ARCHIVE_ERRNO_MISC,
+ "gzip compression not supported on this platform");
+ return (ARCHIVE_FATAL);
+}
+#else
+/* Don't compile this if we don't have zlib. */
+
+struct private_data {
+ z_stream stream;
+ int64_t total_in;
+ unsigned char *compressed;
+ size_t compressed_buffer_size;
+ unsigned long crc;
+};
+
+struct private_config {
+ int compression_level;
+};
+
+
+/*
+ * Yuck. zlib.h is not const-correct, so I need this one bit
+ * of ugly hackery to convert a const * pointer to a non-const pointer.
+ */
+#define SET_NEXT_IN(st,src) \
+ (st)->stream.next_in = (Bytef *)(uintptr_t)(const void *)(src)
+
+static int archive_compressor_gzip_finish(struct archive_write *);
+static int archive_compressor_gzip_init(struct archive_write *);
+static int archive_compressor_gzip_options(struct archive_write *,
+ const char *, const char *);
+static int archive_compressor_gzip_write(struct archive_write *,
+ const void *, size_t);
+static int drive_compressor(struct archive_write *, struct private_data *,
+ int finishing);
+
+
+/*
+ * Allocate, initialize and return a archive object.
+ */
+int
+archive_write_set_compression_gzip(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ struct private_config *config;
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_write_set_compression_gzip");
+ config = malloc(sizeof(*config));
+ if (config == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Out of memory");
+ return (ARCHIVE_FATAL);
+ }
+ a->compressor.config = config;
+ a->compressor.finish = &archive_compressor_gzip_finish;
+ config->compression_level = Z_DEFAULT_COMPRESSION;
+ a->compressor.init = &archive_compressor_gzip_init;
+ a->compressor.options = &archive_compressor_gzip_options;
+ a->archive.compression_code = ARCHIVE_COMPRESSION_GZIP;
+ a->archive.compression_name = "gzip";
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Setup callback.
+ */
+static int
+archive_compressor_gzip_init(struct archive_write *a)
+{
+ int ret;
+ struct private_data *state;
+ struct private_config *config;
+ time_t t;
+
+ config = (struct private_config *)a->compressor.config;
+
+ if (a->client_opener != NULL) {
+ ret = (a->client_opener)(&a->archive, a->client_data);
+ if (ret != ARCHIVE_OK)
+ return (ret);
+ }
+
+ /*
+ * The next check is a temporary workaround until the gzip
+ * code can be overhauled some. The code should not require
+ * that compressed_buffer_size == bytes_per_block. Removing
+ * this assumption will allow us to compress larger chunks at
+ * a time, which should improve overall performance
+ * marginally. As a minor side-effect, such a cleanup would
+ * allow us to support truly arbitrary block sizes.
+ */
+ if (a->bytes_per_block < 10) {
+ archive_set_error(&a->archive, EINVAL,
+ "GZip compressor requires a minimum 10 byte block size");
+ return (ARCHIVE_FATAL);
+ }
+
+ state = (struct private_data *)malloc(sizeof(*state));
+ if (state == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate data for compression");
+ return (ARCHIVE_FATAL);
+ }
+ memset(state, 0, sizeof(*state));
+
+ /*
+ * See comment above. We should set compressed_buffer_size to
+ * max(bytes_per_block, 65536), but the code can't handle that yet.
+ */
+ state->compressed_buffer_size = a->bytes_per_block;
+ state->compressed = (unsigned char *)malloc(state->compressed_buffer_size);
+ state->crc = crc32(0L, NULL, 0);
+
+ if (state->compressed == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate data for compression buffer");
+ free(state);
+ return (ARCHIVE_FATAL);
+ }
+
+ state->stream.next_out = state->compressed;
+ state->stream.avail_out = state->compressed_buffer_size;
+
+ /* Prime output buffer with a gzip header. */
+ t = time(NULL);
+ state->compressed[0] = 0x1f; /* GZip signature bytes */
+ state->compressed[1] = 0x8b;
+ state->compressed[2] = 0x08; /* "Deflate" compression */
+ state->compressed[3] = 0; /* No options */
+ state->compressed[4] = (t)&0xff; /* Timestamp */
+ state->compressed[5] = (t>>8)&0xff;
+ state->compressed[6] = (t>>16)&0xff;
+ state->compressed[7] = (t>>24)&0xff;
+ state->compressed[8] = 0; /* No deflate options */
+ state->compressed[9] = 3; /* OS=Unix */
+ state->stream.next_out += 10;
+ state->stream.avail_out -= 10;
+
+ a->compressor.write = archive_compressor_gzip_write;
+
+ /* Initialize compression library. */
+ ret = deflateInit2(&(state->stream),
+ config->compression_level,
+ Z_DEFLATED,
+ -15 /* < 0 to suppress zlib header */,
+ 8,
+ Z_DEFAULT_STRATEGY);
+
+ if (ret == Z_OK) {
+ a->compressor.data = state;
+ return (0);
+ }
+
+ /* Library setup failed: clean up. */
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Internal error "
+ "initializing compression library");
+ free(state->compressed);
+ free(state);
+
+ /* Override the error message if we know what really went wrong. */
+ switch (ret) {
+ case Z_STREAM_ERROR:
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Internal error initializing "
+ "compression library: invalid setup parameter");
+ break;
+ case Z_MEM_ERROR:
+ archive_set_error(&a->archive, ENOMEM, "Internal error initializing "
+ "compression library");
+ break;
+ case Z_VERSION_ERROR:
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Internal error initializing "
+ "compression library: invalid library version");
+ break;
+ }
+
+ return (ARCHIVE_FATAL);
+}
+
+/*
+ * Set write options.
+ */
+static int
+archive_compressor_gzip_options(struct archive_write *a, const char *key,
+ const char *value)
+{
+ struct private_config *config;
+
+ config = (struct private_config *)a->compressor.config;
+ if (strcmp(key, "compression-level") == 0) {
+ if (value == NULL || !(value[0] >= '0' && value[0] <= '9') ||
+ value[1] != '\0')
+ return (ARCHIVE_WARN);
+ config->compression_level = value[0] - '0';
+ return (ARCHIVE_OK);
+ }
+
+ return (ARCHIVE_WARN);
+}
+
+/*
+ * Write data to the compressed stream.
+ */
+static int
+archive_compressor_gzip_write(struct archive_write *a, const void *buff,
+ size_t length)
+{
+ struct private_data *state;
+ int ret;
+
+ state = (struct private_data *)a->compressor.data;
+ if (a->client_writer == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
+ "No write callback is registered? "
+ "This is probably an internal programming error.");
+ return (ARCHIVE_FATAL);
+ }
+
+ /* Update statistics */
+ state->crc = crc32(state->crc, (const Bytef *)buff, length);
+ state->total_in += length;
+
+ /* Compress input data to output buffer */
+ SET_NEXT_IN(state, buff);
+ state->stream.avail_in = length;
+ if ((ret = drive_compressor(a, state, 0)) != ARCHIVE_OK)
+ return (ret);
+
+ a->archive.file_position += length;
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Finish the compression...
+ */
+static int
+archive_compressor_gzip_finish(struct archive_write *a)
+{
+ ssize_t block_length, target_block_length, bytes_written;
+ int ret;
+ struct private_data *state;
+ unsigned tocopy;
+ unsigned char trailer[8];
+
+ state = (struct private_data *)a->compressor.data;
+ ret = 0;
+ if (state != NULL) {
+ if (a->client_writer == NULL) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_PROGRAMMER,
+ "No write callback is registered? "
+ "This is probably an internal programming error.");
+ ret = ARCHIVE_FATAL;
+ goto cleanup;
+ }
+
+ /* By default, always pad the uncompressed data. */
+ if (a->pad_uncompressed) {
+ tocopy = a->bytes_per_block -
+ (state->total_in % a->bytes_per_block);
+ while (tocopy > 0 && tocopy < (unsigned)a->bytes_per_block) {
+ SET_NEXT_IN(state, a->nulls);
+ state->stream.avail_in = tocopy < a->null_length ?
+ tocopy : a->null_length;
+ state->crc = crc32(state->crc, a->nulls,
+ state->stream.avail_in);
+ state->total_in += state->stream.avail_in;
+ tocopy -= state->stream.avail_in;
+ ret = drive_compressor(a, state, 0);
+ if (ret != ARCHIVE_OK)
+ goto cleanup;
+ }
+ }
+
+ /* Finish compression cycle */
+ if (((ret = drive_compressor(a, state, 1))) != ARCHIVE_OK)
+ goto cleanup;
+
+ /* Build trailer: 4-byte CRC and 4-byte length. */
+ trailer[0] = (state->crc)&0xff;
+ trailer[1] = (state->crc >> 8)&0xff;
+ trailer[2] = (state->crc >> 16)&0xff;
+ trailer[3] = (state->crc >> 24)&0xff;
+ trailer[4] = (state->total_in)&0xff;
+ trailer[5] = (state->total_in >> 8)&0xff;
+ trailer[6] = (state->total_in >> 16)&0xff;
+ trailer[7] = (state->total_in >> 24)&0xff;
+
+ /* Add trailer to current block. */
+ tocopy = 8;
+ if (tocopy > state->stream.avail_out)
+ tocopy = state->stream.avail_out;
+ memcpy(state->stream.next_out, trailer, tocopy);
+ state->stream.next_out += tocopy;
+ state->stream.avail_out -= tocopy;
+
+ /* If it overflowed, flush and start a new block. */
+ if (tocopy < 8) {
+ bytes_written = (a->client_writer)(&a->archive, a->client_data,
+ state->compressed, state->compressed_buffer_size);
+ if (bytes_written <= 0) {
+ ret = ARCHIVE_FATAL;
+ goto cleanup;
+ }
+ a->archive.raw_position += bytes_written;
+ state->stream.next_out = state->compressed;
+ state->stream.avail_out = state->compressed_buffer_size;
+ memcpy(state->stream.next_out, trailer + tocopy, 8-tocopy);
+ state->stream.next_out += 8-tocopy;
+ state->stream.avail_out -= 8-tocopy;
+ }
+
+ /* Optionally, pad the final compressed block. */
+ block_length = state->stream.next_out - state->compressed;
+
+ /* Tricky calculation to determine size of last block. */
+ if (a->bytes_in_last_block <= 0)
+ /* Default or Zero: pad to full block */
+ target_block_length = a->bytes_per_block;
+ else
+ /* Round length to next multiple of bytes_in_last_block. */
+ target_block_length = a->bytes_in_last_block *
+ ( (block_length + a->bytes_in_last_block - 1) /
+ a->bytes_in_last_block);
+ if (target_block_length > a->bytes_per_block)
+ target_block_length = a->bytes_per_block;
+ if (block_length < target_block_length) {
+ memset(state->stream.next_out, 0,
+ target_block_length - block_length);
+ block_length = target_block_length;
+ }
+
+ /* Write the last block */
+ bytes_written = (a->client_writer)(&a->archive, a->client_data,
+ state->compressed, block_length);
+ if (bytes_written <= 0) {
+ ret = ARCHIVE_FATAL;
+ goto cleanup;
+ }
+ a->archive.raw_position += bytes_written;
+
+ /* Cleanup: shut down compressor, release memory, etc. */
+ cleanup:
+ switch (deflateEnd(&(state->stream))) {
+ case Z_OK:
+ break;
+ default:
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Failed to clean up compressor");
+ ret = ARCHIVE_FATAL;
+ }
+ free(state->compressed);
+ free(state);
+ }
+ /* Clean up config area even if we never initialized. */
+ free(a->compressor.config);
+ a->compressor.config = NULL;
+ return (ret);
+}
+
+/*
+ * Utility function to push input data through compressor,
+ * writing full output blocks as necessary.
+ *
+ * Note that this handles both the regular write case (finishing ==
+ * false) and the end-of-archive case (finishing == true).
+ */
+static int
+drive_compressor(struct archive_write *a, struct private_data *state, int finishing)
+{
+ ssize_t bytes_written;
+ int ret;
+
+ for (;;) {
+ if (state->stream.avail_out == 0) {
+ bytes_written = (a->client_writer)(&a->archive,
+ a->client_data, state->compressed,
+ state->compressed_buffer_size);
+ if (bytes_written <= 0) {
+ /* TODO: Handle this write failure */
+ return (ARCHIVE_FATAL);
+ } else if ((size_t)bytes_written < state->compressed_buffer_size) {
+ /* Short write: Move remaining to
+ * front of block and keep filling */
+ memmove(state->compressed,
+ state->compressed + bytes_written,
+ state->compressed_buffer_size - bytes_written);
+ }
+ a->archive.raw_position += bytes_written;
+ state->stream.next_out
+ = state->compressed +
+ state->compressed_buffer_size - bytes_written;
+ state->stream.avail_out = bytes_written;
+ }
+
+ /* If there's nothing to do, we're done. */
+ if (!finishing && state->stream.avail_in == 0)
+ return (ARCHIVE_OK);
+
+ ret = deflate(&(state->stream),
+ finishing ? Z_FINISH : Z_NO_FLUSH );
+
+ switch (ret) {
+ case Z_OK:
+ /* In non-finishing case, check if compressor
+ * consumed everything */
+ if (!finishing && state->stream.avail_in == 0)
+ return (ARCHIVE_OK);
+ /* In finishing case, this return always means
+ * there's more work */
+ break;
+ case Z_STREAM_END:
+ /* This return can only occur in finishing case. */
+ return (ARCHIVE_OK);
+ default:
+ /* Any other return value indicates an error. */
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "GZip compression failed:"
+ " deflate() call returned status %d",
+ ret);
+ return (ARCHIVE_FATAL);
+ }
+ }
+}
+
+#endif /* HAVE_ZLIB_H */
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_compression_none.c b/archivers/libarchive/files/libarchive/archive_write_set_compression_none.c
new file mode 100644
index 00000000000..e0216d9e122
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_set_compression_none.c
@@ -0,0 +1,257 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_compression_none.c 201080 2009-12-28 02:03:54Z kientzle $");
+
+#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 "archive.h"
+#include "archive_private.h"
+#include "archive_write_private.h"
+
+static int archive_compressor_none_finish(struct archive_write *a);
+static int archive_compressor_none_init(struct archive_write *);
+static int archive_compressor_none_write(struct archive_write *,
+ const void *, size_t);
+
+struct archive_none {
+ char *buffer;
+ ssize_t buffer_size;
+ char *next; /* Current insert location */
+ ssize_t avail; /* Free space left in buffer */
+};
+
+int
+archive_write_set_compression_none(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_write_set_compression_none");
+ a->compressor.init = &archive_compressor_none_init;
+ return (0);
+}
+
+/*
+ * Setup callback.
+ */
+static int
+archive_compressor_none_init(struct archive_write *a)
+{
+ int ret;
+ struct archive_none *state;
+
+ a->archive.compression_code = ARCHIVE_COMPRESSION_NONE;
+ a->archive.compression_name = "none";
+
+ if (a->client_opener != NULL) {
+ ret = (a->client_opener)(&a->archive, a->client_data);
+ if (ret != 0)
+ return (ret);
+ }
+
+ state = (struct archive_none *)malloc(sizeof(*state));
+ if (state == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate data for output buffering");
+ return (ARCHIVE_FATAL);
+ }
+ memset(state, 0, sizeof(*state));
+
+ state->buffer_size = a->bytes_per_block;
+ if (state->buffer_size != 0) {
+ state->buffer = (char *)malloc(state->buffer_size);
+ if (state->buffer == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate output buffer");
+ free(state);
+ return (ARCHIVE_FATAL);
+ }
+ }
+
+ state->next = state->buffer;
+ state->avail = state->buffer_size;
+
+ a->compressor.data = state;
+ a->compressor.write = archive_compressor_none_write;
+ a->compressor.finish = archive_compressor_none_finish;
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Write data to the stream.
+ */
+static int
+archive_compressor_none_write(struct archive_write *a, const void *vbuff,
+ size_t length)
+{
+ const char *buff;
+ ssize_t remaining, to_copy;
+ ssize_t bytes_written;
+ struct archive_none *state;
+
+ state = (struct archive_none *)a->compressor.data;
+ buff = (const char *)vbuff;
+ if (a->client_writer == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
+ "No write callback is registered? "
+ "This is probably an internal programming error.");
+ return (ARCHIVE_FATAL);
+ }
+
+ remaining = length;
+
+ /*
+ * If there is no buffer for blocking, just pass the data
+ * straight through to the client write callback. In
+ * particular, this supports "no write delay" operation for
+ * special applications. Just set the block size to zero.
+ */
+ if (state->buffer_size == 0) {
+ while (remaining > 0) {
+ bytes_written = (a->client_writer)(&a->archive,
+ a->client_data, buff, remaining);
+ if (bytes_written <= 0)
+ return (ARCHIVE_FATAL);
+ a->archive.raw_position += bytes_written;
+ remaining -= bytes_written;
+ buff += bytes_written;
+ }
+ a->archive.file_position += length;
+ return (ARCHIVE_OK);
+ }
+
+ /* If the copy buffer isn't empty, try to fill it. */
+ if (state->avail < state->buffer_size) {
+ /* If buffer is not empty... */
+ /* ... copy data into buffer ... */
+ to_copy = (remaining > state->avail) ?
+ state->avail : remaining;
+ memcpy(state->next, buff, to_copy);
+ state->next += to_copy;
+ state->avail -= to_copy;
+ buff += to_copy;
+ remaining -= to_copy;
+ /* ... if it's full, write it out. */
+ if (state->avail == 0) {
+ bytes_written = (a->client_writer)(&a->archive,
+ a->client_data, state->buffer, state->buffer_size);
+ if (bytes_written <= 0)
+ return (ARCHIVE_FATAL);
+ /* XXX TODO: if bytes_written < state->buffer_size */
+ a->archive.raw_position += bytes_written;
+ state->next = state->buffer;
+ state->avail = state->buffer_size;
+ }
+ }
+
+ while (remaining > state->buffer_size) {
+ /* Write out full blocks directly to client. */
+ bytes_written = (a->client_writer)(&a->archive,
+ a->client_data, buff, state->buffer_size);
+ if (bytes_written <= 0)
+ return (ARCHIVE_FATAL);
+ a->archive.raw_position += bytes_written;
+ buff += bytes_written;
+ remaining -= bytes_written;
+ }
+
+ if (remaining > 0) {
+ /* Copy last bit into copy buffer. */
+ memcpy(state->next, buff, remaining);
+ state->next += remaining;
+ state->avail -= remaining;
+ }
+
+ a->archive.file_position += length;
+ return (ARCHIVE_OK);
+}
+
+
+/*
+ * Finish the compression.
+ */
+static int
+archive_compressor_none_finish(struct archive_write *a)
+{
+ ssize_t block_length;
+ ssize_t target_block_length;
+ ssize_t bytes_written;
+ int ret;
+ struct archive_none *state;
+
+ state = (struct archive_none *)a->compressor.data;
+ ret = ARCHIVE_OK;
+ if (a->client_writer == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
+ "No write callback is registered? "
+ "This is probably an internal programming error.");
+ return (ARCHIVE_FATAL);
+ }
+
+ /* If there's pending data, pad and write the last block */
+ if (state->next != state->buffer) {
+ block_length = state->buffer_size - state->avail;
+
+ /* Tricky calculation to determine size of last block */
+ if (a->bytes_in_last_block <= 0)
+ /* Default or Zero: pad to full block */
+ target_block_length = a->bytes_per_block;
+ else
+ /* Round to next multiple of bytes_in_last_block. */
+ target_block_length = a->bytes_in_last_block *
+ ( (block_length + a->bytes_in_last_block - 1) /
+ a->bytes_in_last_block);
+ if (target_block_length > a->bytes_per_block)
+ target_block_length = a->bytes_per_block;
+ if (block_length < target_block_length) {
+ memset(state->next, 0,
+ target_block_length - block_length);
+ block_length = target_block_length;
+ }
+ bytes_written = (a->client_writer)(&a->archive,
+ a->client_data, state->buffer, block_length);
+ if (bytes_written <= 0)
+ ret = ARCHIVE_FATAL;
+ else {
+ a->archive.raw_position += bytes_written;
+ ret = ARCHIVE_OK;
+ }
+ }
+ if (state->buffer)
+ free(state->buffer);
+ free(state);
+ a->compressor.data = NULL;
+
+ return (ret);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_compression_program.c b/archivers/libarchive/files/libarchive/archive_write_set_compression_program.c
new file mode 100644
index 00000000000..475ba354032
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_set_compression_program.c
@@ -0,0 +1,347 @@
+/*-
+ * Copyright (c) 2007 Joerg Sonnenberger
+ * 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 "archive_platform.h"
+
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_compression_program.c 201104 2009-12-28 03:14:30Z kientzle $");
+
+/* This capability is only available on POSIX systems. */
+#if (!defined(HAVE_PIPE) || !defined(HAVE_FCNTL) || \
+ !(defined(HAVE_FORK) || defined(HAVE_VFORK))) && (!defined(_WIN32) || defined(__CYGWIN__))
+#include "archive.h"
+
+/*
+ * On non-Posix systems, allow the program to build, but choke if
+ * this function is actually invoked.
+ */
+int
+archive_write_set_compression_program(struct archive *_a, const char *cmd)
+{
+ archive_set_error(_a, -1,
+ "External compression programs not supported on this platform");
+ return (ARCHIVE_FATAL);
+}
+
+#else
+
+#ifdef HAVE_SYS_WAIT_H
+# include <sys/wait.h>
+#endif
+#ifdef HAVE_ERRNO_H
+# include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+# include <string.h>
+#endif
+
+#include "archive.h"
+#include "archive_private.h"
+#include "archive_write_private.h"
+
+#include "filter_fork.h"
+
+struct private_data {
+ char *description;
+ pid_t child;
+ int child_stdin, child_stdout;
+
+ char *child_buf;
+ size_t child_buf_len, child_buf_avail;
+};
+
+static int archive_compressor_program_finish(struct archive_write *);
+static int archive_compressor_program_init(struct archive_write *);
+static int archive_compressor_program_write(struct archive_write *,
+ const void *, size_t);
+
+/*
+ * Allocate, initialize and return a archive object.
+ */
+int
+archive_write_set_compression_program(struct archive *_a, const char *cmd)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ __archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
+ ARCHIVE_STATE_NEW, "archive_write_set_compression_program");
+ a->compressor.init = &archive_compressor_program_init;
+ a->compressor.config = strdup(cmd);
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Setup callback.
+ */
+static int
+archive_compressor_program_init(struct archive_write *a)
+{
+ int ret;
+ struct private_data *state;
+ static const char *prefix = "Program: ";
+ char *cmd = a->compressor.config;
+
+ if (a->client_opener != NULL) {
+ ret = (a->client_opener)(&a->archive, a->client_data);
+ if (ret != ARCHIVE_OK)
+ return (ret);
+ }
+
+ state = (struct private_data *)malloc(sizeof(*state));
+ if (state == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate data for compression");
+ return (ARCHIVE_FATAL);
+ }
+ memset(state, 0, sizeof(*state));
+
+ a->archive.compression_code = ARCHIVE_COMPRESSION_PROGRAM;
+ state->description = (char *)malloc(strlen(prefix) + strlen(cmd) + 1);
+ strcpy(state->description, prefix);
+ strcat(state->description, cmd);
+ a->archive.compression_name = state->description;
+
+ state->child_buf_len = a->bytes_per_block;
+ state->child_buf_avail = 0;
+ state->child_buf = malloc(state->child_buf_len);
+
+ if (state->child_buf == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate data for compression buffer");
+ free(state);
+ return (ARCHIVE_FATAL);
+ }
+
+ if ((state->child = __archive_create_child(cmd,
+ &state->child_stdin, &state->child_stdout)) == -1) {
+ archive_set_error(&a->archive, EINVAL,
+ "Can't initialise filter");
+ free(state->child_buf);
+ free(state);
+ return (ARCHIVE_FATAL);
+ }
+
+ a->compressor.write = archive_compressor_program_write;
+ a->compressor.finish = archive_compressor_program_finish;
+
+ a->compressor.data = state;
+ return (0);
+}
+
+static ssize_t
+child_write(struct archive_write *a, const char *buf, size_t buf_len)
+{
+ struct private_data *state = a->compressor.data;
+ ssize_t ret;
+
+ if (state->child_stdin == -1)
+ return (-1);
+
+ if (buf_len == 0)
+ return (-1);
+
+restart_write:
+ do {
+ ret = write(state->child_stdin, buf, buf_len);
+ } while (ret == -1 && errno == EINTR);
+
+ if (ret > 0)
+ return (ret);
+ if (ret == 0) {
+ close(state->child_stdin);
+ state->child_stdin = -1;
+ fcntl(state->child_stdout, F_SETFL, 0);
+ return (0);
+ }
+ if (ret == -1 && errno != EAGAIN)
+ return (-1);
+
+ if (state->child_stdout == -1) {
+ fcntl(state->child_stdin, F_SETFL, 0);
+ __archive_check_child(state->child_stdin, state->child_stdout);
+ goto restart_write;
+ }
+
+ do {
+ ret = read(state->child_stdout,
+ state->child_buf + state->child_buf_avail,
+ state->child_buf_len - state->child_buf_avail);
+ } while (ret == -1 && errno == EINTR);
+
+ if (ret == 0 || (ret == -1 && errno == EPIPE)) {
+ close(state->child_stdout);
+ state->child_stdout = -1;
+ fcntl(state->child_stdin, F_SETFL, 0);
+ goto restart_write;
+ }
+ if (ret == -1 && errno == EAGAIN) {
+ __archive_check_child(state->child_stdin, state->child_stdout);
+ goto restart_write;
+ }
+ if (ret == -1)
+ return (-1);
+
+ state->child_buf_avail += ret;
+
+ ret = (a->client_writer)(&a->archive, a->client_data,
+ state->child_buf, state->child_buf_avail);
+ if (ret <= 0)
+ return (-1);
+
+ if ((size_t)ret < state->child_buf_avail) {
+ memmove(state->child_buf, state->child_buf + ret,
+ state->child_buf_avail - ret);
+ }
+ state->child_buf_avail -= ret;
+ a->archive.raw_position += ret;
+ goto restart_write;
+}
+
+/*
+ * Write data to the compressed stream.
+ */
+static int
+archive_compressor_program_write(struct archive_write *a, const void *buff,
+ size_t length)
+{
+ ssize_t ret;
+ const char *buf;
+
+ if (a->client_writer == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
+ "No write callback is registered? "
+ "This is probably an internal programming error.");
+ return (ARCHIVE_FATAL);
+ }
+
+ buf = buff;
+ while (length > 0) {
+ ret = child_write(a, buf, length);
+ if (ret == -1 || ret == 0) {
+ archive_set_error(&a->archive, EIO,
+ "Can't write to filter");
+ return (ARCHIVE_FATAL);
+ }
+ length -= ret;
+ buf += ret;
+ }
+
+ a->archive.file_position += length;
+ return (ARCHIVE_OK);
+}
+
+
+/*
+ * Finish the compression...
+ */
+static int
+archive_compressor_program_finish(struct archive_write *a)
+{
+ int ret, status;
+ ssize_t bytes_read, bytes_written;
+ struct private_data *state;
+
+ state = (struct private_data *)a->compressor.data;
+ ret = 0;
+ if (a->client_writer == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
+ "No write callback is registered? "
+ "This is probably an internal programming error.");
+ ret = ARCHIVE_FATAL;
+ goto cleanup;
+ }
+
+ /* XXX pad compressed data. */
+
+ close(state->child_stdin);
+ state->child_stdin = -1;
+ fcntl(state->child_stdout, F_SETFL, 0);
+
+ for (;;) {
+ do {
+ bytes_read = read(state->child_stdout,
+ state->child_buf + state->child_buf_avail,
+ state->child_buf_len - state->child_buf_avail);
+ } while (bytes_read == -1 && errno == EINTR);
+
+ if (bytes_read == 0 || (bytes_read == -1 && errno == EPIPE))
+ break;
+
+ if (bytes_read == -1) {
+ archive_set_error(&a->archive, errno,
+ "Read from filter failed unexpectedly.");
+ ret = ARCHIVE_FATAL;
+ goto cleanup;
+ }
+ state->child_buf_avail += bytes_read;
+
+ bytes_written = (a->client_writer)(&a->archive, a->client_data,
+ state->child_buf, state->child_buf_avail);
+ if (bytes_written <= 0) {
+ ret = ARCHIVE_FATAL;
+ goto cleanup;
+ }
+ if ((size_t)bytes_written < state->child_buf_avail) {
+ memmove(state->child_buf,
+ state->child_buf + bytes_written,
+ state->child_buf_avail - bytes_written);
+ }
+ state->child_buf_avail -= bytes_written;
+ a->archive.raw_position += bytes_written;
+ }
+
+ /* XXX pad final compressed block. */
+
+cleanup:
+ /* Shut down the child. */
+ if (state->child_stdin != -1)
+ close(state->child_stdin);
+ if (state->child_stdout != -1)
+ close(state->child_stdout);
+ while (waitpid(state->child, &status, 0) == -1 && errno == EINTR)
+ continue;
+
+ if (status != 0) {
+ archive_set_error(&a->archive, EIO,
+ "Filter exited with failure.");
+ ret = ARCHIVE_FATAL;
+ }
+
+ /* Release our configuration data. */
+ free(a->compressor.config);
+ a->compressor.config = NULL;
+
+ /* Release our private state data. */
+ free(state->child_buf);
+ free(state->description);
+ free(state);
+ return (ret);
+}
+
+#endif /* !defined(HAVE_PIPE) || !defined(HAVE_VFORK) || !defined(HAVE_FCNTL) */
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format.c b/archivers/libarchive/files/libarchive/archive_write_set_format.c
new file mode 100644
index 00000000000..b1593fbe6d8
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format.c
@@ -0,0 +1,72 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format.c 201168 2009-12-29 06:15:32Z kientzle $");
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#include "archive.h"
+#include "archive_private.h"
+
+/* A table that maps format codes to functions. */
+static
+struct { int code; int (*setter)(struct archive *); } codes[] =
+{
+ { ARCHIVE_FORMAT_CPIO, archive_write_set_format_cpio },
+ { ARCHIVE_FORMAT_CPIO_SVR4_NOCRC, archive_write_set_format_cpio_newc },
+ { ARCHIVE_FORMAT_CPIO_POSIX, archive_write_set_format_cpio },
+ { ARCHIVE_FORMAT_MTREE, archive_write_set_format_mtree },
+ { ARCHIVE_FORMAT_SHAR, archive_write_set_format_shar },
+ { ARCHIVE_FORMAT_SHAR_BASE, archive_write_set_format_shar },
+ { ARCHIVE_FORMAT_SHAR_DUMP, archive_write_set_format_shar_dump },
+ { ARCHIVE_FORMAT_TAR, archive_write_set_format_pax_restricted },
+ { ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE, archive_write_set_format_pax },
+ { ARCHIVE_FORMAT_TAR_PAX_RESTRICTED,
+ archive_write_set_format_pax_restricted },
+ { ARCHIVE_FORMAT_TAR_USTAR, archive_write_set_format_ustar },
+ { ARCHIVE_FORMAT_ZIP, archive_write_set_format_zip },
+ { 0, NULL }
+};
+
+int
+archive_write_set_format(struct archive *a, int code)
+{
+ int i;
+
+ for (i = 0; codes[i].code != 0; i++) {
+ if (code == codes[i].code)
+ return ((codes[i].setter)(a));
+ }
+
+ archive_set_error(a, EINVAL, "No such format");
+ return (ARCHIVE_FATAL);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c b/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c
new file mode 100644
index 00000000000..b492ceaa56b
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_ar.c
@@ -0,0 +1,550 @@
+/*-
+ * Copyright (c) 2007 Kai Wang
+ * Copyright (c) 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
+ * 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.
+ */
+
+#include "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_ar.c 201108 2009-12-28 03:28:21Z kientzle $");
+
+#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 "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_write_private.h"
+
+struct ar_w {
+ uint64_t entry_bytes_remaining;
+ uint64_t entry_padding;
+ int is_strtab;
+ int has_strtab;
+ char *strtab;
+};
+
+/*
+ * Define structure of the "ar" header.
+ */
+#define AR_name_offset 0
+#define AR_name_size 16
+#define AR_date_offset 16
+#define AR_date_size 12
+#define AR_uid_offset 28
+#define AR_uid_size 6
+#define AR_gid_offset 34
+#define AR_gid_size 6
+#define AR_mode_offset 40
+#define AR_mode_size 8
+#define AR_size_offset 48
+#define AR_size_size 10
+#define AR_fmag_offset 58
+#define AR_fmag_size 2
+
+static int archive_write_set_format_ar(struct archive_write *);
+static int archive_write_ar_header(struct archive_write *,
+ struct archive_entry *);
+static ssize_t archive_write_ar_data(struct archive_write *,
+ const void *buff, size_t s);
+static int archive_write_ar_destroy(struct archive_write *);
+static int archive_write_ar_finish(struct archive_write *);
+static int archive_write_ar_finish_entry(struct archive_write *);
+static const char *ar_basename(const char *path);
+static int format_octal(int64_t v, char *p, int s);
+static int format_decimal(int64_t v, char *p, int s);
+
+int
+archive_write_set_format_ar_bsd(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ int r = archive_write_set_format_ar(a);
+ if (r == ARCHIVE_OK) {
+ a->archive.archive_format = ARCHIVE_FORMAT_AR_BSD;
+ a->archive.archive_format_name = "ar (BSD)";
+ }
+ return (r);
+}
+
+int
+archive_write_set_format_ar_svr4(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ int r = archive_write_set_format_ar(a);
+ if (r == ARCHIVE_OK) {
+ a->archive.archive_format = ARCHIVE_FORMAT_AR_GNU;
+ a->archive.archive_format_name = "ar (GNU/SVR4)";
+ }
+ return (r);
+}
+
+/*
+ * Generic initialization.
+ */
+static int
+archive_write_set_format_ar(struct archive_write *a)
+{
+ struct ar_w *ar;
+
+ /* If someone else was already registered, unregister them. */
+ if (a->format_destroy != NULL)
+ (a->format_destroy)(a);
+
+ ar = (struct ar_w *)malloc(sizeof(*ar));
+ if (ar == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Can't allocate ar data");
+ return (ARCHIVE_FATAL);
+ }
+ memset(ar, 0, sizeof(*ar));
+ a->format_data = ar;
+
+ a->format_name = "ar";
+ a->format_write_header = archive_write_ar_header;
+ a->format_write_data = archive_write_ar_data;
+ a->format_finish = archive_write_ar_finish;
+ a->format_destroy = archive_write_ar_destroy;
+ a->format_finish_entry = archive_write_ar_finish_entry;
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_write_ar_header(struct archive_write *a, struct archive_entry *entry)
+{
+ int ret, append_fn;
+ char buff[60];
+ char *ss, *se;
+ struct ar_w *ar;
+ const char *pathname;
+ const char *filename;
+ int64_t size;
+
+ append_fn = 0;
+ ar = (struct ar_w *)a->format_data;
+ ar->is_strtab = 0;
+ filename = NULL;
+ size = archive_entry_size(entry);
+
+
+ /*
+ * Reject files with empty name.
+ */
+ pathname = archive_entry_pathname(entry);
+ if (*pathname == '\0') {
+ archive_set_error(&a->archive, EINVAL,
+ "Invalid filename");
+ return (ARCHIVE_WARN);
+ }
+
+ /*
+ * If we are now at the beginning of the archive,
+ * we need first write the ar global header.
+ */
+ if (a->archive.file_position == 0)
+ (a->compressor.write)(a, "!<arch>\n", 8);
+
+ memset(buff, ' ', 60);
+ strncpy(&buff[AR_fmag_offset], "`\n", 2);
+
+ if (strcmp(pathname, "/") == 0 ) {
+ /* Entry is archive symbol table in GNU format */
+ buff[AR_name_offset] = '/';
+ goto stat;
+ }
+ if (strcmp(pathname, "__.SYMDEF") == 0) {
+ /* Entry is archive symbol table in BSD format */
+ strncpy(buff + AR_name_offset, "__.SYMDEF", 9);
+ goto stat;
+ }
+ if (strcmp(pathname, "//") == 0) {
+ /*
+ * Entry is archive filename table, inform that we should
+ * collect strtab in next _data call.
+ */
+ ar->is_strtab = 1;
+ buff[AR_name_offset] = buff[AR_name_offset + 1] = '/';
+ /*
+ * For archive string table, only ar_size filed should
+ * be set.
+ */
+ goto size;
+ }
+
+ /*
+ * Otherwise, entry is a normal archive member.
+ * Strip leading paths from filenames, if any.
+ */
+ if ((filename = ar_basename(pathname)) == NULL) {
+ /* Reject filenames with trailing "/" */
+ archive_set_error(&a->archive, EINVAL,
+ "Invalid filename");
+ return (ARCHIVE_WARN);
+ }
+
+ if (a->archive.archive_format == ARCHIVE_FORMAT_AR_GNU) {
+ /*
+ * SVR4/GNU variant use a "/" to mark then end of the filename,
+ * make it possible to have embedded spaces in the filename.
+ * So, the longest filename here (without extension) is
+ * actually 15 bytes.
+ */
+ if (strlen(filename) <= 15) {
+ strncpy(&buff[AR_name_offset],
+ filename, strlen(filename));
+ buff[AR_name_offset + strlen(filename)] = '/';
+ } else {
+ /*
+ * For filename longer than 15 bytes, GNU variant
+ * makes use of a string table and instead stores the
+ * offset of the real filename to in the ar_name field.
+ * The string table should have been written before.
+ */
+ if (ar->has_strtab <= 0) {
+ archive_set_error(&a->archive, EINVAL,
+ "Can't find string table");
+ return (ARCHIVE_WARN);
+ }
+
+ se = (char *)malloc(strlen(filename) + 3);
+ if (se == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate filename buffer");
+ return (ARCHIVE_FATAL);
+ }
+
+ strncpy(se, filename, strlen(filename));
+ strcpy(se + strlen(filename), "/\n");
+
+ ss = strstr(ar->strtab, se);
+ free(se);
+
+ if (ss == NULL) {
+ archive_set_error(&a->archive, EINVAL,
+ "Invalid string table");
+ return (ARCHIVE_WARN);
+ }
+
+ /*
+ * GNU variant puts "/" followed by digits into
+ * ar_name field. These digits indicates the real
+ * filename string's offset to the string table.
+ */
+ buff[AR_name_offset] = '/';
+ if (format_decimal(ss - ar->strtab,
+ buff + AR_name_offset + 1,
+ AR_name_size - 1)) {
+ archive_set_error(&a->archive, ERANGE,
+ "string table offset too large");
+ return (ARCHIVE_WARN);
+ }
+ }
+ } else if (a->archive.archive_format == ARCHIVE_FORMAT_AR_BSD) {
+ /*
+ * BSD variant: for any file name which is more than
+ * 16 chars or contains one or more embedded space(s), the
+ * string "#1/" followed by the ASCII length of the name is
+ * put into the ar_name field. The file size (stored in the
+ * ar_size field) is incremented by the length of the name.
+ * The name is then written immediately following the
+ * archive header.
+ */
+ if (strlen(filename) <= 16 && strchr(filename, ' ') == NULL) {
+ strncpy(&buff[AR_name_offset], filename, strlen(filename));
+ buff[AR_name_offset + strlen(filename)] = ' ';
+ }
+ else {
+ strncpy(buff + AR_name_offset, "#1/", 3);
+ if (format_decimal(strlen(filename),
+ buff + AR_name_offset + 3,
+ AR_name_size - 3)) {
+ archive_set_error(&a->archive, ERANGE,
+ "File name too long");
+ return (ARCHIVE_WARN);
+ }
+ append_fn = 1;
+ size += strlen(filename);
+ }
+ }
+
+stat:
+ if (format_decimal(archive_entry_mtime(entry), buff + AR_date_offset, AR_date_size)) {
+ archive_set_error(&a->archive, ERANGE,
+ "File modification time too large");
+ return (ARCHIVE_WARN);
+ }
+ if (format_decimal(archive_entry_uid(entry), buff + AR_uid_offset, AR_uid_size)) {
+ archive_set_error(&a->archive, ERANGE,
+ "Numeric user ID too large");
+ return (ARCHIVE_WARN);
+ }
+ if (format_decimal(archive_entry_gid(entry), buff + AR_gid_offset, AR_gid_size)) {
+ archive_set_error(&a->archive, ERANGE,
+ "Numeric group ID too large");
+ return (ARCHIVE_WARN);
+ }
+ if (format_octal(archive_entry_mode(entry), buff + AR_mode_offset, AR_mode_size)) {
+ archive_set_error(&a->archive, ERANGE,
+ "Numeric mode too large");
+ return (ARCHIVE_WARN);
+ }
+ /*
+ * Sanity Check: A non-pseudo archive member should always be
+ * a regular file.
+ */
+ if (filename != NULL && archive_entry_filetype(entry) != AE_IFREG) {
+ archive_set_error(&a->archive, EINVAL,
+ "Regular file required for non-pseudo member");
+ return (ARCHIVE_WARN);
+ }
+
+size:
+ if (format_decimal(size, buff + AR_size_offset, AR_size_size)) {
+ archive_set_error(&a->archive, ERANGE,
+ "File size out of range");
+ return (ARCHIVE_WARN);
+ }
+
+ ret = (a->compressor.write)(a, buff, 60);
+ if (ret != ARCHIVE_OK)
+ return (ret);
+
+ ar->entry_bytes_remaining = size;
+ ar->entry_padding = ar->entry_bytes_remaining % 2;
+
+ if (append_fn > 0) {
+ ret = (a->compressor.write)(a, filename, strlen(filename));
+ if (ret != ARCHIVE_OK)
+ return (ret);
+ ar->entry_bytes_remaining -= strlen(filename);
+ }
+
+ return (ARCHIVE_OK);
+}
+
+static ssize_t
+archive_write_ar_data(struct archive_write *a, const void *buff, size_t s)
+{
+ struct ar_w *ar;
+ int ret;
+
+ ar = (struct ar_w *)a->format_data;
+ if (s > ar->entry_bytes_remaining)
+ s = ar->entry_bytes_remaining;
+
+ if (ar->is_strtab > 0) {
+ if (ar->has_strtab > 0) {
+ archive_set_error(&a->archive, EINVAL,
+ "More than one string tables exist");
+ return (ARCHIVE_WARN);
+ }
+
+ ar->strtab = (char *)malloc(s);
+ if (ar->strtab == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate strtab buffer");
+ return (ARCHIVE_FATAL);
+ }
+ strncpy(ar->strtab, buff, s);
+ ar->has_strtab = 1;
+ }
+
+ ret = (a->compressor.write)(a, buff, s);
+ if (ret != ARCHIVE_OK)
+ return (ret);
+
+ ar->entry_bytes_remaining -= s;
+ return (s);
+}
+
+static int
+archive_write_ar_destroy(struct archive_write *a)
+{
+ struct ar_w *ar;
+
+ ar = (struct ar_w *)a->format_data;
+
+ if (ar == NULL)
+ return (ARCHIVE_OK);
+
+ if (ar->has_strtab > 0) {
+ free(ar->strtab);
+ ar->strtab = NULL;
+ }
+
+ free(ar);
+ a->format_data = NULL;
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_write_ar_finish(struct archive_write *a)
+{
+ int ret;
+
+ /*
+ * If we haven't written anything yet, we need to write
+ * the ar global header now to make it a valid ar archive.
+ */
+ if (a->archive.file_position == 0) {
+ ret = (a->compressor.write)(a, "!<arch>\n", 8);
+ return (ret);
+ }
+
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_write_ar_finish_entry(struct archive_write *a)
+{
+ struct ar_w *ar;
+ int ret;
+
+ ar = (struct ar_w *)a->format_data;
+
+ if (ar->entry_bytes_remaining != 0) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Entry remaining bytes larger than 0");
+ return (ARCHIVE_WARN);
+ }
+
+ if (ar->entry_padding == 0) {
+ return (ARCHIVE_OK);
+ }
+
+ if (ar->entry_padding != 1) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Padding wrong size: %d should be 1 or 0",
+ ar->entry_padding);
+ return (ARCHIVE_WARN);
+ }
+
+ ret = (a->compressor.write)(a, "\n", 1);
+ return (ret);
+}
+
+/*
+ * Format a number into the specified field using base-8.
+ * NB: This version is slightly different from the one in
+ * _ustar.c
+ */
+static int
+format_octal(int64_t v, char *p, int s)
+{
+ int len;
+ char *h;
+
+ len = s;
+ h = p;
+
+ /* Octal values can't be negative, so use 0. */
+ if (v < 0) {
+ while (len-- > 0)
+ *p++ = '0';
+ return (-1);
+ }
+
+ p += s; /* Start at the end and work backwards. */
+ do {
+ *--p = (char)('0' + (v & 7));
+ v >>= 3;
+ } while (--s > 0 && v > 0);
+
+ if (v == 0) {
+ memmove(h, p, len - s);
+ p = h + len - s;
+ while (s-- > 0)
+ *p++ = ' ';
+ return (0);
+ }
+ /* If it overflowed, fill field with max value. */
+ while (len-- > 0)
+ *p++ = '7';
+
+ return (-1);
+}
+
+/*
+ * Format a number into the specified field using base-10.
+ */
+static int
+format_decimal(int64_t v, char *p, int s)
+{
+ int len;
+ char *h;
+
+ len = s;
+ h = p;
+
+ /* Negative values in ar header are meaningless , so use 0. */
+ if (v < 0) {
+ while (len-- > 0)
+ *p++ = '0';
+ return (-1);
+ }
+
+ p += s;
+ do {
+ *--p = (char)('0' + (v % 10));
+ v /= 10;
+ } while (--s > 0 && v > 0);
+
+ if (v == 0) {
+ memmove(h, p, len - s);
+ p = h + len - s;
+ while (s-- > 0)
+ *p++ = ' ';
+ return (0);
+ }
+ /* If it overflowed, fill field with max value. */
+ while (len-- > 0)
+ *p++ = '9';
+
+ return (-1);
+}
+
+static const char *
+ar_basename(const char *path)
+{
+ const char *endp, *startp;
+
+ endp = path + strlen(path) - 1;
+ /*
+ * For filename with trailing slash(es), we return
+ * NULL indicating an error.
+ */
+ if (*endp == '/')
+ return (NULL);
+
+ /* Find the start of the base */
+ startp = endp;
+ while (startp > path && *(startp - 1) != '/')
+ startp--;
+
+ return (startp);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_by_name.c b/archivers/libarchive/files/libarchive/archive_write_set_format_by_name.c
new file mode 100644
index 00000000000..a0921199c22
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_by_name.c
@@ -0,0 +1,76 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_by_name.c 201168 2009-12-29 06:15:32Z kientzle $");
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive.h"
+#include "archive_private.h"
+
+/* A table that maps names to functions. */
+static
+struct { const char *name; int (*setter)(struct archive *); } names[] =
+{
+ { "ar", archive_write_set_format_ar_bsd },
+ { "arbsd", archive_write_set_format_ar_bsd },
+ { "argnu", archive_write_set_format_ar_svr4 },
+ { "arsvr4", archive_write_set_format_ar_svr4 },
+ { "cpio", archive_write_set_format_cpio },
+ { "mtree", archive_write_set_format_mtree },
+ { "newc", archive_write_set_format_cpio_newc },
+ { "odc", archive_write_set_format_cpio },
+ { "pax", archive_write_set_format_pax },
+ { "posix", archive_write_set_format_pax },
+ { "shar", archive_write_set_format_shar },
+ { "shardump", archive_write_set_format_shar_dump },
+ { "ustar", archive_write_set_format_ustar },
+ { "zip", archive_write_set_format_zip },
+ { NULL, NULL }
+};
+
+int
+archive_write_set_format_by_name(struct archive *a, const char *name)
+{
+ int i;
+
+ for (i = 0; names[i].name != NULL; i++) {
+ if (strcmp(name, names[i].name) == 0)
+ return ((names[i].setter)(a));
+ }
+
+ archive_set_error(a, EINVAL, "No such format '%s'", name);
+ return (ARCHIVE_FATAL);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_cpio.c b/archivers/libarchive/files/libarchive/archive_write_set_format_cpio.c
new file mode 100644
index 00000000000..4e8e1e0bdca
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_cpio.c
@@ -0,0 +1,344 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_cpio.c 201170 2009-12-29 06:34:23Z kientzle $");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_write_private.h"
+
+static ssize_t archive_write_cpio_data(struct archive_write *,
+ const void *buff, size_t s);
+static int archive_write_cpio_finish(struct archive_write *);
+static int archive_write_cpio_destroy(struct archive_write *);
+static int archive_write_cpio_finish_entry(struct archive_write *);
+static int archive_write_cpio_header(struct archive_write *,
+ struct archive_entry *);
+static int format_octal(int64_t, void *, int);
+static int64_t format_octal_recursive(int64_t, char *, int);
+
+struct cpio {
+ uint64_t entry_bytes_remaining;
+
+ int64_t ino_next;
+
+ struct { int64_t old; int new;} *ino_list;
+ size_t ino_list_size;
+ size_t ino_list_next;
+};
+
+struct cpio_header {
+ char c_magic[6];
+ char c_dev[6];
+ char c_ino[6];
+ char c_mode[6];
+ char c_uid[6];
+ char c_gid[6];
+ char c_nlink[6];
+ char c_rdev[6];
+ char c_mtime[11];
+ char c_namesize[6];
+ char c_filesize[11];
+};
+
+/*
+ * Set output format to 'cpio' format.
+ */
+int
+archive_write_set_format_cpio(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ struct cpio *cpio;
+
+ /* If someone else was already registered, unregister them. */
+ if (a->format_destroy != NULL)
+ (a->format_destroy)(a);
+
+ cpio = (struct cpio *)malloc(sizeof(*cpio));
+ if (cpio == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
+ return (ARCHIVE_FATAL);
+ }
+ memset(cpio, 0, sizeof(*cpio));
+ a->format_data = cpio;
+
+ a->pad_uncompressed = 1;
+ a->format_name = "cpio";
+ a->format_write_header = archive_write_cpio_header;
+ a->format_write_data = archive_write_cpio_data;
+ a->format_finish_entry = archive_write_cpio_finish_entry;
+ a->format_finish = archive_write_cpio_finish;
+ a->format_destroy = archive_write_cpio_destroy;
+ a->archive.archive_format = ARCHIVE_FORMAT_CPIO_POSIX;
+ a->archive.archive_format_name = "POSIX cpio";
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Ino values are as long as 64 bits on some systems; cpio format
+ * only allows 18 bits and relies on the ino values to identify hardlinked
+ * files. So, we can't merely "hash" the ino numbers since collisions
+ * would corrupt the archive. Instead, we generate synthetic ino values
+ * to store in the archive and maintain a map of original ino values to
+ * synthetic ones so we can preserve hardlink information.
+ *
+ * TODO: Make this more efficient. It's not as bad as it looks (most
+ * files don't have any hardlinks and we don't do any work here for those),
+ * but it wouldn't be hard to do better.
+ *
+ * TODO: Work with dev/ino pairs here instead of just ino values.
+ */
+static int
+synthesize_ino_value(struct cpio *cpio, struct archive_entry *entry)
+{
+ int64_t ino = archive_entry_ino64(entry);
+ int ino_new;
+ size_t i;
+
+ /*
+ * If no index number was given, don't assign one. In
+ * particular, this handles the end-of-archive marker
+ * correctly by giving it a zero index value. (This is also
+ * why we start our synthetic index numbers with one below.)
+ */
+ if (ino == 0)
+ return (0);
+
+ /* Don't store a mapping if we don't need to. */
+ if (archive_entry_nlink(entry) < 2) {
+ return ++cpio->ino_next;
+ }
+
+ /* Look up old ino; if we have it, this is a hardlink
+ * and we reuse the same value. */
+ for (i = 0; i < cpio->ino_list_next; ++i) {
+ if (cpio->ino_list[i].old == ino)
+ return (cpio->ino_list[i].new);
+ }
+
+ /* Assign a new index number. */
+ ino_new = ++cpio->ino_next;
+
+ /* Ensure space for the new mapping. */
+ if (cpio->ino_list_size <= cpio->ino_list_next) {
+ size_t newsize = cpio->ino_list_size < 512
+ ? 512 : cpio->ino_list_size * 2;
+ void *newlist = realloc(cpio->ino_list,
+ sizeof(cpio->ino_list[0]) * newsize);
+ if (newlist == NULL)
+ return (-1);
+
+ cpio->ino_list_size = newsize;
+ cpio->ino_list = newlist;
+ }
+
+ /* Record and return the new value. */
+ cpio->ino_list[cpio->ino_list_next].old = ino;
+ cpio->ino_list[cpio->ino_list_next].new = ino_new;
+ ++cpio->ino_list_next;
+ return (ino_new);
+}
+
+static int
+archive_write_cpio_header(struct archive_write *a, struct archive_entry *entry)
+{
+ struct cpio *cpio;
+ const char *p, *path;
+ int pathlength, ret, ret2;
+ int64_t ino;
+ struct cpio_header h;
+
+ cpio = (struct cpio *)a->format_data;
+ ret2 = ARCHIVE_OK;
+
+ path = archive_entry_pathname(entry);
+ pathlength = (int)strlen(path) + 1; /* Include trailing null. */
+
+ memset(&h, 0, sizeof(h));
+ format_octal(070707, &h.c_magic, sizeof(h.c_magic));
+ format_octal(archive_entry_dev(entry), &h.c_dev, sizeof(h.c_dev));
+
+ ino = synthesize_ino_value(cpio, entry);
+ if (ino < 0) {
+ archive_set_error(&a->archive, ENOMEM,
+ "No memory for ino translation table");
+ return (ARCHIVE_FATAL);
+ } else if (ino > 0777777) {
+ archive_set_error(&a->archive, ERANGE,
+ "Too many files for this cpio format");
+ return (ARCHIVE_FATAL);
+ }
+ format_octal(ino & 0777777, &h.c_ino, sizeof(h.c_ino));
+
+ format_octal(archive_entry_mode(entry), &h.c_mode, sizeof(h.c_mode));
+ format_octal(archive_entry_uid(entry), &h.c_uid, sizeof(h.c_uid));
+ format_octal(archive_entry_gid(entry), &h.c_gid, sizeof(h.c_gid));
+ format_octal(archive_entry_nlink(entry), &h.c_nlink, sizeof(h.c_nlink));
+ if (archive_entry_filetype(entry) == AE_IFBLK
+ || archive_entry_filetype(entry) == AE_IFCHR)
+ format_octal(archive_entry_dev(entry), &h.c_rdev, sizeof(h.c_rdev));
+ else
+ format_octal(0, &h.c_rdev, sizeof(h.c_rdev));
+ format_octal(archive_entry_mtime(entry), &h.c_mtime, sizeof(h.c_mtime));
+ format_octal(pathlength, &h.c_namesize, sizeof(h.c_namesize));
+
+ /* Non-regular files don't store bodies. */
+ if (archive_entry_filetype(entry) != AE_IFREG)
+ archive_entry_set_size(entry, 0);
+
+ /* Symlinks get the link written as the body of the entry. */
+ p = archive_entry_symlink(entry);
+ if (p != NULL && *p != '\0')
+ format_octal(strlen(p), &h.c_filesize, sizeof(h.c_filesize));
+ else
+ format_octal(archive_entry_size(entry),
+ &h.c_filesize, sizeof(h.c_filesize));
+
+ ret = (a->compressor.write)(a, &h, sizeof(h));
+ if (ret != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+
+ ret = (a->compressor.write)(a, path, pathlength);
+ if (ret != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+
+ cpio->entry_bytes_remaining = archive_entry_size(entry);
+
+ /* Write the symlink now. */
+ if (p != NULL && *p != '\0')
+ ret = (a->compressor.write)(a, p, strlen(p));
+
+ if (ret == ARCHIVE_OK)
+ ret = ret2;
+ return (ret);
+}
+
+static ssize_t
+archive_write_cpio_data(struct archive_write *a, const void *buff, size_t s)
+{
+ struct cpio *cpio;
+ int ret;
+
+ cpio = (struct cpio *)a->format_data;
+ if (s > cpio->entry_bytes_remaining)
+ s = cpio->entry_bytes_remaining;
+
+ ret = (a->compressor.write)(a, buff, s);
+ cpio->entry_bytes_remaining -= s;
+ if (ret >= 0)
+ return (s);
+ else
+ return (ret);
+}
+
+/*
+ * Format a number into the specified field.
+ */
+static int
+format_octal(int64_t v, void *p, int digits)
+{
+ int64_t max;
+ int ret;
+
+ max = (((int64_t)1) << (digits * 3)) - 1;
+ if (v >= 0 && v <= max) {
+ format_octal_recursive(v, (char *)p, digits);
+ ret = 0;
+ } else {
+ format_octal_recursive(max, (char *)p, digits);
+ ret = -1;
+ }
+ return (ret);
+}
+
+static int64_t
+format_octal_recursive(int64_t v, char *p, int s)
+{
+ if (s == 0)
+ return (v);
+ v = format_octal_recursive(v, p+1, s-1);
+ *p = '0' + (v & 7);
+ return (v >> 3);
+}
+
+static int
+archive_write_cpio_finish(struct archive_write *a)
+{
+ int er;
+ struct archive_entry *trailer;
+
+ trailer = archive_entry_new();
+ /* nlink = 1 here for GNU cpio compat. */
+ archive_entry_set_nlink(trailer, 1);
+ archive_entry_set_pathname(trailer, "TRAILER!!!");
+ er = archive_write_cpio_header(a, trailer);
+ archive_entry_free(trailer);
+ return (er);
+}
+
+static int
+archive_write_cpio_destroy(struct archive_write *a)
+{
+ struct cpio *cpio;
+
+ cpio = (struct cpio *)a->format_data;
+ free(cpio->ino_list);
+ free(cpio);
+ a->format_data = NULL;
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_write_cpio_finish_entry(struct archive_write *a)
+{
+ struct cpio *cpio;
+ size_t to_write;
+ int ret;
+
+ cpio = (struct cpio *)a->format_data;
+ ret = ARCHIVE_OK;
+ while (cpio->entry_bytes_remaining > 0) {
+ to_write = cpio->entry_bytes_remaining < a->null_length ?
+ cpio->entry_bytes_remaining : a->null_length;
+ ret = (a->compressor.write)(a, a->nulls, to_write);
+ if (ret != ARCHIVE_OK)
+ return (ret);
+ cpio->entry_bytes_remaining -= to_write;
+ }
+ return (ret);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_cpio_newc.c b/archivers/libarchive/files/libarchive/archive_write_set_format_cpio_newc.c
new file mode 100644
index 00000000000..0af0890952e
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_cpio_newc.c
@@ -0,0 +1,295 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * Copyright (c) 2006 Rudolf Marek SYSGO s.r.o.
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_cpio_newc.c 201160 2009-12-29 05:41:57Z kientzle $");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_write_private.h"
+
+static ssize_t archive_write_newc_data(struct archive_write *,
+ const void *buff, size_t s);
+static int archive_write_newc_finish(struct archive_write *);
+static int archive_write_newc_destroy(struct archive_write *);
+static int archive_write_newc_finish_entry(struct archive_write *);
+static int archive_write_newc_header(struct archive_write *,
+ struct archive_entry *);
+static int format_hex(int64_t, void *, int);
+static int64_t format_hex_recursive(int64_t, char *, int);
+
+struct cpio {
+ uint64_t entry_bytes_remaining;
+ int padding;
+};
+
+struct cpio_header_newc {
+ char c_magic[6];
+ char c_ino[8];
+ char c_mode[8];
+ char c_uid[8];
+ char c_gid[8];
+ char c_nlink[8];
+ char c_mtime[8];
+ char c_filesize[8];
+ char c_devmajor[8];
+ char c_devminor[8];
+ char c_rdevmajor[8];
+ char c_rdevminor[8];
+ char c_namesize[8];
+ char c_checksum[8];
+};
+
+/* Logic trick: difference between 'n' and next multiple of 4 */
+#define PAD4(n) (3 & (1 + ~(n)))
+
+/*
+ * Set output format to 'cpio' format.
+ */
+int
+archive_write_set_format_cpio_newc(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ struct cpio *cpio;
+
+ /* If someone else was already registered, unregister them. */
+ if (a->format_destroy != NULL)
+ (a->format_destroy)(a);
+
+ cpio = (struct cpio *)malloc(sizeof(*cpio));
+ if (cpio == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Can't allocate cpio data");
+ return (ARCHIVE_FATAL);
+ }
+ memset(cpio, 0, sizeof(*cpio));
+ a->format_data = cpio;
+
+ a->pad_uncompressed = 1;
+ a->format_name = "cpio";
+ a->format_write_header = archive_write_newc_header;
+ a->format_write_data = archive_write_newc_data;
+ a->format_finish_entry = archive_write_newc_finish_entry;
+ a->format_finish = archive_write_newc_finish;
+ a->format_destroy = archive_write_newc_destroy;
+ a->archive.archive_format = ARCHIVE_FORMAT_CPIO_SVR4_NOCRC;
+ a->archive.archive_format_name = "SVR4 cpio nocrc";
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_write_newc_header(struct archive_write *a, struct archive_entry *entry)
+{
+ int64_t ino;
+ struct cpio *cpio;
+ const char *p, *path;
+ int pathlength, ret, ret2;
+ struct cpio_header_newc h;
+ int pad;
+
+ cpio = (struct cpio *)a->format_data;
+ ret2 = ARCHIVE_OK;
+
+ path = archive_entry_pathname(entry);
+ pathlength = (int)strlen(path) + 1; /* Include trailing null. */
+
+ memset(&h, 0, sizeof(h));
+ format_hex(0x070701, &h.c_magic, sizeof(h.c_magic));
+ format_hex(archive_entry_devmajor(entry), &h.c_devmajor,
+ sizeof(h.c_devmajor));
+ format_hex(archive_entry_devminor(entry), &h.c_devminor,
+ sizeof(h.c_devminor));
+
+ ino = archive_entry_ino64(entry);
+ if (ino > 0xffffffff) {
+ archive_set_error(&a->archive, ERANGE,
+ "large inode number truncated");
+ ret2 = ARCHIVE_WARN;
+ }
+
+ format_hex(ino & 0xffffffff, &h.c_ino, sizeof(h.c_ino));
+ format_hex(archive_entry_mode(entry), &h.c_mode, sizeof(h.c_mode));
+ format_hex(archive_entry_uid(entry), &h.c_uid, sizeof(h.c_uid));
+ format_hex(archive_entry_gid(entry), &h.c_gid, sizeof(h.c_gid));
+ format_hex(archive_entry_nlink(entry), &h.c_nlink, sizeof(h.c_nlink));
+ if (archive_entry_filetype(entry) == AE_IFBLK
+ || archive_entry_filetype(entry) == AE_IFCHR) {
+ format_hex(archive_entry_rdevmajor(entry), &h.c_rdevmajor, sizeof(h.c_rdevmajor));
+ format_hex(archive_entry_rdevminor(entry), &h.c_rdevminor, sizeof(h.c_rdevminor));
+ } else {
+ format_hex(0, &h.c_rdevmajor, sizeof(h.c_rdevmajor));
+ format_hex(0, &h.c_rdevminor, sizeof(h.c_rdevminor));
+ }
+ format_hex(archive_entry_mtime(entry), &h.c_mtime, sizeof(h.c_mtime));
+ format_hex(pathlength, &h.c_namesize, sizeof(h.c_namesize));
+ format_hex(0, &h.c_checksum, sizeof(h.c_checksum));
+
+ /* Non-regular files don't store bodies. */
+ if (archive_entry_filetype(entry) != AE_IFREG)
+ archive_entry_set_size(entry, 0);
+
+ /* Symlinks get the link written as the body of the entry. */
+ p = archive_entry_symlink(entry);
+ if (p != NULL && *p != '\0')
+ format_hex(strlen(p), &h.c_filesize, sizeof(h.c_filesize));
+ else
+ format_hex(archive_entry_size(entry),
+ &h.c_filesize, sizeof(h.c_filesize));
+
+ ret = (a->compressor.write)(a, &h, sizeof(h));
+ if (ret != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+
+ /* Pad pathname to even length. */
+ ret = (a->compressor.write)(a, path, pathlength);
+ if (ret != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+ pad = PAD4(pathlength + sizeof(struct cpio_header_newc));
+ if (pad)
+ ret = (a->compressor.write)(a, "\0\0\0", pad);
+ if (ret != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+
+ cpio->entry_bytes_remaining = archive_entry_size(entry);
+ cpio->padding = PAD4(cpio->entry_bytes_remaining);
+
+ /* Write the symlink now. */
+ if (p != NULL && *p != '\0') {
+ ret = (a->compressor.write)(a, p, strlen(p));
+ if (ret != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+ pad = PAD4(strlen(p));
+ ret = (a->compressor.write)(a, "\0\0\0", pad);
+ }
+
+ if (ret == ARCHIVE_OK)
+ ret = ret2;
+ return (ret);
+}
+
+static ssize_t
+archive_write_newc_data(struct archive_write *a, const void *buff, size_t s)
+{
+ struct cpio *cpio;
+ int ret;
+
+ cpio = (struct cpio *)a->format_data;
+ if (s > cpio->entry_bytes_remaining)
+ s = cpio->entry_bytes_remaining;
+
+ ret = (a->compressor.write)(a, buff, s);
+ cpio->entry_bytes_remaining -= s;
+ if (ret >= 0)
+ return (s);
+ else
+ return (ret);
+}
+
+/*
+ * Format a number into the specified field.
+ */
+static int
+format_hex(int64_t v, void *p, int digits)
+{
+ int64_t max;
+ int ret;
+
+ max = (((int64_t)1) << (digits * 4)) - 1;
+ if (v >= 0 && v <= max) {
+ format_hex_recursive(v, (char *)p, digits);
+ ret = 0;
+ } else {
+ format_hex_recursive(max, (char *)p, digits);
+ ret = -1;
+ }
+ return (ret);
+}
+
+static int64_t
+format_hex_recursive(int64_t v, char *p, int s)
+{
+ if (s == 0)
+ return (v);
+ v = format_hex_recursive(v, p+1, s-1);
+ *p = "0123456789abcdef"[v & 0xf];
+ return (v >> 4);
+}
+
+static int
+archive_write_newc_finish(struct archive_write *a)
+{
+ int er;
+ struct archive_entry *trailer;
+
+ trailer = archive_entry_new();
+ archive_entry_set_nlink(trailer, 1);
+ archive_entry_set_pathname(trailer, "TRAILER!!!");
+ er = archive_write_newc_header(a, trailer);
+ archive_entry_free(trailer);
+ return (er);
+}
+
+static int
+archive_write_newc_destroy(struct archive_write *a)
+{
+ struct cpio *cpio;
+
+ cpio = (struct cpio *)a->format_data;
+ free(cpio);
+ a->format_data = NULL;
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_write_newc_finish_entry(struct archive_write *a)
+{
+ struct cpio *cpio;
+ size_t to_write;
+ int ret;
+
+ cpio = (struct cpio *)a->format_data;
+ while (cpio->entry_bytes_remaining > 0) {
+ to_write = cpio->entry_bytes_remaining < a->null_length ?
+ cpio->entry_bytes_remaining : a->null_length;
+ ret = (a->compressor.write)(a, a->nulls, to_write);
+ if (ret != ARCHIVE_OK)
+ return (ret);
+ cpio->entry_bytes_remaining -= to_write;
+ }
+ ret = (a->compressor.write)(a, a->nulls, cpio->padding);
+ return (ret);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c b/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c
new file mode 100644
index 00000000000..00c3f3f08cc
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_pax.c
@@ -0,0 +1,1386 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_pax.c 201162 2009-12-29 05:47:46Z kientzle $");
+
+#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 "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_write_private.h"
+
+struct pax {
+ uint64_t entry_bytes_remaining;
+ uint64_t entry_padding;
+ struct archive_string pax_header;
+};
+
+static void add_pax_attr(struct archive_string *, const char *key,
+ const char *value);
+static void add_pax_attr_int(struct archive_string *,
+ const char *key, int64_t value);
+static void add_pax_attr_time(struct archive_string *,
+ const char *key, int64_t sec,
+ unsigned long nanos);
+static void add_pax_attr_w(struct archive_string *,
+ const char *key, const wchar_t *wvalue);
+static ssize_t archive_write_pax_data(struct archive_write *,
+ const void *, size_t);
+static int archive_write_pax_finish(struct archive_write *);
+static int archive_write_pax_destroy(struct archive_write *);
+static int archive_write_pax_finish_entry(struct archive_write *);
+static int archive_write_pax_header(struct archive_write *,
+ struct archive_entry *);
+static char *base64_encode(const char *src, size_t len);
+static char *build_pax_attribute_name(char *dest, const char *src);
+static char *build_ustar_entry_name(char *dest, const char *src,
+ size_t src_length, const char *insert);
+static char *format_int(char *dest, int64_t);
+static int has_non_ASCII(const wchar_t *);
+static char *url_encode(const char *in);
+static int write_nulls(struct archive_write *, size_t);
+
+/*
+ * Set output format to 'restricted pax' format.
+ *
+ * This is the same as normal 'pax', but tries to suppress
+ * the pax header whenever possible. This is the default for
+ * bsdtar, for instance.
+ */
+int
+archive_write_set_format_pax_restricted(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ int r;
+ r = archive_write_set_format_pax(&a->archive);
+ a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_RESTRICTED;
+ a->archive.archive_format_name = "restricted POSIX pax interchange";
+ return (r);
+}
+
+/*
+ * Set output format to 'pax' format.
+ */
+int
+archive_write_set_format_pax(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ struct pax *pax;
+
+ if (a->format_destroy != NULL)
+ (a->format_destroy)(a);
+
+ pax = (struct pax *)malloc(sizeof(*pax));
+ if (pax == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Can't allocate pax data");
+ return (ARCHIVE_FATAL);
+ }
+ memset(pax, 0, sizeof(*pax));
+ a->format_data = pax;
+
+ a->pad_uncompressed = 1;
+ a->format_name = "pax";
+ a->format_write_header = archive_write_pax_header;
+ a->format_write_data = archive_write_pax_data;
+ a->format_finish = archive_write_pax_finish;
+ a->format_destroy = archive_write_pax_destroy;
+ a->format_finish_entry = archive_write_pax_finish_entry;
+ a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE;
+ a->archive.archive_format_name = "POSIX pax interchange";
+ return (ARCHIVE_OK);
+}
+
+/*
+ * Note: This code assumes that 'nanos' has the same sign as 'sec',
+ * which implies that sec=-1, nanos=200000000 represents -1.2 seconds
+ * and not -0.8 seconds. This is a pretty pedantic point, as we're
+ * unlikely to encounter many real files created before Jan 1, 1970,
+ * much less ones with timestamps recorded to sub-second resolution.
+ */
+static void
+add_pax_attr_time(struct archive_string *as, const char *key,
+ int64_t sec, unsigned long nanos)
+{
+ int digit, i;
+ char *t;
+ /*
+ * Note that each byte contributes fewer than 3 base-10
+ * digits, so this will always be big enough.
+ */
+ char tmp[1 + 3*sizeof(sec) + 1 + 3*sizeof(nanos)];
+
+ tmp[sizeof(tmp) - 1] = 0;
+ t = tmp + sizeof(tmp) - 1;
+
+ /* Skip trailing zeros in the fractional part. */
+ for (digit = 0, i = 10; i > 0 && digit == 0; i--) {
+ digit = nanos % 10;
+ nanos /= 10;
+ }
+
+ /* Only format the fraction if it's non-zero. */
+ if (i > 0) {
+ while (i > 0) {
+ *--t = "0123456789"[digit];
+ digit = nanos % 10;
+ nanos /= 10;
+ i--;
+ }
+ *--t = '.';
+ }
+ t = format_int(t, sec);
+
+ add_pax_attr(as, key, t);
+}
+
+static char *
+format_int(char *t, int64_t i)
+{
+ int sign;
+
+ if (i < 0) {
+ sign = -1;
+ i = -i;
+ } else
+ sign = 1;
+
+ do {
+ *--t = "0123456789"[i % 10];
+ } while (i /= 10);
+ if (sign < 0)
+ *--t = '-';
+ return (t);
+}
+
+static void
+add_pax_attr_int(struct archive_string *as, const char *key, int64_t value)
+{
+ char tmp[1 + 3 * sizeof(value)];
+
+ tmp[sizeof(tmp) - 1] = 0;
+ add_pax_attr(as, key, format_int(tmp + sizeof(tmp) - 1, value));
+}
+
+static char *
+utf8_encode(const wchar_t *wval)
+{
+ int utf8len;
+ const wchar_t *wp;
+ unsigned long wc;
+ char *utf8_value, *p;
+
+ utf8len = 0;
+ for (wp = wval; *wp != L'\0'; ) {
+ wc = *wp++;
+
+ if (wc >= 0xd800 && wc <= 0xdbff
+ && *wp >= 0xdc00 && *wp <= 0xdfff) {
+ /* This is a surrogate pair. Combine into a
+ * full Unicode value before encoding into
+ * UTF-8. */
+ wc = (wc - 0xd800) << 10; /* High 10 bits */
+ wc += (*wp++ - 0xdc00); /* Low 10 bits */
+ wc += 0x10000; /* Skip BMP */
+ }
+ if (wc <= 0x7f)
+ utf8len++;
+ else if (wc <= 0x7ff)
+ utf8len += 2;
+ else if (wc <= 0xffff)
+ utf8len += 3;
+ else if (wc <= 0x1fffff)
+ utf8len += 4;
+ else if (wc <= 0x3ffffff)
+ utf8len += 5;
+ else if (wc <= 0x7fffffff)
+ utf8len += 6;
+ /* Ignore larger values; UTF-8 can't encode them. */
+ }
+
+ utf8_value = (char *)malloc(utf8len + 1);
+ if (utf8_value == NULL) {
+ __archive_errx(1, "Not enough memory for attributes");
+ return (NULL);
+ }
+
+ for (wp = wval, p = utf8_value; *wp != L'\0'; ) {
+ wc = *wp++;
+ if (wc >= 0xd800 && wc <= 0xdbff
+ && *wp >= 0xdc00 && *wp <= 0xdfff) {
+ /* Combine surrogate pair. */
+ wc = (wc - 0xd800) << 10;
+ wc += *wp++ - 0xdc00 + 0x10000;
+ }
+ if (wc <= 0x7f) {
+ *p++ = (char)wc;
+ } else if (wc <= 0x7ff) {
+ p[0] = 0xc0 | ((wc >> 6) & 0x1f);
+ p[1] = 0x80 | (wc & 0x3f);
+ p += 2;
+ } else if (wc <= 0xffff) {
+ p[0] = 0xe0 | ((wc >> 12) & 0x0f);
+ p[1] = 0x80 | ((wc >> 6) & 0x3f);
+ p[2] = 0x80 | (wc & 0x3f);
+ p += 3;
+ } else if (wc <= 0x1fffff) {
+ p[0] = 0xf0 | ((wc >> 18) & 0x07);
+ p[1] = 0x80 | ((wc >> 12) & 0x3f);
+ p[2] = 0x80 | ((wc >> 6) & 0x3f);
+ p[3] = 0x80 | (wc & 0x3f);
+ p += 4;
+ } else if (wc <= 0x3ffffff) {
+ p[0] = 0xf8 | ((wc >> 24) & 0x03);
+ p[1] = 0x80 | ((wc >> 18) & 0x3f);
+ p[2] = 0x80 | ((wc >> 12) & 0x3f);
+ p[3] = 0x80 | ((wc >> 6) & 0x3f);
+ p[4] = 0x80 | (wc & 0x3f);
+ p += 5;
+ } else if (wc <= 0x7fffffff) {
+ p[0] = 0xfc | ((wc >> 30) & 0x01);
+ p[1] = 0x80 | ((wc >> 24) & 0x3f);
+ p[1] = 0x80 | ((wc >> 18) & 0x3f);
+ p[2] = 0x80 | ((wc >> 12) & 0x3f);
+ p[3] = 0x80 | ((wc >> 6) & 0x3f);
+ p[4] = 0x80 | (wc & 0x3f);
+ p += 6;
+ }
+ /* Ignore larger values; UTF-8 can't encode them. */
+ }
+ *p = '\0';
+
+ return (utf8_value);
+}
+
+static void
+add_pax_attr_w(struct archive_string *as, const char *key, const wchar_t *wval)
+{
+ char *utf8_value = utf8_encode(wval);
+ if (utf8_value == NULL)
+ return;
+ add_pax_attr(as, key, utf8_value);
+ free(utf8_value);
+}
+
+/*
+ * Add a key/value attribute to the pax header. This function handles
+ * the length field and various other syntactic requirements.
+ */
+static void
+add_pax_attr(struct archive_string *as, const char *key, const char *value)
+{
+ int digits, i, len, next_ten;
+ char tmp[1 + 3 * sizeof(int)]; /* < 3 base-10 digits per byte */
+
+ /*-
+ * PAX attributes have the following layout:
+ * <len> <space> <key> <=> <value> <nl>
+ */
+ len = 1 + (int)strlen(key) + 1 + (int)strlen(value) + 1;
+
+ /*
+ * The <len> field includes the length of the <len> field, so
+ * computing the correct length is tricky. I start by
+ * counting the number of base-10 digits in 'len' and
+ * computing the next higher power of 10.
+ */
+ next_ten = 1;
+ digits = 0;
+ i = len;
+ while (i > 0) {
+ i = i / 10;
+ digits++;
+ next_ten = next_ten * 10;
+ }
+ /*
+ * For example, if string without the length field is 99
+ * chars, then adding the 2 digit length "99" will force the
+ * total length past 100, requiring an extra digit. The next
+ * statement adjusts for this effect.
+ */
+ if (len + digits >= next_ten)
+ digits++;
+
+ /* Now, we have the right length so we can build the line. */
+ tmp[sizeof(tmp) - 1] = 0; /* Null-terminate the work area. */
+ archive_strcat(as, format_int(tmp + sizeof(tmp) - 1, len + digits));
+ archive_strappend_char(as, ' ');
+ archive_strcat(as, key);
+ archive_strappend_char(as, '=');
+ archive_strcat(as, value);
+ archive_strappend_char(as, '\n');
+}
+
+static void
+archive_write_pax_header_xattrs(struct pax *pax, struct archive_entry *entry)
+{
+ struct archive_string s;
+ int i = archive_entry_xattr_reset(entry);
+
+ while (i--) {
+ const char *name;
+ const void *value;
+ char *encoded_value;
+ char *url_encoded_name = NULL, *encoded_name = NULL;
+ wchar_t *wcs_name = NULL;
+ size_t size;
+
+ archive_entry_xattr_next(entry, &name, &value, &size);
+ /* Name is URL-encoded, then converted to wchar_t,
+ * then UTF-8 encoded. */
+ url_encoded_name = url_encode(name);
+ if (url_encoded_name != NULL) {
+ /* Convert narrow-character to wide-character. */
+ size_t wcs_length = strlen(url_encoded_name);
+ wcs_name = (wchar_t *)malloc((wcs_length + 1) * sizeof(wchar_t));
+ if (wcs_name == NULL)
+ __archive_errx(1, "No memory for xattr conversion");
+ mbstowcs(wcs_name, url_encoded_name, wcs_length);
+ wcs_name[wcs_length] = 0;
+ free(url_encoded_name); /* Done with this. */
+ }
+ if (wcs_name != NULL) {
+ encoded_name = utf8_encode(wcs_name);
+ free(wcs_name); /* Done with wchar_t name. */
+ }
+
+ encoded_value = base64_encode((const char *)value, size);
+
+ if (encoded_name != NULL && encoded_value != NULL) {
+ archive_string_init(&s);
+ archive_strcpy(&s, "LIBARCHIVE.xattr.");
+ archive_strcat(&s, encoded_name);
+ add_pax_attr(&(pax->pax_header), s.s, encoded_value);
+ archive_string_free(&s);
+ }
+ free(encoded_name);
+ free(encoded_value);
+ }
+}
+
+/*
+ * TODO: Consider adding 'comment' and 'charset' fields to
+ * archive_entry so that clients can specify them. Also, consider
+ * adding generic key/value tags so clients can add arbitrary
+ * key/value data.
+ */
+static int
+archive_write_pax_header(struct archive_write *a,
+ struct archive_entry *entry_original)
+{
+ struct archive_entry *entry_main;
+ const char *p;
+ char *t;
+ const wchar_t *wp;
+ const char *suffix;
+ int need_extension, r, ret;
+ struct pax *pax;
+ const char *hdrcharset = NULL;
+ const char *hardlink;
+ const char *path = NULL, *linkpath = NULL;
+ const char *uname = NULL, *gname = NULL;
+ const wchar_t *path_w = NULL, *linkpath_w = NULL;
+ const wchar_t *uname_w = NULL, *gname_w = NULL;
+
+ char paxbuff[512];
+ char ustarbuff[512];
+ char ustar_entry_name[256];
+ char pax_entry_name[256];
+
+ ret = ARCHIVE_OK;
+ need_extension = 0;
+ pax = (struct pax *)a->format_data;
+
+ hardlink = archive_entry_hardlink(entry_original);
+
+ /* Make sure this is a type of entry that we can handle here */
+ if (hardlink == NULL) {
+ switch (archive_entry_filetype(entry_original)) {
+ case AE_IFBLK:
+ case AE_IFCHR:
+ case AE_IFIFO:
+ case AE_IFLNK:
+ case AE_IFREG:
+ break;
+ case AE_IFDIR:
+ /*
+ * Ensure a trailing '/'. Modify the original
+ * entry so the client sees the change.
+ */
+ p = archive_entry_pathname(entry_original);
+ if (p[strlen(p) - 1] != '/') {
+ t = (char *)malloc(strlen(p) + 2);
+ if (t == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate pax data");
+ return(ARCHIVE_FATAL);
+ }
+ strcpy(t, p);
+ strcat(t, "/");
+ archive_entry_copy_pathname(entry_original, t);
+ free(t);
+ }
+ break;
+ case AE_IFSOCK:
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "tar format cannot archive socket");
+ return (ARCHIVE_WARN);
+ default:
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "tar format cannot archive this (type=0%lo)",
+ (unsigned long)archive_entry_filetype(entry_original));
+ return (ARCHIVE_WARN);
+ }
+ }
+
+ /* Copy entry so we can modify it as needed. */
+ entry_main = archive_entry_clone(entry_original);
+ archive_string_empty(&(pax->pax_header)); /* Blank our work area. */
+
+ /*
+ * First, check the name fields and see if any of them
+ * require binary coding. If any of them does, then all of
+ * them do.
+ */
+ hdrcharset = NULL;
+ path = archive_entry_pathname(entry_main);
+ path_w = archive_entry_pathname_w(entry_main);
+ if (path != NULL && path_w == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Can't translate pathname '%s' to UTF-8", path);
+ ret = ARCHIVE_WARN;
+ hdrcharset = "BINARY";
+ }
+ uname = archive_entry_uname(entry_main);
+ uname_w = archive_entry_uname_w(entry_main);
+ if (uname != NULL && uname_w == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Can't translate uname '%s' to UTF-8", uname);
+ ret = ARCHIVE_WARN;
+ hdrcharset = "BINARY";
+ }
+ gname = archive_entry_gname(entry_main);
+ gname_w = archive_entry_gname_w(entry_main);
+ if (gname != NULL && gname_w == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Can't translate gname '%s' to UTF-8", gname);
+ ret = ARCHIVE_WARN;
+ hdrcharset = "BINARY";
+ }
+ linkpath = hardlink;
+ if (linkpath != NULL) {
+ linkpath_w = archive_entry_hardlink_w(entry_main);
+ } else {
+ linkpath = archive_entry_symlink(entry_main);
+ if (linkpath != NULL)
+ linkpath_w = archive_entry_symlink_w(entry_main);
+ }
+ if (linkpath != NULL && linkpath_w == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Can't translate linkpath '%s' to UTF-8", linkpath);
+ ret = ARCHIVE_WARN;
+ hdrcharset = "BINARY";
+ }
+
+ /* Store the header encoding first, to be nice to readers. */
+ if (hdrcharset != NULL)
+ add_pax_attr(&(pax->pax_header), "hdrcharset", hdrcharset);
+
+
+ /*
+ * If name is too long, or has non-ASCII characters, add
+ * 'path' to pax extended attrs. (Note that an unconvertible
+ * name must have non-ASCII characters.)
+ */
+ if (path == NULL) {
+ /* We don't have a narrow version, so we have to store
+ * the wide version. */
+ add_pax_attr_w(&(pax->pax_header), "path", path_w);
+ archive_entry_set_pathname(entry_main, "@WidePath");
+ need_extension = 1;
+ } else if (has_non_ASCII(path_w)) {
+ /* We have non-ASCII characters. */
+ if (path_w == NULL || hdrcharset != NULL) {
+ /* Can't do UTF-8, so store it raw. */
+ add_pax_attr(&(pax->pax_header), "path", path);
+ } else {
+ /* Store UTF-8 */
+ add_pax_attr_w(&(pax->pax_header),
+ "path", path_w);
+ }
+ archive_entry_set_pathname(entry_main,
+ build_ustar_entry_name(ustar_entry_name,
+ path, strlen(path), NULL));
+ need_extension = 1;
+ } else {
+ /* We have an all-ASCII path; we'd like to just store
+ * it in the ustar header if it will fit. Yes, this
+ * duplicates some of the logic in
+ * write_set_format_ustar.c
+ */
+ if (strlen(path) <= 100) {
+ /* Fits in the old 100-char tar name field. */
+ } else {
+ /* Find largest suffix that will fit. */
+ /* Note: strlen() > 100, so strlen() - 100 - 1 >= 0 */
+ suffix = strchr(path + strlen(path) - 100 - 1, '/');
+ /* Don't attempt an empty prefix. */
+ if (suffix == path)
+ suffix = strchr(suffix + 1, '/');
+ /* We can put it in the ustar header if it's
+ * all ASCII and it's either <= 100 characters
+ * or can be split at a '/' into a prefix <=
+ * 155 chars and a suffix <= 100 chars. (Note
+ * the strchr() above will return NULL exactly
+ * when the path can't be split.)
+ */
+ if (suffix == NULL /* Suffix > 100 chars. */
+ || suffix[1] == '\0' /* empty suffix */
+ || suffix - path > 155) /* Prefix > 155 chars */
+ {
+ if (path_w == NULL || hdrcharset != NULL) {
+ /* Can't do UTF-8, so store it raw. */
+ add_pax_attr(&(pax->pax_header),
+ "path", path);
+ } else {
+ /* Store UTF-8 */
+ add_pax_attr_w(&(pax->pax_header),
+ "path", path_w);
+ }
+ archive_entry_set_pathname(entry_main,
+ build_ustar_entry_name(ustar_entry_name,
+ path, strlen(path), NULL));
+ need_extension = 1;
+ }
+ }
+ }
+
+ if (linkpath != NULL) {
+ /* If link name is too long or has non-ASCII characters, add
+ * 'linkpath' to pax extended attrs. */
+ if (strlen(linkpath) > 100 || linkpath_w == NULL
+ || linkpath_w == NULL || has_non_ASCII(linkpath_w)) {
+ if (linkpath_w == NULL || hdrcharset != NULL)
+ /* If the linkpath is not convertible
+ * to wide, or we're encoding in
+ * binary anyway, store it raw. */
+ add_pax_attr(&(pax->pax_header),
+ "linkpath", linkpath);
+ else
+ /* If the link is long or has a
+ * non-ASCII character, store it as a
+ * pax extended attribute. */
+ add_pax_attr_w(&(pax->pax_header),
+ "linkpath", linkpath_w);
+ if (strlen(linkpath) > 100) {
+ if (hardlink != NULL)
+ archive_entry_set_hardlink(entry_main,
+ "././@LongHardLink");
+ else
+ archive_entry_set_symlink(entry_main,
+ "././@LongSymLink");
+ }
+ need_extension = 1;
+ }
+ }
+
+ /* If file size is too large, add 'size' to pax extended attrs. */
+ if (archive_entry_size(entry_main) >= (((int64_t)1) << 33)) {
+ add_pax_attr_int(&(pax->pax_header), "size",
+ archive_entry_size(entry_main));
+ need_extension = 1;
+ }
+
+ /* If numeric GID is too large, add 'gid' to pax extended attrs. */
+ if ((unsigned int)archive_entry_gid(entry_main) >= (1 << 18)) {
+ add_pax_attr_int(&(pax->pax_header), "gid",
+ archive_entry_gid(entry_main));
+ need_extension = 1;
+ }
+
+ /* If group name is too large or has non-ASCII characters, add
+ * 'gname' to pax extended attrs. */
+ if (gname != NULL) {
+ if (strlen(gname) > 31
+ || gname_w == NULL
+ || has_non_ASCII(gname_w))
+ {
+ if (gname_w == NULL || hdrcharset != NULL) {
+ add_pax_attr(&(pax->pax_header),
+ "gname", gname);
+ } else {
+ add_pax_attr_w(&(pax->pax_header),
+ "gname", gname_w);
+ }
+ need_extension = 1;
+ }
+ }
+
+ /* If numeric UID is too large, add 'uid' to pax extended attrs. */
+ if ((unsigned int)archive_entry_uid(entry_main) >= (1 << 18)) {
+ add_pax_attr_int(&(pax->pax_header), "uid",
+ archive_entry_uid(entry_main));
+ need_extension = 1;
+ }
+
+ /* Add 'uname' to pax extended attrs if necessary. */
+ if (uname != NULL) {
+ if (strlen(uname) > 31
+ || uname_w == NULL
+ || has_non_ASCII(uname_w))
+ {
+ if (uname_w == NULL || hdrcharset != NULL) {
+ add_pax_attr(&(pax->pax_header),
+ "uname", uname);
+ } else {
+ add_pax_attr_w(&(pax->pax_header),
+ "uname", uname_w);
+ }
+ need_extension = 1;
+ }
+ }
+
+ /*
+ * POSIX/SUSv3 doesn't provide a standard key for large device
+ * numbers. I use the same keys here that Joerg Schilling
+ * used for 'star.' (Which, somewhat confusingly, are called
+ * "devXXX" even though they code "rdev" values.) No doubt,
+ * other implementations use other keys. Note that there's no
+ * reason we can't write the same information into a number of
+ * different keys.
+ *
+ * Of course, this is only needed for block or char device entries.
+ */
+ if (archive_entry_filetype(entry_main) == AE_IFBLK
+ || archive_entry_filetype(entry_main) == AE_IFCHR) {
+ /*
+ * If rdevmajor is too large, add 'SCHILY.devmajor' to
+ * extended attributes.
+ */
+ dev_t rdevmajor, rdevminor;
+ rdevmajor = archive_entry_rdevmajor(entry_main);
+ rdevminor = archive_entry_rdevminor(entry_main);
+ if (rdevmajor >= (1 << 18)) {
+ add_pax_attr_int(&(pax->pax_header), "SCHILY.devmajor",
+ rdevmajor);
+ /*
+ * Non-strict formatting below means we don't
+ * have to truncate here. Not truncating improves
+ * the chance that some more modern tar archivers
+ * (such as GNU tar 1.13) can restore the full
+ * value even if they don't understand the pax
+ * extended attributes. See my rant below about
+ * file size fields for additional details.
+ */
+ /* archive_entry_set_rdevmajor(entry_main,
+ rdevmajor & ((1 << 18) - 1)); */
+ need_extension = 1;
+ }
+
+ /*
+ * If devminor is too large, add 'SCHILY.devminor' to
+ * extended attributes.
+ */
+ if (rdevminor >= (1 << 18)) {
+ add_pax_attr_int(&(pax->pax_header), "SCHILY.devminor",
+ rdevminor);
+ /* Truncation is not necessary here, either. */
+ /* archive_entry_set_rdevminor(entry_main,
+ rdevminor & ((1 << 18) - 1)); */
+ need_extension = 1;
+ }
+ }
+
+ /*
+ * Technically, the mtime field in the ustar header can
+ * support 33 bits, but many platforms use signed 32-bit time
+ * values. The cutoff of 0x7fffffff here is a compromise.
+ * Yes, this check is duplicated just below; this helps to
+ * avoid writing an mtime attribute just to handle a
+ * high-resolution timestamp in "restricted pax" mode.
+ */
+ if (!need_extension &&
+ ((archive_entry_mtime(entry_main) < 0)
+ || (archive_entry_mtime(entry_main) >= 0x7fffffff)))
+ need_extension = 1;
+
+ /* I use a star-compatible file flag attribute. */
+ p = archive_entry_fflags_text(entry_main);
+ if (!need_extension && p != NULL && *p != '\0')
+ need_extension = 1;
+
+ /* If there are non-trivial ACL entries, we need an extension. */
+ if (!need_extension && archive_entry_acl_count(entry_original,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS) > 0)
+ need_extension = 1;
+
+ /* If there are non-trivial ACL entries, we need an extension. */
+ if (!need_extension && archive_entry_acl_count(entry_original,
+ ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) > 0)
+ need_extension = 1;
+
+ /* If there are extended attributes, we need an extension */
+ if (!need_extension && archive_entry_xattr_count(entry_original) > 0)
+ need_extension = 1;
+
+ /*
+ * The following items are handled differently in "pax
+ * restricted" format. In particular, in "pax restricted"
+ * format they won't be added unless need_extension is
+ * already set (we're already generating an extended header, so
+ * may as well include these).
+ */
+ if (a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_RESTRICTED ||
+ need_extension) {
+
+ if (archive_entry_mtime(entry_main) < 0 ||
+ archive_entry_mtime(entry_main) >= 0x7fffffff ||
+ archive_entry_mtime_nsec(entry_main) != 0)
+ add_pax_attr_time(&(pax->pax_header), "mtime",
+ archive_entry_mtime(entry_main),
+ archive_entry_mtime_nsec(entry_main));
+
+ if (archive_entry_ctime(entry_main) != 0 ||
+ archive_entry_ctime_nsec(entry_main) != 0)
+ add_pax_attr_time(&(pax->pax_header), "ctime",
+ archive_entry_ctime(entry_main),
+ archive_entry_ctime_nsec(entry_main));
+
+ if (archive_entry_atime(entry_main) != 0 ||
+ archive_entry_atime_nsec(entry_main) != 0)
+ add_pax_attr_time(&(pax->pax_header), "atime",
+ archive_entry_atime(entry_main),
+ archive_entry_atime_nsec(entry_main));
+
+ /* Store birth/creationtime only if it's earlier than mtime */
+ if (archive_entry_birthtime_is_set(entry_main) &&
+ archive_entry_birthtime(entry_main)
+ < archive_entry_mtime(entry_main))
+ add_pax_attr_time(&(pax->pax_header),
+ "LIBARCHIVE.creationtime",
+ archive_entry_birthtime(entry_main),
+ archive_entry_birthtime_nsec(entry_main));
+
+ /* I use a star-compatible file flag attribute. */
+ p = archive_entry_fflags_text(entry_main);
+ if (p != NULL && *p != '\0')
+ add_pax_attr(&(pax->pax_header), "SCHILY.fflags", p);
+
+ /* I use star-compatible ACL attributes. */
+ wp = archive_entry_acl_text_w(entry_original,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS |
+ ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID);
+ if (wp != NULL && *wp != L'\0')
+ add_pax_attr_w(&(pax->pax_header),
+ "SCHILY.acl.access", wp);
+ wp = archive_entry_acl_text_w(entry_original,
+ ARCHIVE_ENTRY_ACL_TYPE_DEFAULT |
+ ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID);
+ if (wp != NULL && *wp != L'\0')
+ add_pax_attr_w(&(pax->pax_header),
+ "SCHILY.acl.default", wp);
+
+ /* Include star-compatible metadata info. */
+ /* Note: "SCHILY.dev{major,minor}" are NOT the
+ * major/minor portions of "SCHILY.dev". */
+ add_pax_attr_int(&(pax->pax_header), "SCHILY.dev",
+ archive_entry_dev(entry_main));
+ add_pax_attr_int(&(pax->pax_header), "SCHILY.ino",
+ archive_entry_ino64(entry_main));
+ add_pax_attr_int(&(pax->pax_header), "SCHILY.nlink",
+ archive_entry_nlink(entry_main));
+
+ /* Store extended attributes */
+ archive_write_pax_header_xattrs(pax, entry_original);
+ }
+
+ /* Only regular files have data. */
+ if (archive_entry_filetype(entry_main) != AE_IFREG)
+ archive_entry_set_size(entry_main, 0);
+
+ /*
+ * Pax-restricted does not store data for hardlinks, in order
+ * to improve compatibility with ustar.
+ */
+ if (a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE &&
+ hardlink != NULL)
+ archive_entry_set_size(entry_main, 0);
+
+ /*
+ * XXX Full pax interchange format does permit a hardlink
+ * entry to have data associated with it. I'm not supporting
+ * that here because the client expects me to tell them whether
+ * or not this format expects data for hardlinks. If I
+ * don't check here, then every pax archive will end up with
+ * duplicated data for hardlinks. Someday, there may be
+ * need to select this behavior, in which case the following
+ * will need to be revisited. XXX
+ */
+ if (hardlink != NULL)
+ archive_entry_set_size(entry_main, 0);
+
+ /* Format 'ustar' header for main entry.
+ *
+ * The trouble with file size: If the reader can't understand
+ * the file size, they may not be able to locate the next
+ * entry and the rest of the archive is toast. Pax-compliant
+ * readers are supposed to ignore the file size in the main
+ * header, so the question becomes how to maximize portability
+ * for readers that don't support pax attribute extensions.
+ * For maximum compatibility, I permit numeric extensions in
+ * the main header so that the file size stored will always be
+ * correct, even if it's in a format that only some
+ * implementations understand. The technique used here is:
+ *
+ * a) If possible, follow the standard exactly. This handles
+ * files up to 8 gigabytes minus 1.
+ *
+ * b) If that fails, try octal but omit the field terminator.
+ * That handles files up to 64 gigabytes minus 1.
+ *
+ * c) Otherwise, use base-256 extensions. That handles files
+ * up to 2^63 in this implementation, with the potential to
+ * go up to 2^94. That should hold us for a while. ;-)
+ *
+ * The non-strict formatter uses similar logic for other
+ * numeric fields, though they're less critical.
+ */
+ __archive_write_format_header_ustar(a, ustarbuff, entry_main, -1, 0);
+
+ /* If we built any extended attributes, write that entry first. */
+ if (archive_strlen(&(pax->pax_header)) > 0) {
+ struct archive_entry *pax_attr_entry;
+ time_t s;
+ uid_t uid;
+ gid_t gid;
+ mode_t mode;
+
+ pax_attr_entry = archive_entry_new();
+ p = archive_entry_pathname(entry_main);
+ archive_entry_set_pathname(pax_attr_entry,
+ build_pax_attribute_name(pax_entry_name, p));
+ archive_entry_set_size(pax_attr_entry,
+ archive_strlen(&(pax->pax_header)));
+ /* Copy uid/gid (but clip to ustar limits). */
+ uid = archive_entry_uid(entry_main);
+ if ((unsigned int)uid >= 1 << 18)
+ uid = (uid_t)(1 << 18) - 1;
+ archive_entry_set_uid(pax_attr_entry, uid);
+ gid = archive_entry_gid(entry_main);
+ if ((unsigned int)gid >= 1 << 18)
+ gid = (gid_t)(1 << 18) - 1;
+ archive_entry_set_gid(pax_attr_entry, gid);
+ /* Copy mode over (but not setuid/setgid bits) */
+ mode = archive_entry_mode(entry_main);
+#ifdef S_ISUID
+ mode &= ~S_ISUID;
+#endif
+#ifdef S_ISGID
+ mode &= ~S_ISGID;
+#endif
+#ifdef S_ISVTX
+ mode &= ~S_ISVTX;
+#endif
+ archive_entry_set_mode(pax_attr_entry, mode);
+
+ /* Copy uname/gname. */
+ archive_entry_set_uname(pax_attr_entry,
+ archive_entry_uname(entry_main));
+ archive_entry_set_gname(pax_attr_entry,
+ archive_entry_gname(entry_main));
+
+ /* Copy mtime, but clip to ustar limits. */
+ s = archive_entry_mtime(entry_main);
+ if (s < 0) { s = 0; }
+ if (s >= 0x7fffffff) { s = 0x7fffffff; }
+ archive_entry_set_mtime(pax_attr_entry, s, 0);
+
+ /* Standard ustar doesn't support atime. */
+ archive_entry_set_atime(pax_attr_entry, 0, 0);
+
+ /* Standard ustar doesn't support ctime. */
+ archive_entry_set_ctime(pax_attr_entry, 0, 0);
+
+ r = __archive_write_format_header_ustar(a, paxbuff,
+ pax_attr_entry, 'x', 1);
+
+ archive_entry_free(pax_attr_entry);
+
+ /* Note that the 'x' header shouldn't ever fail to format */
+ if (r != 0) {
+ const char *msg = "archive_write_pax_header: "
+ "'x' header failed?! This can't happen.\n";
+ size_t u = write(2, msg, strlen(msg));
+ (void)u; /* UNUSED */
+ exit(1);
+ }
+ r = (a->compressor.write)(a, paxbuff, 512);
+ if (r != ARCHIVE_OK) {
+ pax->entry_bytes_remaining = 0;
+ pax->entry_padding = 0;
+ return (ARCHIVE_FATAL);
+ }
+
+ pax->entry_bytes_remaining = archive_strlen(&(pax->pax_header));
+ pax->entry_padding = 0x1ff & (-(int64_t)pax->entry_bytes_remaining);
+
+ r = (a->compressor.write)(a, pax->pax_header.s,
+ archive_strlen(&(pax->pax_header)));
+ if (r != ARCHIVE_OK) {
+ /* If a write fails, we're pretty much toast. */
+ return (ARCHIVE_FATAL);
+ }
+ /* Pad out the end of the entry. */
+ r = write_nulls(a, pax->entry_padding);
+ if (r != ARCHIVE_OK) {
+ /* If a write fails, we're pretty much toast. */
+ return (ARCHIVE_FATAL);
+ }
+ pax->entry_bytes_remaining = pax->entry_padding = 0;
+ }
+
+ /* Write the header for main entry. */
+ r = (a->compressor.write)(a, ustarbuff, 512);
+ if (r != ARCHIVE_OK)
+ return (r);
+
+ /*
+ * Inform the client of the on-disk size we're using, so
+ * they can avoid unnecessarily writing a body for something
+ * that we're just going to ignore.
+ */
+ archive_entry_set_size(entry_original, archive_entry_size(entry_main));
+ pax->entry_bytes_remaining = archive_entry_size(entry_main);
+ pax->entry_padding = 0x1ff & (-(int64_t)pax->entry_bytes_remaining);
+ archive_entry_free(entry_main);
+
+ return (ret);
+}
+
+/*
+ * We need a valid name for the regular 'ustar' entry. This routine
+ * tries to hack something more-or-less reasonable.
+ *
+ * The approach here tries to preserve leading dir names. We do so by
+ * working with four sections:
+ * 1) "prefix" directory names,
+ * 2) "suffix" directory names,
+ * 3) inserted dir name (optional),
+ * 4) filename.
+ *
+ * These sections must satisfy the following requirements:
+ * * Parts 1 & 2 together form an initial portion of the dir name.
+ * * Part 3 is specified by the caller. (It should not contain a leading
+ * or trailing '/'.)
+ * * Part 4 forms an initial portion of the base filename.
+ * * The filename must be <= 99 chars to fit the ustar 'name' field.
+ * * Parts 2, 3, 4 together must be <= 99 chars to fit the ustar 'name' fld.
+ * * Part 1 must be <= 155 chars to fit the ustar 'prefix' field.
+ * * If the original name ends in a '/', the new name must also end in a '/'
+ * * Trailing '/.' sequences may be stripped.
+ *
+ * Note: Recall that the ustar format does not store the '/' separating
+ * parts 1 & 2, but does store the '/' separating parts 2 & 3.
+ */
+static char *
+build_ustar_entry_name(char *dest, const char *src, size_t src_length,
+ const char *insert)
+{
+ const char *prefix, *prefix_end;
+ const char *suffix, *suffix_end;
+ const char *filename, *filename_end;
+ char *p;
+ int need_slash = 0; /* Was there a trailing slash? */
+ size_t suffix_length = 99;
+ size_t insert_length;
+
+ /* Length of additional dir element to be added. */
+ if (insert == NULL)
+ insert_length = 0;
+ else
+ /* +2 here allows for '/' before and after the insert. */
+ insert_length = strlen(insert) + 2;
+
+ /* Step 0: Quick bailout in a common case. */
+ if (src_length < 100 && insert == NULL) {
+ strncpy(dest, src, src_length);
+ dest[src_length] = '\0';
+ return (dest);
+ }
+
+ /* Step 1: Locate filename and enforce the length restriction. */
+ filename_end = src + src_length;
+ /* Remove trailing '/' chars and '/.' pairs. */
+ for (;;) {
+ if (filename_end > src && filename_end[-1] == '/') {
+ filename_end --;
+ need_slash = 1; /* Remember to restore trailing '/'. */
+ continue;
+ }
+ if (filename_end > src + 1 && filename_end[-1] == '.'
+ && filename_end[-2] == '/') {
+ filename_end -= 2;
+ need_slash = 1; /* "foo/." will become "foo/" */
+ continue;
+ }
+ break;
+ }
+ if (need_slash)
+ suffix_length--;
+ /* Find start of filename. */
+ filename = filename_end - 1;
+ while ((filename > src) && (*filename != '/'))
+ filename --;
+ if ((*filename == '/') && (filename < filename_end - 1))
+ filename ++;
+ /* Adjust filename_end so that filename + insert fits in 99 chars. */
+ suffix_length -= insert_length;
+ if (filename_end > filename + suffix_length)
+ filename_end = filename + suffix_length;
+ /* Calculate max size for "suffix" section (#3 above). */
+ suffix_length -= filename_end - filename;
+
+ /* Step 2: Locate the "prefix" section of the dirname, including
+ * trailing '/'. */
+ prefix = src;
+ prefix_end = prefix + 155;
+ if (prefix_end > filename)
+ prefix_end = filename;
+ while (prefix_end > prefix && *prefix_end != '/')
+ prefix_end--;
+ if ((prefix_end < filename) && (*prefix_end == '/'))
+ prefix_end++;
+
+ /* Step 3: Locate the "suffix" section of the dirname,
+ * including trailing '/'. */
+ suffix = prefix_end;
+ suffix_end = suffix + suffix_length; /* Enforce limit. */
+ if (suffix_end > filename)
+ suffix_end = filename;
+ if (suffix_end < suffix)
+ suffix_end = suffix;
+ while (suffix_end > suffix && *suffix_end != '/')
+ suffix_end--;
+ if ((suffix_end < filename) && (*suffix_end == '/'))
+ suffix_end++;
+
+ /* Step 4: Build the new name. */
+ /* The OpenBSD strlcpy function is safer, but less portable. */
+ /* Rather than maintain two versions, just use the strncpy version. */
+ p = dest;
+ if (prefix_end > prefix) {
+ strncpy(p, prefix, prefix_end - prefix);
+ p += prefix_end - prefix;
+ }
+ if (suffix_end > suffix) {
+ strncpy(p, suffix, suffix_end - suffix);
+ p += suffix_end - suffix;
+ }
+ if (insert != NULL) {
+ /* Note: assume insert does not have leading or trailing '/' */
+ strcpy(p, insert);
+ p += strlen(insert);
+ *p++ = '/';
+ }
+ strncpy(p, filename, filename_end - filename);
+ p += filename_end - filename;
+ if (need_slash)
+ *p++ = '/';
+ *p = '\0';
+
+ return (dest);
+}
+
+/*
+ * The ustar header for the pax extended attributes must have a
+ * reasonable name: SUSv3 requires 'dirname'/PaxHeader.'pid'/'filename'
+ * where 'pid' is the PID of the archiving process. Unfortunately,
+ * that makes testing a pain since the output varies for each run,
+ * so I'm sticking with the simpler 'dirname'/PaxHeader/'filename'
+ * for now. (Someday, I'll make this settable. Then I can use the
+ * SUS recommendation as default and test harnesses can override it
+ * to get predictable results.)
+ *
+ * Joerg Schilling has argued that this is unnecessary because, in
+ * practice, if the pax extended attributes get extracted as regular
+ * files, noone is going to bother reading those attributes to
+ * manually restore them. Based on this, 'star' uses
+ * /tmp/PaxHeader/'basename' as the ustar header name. This is a
+ * tempting argument, in part because it's simpler than the SUSv3
+ * recommendation, but I'm not entirely convinced. I'm also
+ * uncomfortable with the fact that "/tmp" is a Unix-ism.
+ *
+ * The following routine leverages build_ustar_entry_name() above and
+ * so is simpler than you might think. It just needs to provide the
+ * additional path element and handle a few pathological cases).
+ */
+static char *
+build_pax_attribute_name(char *dest, const char *src)
+{
+ char buff[64];
+ const char *p;
+
+ /* Handle the null filename case. */
+ if (src == NULL || *src == '\0') {
+ strcpy(dest, "PaxHeader/blank");
+ return (dest);
+ }
+
+ /* Prune final '/' and other unwanted final elements. */
+ p = src + strlen(src);
+ for (;;) {
+ /* Ends in "/", remove the '/' */
+ if (p > src && p[-1] == '/') {
+ --p;
+ continue;
+ }
+ /* Ends in "/.", remove the '.' */
+ if (p > src + 1 && p[-1] == '.'
+ && p[-2] == '/') {
+ --p;
+ continue;
+ }
+ break;
+ }
+
+ /* Pathological case: After above, there was nothing left.
+ * This includes "/." "/./." "/.//./." etc. */
+ if (p == src) {
+ strcpy(dest, "/PaxHeader/rootdir");
+ return (dest);
+ }
+
+ /* Convert unadorned "." into a suitable filename. */
+ if (*src == '.' && p == src + 1) {
+ strcpy(dest, "PaxHeader/currentdir");
+ return (dest);
+ }
+
+ /*
+ * TODO: Push this string into the 'pax' structure to avoid
+ * recomputing it every time. That will also open the door
+ * to having clients override it.
+ */
+#if HAVE_GETPID && 0 /* Disable this for now; see above comment. */
+ sprintf(buff, "PaxHeader.%d", getpid());
+#else
+ /* If the platform can't fetch the pid, don't include it. */
+ strcpy(buff, "PaxHeader");
+#endif
+ /* General case: build a ustar-compatible name adding "/PaxHeader/". */
+ build_ustar_entry_name(dest, src, p - src, buff);
+
+ return (dest);
+}
+
+/* Write two null blocks for the end of archive */
+static int
+archive_write_pax_finish(struct archive_write *a)
+{
+ int r;
+
+ if (a->compressor.write == NULL)
+ return (ARCHIVE_OK);
+
+ r = write_nulls(a, 512 * 2);
+ return (r);
+}
+
+static int
+archive_write_pax_destroy(struct archive_write *a)
+{
+ struct pax *pax;
+
+ pax = (struct pax *)a->format_data;
+ if (pax == NULL)
+ return (ARCHIVE_OK);
+
+ archive_string_free(&pax->pax_header);
+ free(pax);
+ a->format_data = NULL;
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_write_pax_finish_entry(struct archive_write *a)
+{
+ struct pax *pax;
+ int ret;
+
+ pax = (struct pax *)a->format_data;
+ ret = write_nulls(a, pax->entry_bytes_remaining + pax->entry_padding);
+ pax->entry_bytes_remaining = pax->entry_padding = 0;
+ return (ret);
+}
+
+static int
+write_nulls(struct archive_write *a, size_t padding)
+{
+ int ret;
+ size_t to_write;
+
+ while (padding > 0) {
+ to_write = padding < a->null_length ? padding : a->null_length;
+ ret = (a->compressor.write)(a, a->nulls, to_write);
+ if (ret != ARCHIVE_OK)
+ return (ret);
+ padding -= to_write;
+ }
+ return (ARCHIVE_OK);
+}
+
+static ssize_t
+archive_write_pax_data(struct archive_write *a, const void *buff, size_t s)
+{
+ struct pax *pax;
+ int ret;
+
+ pax = (struct pax *)a->format_data;
+ if (s > pax->entry_bytes_remaining)
+ s = pax->entry_bytes_remaining;
+
+ ret = (a->compressor.write)(a, buff, s);
+ pax->entry_bytes_remaining -= s;
+ if (ret == ARCHIVE_OK)
+ return (s);
+ else
+ return (ret);
+}
+
+static int
+has_non_ASCII(const wchar_t *wp)
+{
+ if (wp == NULL)
+ return (1);
+ while (*wp != L'\0' && *wp < 128)
+ wp++;
+ return (*wp != L'\0');
+}
+
+/*
+ * Used by extended attribute support; encodes the name
+ * so that there will be no '=' characters in the result.
+ */
+static char *
+url_encode(const char *in)
+{
+ const char *s;
+ char *d;
+ int out_len = 0;
+ char *out;
+
+ for (s = in; *s != '\0'; s++) {
+ if (*s < 33 || *s > 126 || *s == '%' || *s == '=')
+ out_len += 3;
+ else
+ out_len++;
+ }
+
+ out = (char *)malloc(out_len + 1);
+ if (out == NULL)
+ return (NULL);
+
+ for (s = in, d = out; *s != '\0'; s++) {
+ /* encode any non-printable ASCII character or '%' or '=' */
+ if (*s < 33 || *s > 126 || *s == '%' || *s == '=') {
+ /* URL encoding is '%' followed by two hex digits */
+ *d++ = '%';
+ *d++ = "0123456789ABCDEF"[0x0f & (*s >> 4)];
+ *d++ = "0123456789ABCDEF"[0x0f & *s];
+ } else {
+ *d++ = *s;
+ }
+ }
+ *d = '\0';
+ return (out);
+}
+
+/*
+ * Encode a sequence of bytes into a C string using base-64 encoding.
+ *
+ * Returns a null-terminated C string allocated with malloc(); caller
+ * is responsible for freeing the result.
+ */
+static char *
+base64_encode(const char *s, size_t len)
+{
+ static const char digits[64] =
+ { 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O',
+ 'P','Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d',
+ 'e','f','g','h','i','j','k','l','m','n','o','p','q','r','s',
+ 't','u','v','w','x','y','z','0','1','2','3','4','5','6','7',
+ '8','9','+','/' };
+ int v;
+ char *d, *out;
+
+ /* 3 bytes becomes 4 chars, but round up and allow for trailing NUL */
+ out = (char *)malloc((len * 4 + 2) / 3 + 1);
+ if (out == NULL)
+ return (NULL);
+ d = out;
+
+ /* Convert each group of 3 bytes into 4 characters. */
+ while (len >= 3) {
+ v = (((int)s[0] << 16) & 0xff0000)
+ | (((int)s[1] << 8) & 0xff00)
+ | (((int)s[2]) & 0x00ff);
+ s += 3;
+ len -= 3;
+ *d++ = digits[(v >> 18) & 0x3f];
+ *d++ = digits[(v >> 12) & 0x3f];
+ *d++ = digits[(v >> 6) & 0x3f];
+ *d++ = digits[(v) & 0x3f];
+ }
+ /* Handle final group of 1 byte (2 chars) or 2 bytes (3 chars). */
+ switch (len) {
+ case 0: break;
+ case 1:
+ v = (((int)s[0] << 16) & 0xff0000);
+ *d++ = digits[(v >> 18) & 0x3f];
+ *d++ = digits[(v >> 12) & 0x3f];
+ break;
+ case 2:
+ v = (((int)s[0] << 16) & 0xff0000)
+ | (((int)s[1] << 8) & 0xff00);
+ *d++ = digits[(v >> 18) & 0x3f];
+ *d++ = digits[(v >> 12) & 0x3f];
+ *d++ = digits[(v >> 6) & 0x3f];
+ break;
+ }
+ /* Add trailing NUL character so output is a valid C string. */
+ *d = '\0';
+ return (out);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_shar.c b/archivers/libarchive/files/libarchive/archive_write_set_format_shar.c
new file mode 100644
index 00000000000..62a875b98d3
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_shar.c
@@ -0,0 +1,626 @@
+/*-
+ * Copyright (c) 2003-2007 Tim Kientzle
+ * Copyright (c) 2008 Joerg Sonnenberger
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_shar.c 189438 2009-03-06 05:58:56Z kientzle $");
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_write_private.h"
+
+struct shar {
+ int dump;
+ int end_of_line;
+ struct archive_entry *entry;
+ int has_data;
+ char *last_dir;
+
+ /* Line buffer for uuencoded dump format */
+ char outbuff[45];
+ size_t outpos;
+
+ int wrote_header;
+ struct archive_string work;
+ struct archive_string quoted_name;
+};
+
+static int archive_write_shar_finish(struct archive_write *);
+static int archive_write_shar_destroy(struct archive_write *);
+static int archive_write_shar_header(struct archive_write *,
+ struct archive_entry *);
+static ssize_t archive_write_shar_data_sed(struct archive_write *,
+ const void * buff, size_t);
+static ssize_t archive_write_shar_data_uuencode(struct archive_write *,
+ const void * buff, size_t);
+static int archive_write_shar_finish_entry(struct archive_write *);
+
+/*
+ * Copy the given string to the buffer, quoting all shell meta characters
+ * found.
+ */
+static void
+shar_quote(struct archive_string *buf, const char *str, int in_shell)
+{
+ static const char meta[] = "\n \t'`\";&<>()|*?{}[]\\$!#^~";
+ size_t len;
+
+ while (*str != '\0') {
+ if ((len = strcspn(str, meta)) != 0) {
+ archive_strncat(buf, str, len);
+ str += len;
+ } else if (*str == '\n') {
+ if (in_shell)
+ archive_strcat(buf, "\"\n\"");
+ else
+ archive_strcat(buf, "\\n");
+ ++str;
+ } else {
+ archive_strappend_char(buf, '\\');
+ archive_strappend_char(buf, *str);
+ ++str;
+ }
+ }
+}
+
+/*
+ * Set output format to 'shar' format.
+ */
+int
+archive_write_set_format_shar(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ struct shar *shar;
+
+ /* If someone else was already registered, unregister them. */
+ if (a->format_destroy != NULL)
+ (a->format_destroy)(a);
+
+ shar = (struct shar *)malloc(sizeof(*shar));
+ if (shar == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Can't allocate shar data");
+ return (ARCHIVE_FATAL);
+ }
+ memset(shar, 0, sizeof(*shar));
+ archive_string_init(&shar->work);
+ archive_string_init(&shar->quoted_name);
+ a->format_data = shar;
+
+ a->pad_uncompressed = 0;
+ a->format_name = "shar";
+ a->format_write_header = archive_write_shar_header;
+ a->format_finish = archive_write_shar_finish;
+ a->format_destroy = archive_write_shar_destroy;
+ a->format_write_data = archive_write_shar_data_sed;
+ a->format_finish_entry = archive_write_shar_finish_entry;
+ a->archive.archive_format = ARCHIVE_FORMAT_SHAR_BASE;
+ a->archive.archive_format_name = "shar";
+ return (ARCHIVE_OK);
+}
+
+/*
+ * An alternate 'shar' that uses uudecode instead of 'sed' to encode
+ * file contents and can therefore be used to archive binary files.
+ * In addition, this variant also attempts to restore ownership, file modes,
+ * and other extended file information.
+ */
+int
+archive_write_set_format_shar_dump(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ struct shar *shar;
+
+ archive_write_set_format_shar(&a->archive);
+ shar = (struct shar *)a->format_data;
+ shar->dump = 1;
+ a->format_write_data = archive_write_shar_data_uuencode;
+ a->archive.archive_format = ARCHIVE_FORMAT_SHAR_DUMP;
+ a->archive.archive_format_name = "shar dump";
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_write_shar_header(struct archive_write *a, struct archive_entry *entry)
+{
+ const char *linkname;
+ const char *name;
+ char *p, *pp;
+ struct shar *shar;
+
+ shar = (struct shar *)a->format_data;
+ if (!shar->wrote_header) {
+ archive_strcat(&shar->work, "#!/bin/sh\n");
+ archive_strcat(&shar->work, "# This is a shell archive\n");
+ shar->wrote_header = 1;
+ }
+
+ /* Save the entry for the closing. */
+ if (shar->entry)
+ archive_entry_free(shar->entry);
+ shar->entry = archive_entry_clone(entry);
+ name = archive_entry_pathname(entry);
+
+ /* Handle some preparatory issues. */
+ switch(archive_entry_filetype(entry)) {
+ case AE_IFREG:
+ /* Only regular files have non-zero size. */
+ break;
+ case AE_IFDIR:
+ archive_entry_set_size(entry, 0);
+ /* Don't bother trying to recreate '.' */
+ if (strcmp(name, ".") == 0 || strcmp(name, "./") == 0)
+ return (ARCHIVE_OK);
+ break;
+ case AE_IFIFO:
+ case AE_IFCHR:
+ case AE_IFBLK:
+ /* All other file types have zero size in the archive. */
+ archive_entry_set_size(entry, 0);
+ break;
+ default:
+ archive_entry_set_size(entry, 0);
+ if (archive_entry_hardlink(entry) == NULL &&
+ archive_entry_symlink(entry) == NULL) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "shar format cannot archive this");
+ return (ARCHIVE_WARN);
+ }
+ }
+
+ archive_string_empty(&shar->quoted_name);
+ shar_quote(&shar->quoted_name, name, 1);
+
+ /* Stock preparation for all file types. */
+ archive_string_sprintf(&shar->work, "echo x %s\n", shar->quoted_name.s);
+
+ if (archive_entry_filetype(entry) != AE_IFDIR) {
+ /* Try to create the dir. */
+ p = strdup(name);
+ pp = strrchr(p, '/');
+ /* If there is a / character, try to create the dir. */
+ if (pp != NULL) {
+ *pp = '\0';
+
+ /* Try to avoid a lot of redundant mkdir commands. */
+ if (strcmp(p, ".") == 0) {
+ /* Don't try to "mkdir ." */
+ free(p);
+ } else if (shar->last_dir == NULL) {
+ archive_strcat(&shar->work, "mkdir -p ");
+ shar_quote(&shar->work, p, 1);
+ archive_strcat(&shar->work,
+ " > /dev/null 2>&1\n");
+ shar->last_dir = p;
+ } else if (strcmp(p, shar->last_dir) == 0) {
+ /* We've already created this exact dir. */
+ free(p);
+ } else if (strlen(p) < strlen(shar->last_dir) &&
+ strncmp(p, shar->last_dir, strlen(p)) == 0) {
+ /* We've already created a subdir. */
+ free(p);
+ } else {
+ archive_strcat(&shar->work, "mkdir -p ");
+ shar_quote(&shar->work, p, 1);
+ archive_strcat(&shar->work,
+ " > /dev/null 2>&1\n");
+ shar->last_dir = p;
+ }
+ } else {
+ free(p);
+ }
+ }
+
+ /* Handle file-type specific issues. */
+ shar->has_data = 0;
+ if ((linkname = archive_entry_hardlink(entry)) != NULL) {
+ archive_strcat(&shar->work, "ln -f ");
+ shar_quote(&shar->work, linkname, 1);
+ archive_string_sprintf(&shar->work, " %s\n",
+ shar->quoted_name.s);
+ } else if ((linkname = archive_entry_symlink(entry)) != NULL) {
+ archive_strcat(&shar->work, "ln -fs ");
+ shar_quote(&shar->work, linkname, 1);
+ archive_string_sprintf(&shar->work, " %s\n",
+ shar->quoted_name.s);
+ } else {
+ switch(archive_entry_filetype(entry)) {
+ case AE_IFREG:
+ if (archive_entry_size(entry) == 0) {
+ /* More portable than "touch." */
+ archive_string_sprintf(&shar->work,
+ "test -e \"%s\" || :> \"%s\"\n",
+ shar->quoted_name.s, shar->quoted_name.s);
+ } else {
+ if (shar->dump) {
+ archive_string_sprintf(&shar->work,
+ "uudecode -p > %s << 'SHAR_END'\n",
+ shar->quoted_name.s);
+ archive_string_sprintf(&shar->work,
+ "begin %o ",
+ archive_entry_mode(entry) & 0777);
+ shar_quote(&shar->work, name, 0);
+ archive_strcat(&shar->work, "\n");
+ } else {
+ archive_string_sprintf(&shar->work,
+ "sed 's/^X//' > %s << 'SHAR_END'\n",
+ shar->quoted_name.s);
+ }
+ shar->has_data = 1;
+ shar->end_of_line = 1;
+ shar->outpos = 0;
+ }
+ break;
+ case AE_IFDIR:
+ archive_string_sprintf(&shar->work,
+ "mkdir -p %s > /dev/null 2>&1\n",
+ shar->quoted_name.s);
+ /* Record that we just created this directory. */
+ if (shar->last_dir != NULL)
+ free(shar->last_dir);
+
+ shar->last_dir = strdup(name);
+ /* Trim a trailing '/'. */
+ pp = strrchr(shar->last_dir, '/');
+ if (pp != NULL && pp[1] == '\0')
+ *pp = '\0';
+ /*
+ * TODO: Put dir name/mode on a list to be fixed
+ * up at end of archive.
+ */
+ break;
+ case AE_IFIFO:
+ archive_string_sprintf(&shar->work,
+ "mkfifo %s\n", shar->quoted_name.s);
+ break;
+ case AE_IFCHR:
+ archive_string_sprintf(&shar->work,
+ "mknod %s c %d %d\n", shar->quoted_name.s,
+ archive_entry_rdevmajor(entry),
+ archive_entry_rdevminor(entry));
+ break;
+ case AE_IFBLK:
+ archive_string_sprintf(&shar->work,
+ "mknod %s b %d %d\n", shar->quoted_name.s,
+ archive_entry_rdevmajor(entry),
+ archive_entry_rdevminor(entry));
+ break;
+ default:
+ return (ARCHIVE_WARN);
+ }
+ }
+
+ return (ARCHIVE_OK);
+}
+
+static ssize_t
+archive_write_shar_data_sed(struct archive_write *a, const void *buff, size_t n)
+{
+ static const size_t ensured = 65533;
+ struct shar *shar;
+ const char *src;
+ char *buf, *buf_end;
+ int ret;
+ size_t written = n;
+
+ shar = (struct shar *)a->format_data;
+ if (!shar->has_data || n == 0)
+ return (0);
+
+ src = (const char *)buff;
+
+ /*
+ * ensure is the number of bytes in buffer before expanding the
+ * current character. Each operation writes the current character
+ * and optionally the start-of-new-line marker. This can happen
+ * twice before entering the loop, so make sure three additional
+ * bytes can be written.
+ */
+ if (archive_string_ensure(&shar->work, ensured + 3) == NULL)
+ __archive_errx(1, "Out of memory");
+
+ if (shar->work.length > ensured) {
+ ret = (*a->compressor.write)(a, shar->work.s,
+ shar->work.length);
+ if (ret != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+ archive_string_empty(&shar->work);
+ }
+ buf = shar->work.s + shar->work.length;
+ buf_end = shar->work.s + ensured;
+
+ if (shar->end_of_line) {
+ *buf++ = 'X';
+ shar->end_of_line = 0;
+ }
+
+ while (n-- != 0) {
+ if ((*buf++ = *src++) == '\n') {
+ if (n == 0)
+ shar->end_of_line = 1;
+ else
+ *buf++ = 'X';
+ }
+
+ if (buf >= buf_end) {
+ shar->work.length = buf - shar->work.s;
+ ret = (*a->compressor.write)(a, shar->work.s,
+ shar->work.length);
+ if (ret != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+ archive_string_empty(&shar->work);
+ buf = shar->work.s;
+ }
+ }
+
+ shar->work.length = buf - shar->work.s;
+
+ return (written);
+}
+
+#define UUENC(c) (((c)!=0) ? ((c) & 077) + ' ': '`')
+
+static void
+uuencode_group(const char _in[3], char out[4])
+{
+ const unsigned char *in = (const unsigned char *)_in;
+ int t;
+
+ t = (in[0] << 16) | (in[1] << 8) | in[2];
+ out[0] = UUENC( 0x3f & (t >> 18) );
+ out[1] = UUENC( 0x3f & (t >> 12) );
+ out[2] = UUENC( 0x3f & (t >> 6) );
+ out[3] = UUENC( 0x3f & t );
+}
+
+static void
+uuencode_line(struct shar *shar, const char *inbuf, size_t len)
+{
+ char tmp_buf[3], *buf;
+ size_t alloc_len;
+
+ /* len <= 45 -> expanded to 60 + len byte + new line */
+ alloc_len = shar->work.length + 62;
+ if (archive_string_ensure(&shar->work, alloc_len) == NULL)
+ __archive_errx(1, "Out of memory");
+
+ buf = shar->work.s + shar->work.length;
+ *buf++ = UUENC(len);
+ while (len >= 3) {
+ uuencode_group(inbuf, buf);
+ len -= 3;
+ inbuf += 3;
+ buf += 4;
+ }
+ if (len != 0) {
+ tmp_buf[0] = inbuf[0];
+ if (len == 1)
+ tmp_buf[1] = '\0';
+ else
+ tmp_buf[1] = inbuf[1];
+ tmp_buf[2] = '\0';
+ uuencode_group(inbuf, buf);
+ buf += 4;
+ }
+ *buf++ = '\n';
+ if ((buf - shar->work.s) > (ptrdiff_t)(shar->work.length + 62))
+ __archive_errx(1, "Buffer overflow");
+ shar->work.length = buf - shar->work.s;
+}
+
+static ssize_t
+archive_write_shar_data_uuencode(struct archive_write *a, const void *buff,
+ size_t length)
+{
+ struct shar *shar;
+ const char *src;
+ size_t n;
+ int ret;
+
+ shar = (struct shar *)a->format_data;
+ if (!shar->has_data)
+ return (ARCHIVE_OK);
+ src = (const char *)buff;
+
+ if (shar->outpos != 0) {
+ n = 45 - shar->outpos;
+ if (n > length)
+ n = length;
+ memcpy(shar->outbuff + shar->outpos, src, n);
+ if (shar->outpos + n < 45) {
+ shar->outpos += n;
+ return length;
+ }
+ uuencode_line(shar, shar->outbuff, 45);
+ src += n;
+ n = length - n;
+ } else {
+ n = length;
+ }
+
+ while (n >= 45) {
+ uuencode_line(shar, src, 45);
+ src += 45;
+ n -= 45;
+
+ if (shar->work.length < 65536)
+ continue;
+ ret = (*a->compressor.write)(a, shar->work.s,
+ shar->work.length);
+ if (ret != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+ archive_string_empty(&shar->work);
+ }
+ if (n != 0) {
+ memcpy(shar->outbuff, src, n);
+ shar->outpos = n;
+ }
+ return (length);
+}
+
+static int
+archive_write_shar_finish_entry(struct archive_write *a)
+{
+ const char *g, *p, *u;
+ struct shar *shar;
+ int ret;
+
+ shar = (struct shar *)a->format_data;
+ if (shar->entry == NULL)
+ return (0);
+
+ if (shar->dump) {
+ /* Finish uuencoded data. */
+ if (shar->has_data) {
+ if (shar->outpos > 0)
+ uuencode_line(shar, shar->outbuff,
+ shar->outpos);
+ archive_strcat(&shar->work, "`\nend\n");
+ archive_strcat(&shar->work, "SHAR_END\n");
+ }
+ /* Restore file mode, owner, flags. */
+ /*
+ * TODO: Don't immediately restore mode for
+ * directories; defer that to end of script.
+ */
+ archive_string_sprintf(&shar->work, "chmod %o ",
+ archive_entry_mode(shar->entry) & 07777);
+ shar_quote(&shar->work, archive_entry_pathname(shar->entry), 1);
+ archive_strcat(&shar->work, "\n");
+
+ u = archive_entry_uname(shar->entry);
+ g = archive_entry_gname(shar->entry);
+ if (u != NULL || g != NULL) {
+ archive_strcat(&shar->work, "chown ");
+ if (u != NULL)
+ shar_quote(&shar->work, u, 1);
+ if (g != NULL) {
+ archive_strcat(&shar->work, ":");
+ shar_quote(&shar->work, g, 1);
+ }
+ shar_quote(&shar->work,
+ archive_entry_pathname(shar->entry), 1);
+ archive_strcat(&shar->work, "\n");
+ }
+
+ if ((p = archive_entry_fflags_text(shar->entry)) != NULL) {
+ archive_string_sprintf(&shar->work, "chflags %s ",
+ p, archive_entry_pathname(shar->entry));
+ shar_quote(&shar->work,
+ archive_entry_pathname(shar->entry), 1);
+ archive_strcat(&shar->work, "\n");
+ }
+
+ /* TODO: restore ACLs */
+
+ } else {
+ if (shar->has_data) {
+ /* Finish sed-encoded data: ensure last line ends. */
+ if (!shar->end_of_line)
+ archive_strappend_char(&shar->work, '\n');
+ archive_strcat(&shar->work, "SHAR_END\n");
+ }
+ }
+
+ archive_entry_free(shar->entry);
+ shar->entry = NULL;
+
+ if (shar->work.length < 65536)
+ return (ARCHIVE_OK);
+
+ ret = (*a->compressor.write)(a, shar->work.s, shar->work.length);
+ if (ret != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+ archive_string_empty(&shar->work);
+
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_write_shar_finish(struct archive_write *a)
+{
+ struct shar *shar;
+ int ret;
+
+ /*
+ * TODO: Accumulate list of directory names/modes and
+ * fix them all up at end-of-archive.
+ */
+
+ shar = (struct shar *)a->format_data;
+
+ /*
+ * Only write the end-of-archive markers if the archive was
+ * actually started. This avoids problems if someone sets
+ * shar format, then sets another format (which would invoke
+ * shar_finish to free the format-specific data).
+ */
+ if (shar->wrote_header == 0)
+ return (ARCHIVE_OK);
+
+ archive_strcat(&shar->work, "exit\n");
+
+ ret = (*a->compressor.write)(a, shar->work.s, shar->work.length);
+ if (ret != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+
+ /* Shar output is never padded. */
+ archive_write_set_bytes_in_last_block(&a->archive, 1);
+ /*
+ * TODO: shar should also suppress padding of
+ * uncompressed data within gzip/bzip2 streams.
+ */
+
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_write_shar_destroy(struct archive_write *a)
+{
+ struct shar *shar;
+
+ shar = (struct shar *)a->format_data;
+ if (shar == NULL)
+ return (ARCHIVE_OK);
+
+ archive_entry_free(shar->entry);
+ free(shar->last_dir);
+ archive_string_free(&(shar->work));
+ archive_string_free(&(shar->quoted_name));
+ free(shar);
+ a->format_data = NULL;
+ return (ARCHIVE_OK);
+}
diff --git a/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c b/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c
new file mode 100644
index 00000000000..1de273fc2df
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/archive_write_set_format_ustar.c
@@ -0,0 +1,587 @@
+/*-
+ * 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 "archive_platform.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_ustar.c 191579 2009-04-27 18:35:03Z kientzle $");
+
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+#include "archive_private.h"
+#include "archive_write_private.h"
+
+struct ustar {
+ uint64_t entry_bytes_remaining;
+ uint64_t entry_padding;
+};
+
+/*
+ * Define structure of POSIX 'ustar' tar header.
+ */
+#define USTAR_name_offset 0
+#define USTAR_name_size 100
+#define USTAR_mode_offset 100
+#define USTAR_mode_size 6
+#define USTAR_mode_max_size 8
+#define USTAR_uid_offset 108
+#define USTAR_uid_size 6
+#define USTAR_uid_max_size 8
+#define USTAR_gid_offset 116
+#define USTAR_gid_size 6
+#define USTAR_gid_max_size 8
+#define USTAR_size_offset 124
+#define USTAR_size_size 11
+#define USTAR_size_max_size 12
+#define USTAR_mtime_offset 136
+#define USTAR_mtime_size 11
+#define USTAR_mtime_max_size 11
+#define USTAR_checksum_offset 148
+#define USTAR_checksum_size 8
+#define USTAR_typeflag_offset 156
+#define USTAR_typeflag_size 1
+#define USTAR_linkname_offset 157
+#define USTAR_linkname_size 100
+#define USTAR_magic_offset 257
+#define USTAR_magic_size 6
+#define USTAR_version_offset 263
+#define USTAR_version_size 2
+#define USTAR_uname_offset 265
+#define USTAR_uname_size 32
+#define USTAR_gname_offset 297
+#define USTAR_gname_size 32
+#define USTAR_rdevmajor_offset 329
+#define USTAR_rdevmajor_size 6
+#define USTAR_rdevmajor_max_size 8
+#define USTAR_rdevminor_offset 337
+#define USTAR_rdevminor_size 6
+#define USTAR_rdevminor_max_size 8
+#define USTAR_prefix_offset 345
+#define USTAR_prefix_size 155
+#define USTAR_padding_offset 500
+#define USTAR_padding_size 12
+
+/*
+ * A filled-in copy of the header for initialization.
+ */
+static const char template_header[] = {
+ /* name: 100 bytes */
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,
+ /* Mode, space-null termination: 8 bytes */
+ '0','0','0','0','0','0', ' ','\0',
+ /* uid, space-null termination: 8 bytes */
+ '0','0','0','0','0','0', ' ','\0',
+ /* gid, space-null termination: 8 bytes */
+ '0','0','0','0','0','0', ' ','\0',
+ /* size, space termation: 12 bytes */
+ '0','0','0','0','0','0','0','0','0','0','0', ' ',
+ /* mtime, space termation: 12 bytes */
+ '0','0','0','0','0','0','0','0','0','0','0', ' ',
+ /* Initial checksum value: 8 spaces */
+ ' ',' ',' ',' ',' ',' ',' ',' ',
+ /* Typeflag: 1 byte */
+ '0', /* '0' = regular file */
+ /* Linkname: 100 bytes */
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,
+ /* Magic: 6 bytes, Version: 2 bytes */
+ 'u','s','t','a','r','\0', '0','0',
+ /* Uname: 32 bytes */
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ /* Gname: 32 bytes */
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ /* rdevmajor + space/null padding: 8 bytes */
+ '0','0','0','0','0','0', ' ','\0',
+ /* rdevminor + space/null padding: 8 bytes */
+ '0','0','0','0','0','0', ' ','\0',
+ /* Prefix: 155 bytes */
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,
+ /* Padding: 12 bytes */
+ 0,0,0,0,0,0,0,0, 0,0,0,0
+};
+
+static ssize_t archive_write_ustar_data(struct archive_write *a, const void *buff,
+ size_t s);
+static int archive_write_ustar_destroy(struct archive_write *);
+static int archive_write_ustar_finish(struct archive_write *);
+static int archive_write_ustar_finish_entry(struct archive_write *);
+static int archive_write_ustar_header(struct archive_write *,
+ struct archive_entry *entry);
+static int format_256(int64_t, char *, int);
+static int format_number(int64_t, char *, int size, int max, int strict);
+static int format_octal(int64_t, char *, int);
+static int write_nulls(struct archive_write *a, size_t);
+
+/*
+ * Set output format to 'ustar' format.
+ */
+int
+archive_write_set_format_ustar(struct archive *_a)
+{
+ struct archive_write *a = (struct archive_write *)_a;
+ struct ustar *ustar;
+
+ /* If someone else was already registered, unregister them. */
+ if (a->format_destroy != NULL)
+ (a->format_destroy)(a);
+
+ /* Basic internal sanity test. */
+ if (sizeof(template_header) != 512) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Internal: template_header wrong size: %d should be 512", sizeof(template_header));
+ return (ARCHIVE_FATAL);
+ }
+
+ ustar = (struct ustar *)malloc(sizeof(*ustar));
+ if (ustar == NULL) {
+ archive_set_error(&a->archive, ENOMEM, "Can't allocate ustar data");
+ return (ARCHIVE_FATAL);
+ }
+ memset(ustar, 0, sizeof(*ustar));
+ a->format_data = ustar;
+
+ a->pad_uncompressed = 1; /* Mimic gtar in this respect. */
+ a->format_name = "ustar";
+ a->format_write_header = archive_write_ustar_header;
+ a->format_write_data = archive_write_ustar_data;
+ a->format_finish = archive_write_ustar_finish;
+ a->format_destroy = archive_write_ustar_destroy;
+ a->format_finish_entry = archive_write_ustar_finish_entry;
+ a->archive.archive_format = ARCHIVE_FORMAT_TAR_USTAR;
+ a->archive.archive_format_name = "POSIX ustar";
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_write_ustar_header(struct archive_write *a, struct archive_entry *entry)
+{
+ char buff[512];
+ int ret, ret2;
+ struct ustar *ustar;
+
+ ustar = (struct ustar *)a->format_data;
+
+ /* Only regular files (not hardlinks) have data. */
+ if (archive_entry_hardlink(entry) != NULL ||
+ archive_entry_symlink(entry) != NULL ||
+ !(archive_entry_filetype(entry) == AE_IFREG))
+ archive_entry_set_size(entry, 0);
+
+ if (AE_IFDIR == archive_entry_filetype(entry)) {
+ const char *p;
+ char *t;
+ /*
+ * Ensure a trailing '/'. Modify the entry so
+ * the client sees the change.
+ */
+ p = archive_entry_pathname(entry);
+ if (p[strlen(p) - 1] != '/') {
+ t = (char *)malloc(strlen(p) + 2);
+ if (t == NULL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "Can't allocate ustar data");
+ return(ARCHIVE_FATAL);
+ }
+ strcpy(t, p);
+ strcat(t, "/");
+ archive_entry_copy_pathname(entry, t);
+ free(t);
+ }
+ }
+
+ ret = __archive_write_format_header_ustar(a, buff, entry, -1, 1);
+ if (ret < ARCHIVE_WARN)
+ return (ret);
+ ret2 = (a->compressor.write)(a, buff, 512);
+ if (ret2 < ARCHIVE_WARN)
+ return (ret2);
+ if (ret2 < ret)
+ ret = ret2;
+
+ ustar->entry_bytes_remaining = archive_entry_size(entry);
+ ustar->entry_padding = 0x1ff & (-(int64_t)ustar->entry_bytes_remaining);
+ return (ret);
+}
+
+/*
+ * Format a basic 512-byte "ustar" header.
+ *
+ * Returns -1 if format failed (due to field overflow).
+ * Note that this always formats as much of the header as possible.
+ * If "strict" is set to zero, it will extend numeric fields as
+ * necessary (overwriting terminators or using base-256 extensions).
+ *
+ * This is exported so that other 'tar' formats can use it.
+ */
+int
+__archive_write_format_header_ustar(struct archive_write *a, char h[512],
+ struct archive_entry *entry, int tartype, int strict)
+{
+ unsigned int checksum;
+ int i, ret;
+ size_t copy_length;
+ const char *p, *pp;
+ int mytartype;
+
+ ret = 0;
+ mytartype = -1;
+ /*
+ * The "template header" already includes the "ustar"
+ * signature, various end-of-field markers and other required
+ * elements.
+ */
+ memcpy(h, &template_header, 512);
+
+ /*
+ * Because the block is already null-filled, and strings
+ * are allowed to exactly fill their destination (without null),
+ * I use memcpy(dest, src, strlen()) here a lot to copy strings.
+ */
+
+ pp = archive_entry_pathname(entry);
+ if (strlen(pp) <= USTAR_name_size)
+ memcpy(h + USTAR_name_offset, pp, strlen(pp));
+ else {
+ /* Store in two pieces, splitting at a '/'. */
+ p = strchr(pp + strlen(pp) - USTAR_name_size - 1, '/');
+ /*
+ * Look for the next '/' if we chose the first character
+ * as the separator. (ustar format doesn't permit
+ * an empty prefix.)
+ */
+ if (p == pp)
+ p = strchr(p + 1, '/');
+ /* Fail if the name won't fit. */
+ if (!p) {
+ /* No separator. */
+ archive_set_error(&a->archive, ENAMETOOLONG,
+ "Pathname too long");
+ ret = ARCHIVE_FAILED;
+ } else if (p[1] == '\0') {
+ /*
+ * The only feasible separator is a final '/';
+ * this would result in a non-empty prefix and
+ * an empty name, which POSIX doesn't
+ * explicity forbid, but it just feels wrong.
+ */
+ archive_set_error(&a->archive, ENAMETOOLONG,
+ "Pathname too long");
+ ret = ARCHIVE_FAILED;
+ } else if (p > pp + USTAR_prefix_size) {
+ /* Prefix is too long. */
+ archive_set_error(&a->archive, ENAMETOOLONG,
+ "Pathname too long");
+ ret = ARCHIVE_FAILED;
+ } else {
+ /* Copy prefix and remainder to appropriate places */
+ memcpy(h + USTAR_prefix_offset, pp, p - pp);
+ memcpy(h + USTAR_name_offset, p + 1, pp + strlen(pp) - p - 1);
+ }
+ }
+
+ p = archive_entry_hardlink(entry);
+ if (p != NULL)
+ mytartype = '1';
+ else
+ p = archive_entry_symlink(entry);
+ if (p != NULL && p[0] != '\0') {
+ copy_length = strlen(p);
+ if (copy_length > USTAR_linkname_size) {
+ archive_set_error(&a->archive, ENAMETOOLONG,
+ "Link contents too long");
+ ret = ARCHIVE_FAILED;
+ copy_length = USTAR_linkname_size;
+ }
+ memcpy(h + USTAR_linkname_offset, p, copy_length);
+ }
+
+ p = archive_entry_uname(entry);
+ if (p != NULL && p[0] != '\0') {
+ copy_length = strlen(p);
+ if (copy_length > USTAR_uname_size) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Username too long");
+ ret = ARCHIVE_FAILED;
+ copy_length = USTAR_uname_size;
+ }
+ memcpy(h + USTAR_uname_offset, p, copy_length);
+ }
+
+ p = archive_entry_gname(entry);
+ if (p != NULL && p[0] != '\0') {
+ copy_length = strlen(p);
+ if (strlen(p) > USTAR_gname_size) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Group name too long");
+ ret = ARCHIVE_FAILED;
+ copy_length = USTAR_gname_size;
+ }
+ memcpy(h + USTAR_gname_offset, p, copy_length);
+ }
+
+ if (format_number(archive_entry_mode(entry) & 07777, h + USTAR_mode_offset, USTAR_mode_size, USTAR_mode_max_size, strict)) {
+ archive_set_error(&a->archive, ERANGE, "Numeric mode too large");
+ ret = ARCHIVE_FAILED;
+ }
+
+ if (format_number(archive_entry_uid(entry), h + USTAR_uid_offset, USTAR_uid_size, USTAR_uid_max_size, strict)) {
+ archive_set_error(&a->archive, ERANGE, "Numeric user ID too large");
+ ret = ARCHIVE_FAILED;
+ }
+
+ if (format_number(archive_entry_gid(entry), h + USTAR_gid_offset, USTAR_gid_size, USTAR_gid_max_size, strict)) {
+ archive_set_error(&a->archive, ERANGE, "Numeric group ID too large");
+ ret = ARCHIVE_FAILED;
+ }
+
+ if (format_number(archive_entry_size(entry), h + USTAR_size_offset, USTAR_size_size, USTAR_size_max_size, strict)) {
+ archive_set_error(&a->archive, ERANGE, "File size out of range");
+ ret = ARCHIVE_FAILED;
+ }
+
+ if (format_number(archive_entry_mtime(entry), h + USTAR_mtime_offset, USTAR_mtime_size, USTAR_mtime_max_size, strict)) {
+ archive_set_error(&a->archive, ERANGE,
+ "File modification time too large");
+ ret = ARCHIVE_FAILED;
+ }
+
+ if (archive_entry_filetype(entry) == AE_IFBLK
+ || archive_entry_filetype(entry) == AE_IFCHR) {
+ if (format_number(archive_entry_rdevmajor(entry), h + USTAR_rdevmajor_offset,
+ USTAR_rdevmajor_size, USTAR_rdevmajor_max_size, strict)) {
+ archive_set_error(&a->archive, ERANGE,
+ "Major device number too large");
+ ret = ARCHIVE_FAILED;
+ }
+
+ if (format_number(archive_entry_rdevminor(entry), h + USTAR_rdevminor_offset,
+ USTAR_rdevminor_size, USTAR_rdevminor_max_size, strict)) {
+ archive_set_error(&a->archive, ERANGE,
+ "Minor device number too large");
+ ret = ARCHIVE_FAILED;
+ }
+ }
+
+ if (tartype >= 0) {
+ h[USTAR_typeflag_offset] = tartype;
+ } else if (mytartype >= 0) {
+ h[USTAR_typeflag_offset] = mytartype;
+ } else {
+ switch (archive_entry_filetype(entry)) {
+ case AE_IFREG: h[USTAR_typeflag_offset] = '0' ; break;
+ case AE_IFLNK: h[USTAR_typeflag_offset] = '2' ; break;
+ case AE_IFCHR: h[USTAR_typeflag_offset] = '3' ; break;
+ case AE_IFBLK: h[USTAR_typeflag_offset] = '4' ; break;
+ case AE_IFDIR: h[USTAR_typeflag_offset] = '5' ; break;
+ case AE_IFIFO: h[USTAR_typeflag_offset] = '6' ; break;
+ case AE_IFSOCK:
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "tar format cannot archive socket");
+ return (ARCHIVE_FAILED);
+ default:
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "tar format cannot archive this (mode=0%lo)",
+ (unsigned long)archive_entry_mode(entry));
+ ret = ARCHIVE_FAILED;
+ }
+ }
+
+ checksum = 0;
+ for (i = 0; i < 512; i++)
+ checksum += 255 & (unsigned int)h[i];
+ h[USTAR_checksum_offset + 6] = '\0'; /* Can't be pre-set in the template. */
+ /* h[USTAR_checksum_offset + 7] = ' '; */ /* This is pre-set in the template. */
+ format_octal(checksum, h + USTAR_checksum_offset, 6);
+ return (ret);
+}
+
+/*
+ * Format a number into a field, with some intelligence.
+ */
+static int
+format_number(int64_t v, char *p, int s, int maxsize, int strict)
+{
+ int64_t limit;
+
+ limit = ((int64_t)1 << (s*3));
+
+ /* "Strict" only permits octal values with proper termination. */
+ if (strict)
+ return (format_octal(v, p, s));
+
+ /*
+ * In non-strict mode, we allow the number to overwrite one or
+ * more bytes of the field termination. Even old tar
+ * implementations should be able to handle this with no
+ * problem.
+ */
+ if (v >= 0) {
+ while (s <= maxsize) {
+ if (v < limit)
+ return (format_octal(v, p, s));
+ s++;
+ limit <<= 3;
+ }
+ }
+
+ /* Base-256 can handle any number, positive or negative. */
+ return (format_256(v, p, maxsize));
+}
+
+/*
+ * Format a number into the specified field using base-256.
+ */
+static int
+format_256(int64_t v, char *p, int s)
+{
+ p += s;
+ while (s-- > 0) {
+ *--p = (char)(v & 0xff);
+ v >>= 8;
+ }
+ *p |= 0x80; /* Set the base-256 marker bit. */
+ return (0);
+}
+
+/*
+ * Format a number into the specified field.
+ */
+static int
+format_octal(int64_t v, char *p, int s)
+{
+ int len;
+
+ len = s;
+
+ /* Octal values can't be negative, so use 0. */
+ if (v < 0) {
+ while (len-- > 0)
+ *p++ = '0';
+ return (-1);
+ }
+
+ p += s; /* Start at the end and work backwards. */
+ while (s-- > 0) {
+ *--p = (char)('0' + (v & 7));
+ v >>= 3;
+ }
+
+ if (v == 0)
+ return (0);
+
+ /* If it overflowed, fill field with max value. */
+ while (len-- > 0)
+ *p++ = '7';
+
+ return (-1);
+}
+
+static int
+archive_write_ustar_finish(struct archive_write *a)
+{
+ int r;
+
+ if (a->compressor.write == NULL)
+ return (ARCHIVE_OK);
+
+ r = write_nulls(a, 512*2);
+ return (r);
+}
+
+static int
+archive_write_ustar_destroy(struct archive_write *a)
+{
+ struct ustar *ustar;
+
+ ustar = (struct ustar *)a->format_data;
+ free(ustar);
+ a->format_data = NULL;
+ return (ARCHIVE_OK);
+}
+
+static int
+archive_write_ustar_finish_entry(struct archive_write *a)
+{
+ struct ustar *ustar;
+ int ret;
+
+ ustar = (struct ustar *)a->format_data;
+ ret = write_nulls(a,
+ ustar->entry_bytes_remaining + ustar->entry_padding);
+ ustar->entry_bytes_remaining = ustar->entry_padding = 0;
+ return (ret);
+}
+
+static int
+write_nulls(struct archive_write *a, size_t padding)
+{
+ int ret;
+ size_t to_write;
+
+ while (padding > 0) {
+ to_write = padding < a->null_length ? padding : a->null_length;
+ ret = (a->compressor.write)(a, a->nulls, to_write);
+ if (ret != ARCHIVE_OK)
+ return (ret);
+ padding -= to_write;
+ }
+ return (ARCHIVE_OK);
+}
+
+static ssize_t
+archive_write_ustar_data(struct archive_write *a, const void *buff, size_t s)
+{
+ struct ustar *ustar;
+ int ret;
+
+ ustar = (struct ustar *)a->format_data;
+ if (s > ustar->entry_bytes_remaining)
+ s = ustar->entry_bytes_remaining;
+ ret = (a->compressor.write)(a, buff, s);
+ ustar->entry_bytes_remaining -= s;
+ if (ret != ARCHIVE_OK)
+ return (ret);
+ return (s);
+}
diff --git a/archivers/libarchive/files/libarchive/config_freebsd.h b/archivers/libarchive/files/libarchive/config_freebsd.h
new file mode 100644
index 00000000000..fad40871415
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/config_freebsd.h
@@ -0,0 +1,154 @@
+/*-
+ * 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: head/lib/libarchive/config_freebsd.h 201079 2009-12-28 02:01:42Z kientzle $
+ */
+
+/* FreeBSD 5.0 and later have ACL and extattr support. */
+#if __FreeBSD__ > 4
+#define HAVE_ACL_CREATE_ENTRY 1
+#define HAVE_ACL_GET_LINK_NP 1
+#define HAVE_ACL_GET_PERM_NP 1
+#define HAVE_ACL_INIT 1
+#define HAVE_ACL_SET_FD 1
+#define HAVE_ACL_SET_FD_NP 1
+#define HAVE_ACL_SET_FILE 1
+#define HAVE_ACL_USER 1
+#define HAVE_EXTATTR_GET_FILE 1
+#define HAVE_EXTATTR_LIST_FILE 1
+#define HAVE_EXTATTR_SET_FD 1
+#define HAVE_EXTATTR_SET_FILE 1
+#define HAVE_SYS_ACL_H 1
+#define HAVE_SYS_EXTATTR_H 1
+#endif
+
+#ifdef WITH_OPENSSL
+#define HAVE_OPENSSL_MD5_H 1
+#define HAVE_OPENSSL_RIPEMD_H 1
+#define HAVE_OPENSSL_SHA_H 1
+#define HAVE_SHA384 1
+#define HAVE_SHA512 1
+#endif
+
+#define HAVE_BSDXML_H 1
+#define HAVE_BZLIB_H 1
+#define HAVE_CHFLAGS 1
+#define HAVE_CHOWN 1
+#define HAVE_DECL_INT64_MAX 1
+#define HAVE_DECL_INT64_MIN 1
+#define HAVE_DECL_SIZE_MAX 1
+#define HAVE_DECL_SSIZE_MAX 1
+#define HAVE_DECL_STRERROR_R 1
+#define HAVE_DECL_UINT32_MAX 1
+#define HAVE_DECL_UINT64_MAX 1
+#define HAVE_DIRENT_H 1
+#define HAVE_EFTYPE 1
+#define HAVE_EILSEQ 1
+#define HAVE_ERRNO_H 1
+#define HAVE_FCHDIR 1
+#define HAVE_FCHFLAGS 1
+#define HAVE_FCHMOD 1
+#define HAVE_FCHOWN 1
+#define HAVE_FCNTL 1
+#define HAVE_FCNTL_H 1
+#define HAVE_FSEEKO 1
+#define HAVE_FSTAT 1
+#define HAVE_FTRUNCATE 1
+#define HAVE_FUTIMES 1
+#define HAVE_GETEUID 1
+#define HAVE_GETPID 1
+#define HAVE_GRP_H 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LCHFLAGS 1
+#define HAVE_LCHMOD 1
+#define HAVE_LCHOWN 1
+#define HAVE_LIMITS_H 1
+#define HAVE_LINK 1
+#define HAVE_LSTAT 1
+#define HAVE_LUTIMES 1
+#define HAVE_MALLOC 1
+#define HAVE_MD5 1
+#define HAVE_MD5_H 1
+#define HAVE_MEMMOVE 1
+#define HAVE_MKDIR 1
+#define HAVE_MKFIFO 1
+#define HAVE_MKNOD 1
+#define HAVE_PIPE 1
+#define HAVE_POLL 1
+#define HAVE_POLL_H 1
+#define HAVE_PWD_H 1
+#define HAVE_READLINK 1
+#define HAVE_RMD160 1
+#define HAVE_SELECT 1
+#define HAVE_SETENV 1
+#define HAVE_SHA_H 1
+#define HAVE_SHA1 1
+#define HAVE_SHA256 1
+#define HAVE_SHA256_H 1
+#define HAVE_SIGNAL_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRCHR 1
+#define HAVE_STRDUP 1
+#define HAVE_STRERROR 1
+#define HAVE_STRERROR_R 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_STRRCHR 1
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1
+#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1
+#define HAVE_STRUCT_STAT_ST_FLAGS 1
+#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1
+#define HAVE_SYMLINK 1
+#define HAVE_SYS_CDEFS_H 1
+#define HAVE_SYS_IOCTL_H 1
+#define HAVE_SYS_SELECT_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TIME_H 1
+#define HAVE_SYS_TYPES_H 1
+#undef HAVE_SYS_UTIME_H
+#define HAVE_SYS_WAIT_H 1
+#define HAVE_TIMEGM 1
+#define HAVE_TZSET 1
+#define HAVE_UNISTD_H 1
+#define HAVE_UNSETENV 1
+#define HAVE_UTIME 1
+#define HAVE_UTIMES 1
+#define HAVE_UTIME_H 1
+#define HAVE_VFORK 1
+#define HAVE_WCHAR_H 1
+#define HAVE_WCSCPY 1
+#define HAVE_WCSLEN 1
+#define HAVE_WCTOMB 1
+#define HAVE_WMEMCMP 1
+#define HAVE_WMEMCPY 1
+#define HAVE_ZLIB_H 1
+#define TIME_WITH_SYS_TIME 1
+
+/* FreeBSD 4 and earlier lack intmax_t/uintmax_t */
+#if __FreeBSD__ < 5
+#define intmax_t int64_t
+#define uintmax_t uint64_t
+#endif
diff --git a/archivers/libarchive/files/libarchive/cpio.5 b/archivers/libarchive/files/libarchive/cpio.5
new file mode 100644
index 00000000000..f54462818ae
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/cpio.5
@@ -0,0 +1,325 @@
+.\" Copyright (c) 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 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: src/lib/libarchive/cpio.5,v 1.2 2008/05/26 17:00:23 kientzle Exp $
+.\"
+.Dd October 5, 2007
+.Dt CPIO 5
+.Os
+.Sh NAME
+.Nm cpio
+.Nd format of cpio archive files
+.Sh DESCRIPTION
+The
+.Nm
+archive format collects any number of files, directories, and other
+file system objects (symbolic links, device nodes, etc.) into a single
+stream of bytes.
+.Ss General Format
+Each file system object in a
+.Nm
+archive comprises a header record with basic numeric metadata
+followed by the full pathname of the entry and the file data.
+The header record stores a series of integer values that generally
+follow the fields in
+.Va struct stat .
+(See
+.Xr stat 2
+for details.)
+The variants differ primarily in how they store those integers
+(binary, octal, or hexadecimal).
+The header is followed by the pathname of the
+entry (the length of the pathname is stored in the header)
+and any file data.
+The end of the archive is indicated by a special record with
+the pathname
+.Dq TRAILER!!! .
+.Ss PWB format
+XXX Any documentation of the original PWB/UNIX 1.0 format? XXX
+.Ss Old Binary Format
+The old binary
+.Nm
+format stores numbers as 2-byte and 4-byte binary values.
+Each entry begins with a header in the following format:
+.Bd -literal -offset indent
+struct header_old_cpio {
+ unsigned short c_magic;
+ unsigned short c_dev;
+ unsigned short c_ino;
+ unsigned short c_mode;
+ unsigned short c_uid;
+ unsigned short c_gid;
+ unsigned short c_nlink;
+ unsigned short c_rdev;
+ unsigned short c_mtime[2];
+ unsigned short c_namesize;
+ unsigned short c_filesize[2];
+};
+.Ed
+.Pp
+The
+.Va unsigned short
+fields here are 16-bit integer values; the
+.Va unsigned int
+fields are 32-bit integer values.
+The fields are as follows
+.Bl -tag -width indent
+.It Va magic
+The integer value octal 070707.
+This value can be used to determine whether this archive is
+written with little-endian or big-endian integers.
+.It Va dev , Va ino
+The device and inode numbers from the disk.
+These are used by programs that read
+.Nm
+archives to determine when two entries refer to the same file.
+Programs that synthesize
+.Nm
+archives should be careful to set these to distinct values for each entry.
+.It Va mode
+The mode specifies both the regular permissions and the file type.
+It consists of several bit fields as follows:
+.Bl -tag -width "MMMMMMM" -compact
+.It 0170000
+This masks the file type bits.
+.It 0140000
+File type value for sockets.
+.It 0120000
+File type value for symbolic links.
+For symbolic links, the link body is stored as file data.
+.It 0100000
+File type value for regular files.
+.It 0060000
+File type value for block special devices.
+.It 0040000
+File type value for directories.
+.It 0020000
+File type value for character special devices.
+.It 0010000
+File type value for named pipes or FIFOs.
+.It 0004000
+SUID bit.
+.It 0002000
+SGID bit.
+.It 0001000
+Sticky bit.
+On some systems, this modifies the behavior of executables and/or directories.
+.It 0000777
+The lower 9 bits specify read/write/execute permissions
+for world, group, and user following standard POSIX conventions.
+.El
+.It Va uid , Va gid
+The numeric user id and group id of the owner.
+.It Va nlink
+The number of links to this file.
+Directories always have a value of at least two here.
+Note that hardlinked files include file data with every copy in the archive.
+.It Va rdev
+For block special and character special entries,
+this field contains the associated device number.
+For all other entry types, it should be set to zero by writers
+and ignored by readers.
+.It Va mtime
+Modification time of the file, indicated as the number
+of seconds since the start of the epoch,
+00:00:00 UTC January 1, 1970.
+The four-byte integer is stored with the most-significant 16 bits first
+followed by the least-significant 16 bits.
+Each of the two 16 bit values are stored in machine-native byte order.
+.It Va namesize
+The number of bytes in the pathname that follows the header.
+This count includes the trailing NUL byte.
+.It Va filesize
+The size of the file.
+Note that this archive format is limited to
+four gigabyte file sizes.
+See
+.Va mtime
+above for a description of the storage of four-byte integers.
+.El
+.Pp
+The pathname immediately follows the fixed header.
+If the
+.Cm namesize
+is odd, an additional NUL byte is added after the pathname.
+The file data is then appended, padded with NUL
+bytes to an even length.
+.Pp
+Hardlinked files are not given special treatment;
+the full file contents are included with each copy of the
+file.
+.Ss Portable ASCII Format
+.St -susv2
+standardized an ASCII variant that is portable across all
+platforms.
+It is commonly known as the
+.Dq old character
+format or as the
+.Dq odc
+format.
+It stores the same numeric fields as the old binary format, but
+represents them as 6-character or 11-character octal values.
+.Bd -literal -offset indent
+struct cpio_odc_header {
+ char c_magic[6];
+ char c_dev[6];
+ char c_ino[6];
+ char c_mode[6];
+ char c_uid[6];
+ char c_gid[6];
+ char c_nlink[6];
+ char c_rdev[6];
+ char c_mtime[11];
+ char c_namesize[6];
+ char c_filesize[11];
+};
+.Ed
+.Pp
+The fields are identical to those in the old binary format.
+The name and file body follow the fixed header.
+Unlike the old binary format, there is no additional padding
+after the pathname or file contents.
+If the files being archived are themselves entirely ASCII, then
+the resulting archive will be entirely ASCII, except for the
+NUL byte that terminates the name field.
+.Ss New ASCII Format
+The "new" ASCII format uses 8-byte hexadecimal fields for
+all numbers and separates device numbers into separate fields
+for major and minor numbers.
+.Bd -literal -offset indent
+struct cpio_newc_header {
+ char c_magic[6];
+ char c_ino[8];
+ char c_mode[8];
+ char c_uid[8];
+ char c_gid[8];
+ char c_nlink[8];
+ char c_mtime[8];
+ char c_filesize[8];
+ char c_devmajor[8];
+ char c_devminor[8];
+ char c_rdevmajor[8];
+ char c_rdevminor[8];
+ char c_namesize[8];
+ char c_check[8];
+};
+.Ed
+.Pp
+Except as specified below, the fields here match those specified
+for the old binary format above.
+.Bl -tag -width indent
+.It Va magic
+The string
+.Dq 070701 .
+.It Va check
+This field is always set to zero by writers and ignored by readers.
+See the next section for more details.
+.El
+.Pp
+The pathname is followed by NUL bytes so that the total size
+of the fixed header plus pathname is a multiple of four.
+Likewise, the file data is padded to a multiple of four bytes.
+Note that this format supports only 4 gigabyte files (unlike the
+older ASCII format, which supports 8 gigabyte files).
+.Pp
+In this format, hardlinked files are handled by setting the
+filesize to zero for each entry except the last one that
+appears in the archive.
+.Ss New CRC Format
+The CRC format is identical to the new ASCII format described
+in the previous section except that the magic field is set
+to
+.Dq 070702
+and the
+.Va check
+field is set to the sum of all bytes in the file data.
+This sum is computed treating all bytes as unsigned values
+and using unsigned arithmetic.
+Only the least-significant 32 bits of the sum are stored.
+.Ss HP variants
+The
+.Nm cpio
+implementation distributed with HPUX used XXXX but stored
+device numbers differently XXX.
+.Ss Other Extensions and Variants
+Sun Solaris uses additional file types to store extended file
+data, including ACLs and extended attributes, as special
+entries in cpio archives.
+.Pp
+XXX Others? XXX
+.Sh BUGS
+The
+.Dq CRC
+format is mis-named, as it uses a simple checksum and
+not a cyclic redundancy check.
+.Pp
+The old binary format is limited to 16 bits for user id,
+group id, device, and inode numbers.
+It is limited to 4 gigabyte file sizes.
+.Pp
+The old ASCII format is limited to 18 bits for
+the user id, group id, device, and inode numbers.
+It is limited to 8 gigabyte file sizes.
+.Pp
+The new ASCII format is limited to 4 gigabyte file sizes.
+.Pp
+None of the cpio formats store user or group names,
+which are essential when moving files between systems with
+dissimilar user or group numbering.
+.Pp
+Especially when writing older cpio variants, it may be necessary
+to map actual device/inode values to synthesized values that
+fit the available fields.
+With very large filesystems, this may be necessary even for
+the newer formats.
+.Sh SEE ALSO
+.Xr cpio 1 ,
+.Xr tar 5
+.Sh STANDARDS
+The
+.Nm cpio
+utility is no longer a part of POSIX or the Single Unix Standard.
+It last appeared in
+.St -susv2 .
+It has been supplanted in subsequent standards by
+.Xr pax 1 .
+The portable ASCII format is currently part of the specification for the
+.Xr pax 1
+utility.
+.Sh HISTORY
+The original cpio utility was written by Dick Haight
+while working in AT&T's Unix Support Group.
+It appeared in 1977 as part of PWB/UNIX 1.0, the
+.Dq Programmer's Work Bench
+derived from
+.At v6
+that was used internally at AT&T.
+Both the old binary and old character formats were in use
+by 1980, according to the System III source released
+by SCO under their
+.Dq Ancient Unix
+license.
+The character format was adopted as part of
+.St -p1003.1-88 .
+XXX when did "newc" appear? Who invented it? When did HP come out with their variant? When did Sun introduce ACLs and extended attributes? XXX
diff --git a/archivers/libarchive/files/libarchive/filter_fork.c b/archivers/libarchive/files/libarchive/filter_fork.c
new file mode 100644
index 00000000000..604ad633f55
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/filter_fork.c
@@ -0,0 +1,161 @@
+/*-
+ * Copyright (c) 2007 Joerg Sonnenberger
+ * 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 "archive_platform.h"
+
+/* This capability is only available on POSIX systems. */
+#if defined(HAVE_PIPE) && defined(HAVE_FCNTL) && \
+ (defined(HAVE_FORK) || defined(HAVE_VFORK))
+
+__FBSDID("$FreeBSD: head/lib/libarchive/filter_fork.c 182958 2008-09-12 05:33:00Z kientzle $");
+
+#if defined(HAVE_POLL)
+# if defined(HAVE_POLL_H)
+# include <poll.h>
+# elif defined(HAVE_SYS_POLL_H)
+# include <sys/poll.h>
+# endif
+#elif defined(HAVE_SELECT)
+# if defined(HAVE_SYS_SELECT_H)
+# include <sys/select.h>
+# elif defined(HAVE_UNISTD_H)
+# include <unistd.h>
+# endif
+#endif
+#ifdef HAVE_FCNTL_H
+# include <fcntl.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
+
+#include "filter_fork.h"
+
+pid_t
+__archive_create_child(const char *path, int *child_stdin, int *child_stdout)
+{
+ pid_t child;
+ int stdin_pipe[2], stdout_pipe[2], tmp;
+
+ if (pipe(stdin_pipe) == -1)
+ goto state_allocated;
+ if (stdin_pipe[0] == 1 /* stdout */) {
+ if ((tmp = dup(stdin_pipe[0])) == -1)
+ goto stdin_opened;
+ close(stdin_pipe[0]);
+ stdin_pipe[0] = tmp;
+ }
+ if (pipe(stdout_pipe) == -1)
+ goto stdin_opened;
+ if (stdout_pipe[1] == 0 /* stdin */) {
+ if ((tmp = dup(stdout_pipe[1])) == -1)
+ goto stdout_opened;
+ close(stdout_pipe[1]);
+ stdout_pipe[1] = tmp;
+ }
+
+#if HAVE_VFORK
+ switch ((child = vfork())) {
+#else
+ switch ((child = fork())) {
+#endif
+ case -1:
+ goto stdout_opened;
+ case 0:
+ close(stdin_pipe[1]);
+ close(stdout_pipe[0]);
+ if (dup2(stdin_pipe[0], 0 /* stdin */) == -1)
+ _exit(254);
+ if (stdin_pipe[0] != 0 /* stdin */)
+ close(stdin_pipe[0]);
+ if (dup2(stdout_pipe[1], 1 /* stdout */) == -1)
+ _exit(254);
+ if (stdout_pipe[1] != 1 /* stdout */)
+ close(stdout_pipe[1]);
+ execlp(path, path, (char *)NULL);
+ _exit(254);
+ default:
+ close(stdin_pipe[0]);
+ close(stdout_pipe[1]);
+
+ *child_stdin = stdin_pipe[1];
+ fcntl(*child_stdin, F_SETFL, O_NONBLOCK);
+ *child_stdout = stdout_pipe[0];
+ fcntl(*child_stdout, F_SETFL, O_NONBLOCK);
+ }
+
+ return child;
+
+stdout_opened:
+ close(stdout_pipe[0]);
+ close(stdout_pipe[1]);
+stdin_opened:
+ close(stdin_pipe[0]);
+ close(stdin_pipe[1]);
+state_allocated:
+ return -1;
+}
+
+void
+__archive_check_child(int in, int out)
+{
+#if defined(HAVE_POLL)
+ struct pollfd fds[2];
+ int idx;
+
+ idx = 0;
+ if (in != -1) {
+ fds[idx].fd = in;
+ fds[idx].events = POLLOUT;
+ ++idx;
+ }
+ if (out != -1) {
+ fds[idx].fd = out;
+ fds[idx].events = POLLIN;
+ ++idx;
+ }
+
+ poll(fds, idx, -1); /* -1 == INFTIM, wait forever */
+#elif defined(HAVE_SELECT)
+ fd_set fds_in, fds_out, fds_error;
+
+ FD_ZERO(&fds_in);
+ FD_ZERO(&fds_out);
+ FD_ZERO(&fds_error);
+ if (out != -1) {
+ FD_SET(out, &fds_in);
+ FD_SET(out, &fds_error);
+ }
+ if (in != -1) {
+ FD_SET(in, &fds_out);
+ FD_SET(in, &fds_error);
+ }
+ select(in < out ? out + 1 : in + 1, &fds_in, &fds_out, &fds_error, NULL);
+#else
+ sleep(1);
+#endif
+}
+
+#endif /* defined(HAVE_PIPE) && defined(HAVE_VFORK) && defined(HAVE_FCNTL) */
diff --git a/archivers/libarchive/files/libarchive/filter_fork.h b/archivers/libarchive/files/libarchive/filter_fork.h
new file mode 100644
index 00000000000..453d032d1c8
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/filter_fork.h
@@ -0,0 +1,41 @@
+/*-
+ * Copyright (c) 2007 Joerg Sonnenberger
+ * 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: head/lib/libarchive/filter_fork.h 201087 2009-12-28 02:18:26Z kientzle $
+ */
+
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
+
+#ifndef FILTER_FORK_H
+#define FILTER_FORK_H
+
+pid_t
+__archive_create_child(const char *path, int *child_stdin, int *child_stdout);
+
+void
+__archive_check_child(int in, int out);
+
+#endif
diff --git a/archivers/libarchive/files/libarchive/libarchive-formats.5 b/archivers/libarchive/files/libarchive/libarchive-formats.5
new file mode 100644
index 00000000000..0acdb50c2bd
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/libarchive-formats.5
@@ -0,0 +1,355 @@
+.\" Copyright (c) 2003-2009 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 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: head/lib/libarchive/libarchive-formats.5 201077 2009-12-28 01:50:23Z kientzle $
+.\"
+.Dd December 27, 2009
+.Dt libarchive-formats 5
+.Os
+.Sh NAME
+.Nm libarchive-formats
+.Nd archive formats supported by the libarchive library
+.Sh DESCRIPTION
+The
+.Xr libarchive 3
+library reads and writes a variety of streaming archive formats.
+Generally speaking, all of these archive formats consist of a series of
+.Dq entries .
+Each entry stores a single file system object, such as a file, directory,
+or symbolic link.
+.Pp
+The following provides a brief description of each format supported
+by libarchive, with some information about recognized extensions or
+limitations of the current library support.
+Note that just because a format is supported by libarchive does not
+imply that a program that uses libarchive will support that format.
+Applications that use libarchive specify which formats they wish
+to support, though many programs do use libarchive convenience
+functions to enable all supported formats.
+.Ss Tar Formats
+The
+.Xr libarchive 3
+library can read most tar archives.
+However, it only writes POSIX-standard
+.Dq ustar
+and
+.Dq pax interchange
+formats.
+.Pp
+All tar formats store each entry in one or more 512-byte records.
+The first record is used for file metadata, including filename,
+timestamp, and mode information, and the file data is stored in
+subsequent records.
+Later variants have extended this by either appropriating undefined
+areas of the header record, extending the header to multiple records,
+or by storing special entries that modify the interpretation of
+subsequent entries.
+.Pp
+.Bl -tag -width indent
+.It Cm gnutar
+The
+.Xr libarchive 3
+library can read GNU-format tar archives.
+It currently supports the most popular GNU extensions, including
+modern long filename and linkname support, as well as atime and ctime data.
+The libarchive library does not support multi-volume
+archives, nor the old GNU long filename format.
+It can read GNU sparse file entries, including the new POSIX-based
+formats, but cannot write GNU sparse file entries.
+.It Cm pax
+The
+.Xr libarchive 3
+library can read and write POSIX-compliant pax interchange format
+archives.
+Pax interchange format archives are an extension of the older ustar
+format that adds a separate entry with additional attributes stored
+as key/value pairs immediately before each regular entry.
+The presence of these additional entries is the only difference between
+pax interchange format and the older ustar format.
+The extended attributes are of unlimited length and are stored
+as UTF-8 Unicode strings.
+Keywords defined in the standard are in all lowercase; vendors are allowed
+to define custom keys by preceding them with the vendor name in all uppercase.
+When writing pax archives, libarchive uses many of the SCHILY keys
+defined by Joerg Schilling's
+.Dq star
+archiver and a few LIBARCHIVE keys.
+The libarchive library can read most of the SCHILY keys
+and most of the GNU keys introduced by GNU tar.
+It silently ignores any keywords that it does not understand.
+.It Cm restricted pax
+The libarchive library can also write pax archives in which it
+attempts to suppress the extended attributes entry whenever
+possible.
+The result will be identical to a ustar archive unless the
+extended attributes entry is required to store a long file
+name, long linkname, extended ACL, file flags, or if any of the standard
+ustar data (user name, group name, UID, GID, etc) cannot be fully
+represented in the ustar header.
+In all cases, the result can be dearchived by any program that
+can read POSIX-compliant pax interchange format archives.
+Programs that correctly read ustar format (see below) will also be
+able to read this format; any extended attributes will be extracted as
+separate files stored in
+.Pa PaxHeader
+directories.
+.It Cm ustar
+The libarchive library can both read and write this format.
+This format has the following limitations:
+.Bl -bullet -compact
+.It
+Device major and minor numbers are limited to 21 bits.
+Nodes with larger numbers will not be added to the archive.
+.It
+Path names in the archive are limited to 255 bytes.
+(Shorter if there is no / character in exactly the right place.)
+.It
+Symbolic links and hard links are stored in the archive with
+the name of the referenced file.
+This name is limited to 100 bytes.
+.It
+Extended attributes, file flags, and other extended
+security information cannot be stored.
+.It
+Archive entries are limited to 8 gigabytes in size.
+.El
+Note that the pax interchange format has none of these restrictions.
+.El
+.Pp
+The libarchive library also reads a variety of commonly-used extensions to
+the basic tar format.
+These extensions are recognized automatically whenever they appear.
+.Bl -tag -width indent
+.It Numeric extensions.
+The POSIX standards require fixed-length numeric fields to be written with
+some character position reserved for terminators.
+Libarchive allows these fields to be written without terminator characters.
+This extends the allowable range; in particular, ustar archives with this
+extension can support entries up to 64 gigabytes in size.
+Libarchive also recognizes base-256 values in most numeric fields.
+This essentially removes all limitations on file size, modification time,
+and device numbers.
+.It Solaris extensions
+Libarchive recognizes ACL and extended attribute records written
+by Solaris tar.
+Currently, libarchive only has support for old-style ACLs; the
+newer NFSv4 ACLs are recognized but discarded.
+.El
+.Pp
+The first tar program appeared in Seventh Edition Unix in 1979.
+The first official standard for the tar file format was the
+.Dq ustar
+(Unix Standard Tar) format defined by POSIX in 1988.
+POSIX.1-2001 extended the ustar format to create the
+.Dq pax interchange
+format.
+.Ss Cpio Formats
+The libarchive library can read a number of common cpio variants and can write
+.Dq odc
+and
+.Dq newc
+format archives.
+A cpio archive stores each entry as a fixed-size header followed
+by a variable-length filename and variable-length data.
+Unlike the tar format, the cpio format does only minimal padding
+of the header or file data.
+There are several cpio variants, which differ primarily in
+how they store the initial header: some store the values as
+octal or hexadecimal numbers in ASCII, others as binary values of
+varying byte order and length.
+.Bl -tag -width indent
+.It Cm binary
+The libarchive library transparently reads both big-endian and little-endian
+variants of the original binary cpio format.
+This format used 32-bit binary values for file size and mtime,
+and 16-bit binary values for the other fields.
+.It Cm odc
+The libarchive library can both read and write this
+POSIX-standard format, which is officially known as the
+.Dq cpio interchange format
+or the
+.Dq octet-oriented cpio archive format
+and sometimes unofficially referred to as the
+.Dq old character format .
+This format stores the header contents as octal values in ASCII.
+It is standard, portable, and immune from byte-order confusion.
+File sizes and mtime are limited to 33 bits (8GB file size),
+other fields are limited to 18 bits.
+.It Cm SVR4
+The libarchive library can read both CRC and non-CRC variants of
+this format.
+The SVR4 format uses eight-digit hexadecimal values for
+all header fields.
+This limits file size to 4GB, and also limits the mtime and
+other fields to 32 bits.
+The SVR4 format can optionally include a CRC of the file
+contents, although libarchive does not currently verify this CRC.
+.El
+.Pp
+Cpio first appeared in PWB/UNIX 1.0, which was released within
+AT&T in 1977.
+PWB/UNIX 1.0 formed the basis of System III Unix, released outside
+of AT&T in 1981.
+This makes cpio older than tar, although cpio was not included
+in Version 7 AT&T Unix.
+As a result, the tar command became much better known in universities
+and research groups that used Version 7.
+The combination of the
+.Nm find
+and
+.Nm cpio
+utilities provided very precise control over file selection.
+Unfortunately, the format has many limitations that make it unsuitable
+for widespread use.
+Only the POSIX format permits files over 4GB, and its 18-bit
+limit for most other fields makes it unsuitable for modern systems.
+In addition, cpio formats only store numeric UID/GID values (not
+usernames and group names), which can make it very difficult to correctly
+transfer archives across systems with dissimilar user numbering.
+.Ss Shar Formats
+A
+.Dq shell archive
+is a shell script that, when executed on a POSIX-compliant
+system, will recreate a collection of file system objects.
+The libarchive library can write two different kinds of shar archives:
+.Bl -tag -width indent
+.It Cm shar
+The traditional shar format uses a limited set of POSIX
+commands, including
+.Xr echo 1 ,
+.Xr mkdir 1 ,
+and
+.Xr sed 1 .
+It is suitable for portably archiving small collections of plain text files.
+However, it is not generally well-suited for large archives
+(many implementations of
+.Xr sh 1
+have limits on the size of a script) nor should it be used with non-text files.
+.It Cm shardump
+This format is similar to shar but encodes files using
+.Xr uuencode 1
+so that the result will be a plain text file regardless of the file contents.
+It also includes additional shell commands that attempt to reproduce as
+many file attributes as possible, including owner, mode, and flags.
+The additional commands used to restore file attributes make
+shardump archives less portable than plain shar archives.
+.El
+.Ss ISO9660 format
+Libarchive can read and extract from files containing ISO9660-compliant
+CDROM images.
+In many cases, this can remove the need to burn a physical CDROM
+just in order to read the files contained in an ISO9660 image.
+It also avoids security and complexity issues that come with
+virtual mounts and loopback devices.
+Libarchive supports the most common Rockridge extensions and has partial
+support for Joliet extensions.
+If both extensions are present, the Joliet extensions will be
+used and the Rockridge extensions will be ignored.
+In particular, this can create problems with hardlinks and symlinks,
+which are supported by Rockridge but not by Joliet.
+.Ss Zip format
+Libarchive can read and write zip format archives that have
+uncompressed entries and entries compressed with the
+.Dq deflate
+algorithm.
+Older zip compression algorithms are not supported.
+It can extract jar archives, archives that use Zip64 extensions and many
+self-extracting zip archives.
+Libarchive reads Zip archives as they are being streamed,
+which allows it to read archives of arbitrary size.
+It currently does not use the central directory; this
+limits libarchive's ability to support some self-extracting
+archives and ones that have been modified in certain ways.
+.Ss Archive (library) file format
+The Unix archive format (commonly created by the
+.Xr ar 1
+archiver) is a general-purpose format which is
+used almost exclusively for object files to be
+read by the link editor
+.Xr ld 1 .
+The ar format has never been standardised.
+There are two common variants:
+the GNU format derived from SVR4,
+and the BSD format, which first appeared in 4.4BSD.
+The two differ primarily in their handling of filenames
+longer than 15 characters:
+the GNU/SVR4 variant writes a filename table at the beginning of the archive;
+the BSD format stores each long filename in an extension
+area adjacent to the entry.
+Libarchive can read both extensions,
+including archives that may include both types of long filenames.
+Programs using libarchive can write GNU/SVR4 format
+if they provide a filename table to be written into
+the archive before any of the entries.
+Any entries whose names are not in the filename table
+will be written using BSD-style long filenames.
+This can cause problems for programs such as
+GNU ld that do not support the BSD-style long filenames.
+.Ss mtree
+Libarchive can read and write files in
+.Xr mtree 5
+format.
+This format is not a true archive format, but rather a textual description
+of a file hierarchy in which each line specifies the name of a file and
+provides specific metadata about that file.
+Libarchive can read all of the keywords supported by both
+the NetBSD and FreeBSD versions of
+.Xr mtree 1 ,
+although many of the keywords cannot currently be stored in an
+.Tn archive_entry
+object.
+When writing, libarchive supports use of the
+.Xr archive_write_set_options 3
+interface to specify which keywords should be included in the
+output.
+If libarchive was compiled with access to suitable
+cryptographic libraries (such as the OpenSSL libraries),
+it can compute hash entries such as
+.Cm sha512
+or
+.Cm md5
+from file data being written to the mtree writer.
+.Pp
+When reading an mtree file, libarchive will locate the corresponding
+files on disk using the
+.Cm contents
+keyword if present or the regular filename.
+If it can locate and open the file on disk, it will use that
+to fill in any metadata that is missing from the mtree file
+and will read the file contents and return those to the program
+using libarchive.
+If it cannot locate and open the file on disk, libarchive
+will return an error for any attempt to read the entry
+body.
+.Sh SEE ALSO
+.Xr ar 1 ,
+.Xr cpio 1 ,
+.Xr mkisofs 1 ,
+.Xr shar 1 ,
+.Xr tar 1 ,
+.Xr zip 1 ,
+.Xr zlib 3 ,
+.Xr cpio 5 ,
+.Xr mtree 5 ,
+.Xr tar 5
diff --git a/archivers/libarchive/files/libarchive/libarchive.3 b/archivers/libarchive/files/libarchive/libarchive.3
new file mode 100644
index 00000000000..8c19d008a90
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/libarchive.3
@@ -0,0 +1,331 @@
+.\" 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 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: src/lib/libarchive/libarchive.3,v 1.11 2007/01/09 08:05:56 kientzle Exp $
+.\"
+.Dd August 19, 2006
+.Dt LIBARCHIVE 3
+.Os
+.Sh NAME
+.Nm libarchive
+.Nd functions for reading and writing streaming archives
+.Sh LIBRARY
+.Lb libarchive
+.Sh OVERVIEW
+The
+.Nm
+library provides a flexible interface for reading and writing
+streaming archive files such as tar and cpio.
+The library is inherently stream-oriented; readers serially iterate through
+the archive, writers serially add things to the archive.
+In particular, note that there is no built-in support for
+random access nor for in-place modification.
+.Pp
+When reading an archive, the library automatically detects the
+format and the compression.
+The library currently has read support for:
+.Bl -bullet -compact
+.It
+old-style tar archives,
+.It
+most variants of the POSIX
+.Dq ustar
+format,
+.It
+the POSIX
+.Dq pax interchange
+format,
+.It
+GNU-format tar archives,
+.It
+most common cpio archive formats,
+.It
+ISO9660 CD images (with or without RockRidge extensions),
+.It
+Zip archives.
+.El
+The library automatically detects archives compressed with
+.Xr gzip 1 ,
+.Xr bzip2 1 ,
+or
+.Xr compress 1
+and decompresses them transparently.
+.Pp
+When writing an archive, you can specify the compression
+to be used and the format to use.
+The library can write
+.Bl -bullet -compact
+.It
+POSIX-standard
+.Dq ustar
+archives,
+.It
+POSIX
+.Dq pax interchange format
+archives,
+.It
+POSIX octet-oriented cpio archives,
+.It
+two different variants of shar archives.
+.El
+Pax interchange format is an extension of the tar archive format that
+eliminates essentially all of the limitations of historic tar formats
+in a standard fashion that is supported
+by POSIX-compliant
+.Xr pax 1
+implementations on many systems as well as several newer implementations of
+.Xr tar 1 .
+Note that the default write format will suppress the pax extended
+attributes for most entries; explicitly requesting pax format will
+enable those attributes for all entries.
+.Pp
+The read and write APIs are accessed through the
+.Fn archive_read_XXX
+functions and the
+.Fn archive_write_XXX
+functions, respectively, and either can be used independently
+of the other.
+.Pp
+The rest of this manual page provides an overview of the library
+operation.
+More detailed information can be found in the individual manual
+pages for each API or utility function.
+.Sh READING AN ARCHIVE
+To read an archive, you must first obtain an initialized
+.Tn struct archive
+object from
+.Fn archive_read_new .
+You can then modify this object for the desired operations with the
+various
+.Fn archive_read_set_XXX
+and
+.Fn archive_read_support_XXX
+functions.
+In particular, you will need to invoke appropriate
+.Fn archive_read_support_XXX
+functions to enable the corresponding compression and format
+support.
+Note that these latter functions perform two distinct operations:
+they cause the corresponding support code to be linked into your
+program, and they enable the corresponding auto-detect code.
+Unless you have specific constraints, you will generally want
+to invoke
+.Fn archive_read_support_compression_all
+and
+.Fn archive_read_support_format_all
+to enable auto-detect for all formats and compression types
+currently supported by the library.
+.Pp
+Once you have prepared the
+.Tn struct archive
+object, you call
+.Fn archive_read_open
+to actually open the archive and prepare it for reading.
+There are several variants of this function;
+the most basic expects you to provide pointers to several
+functions that can provide blocks of bytes from the archive.
+There are convenience forms that allow you to
+specify a filename, file descriptor,
+.Ft "FILE *"
+object, or a block of memory from which to read the archive data.
+Note that the core library makes no assumptions about the
+size of the blocks read;
+callback functions are free to read whatever block size is
+most appropriate for the medium.
+.Pp
+Each archive entry consists of a header followed by a certain
+amount of data.
+You can obtain the next header with
+.Fn archive_read_next_header ,
+which returns a pointer to an
+.Tn struct archive_entry
+structure with information about the current archive element.
+If the entry is a regular file, then the header will be followed
+by the file data.
+You can use
+.Fn archive_read_data
+(which works much like the
+.Xr read 2
+system call)
+to read this data from the archive.
+You may prefer to use the higher-level
+.Fn archive_read_data_skip ,
+which reads and discards the data for this entry,
+.Fn archive_read_data_to_buffer ,
+which reads the data into an in-memory buffer,
+.Fn archive_read_data_to_file ,
+which copies the data to the provided file descriptor, or
+.Fn archive_read_extract ,
+which recreates the specified entry on disk and copies data
+from the archive.
+In particular, note that
+.Fn archive_read_extract
+uses the
+.Tn struct archive_entry
+structure that you provide it, which may differ from the
+entry just read from the archive.
+In particular, many applications will want to override the
+pathname, file permissions, or ownership.
+.Pp
+Once you have finished reading data from the archive, you
+should call
+.Fn archive_read_close
+to close the archive, then call
+.Fn archive_read_finish
+to release all resources, including all memory allocated by the library.
+.Pp
+The
+.Xr archive_read 3
+manual page provides more detailed calling information for this API.
+.Sh WRITING AN ARCHIVE
+You use a similar process to write an archive.
+The
+.Fn archive_write_new
+function creates an archive object useful for writing,
+the various
+.Fn archive_write_set_XXX
+functions are used to set parameters for writing the archive, and
+.Fn archive_write_open
+completes the setup and opens the archive for writing.
+.Pp
+Individual archive entries are written in a three-step
+process:
+You first initialize a
+.Tn struct archive_entry
+structure with information about the new entry.
+At a minimum, you should set the pathname of the
+entry and provide a
+.Va struct stat
+with a valid
+.Va st_mode
+field, which specifies the type of object and
+.Va st_size
+field, which specifies the size of the data portion of the object.
+The
+.Fn archive_write_header
+function actually writes the header data to the archive.
+You can then use
+.Fn archive_write_data
+to write the actual data.
+.Pp
+After all entries have been written, use the
+.Fn archive_write_finish
+function to release all resources.
+.Pp
+The
+.Xr archive_write 3
+manual page provides more detailed calling information for this API.
+.Sh DESCRIPTION
+Detailed descriptions of each function are provided by the
+corresponding manual pages.
+.Pp
+All of the functions utilize an opaque
+.Tn struct archive
+datatype that provides access to the archive contents.
+.Pp
+The
+.Tn struct archive_entry
+structure contains a complete description of a single archive
+entry.
+It uses an opaque interface that is fully documented in
+.Xr archive_entry 3 .
+.Pp
+Users familiar with historic formats should be aware that the newer
+variants have eliminated most restrictions on the length of textual fields.
+Clients should not assume that filenames, link names, user names, or
+group names are limited in length.
+In particular, pax interchange format can easily accommodate pathnames
+in arbitrary character sets that exceed
+.Va PATH_MAX .
+.Sh RETURN VALUES
+Most functions return zero on success, non-zero on error.
+The return value indicates the general severity of the error, ranging
+from
+.Cm ARCHIVE_WARN ,
+which indicates a minor problem that should probably be reported
+to the user, to
+.Cm ARCHIVE_FATAL ,
+which indicates a serious problem that will prevent any further
+operations on this archive.
+On error, the
+.Fn archive_errno
+function can be used to retrieve a numeric error code (see
+.Xr errno 2 ) .
+The
+.Fn archive_error_string
+returns a textual error message suitable for display.
+.Pp
+.Fn archive_read_new
+and
+.Fn archive_write_new
+return pointers to an allocated and initialized
+.Tn struct archive
+object.
+.Pp
+.Fn archive_read_data
+and
+.Fn archive_write_data
+return a count of the number of bytes actually read or written.
+A value of zero indicates the end of the data for this entry.
+A negative value indicates an error, in which case the
+.Fn archive_errno
+and
+.Fn archive_error_string
+functions can be used to obtain more information.
+.Sh ENVIRONMENT
+There are character set conversions within the
+.Xr archive_entry 3
+functions that are impacted by the currently-selected locale.
+.Sh SEE ALSO
+.Xr tar 1 ,
+.Xr archive_entry 3 ,
+.Xr archive_read 3 ,
+.Xr archive_util 3 ,
+.Xr archive_write 3 ,
+.Xr tar 5
+.Sh HISTORY
+The
+.Nm libarchive
+library first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm libarchive
+library was written by
+.An Tim Kientzle Aq kientzle@acm.org .
+.Sh BUGS
+Some archive formats support information that is not supported by
+.Tn struct archive_entry .
+Such information cannot be fully archived or restored using this library.
+This includes, for example, comments, character sets,
+or the arbitrary key/value pairs that can appear in
+pax interchange format archives.
+.Pp
+Conversely, of course, not all of the information that can be
+stored in an
+.Tn struct archive_entry
+is supported by all formats.
+For example, cpio formats do not support nanosecond timestamps;
+old tar formats do not support large device numbers.
diff --git a/archivers/libarchive/files/libarchive/libarchive_internals.3 b/archivers/libarchive/files/libarchive/libarchive_internals.3
new file mode 100644
index 00000000000..9a42b76d4e6
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/libarchive_internals.3
@@ -0,0 +1,366 @@
+.\" 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 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: src/lib/libarchive/libarchive_internals.3,v 1.2 2007/12/30 04:58:22 kientzle Exp $
+.\"
+.Dd April 16, 2007
+.Dt LIBARCHIVE 3
+.Os
+.Sh NAME
+.Nm libarchive_internals
+.Nd description of libarchive internal interfaces
+.Sh OVERVIEW
+The
+.Nm libarchive
+library provides a flexible interface for reading and writing
+streaming archive files such as tar and cpio.
+Internally, it follows a modular layered design that should
+make it easy to add new archive and compression formats.
+.Sh GENERAL ARCHITECTURE
+Externally, libarchive exposes most operations through an
+opaque, object-style interface.
+The
+.Xr archive_entry 1
+objects store information about a single filesystem object.
+The rest of the library provides facilities to write
+.Xr archive_entry 1
+objects to archive files,
+read them from archive files,
+and write them to disk.
+(There are plans to add a facility to read
+.Xr archive_entry 1
+objects from disk as well.)
+.Pp
+The read and write APIs each have four layers: a public API
+layer, a format layer that understands the archive file format,
+a compression layer, and an I/O layer.
+The I/O layer is completely exposed to clients who can replace
+it entirely with their own functions.
+.Pp
+In order to provide as much consistency as possible for clients,
+some public functions are virtualized.
+Eventually, it should be possible for clients to open
+an archive or disk writer, and then use a single set of
+code to select and write entries, regardless of the target.
+.Sh READ ARCHITECTURE
+From the outside, clients use the
+.Xr archive_read 3
+API to manipulate an
+.Nm archive
+object to read entries and bodies from an archive stream.
+Internally, the
+.Nm archive
+object is cast to an
+.Nm archive_read
+object, which holds all read-specific data.
+The API has four layers:
+The lowest layer is the I/O layer.
+This layer can be overridden by clients, but most clients use
+the packaged I/O callbacks provided, for example, by
+.Xr archive_read_open_memory 3 ,
+and
+.Xr archive_read_open_fd 3 .
+The compression layer calls the I/O layer to
+read bytes and decompresses them for the format layer.
+The format layer unpacks a stream of uncompressed bytes and
+creates
+.Nm archive_entry
+objects from the incoming data.
+The API layer tracks overall state
+(for example, it prevents clients from reading data before reading a header)
+and invokes the format and compression layer operations
+through registered function pointers.
+In particular, the API layer drives the format-detection process:
+When opening the archive, it reads an initial block of data
+and offers it to each registered compression handler.
+The one with the highest bid is initialized with the first block.
+Similarly, the format handlers are polled to see which handler
+is the best for each archive.
+(Prior to 2.4.0, the format bidders were invoked for each
+entry, but this design hindered error recovery.)
+.Ss I/O Layer and Client Callbacks
+The read API goes to some lengths to be nice to clients.
+As a result, there are few restrictions on the behavior of
+the client callbacks.
+.Pp
+The client read callback is expected to provide a block
+of data on each call.
+A zero-length return does indicate end of file, but otherwise
+blocks may be as small as one byte or as large as the entire file.
+In particular, blocks may be of different sizes.
+.Pp
+The client skip callback returns the number of bytes actually
+skipped, which may be much smaller than the skip requested.
+The only requirement is that the skip not be larger.
+In particular, clients are allowed to return zero for any
+skip that they don't want to handle.
+The skip callback must never be invoked with a negative value.
+.Pp
+Keep in mind that not all clients are reading from disk:
+clients reading from networks may provide different-sized
+blocks on every request and cannot skip at all;
+advanced clients may use
+.Xr mmap 2
+to read the entire file into memory at once and return the
+entire file to libarchive as a single block;
+other clients may begin asynchronous I/O operations for the
+next block on each request.
+.Ss Decompresssion Layer
+The decompression layer not only handles decompression,
+it also buffers data so that the format handlers see a
+much nicer I/O model.
+The decompression API is a two stage peek/consume model.
+A read_ahead request specifies a minimum read amount;
+the decompression layer must provide a pointer to at least
+that much data.
+If more data is immediately available, it should return more:
+the format layer handles bulk data reads by asking for a minimum
+of one byte and then copying as much data as is available.
+.Pp
+A subsequent call to the
+.Fn consume
+function advances the read pointer.
+Note that data returned from a
+.Fn read_ahead
+call is guaranteed to remain in place until
+the next call to
+.Fn read_ahead .
+Intervening calls to
+.Fn consume
+should not cause the data to move.
+.Pp
+Skip requests must always be handled exactly.
+Decompression handlers that cannot seek forward should
+not register a skip handler;
+the API layer fills in a generic skip handler that reads and discards data.
+.Pp
+A decompression handler has a specific lifecycle:
+.Bl -tag -compact -width indent
+.It Registration/Configuration
+When the client invokes the public support function,
+the decompression handler invokes the internal
+.Fn __archive_read_register_compression
+function to provide bid and initialization functions.
+This function returns
+.Cm NULL
+on error or else a pointer to a
+.Cm struct decompressor_t .
+This structure contains a
+.Va void * config
+slot that can be used for storing any customization information.
+.It Bid
+The bid function is invoked with a pointer and size of a block of data.
+The decompressor can access its config data
+through the
+.Va decompressor
+element of the
+.Cm archive_read
+object.
+The bid function is otherwise stateless.
+In particular, it must not perform any I/O operations.
+.Pp
+The value returned by the bid function indicates its suitability
+for handling this data stream.
+A bid of zero will ensure that this decompressor is never invoked.
+Return zero if magic number checks fail.
+Otherwise, your initial implementation should return the number of bits
+actually checked.
+For example, if you verify two full bytes and three bits of another
+byte, bid 19.
+Note that the initial block may be very short;
+be careful to only inspect the data you are given.
+(The current decompressors require two bytes for correct bidding.)
+.It Initialize
+The winning bidder will have its init function called.
+This function should initialize the remaining slots of the
+.Va struct decompressor_t
+object pointed to by the
+.Va decompressor
+element of the
+.Va archive_read
+object.
+In particular, it should allocate any working data it needs
+in the
+.Va data
+slot of that structure.
+The init function is called with the block of data that
+was used for tasting.
+At this point, the decompressor is responsible for all I/O
+requests to the client callbacks.
+The decompressor is free to read more data as and when
+necessary.
+.It Satisfy I/O requests
+The format handler will invoke the
+.Va read_ahead ,
+.Va consume ,
+and
+.Va skip
+functions as needed.
+.It Finish
+The finish method is called only once when the archive is closed.
+It should release anything stored in the
+.Va data
+and
+.Va config
+slots of the
+.Va decompressor
+object.
+It should not invoke the client close callback.
+.El
+.Ss Format Layer
+The read formats have a similar lifecycle to the decompression handlers:
+.Bl -tag -compact -width indent
+.It Registration
+Allocate your private data and initialize your pointers.
+.It Bid
+Formats bid by invoking the
+.Fn read_ahead
+decompression method but not calling the
+.Fn consume
+method.
+This allows each bidder to look ahead in the input stream.
+Bidders should not look further ahead than necessary, as long
+look aheads put pressure on the decompression layer to buffer
+lots of data.
+Most formats only require a few hundred bytes of look ahead;
+look aheads of a few kilobytes are reasonable.
+(The ISO9660 reader sometimes looks ahead by 48k, which
+should be considered an upper limit.)
+.It Read header
+The header read is usually the most complex part of any format.
+There are a few strategies worth mentioning:
+For formats such as tar or cpio, reading and parsing the header is
+straightforward since headers alternate with data.
+For formats that store all header data at the beginning of the file,
+the first header read request may have to read all headers into
+memory and store that data, sorted by the location of the file
+data.
+Subsequent header read requests will skip forward to the
+beginning of the file data and return the corresponding header.
+.It Read Data
+The read data interface supports sparse files; this requires that
+each call return a block of data specifying the file offset and
+size.
+This may require you to carefully track the location so that you
+can return accurate file offsets for each read.
+Remember that the decompressor will return as much data as it has.
+Generally, you will want to request one byte,
+examine the return value to see how much data is available, and
+possibly trim that to the amount you can use.
+You should invoke consume for each block just before you return it.
+.It Skip All Data
+The skip data call should skip over all file data and trailing padding.
+This is called automatically by the API layer just before each
+header read.
+It is also called in response to the client calling the public
+.Fn data_skip
+function.
+.It Cleanup
+On cleanup, the format should release all of its allocated memory.
+.El
+.Ss API Layer
+XXX to do XXX
+.Sh WRITE ARCHITECTURE
+The write API has a similar set of four layers:
+an API layer, a format layer, a compression layer, and an I/O layer.
+The registration here is much simpler because only
+one format and one compression can be registered at a time.
+.Ss I/O Layer and Client Callbacks
+XXX To be written XXX
+.Ss Compression Layer
+XXX To be written XXX
+.Ss Format Layer
+XXX To be written XXX
+.Ss API Layer
+XXX To be written XXX
+.Sh WRITE_DISK ARCHITECTURE
+The write_disk API is intended to look just like the write API
+to clients.
+Since it does not handle multiple formats or compression, it
+is not layered internally.
+.Sh GENERAL SERVICES
+The
+.Nm archive_read ,
+.Nm archive_write ,
+and
+.Nm archive_write_disk
+objects all contain an initial
+.Nm archive
+object which provides common support for a set of standard services.
+(Recall that ANSI/ISO C90 guarantees that you can cast freely between
+a pointer to a structure and a pointer to the first element of that
+structure.)
+The
+.Nm archive
+object has a magic value that indicates which API this object
+is associated with,
+slots for storing error information,
+and function pointers for virtualized API functions.
+.Sh MISCELLANEOUS NOTES
+Connecting existing archiving libraries into libarchive is generally
+quite difficult.
+In particular, many existing libraries strongly assume that you
+are reading from a file; they seek forwards and backwards as necessary
+to locate various pieces of information.
+In contrast, libarchive never seeks backwards in its input, which
+sometimes requires very different approaches.
+.Pp
+For example, libarchive's ISO9660 support operates very differently
+from most ISO9660 readers.
+The libarchive support utilizes a work-queue design that
+keeps a list of known entries sorted by their location in the input.
+Whenever libarchive's ISO9660 implementation is asked for the next
+header, checks this list to find the next item on the disk.
+Directories are parsed when they are encountered and new
+items are added to the list.
+This design relies heavily on the ISO9660 image being optimized so that
+directories always occur earlier on the disk than the files they
+describe.
+.Pp
+Depending on the specific format, such approaches may not be possible.
+The ZIP format specification, for example, allows archivers to store
+key information only at the end of the file.
+In theory, it is possible to create ZIP archives that cannot
+be read without seeking.
+Fortunately, such archives are very rare, and libarchive can read
+most ZIP archives, though it cannot always extract as much information
+as a dedicated ZIP program.
+.Sh SEE ALSO
+.Xr archive 3 ,
+.Xr archive_entry 3 ,
+.Xr archive_read 3 ,
+.Xr archive_write 3 ,
+.Xr archive_write_disk 3
+.Sh HISTORY
+The
+.Nm libarchive
+library first appeared in
+.Fx 5.3 .
+.Sh AUTHORS
+.An -nosplit
+The
+.Nm libarchive
+library was written by
+.An Tim Kientzle Aq kientzle@acm.org .
+.Sh BUGS
diff --git a/archivers/libarchive/files/libarchive/mtree.5 b/archivers/libarchive/files/libarchive/mtree.5
new file mode 100644
index 00000000000..b6637d6f55e
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/mtree.5
@@ -0,0 +1,269 @@
+.\" Copyright (c) 1989, 1990, 1993
+.\" The Regents of the University of California. 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.
+.\" 4. Neither the name of the University nor the names of its contributors
+.\" may be used to endorse or promote products derived from this software
+.\" without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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.
+.\"
+.\" From: @(#)mtree.8 8.2 (Berkeley) 12/11/93
+.\" $FreeBSD$
+.\"
+.Dd August 20, 2007
+.Dt MTREE 5
+.Os
+.Sh NAME
+.Nm mtree
+.Nd format of mtree dir hierarchy files
+.Sh DESCRIPTION
+The
+.Nm
+format is a textual format that describes a collection of filesystem objects.
+Such files are typically used to create or verify directory hierarchies.
+.Ss General Format
+An
+.Nm
+file consists of a series of lines, each providing information
+about a single filesystem object.
+Leading whitespace is always ignored.
+.Pp
+When encoding file or pathnames, any backslash character or
+character outside of the 95 printable ASCII characters must be
+encoded as a a backslash followed by three
+octal digits.
+When reading mtree files, any appearance of a backslash
+followed by three octal digits should be converted into the
+corresponding character.
+.Pp
+Each line is interpreted independently as one of the following types:
+.Bl -tag -width Cm
+.It Signature
+The first line of any mtree file must begin with
+.Dq #mtree .
+If a file contains any full path entries, the first line should
+begin with
+.Dq #mtree v2.0 ,
+otherwise, the first line should begin with
+.Dq #mtree v1.0 .
+.It Blank
+Blank lines are ignored.
+.It Comment
+Lines beginning with
+.Cm #
+are ignored.
+.It Special
+Lines beginning with
+.Cm /
+are special commands that influence
+the interpretation of later lines.
+.It Relative
+If the first whitespace-delimited word has no
+.Cm /
+characters,
+it is the name of a file in the current directory.
+Any relative entry that describes a directory changes the
+current directory.
+.It dot-dot
+As a special case, a relative entry with the filename
+.Pa ..
+changes the current directory to the parent directory.
+Options on dot-dot entries are always ignored.
+.It Full
+If the first whitespace-delimited word has a
+.Cm /
+character after
+the first character, it is the pathname of a file relative to the
+starting directory.
+There can be multiple full entries describing the same file.
+.El
+.Pp
+Some tools that process
+.Nm
+files may require that multiple lines describing the same file
+occur consecutively.
+It is not permitted for the same file to be mentioned using
+both a relative and a full file specification.
+.Ss Special commands
+Two special commands are currently defined:
+.Bl -tag -width Cm
+.It Cm /set
+This command defines default values for one or more keywords.
+It is followed on the same line by one or more whitespace-separated
+keyword definitions.
+These definitions apply to all following files that do not specify
+a value for that keyword.
+.It Cm /unset
+This command removes any default value set by a previous
+.Cm /set
+command.
+It is followed on the same line by one or more keywords
+separated by whitespace.
+.El
+.Ss Keywords
+After the filename, a full or relative entry consists of zero
+or more whitespace-separated keyword definitions.
+Each such definition consists of a key from the following
+list immediately followed by an '=' sign
+and a value.
+Software programs reading mtree files should warn about
+unrecognized keywords.
+.Pp
+Currently supported keywords are as follows:
+.Bl -tag -width Cm
+.It Cm cksum
+The checksum of the file using the default algorithm specified by
+the
+.Xr cksum 1
+utility.
+.It Cm contents
+The full pathname of a file that holds the contents of this file.
+.It Cm flags
+The file flags as a symbolic name.
+See
+.Xr chflags 1
+for information on these names.
+If no flags are to be set the string
+.Dq none
+may be used to override the current default.
+.It Cm gid
+The file group as a numeric value.
+.It Cm gname
+The file group as a symbolic name.
+.It Cm ignore
+Ignore any file hierarchy below this file.
+.It Cm link
+The target of the symbolic link when type=link.
+.It Cm md5
+The MD5 message digest of the file.
+.It Cm md5digest
+A synonym for
+.Cm md5 .
+.It Cm mode
+The current file's permissions as a numeric (octal) or symbolic
+value.
+.It Cm nlink
+The number of hard links the file is expected to have.
+.It Cm nochange
+Make sure this file or directory exists but otherwise ignore all attributes.
+.It Cm ripemd160digest
+The
+.Tn RIPEMD160
+message digest of the file.
+.It Cm rmd160
+A synonym for
+.Cm ripemd160digest .
+.It Cm rmd160digest
+A synonym for
+.Cm ripemd160digest .
+.It Cm sha1
+The
+.Tn FIPS
+160-1
+.Pq Dq Tn SHA-1
+message digest of the file.
+.It Cm sha1digest
+A synonym for
+.Cm sha1 .
+.It Cm sha256
+The
+.Tn FIPS
+180-2
+.Pq Dq Tn SHA-256
+message digest of the file.
+.It Cm sha256digest
+A synonym for
+.Cm sha256 .
+.It Cm size
+The size, in bytes, of the file.
+.It Cm time
+The last modification time of the file.
+.It Cm type
+The type of the file; may be set to any one of the following:
+.Pp
+.Bl -tag -width Cm -compact
+.It Cm block
+block special device
+.It Cm char
+character special device
+.It Cm dir
+directory
+.It Cm fifo
+fifo
+.It Cm file
+regular file
+.It Cm link
+symbolic link
+.It Cm socket
+socket
+.El
+.It Cm uid
+The file owner as a numeric value.
+.It Cm uname
+The file owner as a symbolic name.
+.El
+.Pp
+.Sh SEE ALSO
+.Xr cksum 1 ,
+.Xr find 1 ,
+.Xr mtree 8
+.Sh BUGS
+The
+.Fx
+implementation of mtree does not currently support
+the
+.Nm
+2.0
+format.
+The requirement for a
+.Dq #mtree
+signature line is new and not yet widely implemented.
+.Sh HISTORY
+The
+.Nm
+utility appeared in
+.Bx 4.3 Reno .
+The
+.Tn MD5
+digest capability was added in
+.Fx 2.1 ,
+in response to the widespread use of programs which can spoof
+.Xr cksum 1 .
+The
+.Tn SHA-1
+and
+.Tn RIPEMD160
+digests were added in
+.Fx 4.0 ,
+as new attacks have demonstrated weaknesses in
+.Tn MD5 .
+The
+.Tn SHA-256
+digest was added in
+.Fx 6.0 .
+Support for file flags was added in
+.Fx 4.0 ,
+and mostly comes from
+.Nx .
+The
+.Dq full
+entry format was added by
+.Nx .
diff --git a/archivers/libarchive/files/libarchive/tar.5 b/archivers/libarchive/files/libarchive/tar.5
new file mode 100644
index 00000000000..aafd535a1a5
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/tar.5
@@ -0,0 +1,831 @@
+.\" Copyright (c) 2003-2009 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 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: head/lib/libarchive/tar.5 201077 2009-12-28 01:50:23Z kientzle $
+.\"
+.Dd December 27, 2009
+.Dt tar 5
+.Os
+.Sh NAME
+.Nm tar
+.Nd format of tape archive files
+.Sh DESCRIPTION
+The
+.Nm
+archive format collects any number of files, directories, and other
+file system objects (symbolic links, device nodes, etc.) into a single
+stream of bytes.
+The format was originally designed to be used with
+tape drives that operate with fixed-size blocks, but is widely used as
+a general packaging mechanism.
+.Ss General Format
+A
+.Nm
+archive consists of a series of 512-byte records.
+Each file system object requires a header record which stores basic metadata
+(pathname, owner, permissions, etc.) and zero or more records containing any
+file data.
+The end of the archive is indicated by two records consisting
+entirely of zero bytes.
+.Pp
+For compatibility with tape drives that use fixed block sizes,
+programs that read or write tar files always read or write a fixed
+number of records with each I/O operation.
+These
+.Dq blocks
+are always a multiple of the record size.
+The maximum block size supported by early
+implementations was 10240 bytes or 20 records.
+This is still the default for most implementations
+although block sizes of 1MiB (2048 records) or larger are
+commonly used with modern high-speed tape drives.
+(Note: the terms
+.Dq block
+and
+.Dq record
+here are not entirely standard; this document follows the
+convention established by John Gilmore in documenting
+.Nm pdtar . )
+.Ss Old-Style Archive Format
+The original tar archive format has been extended many times to
+include additional information that various implementors found
+necessary.
+This section describes the variant implemented by the tar command
+included in
+.At v7 ,
+which seems to be the earliest widely-used version of the tar program.
+.Pp
+The header record for an old-style
+.Nm
+archive consists of the following:
+.Bd -literal -offset indent
+struct header_old_tar {
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char checksum[8];
+ char linkflag[1];
+ char linkname[100];
+ char pad[255];
+};
+.Ed
+All unused bytes in the header record are filled with nulls.
+.Bl -tag -width indent
+.It Va name
+Pathname, stored as a null-terminated string.
+Early tar implementations only stored regular files (including
+hardlinks to those files).
+One common early convention used a trailing "/" character to indicate
+a directory name, allowing directory permissions and owner information
+to be archived and restored.
+.It Va mode
+File mode, stored as an octal number in ASCII.
+.It Va uid , Va gid
+User id and group id of owner, as octal numbers in ASCII.
+.It Va size
+Size of file, as octal number in ASCII.
+For regular files only, this indicates the amount of data
+that follows the header.
+In particular, this field was ignored by early tar implementations
+when extracting hardlinks.
+Modern writers should always store a zero length for hardlink entries.
+.It Va mtime
+Modification time of file, as an octal number in ASCII.
+This indicates the number of seconds since the start of the epoch,
+00:00:00 UTC January 1, 1970.
+Note that negative values should be avoided
+here, as they are handled inconsistently.
+.It Va checksum
+Header checksum, stored as an octal number in ASCII.
+To compute the checksum, set the checksum field to all spaces,
+then sum all bytes in the header using unsigned arithmetic.
+This field should be stored as six octal digits followed by a null and a space
+character.
+Note that many early implementations of tar used signed arithmetic
+for the checksum field, which can cause interoperability problems
+when transferring archives between systems.
+Modern robust readers compute the checksum both ways and accept the
+header if either computation matches.
+.It Va linkflag , Va linkname
+In order to preserve hardlinks and conserve tape, a file
+with multiple links is only written to the archive the first
+time it is encountered.
+The next time it is encountered, the
+.Va linkflag
+is set to an ASCII
+.Sq 1
+and the
+.Va linkname
+field holds the first name under which this file appears.
+(Note that regular files have a null value in the
+.Va linkflag
+field.)
+.El
+.Pp
+Early tar implementations varied in how they terminated these fields.
+The tar command in
+.At v7
+used the following conventions (this is also documented in early BSD manpages):
+the pathname must be null-terminated;
+the mode, uid, and gid fields must end in a space and a null byte;
+the size and mtime fields must end in a space;
+the checksum is terminated by a null and a space.
+Early implementations filled the numeric fields with leading spaces.
+This seems to have been common practice until the
+.St -p1003.1-88
+standard was released.
+For best portability, modern implementations should fill the numeric
+fields with leading zeros.
+.Ss Pre-POSIX Archives
+An early draft of
+.St -p1003.1-88
+served as the basis for John Gilmore's
+.Nm pdtar
+program and many system implementations from the late 1980s
+and early 1990s.
+These archives generally follow the POSIX ustar
+format described below with the following variations:
+.Bl -bullet -compact -width indent
+.It
+The magic value is
+.Dq ustar\ \&
+(note the following space).
+The version field contains a space character followed by a null.
+.It
+The numeric fields are generally filled with leading spaces
+(not leading zeros as recommended in the final standard).
+.It
+The prefix field is often not used, limiting pathnames to
+the 100 characters of old-style archives.
+.El
+.Ss POSIX ustar Archives
+.St -p1003.1-88
+defined a standard tar file format to be read and written
+by compliant implementations of
+.Xr tar 1 .
+This format is often called the
+.Dq ustar
+format, after the magic value used
+in the header.
+(The name is an acronym for
+.Dq Unix Standard TAR . )
+It extends the historic format with new fields:
+.Bd -literal -offset indent
+struct header_posix_ustar {
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char checksum[8];
+ char typeflag[1];
+ char linkname[100];
+ char magic[6];
+ char version[2];
+ char uname[32];
+ char gname[32];
+ char devmajor[8];
+ char devminor[8];
+ char prefix[155];
+ char pad[12];
+};
+.Ed
+.Bl -tag -width indent
+.It Va typeflag
+Type of entry.
+POSIX extended the earlier
+.Va linkflag
+field with several new type values:
+.Bl -tag -width indent -compact
+.It Dq 0
+Regular file.
+NUL should be treated as a synonym, for compatibility purposes.
+.It Dq 1
+Hard link.
+.It Dq 2
+Symbolic link.
+.It Dq 3
+Character device node.
+.It Dq 4
+Block device node.
+.It Dq 5
+Directory.
+.It Dq 6
+FIFO node.
+.It Dq 7
+Reserved.
+.It Other
+A POSIX-compliant implementation must treat any unrecognized typeflag value
+as a regular file.
+In particular, writers should ensure that all entries
+have a valid filename so that they can be restored by readers that do not
+support the corresponding extension.
+Uppercase letters "A" through "Z" are reserved for custom extensions.
+Note that sockets and whiteout entries are not archivable.
+.El
+It is worth noting that the
+.Va size
+field, in particular, has different meanings depending on the type.
+For regular files, of course, it indicates the amount of data
+following the header.
+For directories, it may be used to indicate the total size of all
+files in the directory, for use by operating systems that pre-allocate
+directory space.
+For all other types, it should be set to zero by writers and ignored
+by readers.
+.It Va magic
+Contains the magic value
+.Dq ustar
+followed by a NUL byte to indicate that this is a POSIX standard archive.
+Full compliance requires the uname and gname fields be properly set.
+.It Va version
+Version.
+This should be
+.Dq 00
+(two copies of the ASCII digit zero) for POSIX standard archives.
+.It Va uname , Va gname
+User and group names, as null-terminated ASCII strings.
+These should be used in preference to the uid/gid values
+when they are set and the corresponding names exist on
+the system.
+.It Va devmajor , Va devminor
+Major and minor numbers for character device or block device entry.
+.It Va name , Va prefix
+If the pathname is too long to fit in the 100 bytes provided by the standard
+format, it can be split at any
+.Pa /
+character with the first portion going into the prefix field.
+If the prefix field is not empty, the reader will prepend
+the prefix value and a
+.Pa /
+character to the regular name field to obtain the full pathname.
+The standard does not require a trailing
+.Pa /
+character on directory names, though most implementations still
+include this for compatibility reasons.
+.El
+.Pp
+Note that all unused bytes must be set to
+.Dv NUL .
+.Pp
+Field termination is specified slightly differently by POSIX
+than by previous implementations.
+The
+.Va magic ,
+.Va uname ,
+and
+.Va gname
+fields must have a trailing
+.Dv NUL .
+The
+.Va pathname ,
+.Va linkname ,
+and
+.Va prefix
+fields must have a trailing
+.Dv NUL
+unless they fill the entire field.
+(In particular, it is possible to store a 256-character pathname if it
+happens to have a
+.Pa /
+as the 156th character.)
+POSIX requires numeric fields to be zero-padded in the front, and requires
+them to be terminated with either space or
+.Dv NUL
+characters.
+.Pp
+Currently, most tar implementations comply with the ustar
+format, occasionally extending it by adding new fields to the
+blank area at the end of the header record.
+.Ss Pax Interchange Format
+There are many attributes that cannot be portably stored in a
+POSIX ustar archive.
+.St -p1003.1-2001
+defined a
+.Dq pax interchange format
+that uses two new types of entries to hold text-formatted
+metadata that applies to following entries.
+Note that a pax interchange format archive is a ustar archive in every
+respect.
+The new data is stored in ustar-compatible archive entries that use the
+.Dq x
+or
+.Dq g
+typeflag.
+In particular, older implementations that do not fully support these
+extensions will extract the metadata into regular files, where the
+metadata can be examined as necessary.
+.Pp
+An entry in a pax interchange format archive consists of one or
+two standard ustar entries, each with its own header and data.
+The first optional entry stores the extended attributes
+for the following entry.
+This optional first entry has an "x" typeflag and a size field that
+indicates the total size of the extended attributes.
+The extended attributes themselves are stored as a series of text-format
+lines encoded in the portable UTF-8 encoding.
+Each line consists of a decimal number, a space, a key string, an equals
+sign, a value string, and a new line.
+The decimal number indicates the length of the entire line, including the
+initial length field and the trailing newline.
+An example of such a field is:
+.Dl 25 ctime=1084839148.1212\en
+Keys in all lowercase are standard keys.
+Vendors can add their own keys by prefixing them with an all uppercase
+vendor name and a period.
+Note that, unlike the historic header, numeric values are stored using
+decimal, not octal.
+A description of some common keys follows:
+.Bl -tag -width indent
+.It Cm atime , Cm ctime , Cm mtime
+File access, inode change, and modification times.
+These fields can be negative or include a decimal point and a fractional value.
+.It Cm uname , Cm uid , Cm gname , Cm gid
+User name, group name, and numeric UID and GID values.
+The user name and group name stored here are encoded in UTF8
+and can thus include non-ASCII characters.
+The UID and GID fields can be of arbitrary length.
+.It Cm linkpath
+The full path of the linked-to file.
+Note that this is encoded in UTF8 and can thus include non-ASCII characters.
+.It Cm path
+The full pathname of the entry.
+Note that this is encoded in UTF8 and can thus include non-ASCII characters.
+.It Cm realtime.* , Cm security.*
+These keys are reserved and may be used for future standardization.
+.It Cm size
+The size of the file.
+Note that there is no length limit on this field, allowing conforming
+archives to store files much larger than the historic 8GB limit.
+.It Cm SCHILY.*
+Vendor-specific attributes used by Joerg Schilling's
+.Nm star
+implementation.
+.It Cm SCHILY.acl.access , Cm SCHILY.acl.default
+Stores the access and default ACLs as textual strings in a format
+that is an extension of the format specified by POSIX.1e draft 17.
+In particular, each user or group access specification can include a fourth
+colon-separated field with the numeric UID or GID.
+This allows ACLs to be restored on systems that may not have complete
+user or group information available (such as when NIS/YP or LDAP services
+are temporarily unavailable).
+.It Cm SCHILY.devminor , Cm SCHILY.devmajor
+The full minor and major numbers for device nodes.
+.It Cm SCHILY.fflags
+The file flags.
+.It Cm SCHILY.realsize
+The full size of the file on disk.
+XXX explain? XXX
+.It Cm SCHILY.dev, Cm SCHILY.ino , Cm SCHILY.nlinks
+The device number, inode number, and link count for the entry.
+In particular, note that a pax interchange format archive using Joerg
+Schilling's
+.Cm SCHILY.*
+extensions can store all of the data from
+.Va struct stat .
+.It Cm LIBARCHIVE.xattr. Ns Ar namespace Ns . Ns Ar key
+Libarchive stores POSIX.1e-style extended attributes using
+keys of this form.
+The
+.Ar key
+value is URL-encoded:
+All non-ASCII characters and the two special characters
+.Dq =
+and
+.Dq %
+are encoded as
+.Dq %
+followed by two uppercase hexadecimal digits.
+The value of this key is the extended attribute value
+encoded in base 64.
+XXX Detail the base-64 format here XXX
+.It Cm VENDOR.*
+XXX document other vendor-specific extensions XXX
+.El
+.Pp
+Any values stored in an extended attribute override the corresponding
+values in the regular tar header.
+Note that compliant readers should ignore the regular fields when they
+are overridden.
+This is important, as existing archivers are known to store non-compliant
+values in the standard header fields in this situation.
+There are no limits on length for any of these fields.
+In particular, numeric fields can be arbitrarily large.
+All text fields are encoded in UTF8.
+Compliant writers should store only portable 7-bit ASCII characters in
+the standard ustar header and use extended
+attributes whenever a text value contains non-ASCII characters.
+.Pp
+In addition to the
+.Cm x
+entry described above, the pax interchange format
+also supports a
+.Cm g
+entry.
+The
+.Cm g
+entry is identical in format, but specifies attributes that serve as
+defaults for all subsequent archive entries.
+The
+.Cm g
+entry is not widely used.
+.Pp
+Besides the new
+.Cm x
+and
+.Cm g
+entries, the pax interchange format has a few other minor variations
+from the earlier ustar format.
+The most troubling one is that hardlinks are permitted to have
+data following them.
+This allows readers to restore any hardlink to a file without
+having to rewind the archive to find an earlier entry.
+However, it creates complications for robust readers, as it is no longer
+clear whether or not they should ignore the size field for hardlink entries.
+.Ss GNU Tar Archives
+The GNU tar program started with a pre-POSIX format similar to that
+described earlier and has extended it using several different mechanisms:
+It added new fields to the empty space in the header (some of which was later
+used by POSIX for conflicting purposes);
+it allowed the header to be continued over multiple records;
+and it defined new entries that modify following entries
+(similar in principle to the
+.Cm x
+entry described above, but each GNU special entry is single-purpose,
+unlike the general-purpose
+.Cm x
+entry).
+As a result, GNU tar archives are not POSIX compatible, although
+more lenient POSIX-compliant readers can successfully extract most
+GNU tar archives.
+.Bd -literal -offset indent
+struct header_gnu_tar {
+ char name[100];
+ char mode[8];
+ char uid[8];
+ char gid[8];
+ char size[12];
+ char mtime[12];
+ char checksum[8];
+ char typeflag[1];
+ char linkname[100];
+ char magic[6];
+ char version[2];
+ char uname[32];
+ char gname[32];
+ char devmajor[8];
+ char devminor[8];
+ char atime[12];
+ char ctime[12];
+ char offset[12];
+ char longnames[4];
+ char unused[1];
+ struct {
+ char offset[12];
+ char numbytes[12];
+ } sparse[4];
+ char isextended[1];
+ char realsize[12];
+ char pad[17];
+};
+.Ed
+.Bl -tag -width indent
+.It Va typeflag
+GNU tar uses the following special entry types, in addition to
+those defined by POSIX:
+.Bl -tag -width indent
+.It "7"
+GNU tar treats type "7" records identically to type "0" records,
+except on one obscure RTOS where they are used to indicate the
+pre-allocation of a contiguous file on disk.
+.It "D"
+This indicates a directory entry.
+Unlike the POSIX-standard "5"
+typeflag, the header is followed by data records listing the names
+of files in this directory.
+Each name is preceded by an ASCII "Y"
+if the file is stored in this archive or "N" if the file is not
+stored in this archive.
+Each name is terminated with a null, and
+an extra null marks the end of the name list.
+The purpose of this
+entry is to support incremental backups; a program restoring from
+such an archive may wish to delete files on disk that did not exist
+in the directory when the archive was made.
+.Pp
+Note that the "D" typeflag specifically violates POSIX, which requires
+that unrecognized typeflags be restored as normal files.
+In this case, restoring the "D" entry as a file could interfere
+with subsequent creation of the like-named directory.
+.It "K"
+The data for this entry is a long linkname for the following regular entry.
+.It "L"
+The data for this entry is a long pathname for the following regular entry.
+.It "M"
+This is a continuation of the last file on the previous volume.
+GNU multi-volume archives guarantee that each volume begins with a valid
+entry header.
+To ensure this, a file may be split, with part stored at the end of one volume,
+and part stored at the beginning of the next volume.
+The "M" typeflag indicates that this entry continues an existing file.
+Such entries can only occur as the first or second entry
+in an archive (the latter only if the first entry is a volume label).
+The
+.Va size
+field specifies the size of this entry.
+The
+.Va offset
+field at bytes 369-380 specifies the offset where this file fragment
+begins.
+The
+.Va realsize
+field specifies the total size of the file (which must equal
+.Va size
+plus
+.Va offset ) .
+When extracting, GNU tar checks that the header file name is the one it is
+expecting, that the header offset is in the correct sequence, and that
+the sum of offset and size is equal to realsize.
+.It "N"
+Type "N" records are no longer generated by GNU tar.
+They contained a
+list of files to be renamed or symlinked after extraction; this was
+originally used to support long names.
+The contents of this record
+are a text description of the operations to be done, in the form
+.Dq Rename %s to %s\en
+or
+.Dq Symlink %s to %s\en ;
+in either case, both
+filenames are escaped using K&R C syntax.
+Due to security concerns, "N" records are now generally ignored
+when reading archives.
+.It "S"
+This is a
+.Dq sparse
+regular file.
+Sparse files are stored as a series of fragments.
+The header contains a list of fragment offset/length pairs.
+If more than four such entries are required, the header is
+extended as necessary with
+.Dq extra
+header extensions (an older format that is no longer used), or
+.Dq sparse
+extensions.
+.It "V"
+The
+.Va name
+field should be interpreted as a tape/volume header name.
+This entry should generally be ignored on extraction.
+.El
+.It Va magic
+The magic field holds the five characters
+.Dq ustar
+followed by a space.
+Note that POSIX ustar archives have a trailing null.
+.It Va version
+The version field holds a space character followed by a null.
+Note that POSIX ustar archives use two copies of the ASCII digit
+.Dq 0 .
+.It Va atime , Va ctime
+The time the file was last accessed and the time of
+last change of file information, stored in octal as with
+.Va mtime .
+.It Va longnames
+This field is apparently no longer used.
+.It Sparse Va offset / Va numbytes
+Each such structure specifies a single fragment of a sparse
+file.
+The two fields store values as octal numbers.
+The fragments are each padded to a multiple of 512 bytes
+in the archive.
+On extraction, the list of fragments is collected from the
+header (including any extension headers), and the data
+is then read and written to the file at appropriate offsets.
+.It Va isextended
+If this is set to non-zero, the header will be followed by additional
+.Dq sparse header
+records.
+Each such record contains information about as many as 21 additional
+sparse blocks as shown here:
+.Bd -literal -offset indent
+struct gnu_sparse_header {
+ struct {
+ char offset[12];
+ char numbytes[12];
+ } sparse[21];
+ char isextended[1];
+ char padding[7];
+};
+.Ed
+.It Va realsize
+A binary representation of the file's complete size, with a much larger range
+than the POSIX file size.
+In particular, with
+.Cm M
+type files, the current entry is only a portion of the file.
+In that case, the POSIX size field will indicate the size of this
+entry; the
+.Va realsize
+field will indicate the total size of the file.
+.El
+.Ss GNU tar pax archives
+GNU tar 1.14 (XXX check this XXX) and later will write
+pax interchange format archives when you specify the
+.Fl -posix
+flag.
+This format uses custom keywords to store sparse file information.
+There have been three iterations of this support, referred to
+as
+.Dq 0.0 ,
+.Dq 0.1 ,
+and
+.Dq 1.0 .
+.Bl -tag -width indent
+.It Cm GNU.sparse.numblocks , Cm GNU.sparse.offset , Cm GNU.sparse.numbytes , Cm GNU.sparse.size
+The
+.Dq 0.0
+format used an initial
+.Cm GNU.sparse.numblocks
+attribute to indicate the number of blocks in the file, a pair of
+.Cm GNU.sparse.offset
+and
+.Cm GNU.sparse.numbytes
+to indicate the offset and size of each block,
+and a single
+.Cm GNU.sparse.size
+to indicate the full size of the file.
+This is not the same as the size in the tar header because the
+latter value does not include the size of any holes.
+This format required that the order of attributes be preserved and
+relied on readers accepting multiple appearances of the same attribute
+names, which is not officially permitted by the standards.
+.It Cm GNU.sparse.map
+The
+.Dq 0.1
+format used a single attribute that stored a comma-separated
+list of decimal numbers.
+Each pair of numbers indicated the offset and size, respectively,
+of a block of data.
+This does not work well if the archive is extracted by an archiver
+that does not recognize this extension, since many pax implementations
+simply discard unrecognized attributes.
+.It Cm GNU.sparse.major , Cm GNU.sparse.minor , Cm GNU.sparse.name , Cm GNU.sparse.realsize
+The
+.Dq 1.0
+format stores the sparse block map in one or more 512-byte blocks
+prepended to the file data in the entry body.
+The pax attributes indicate the existence of this map
+(via the
+.Cm GNU.sparse.major
+and
+.Cm GNU.sparse.minor
+fields)
+and the full size of the file.
+The
+.Cm GNU.sparse.name
+holds the true name of the file.
+To avoid confusion, the name stored in the regular tar header
+is a modified name so that extraction errors will be apparent
+to users.
+.El
+.Ss Solaris Tar
+XXX More Details Needed XXX
+.Pp
+Solaris tar (beginning with SunOS XXX 5.7 ?? XXX) supports an
+.Dq extended
+format that is fundamentally similar to pax interchange format,
+with the following differences:
+.Bl -bullet -compact -width indent
+.It
+Extended attributes are stored in an entry whose type is
+.Cm X ,
+not
+.Cm x ,
+as used by pax interchange format.
+The detailed format of this entry appears to be the same
+as detailed above for the
+.Cm x
+entry.
+.It
+An additional
+.Cm A
+entry is used to store an ACL for the following regular entry.
+The body of this entry contains a seven-digit octal number
+followed by a zero byte, followed by the
+textual ACL description.
+The octal value is the number of ACL entries
+plus a constant that indicates the ACL type: 01000000
+for POSIX.1e ACLs and 03000000 for NFSv4 ACLs.
+.El
+.Ss AIX Tar
+XXX More details needed XXX
+.Ss Mac OS X Tar
+The tar distributed with Apple's Mac OS X stores most regular files
+as two separate entries in the tar archive.
+The two entries have the same name except that the first
+one has
+.Dq ._
+added to the beginning of the name.
+This first entry stores the
+.Dq resource fork
+with additional attributes for the file.
+The Mac OS X
+.Fn CopyFile
+API is used to separate a file on disk into separate
+resource and data streams and to reassemble those separate
+streams when the file is restored to disk.
+.Ss Other Extensions
+One obvious extension to increase the size of files is to
+eliminate the terminating characters from the various
+numeric fields.
+For example, the standard only allows the size field to contain
+11 octal digits, reserving the twelfth byte for a trailing
+NUL character.
+Allowing 12 octal digits allows file sizes up to 64 GB.
+.Pp
+Another extension, utilized by GNU tar, star, and other newer
+.Nm
+implementations, permits binary numbers in the standard numeric fields.
+This is flagged by setting the high bit of the first byte.
+This permits 95-bit values for the length and time fields
+and 63-bit values for the uid, gid, and device numbers.
+GNU tar supports this extension for the
+length, mtime, ctime, and atime fields.
+Joerg Schilling's star program supports this extension for
+all numeric fields.
+Note that this extension is largely obsoleted by the extended attribute
+record provided by the pax interchange format.
+.Pp
+Another early GNU extension allowed base-64 values rather than octal.
+This extension was short-lived and is no longer supported by any
+implementation.
+.Sh SEE ALSO
+.Xr ar 1 ,
+.Xr pax 1 ,
+.Xr tar 1
+.Sh STANDARDS
+The
+.Nm tar
+utility is no longer a part of POSIX or the Single Unix Standard.
+It last appeared in
+.St -susv2 .
+It has been supplanted in subsequent standards by
+.Xr pax 1 .
+The ustar format is currently part of the specification for the
+.Xr pax 1
+utility.
+The pax interchange file format is new with
+.St -p1003.1-2001 .
+.Sh HISTORY
+A
+.Nm tar
+command appeared in Seventh Edition Unix, which was released in January, 1979.
+It replaced the
+.Nm tp
+program from Fourth Edition Unix which in turn replaced the
+.Nm tap
+program from First Edition Unix.
+John Gilmore's
+.Nm pdtar
+public-domain implementation (circa 1987) was highly influential
+and formed the basis of
+.Nm GNU tar
+(circa 1988).
+Joerg Shilling's
+.Nm star
+archiver is another open-source (GPL) archiver (originally developed
+circa 1985) which features complete support for pax interchange
+format.
+.Pp
+This documentation was written as part of the
+.Nm libarchive
+and
+.Nm bsdtar
+project by
+.An Tim Kientzle Aq kientzle@FreeBSD.org .
diff --git a/archivers/libarchive/files/libarchive/test/list.h b/archivers/libarchive/files/libarchive/test/list.h
new file mode 100644
index 00000000000..10efb873a64
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/list.h
@@ -0,0 +1,106 @@
+DEFINE_TEST(test_acl_basic)
+DEFINE_TEST(test_acl_freebsd)
+DEFINE_TEST(test_acl_pax)
+DEFINE_TEST(test_archive_api_feature)
+DEFINE_TEST(test_bad_fd)
+DEFINE_TEST(test_compat_bzip2)
+DEFINE_TEST(test_compat_cpio)
+DEFINE_TEST(test_compat_gtar)
+DEFINE_TEST(test_compat_gzip)
+DEFINE_TEST(test_compat_lzma)
+DEFINE_TEST(test_compat_solaris_tar_acl)
+DEFINE_TEST(test_compat_tar_hardlink)
+DEFINE_TEST(test_compat_xz)
+DEFINE_TEST(test_compat_zip)
+DEFINE_TEST(test_empty_write)
+DEFINE_TEST(test_entry)
+DEFINE_TEST(test_entry_strmode)
+DEFINE_TEST(test_extattr_freebsd)
+DEFINE_TEST(test_fuzz)
+DEFINE_TEST(test_link_resolver)
+DEFINE_TEST(test_open_fd)
+DEFINE_TEST(test_open_file)
+DEFINE_TEST(test_open_filename)
+DEFINE_TEST(test_pax_filename_encoding)
+DEFINE_TEST(test_read_compress_program)
+DEFINE_TEST(test_read_data_large)
+DEFINE_TEST(test_read_disk)
+DEFINE_TEST(test_read_disk_entry_from_file)
+DEFINE_TEST(test_read_extract)
+DEFINE_TEST(test_read_file_nonexistent)
+DEFINE_TEST(test_read_format_ar)
+DEFINE_TEST(test_read_format_cpio_bin)
+DEFINE_TEST(test_read_format_cpio_bin_Z)
+DEFINE_TEST(test_read_format_cpio_bin_be)
+DEFINE_TEST(test_read_format_cpio_bin_bz2)
+DEFINE_TEST(test_read_format_cpio_bin_gz)
+DEFINE_TEST(test_read_format_cpio_bin_lzma)
+DEFINE_TEST(test_read_format_cpio_bin_xz)
+DEFINE_TEST(test_read_format_cpio_odc)
+DEFINE_TEST(test_read_format_cpio_svr4_bzip2_rpm)
+DEFINE_TEST(test_read_format_cpio_svr4_gzip)
+DEFINE_TEST(test_read_format_cpio_svr4_gzip_rpm)
+DEFINE_TEST(test_read_format_cpio_svr4c_Z)
+DEFINE_TEST(test_read_format_empty)
+DEFINE_TEST(test_read_format_gtar_gz)
+DEFINE_TEST(test_read_format_gtar_lzma)
+DEFINE_TEST(test_read_format_gtar_sparse)
+DEFINE_TEST(test_read_format_iso_gz)
+DEFINE_TEST(test_read_format_iso_multi_extent)
+DEFINE_TEST(test_read_format_isojoliet_bz2)
+DEFINE_TEST(test_read_format_isojoliet_long)
+DEFINE_TEST(test_read_format_isojoliet_rr)
+DEFINE_TEST(test_read_format_isorr_bz2)
+DEFINE_TEST(test_read_format_isorr_ce)
+DEFINE_TEST(test_read_format_isorr_new_bz2)
+DEFINE_TEST(test_read_format_isorr_rr_moved)
+DEFINE_TEST(test_read_format_isozisofs_bz2)
+DEFINE_TEST(test_read_format_mtree)
+DEFINE_TEST(test_read_format_pax_bz2)
+DEFINE_TEST(test_read_format_raw)
+DEFINE_TEST(test_read_format_tar)
+DEFINE_TEST(test_read_format_tar_empty_filename)
+DEFINE_TEST(test_read_format_tbz)
+DEFINE_TEST(test_read_format_tgz)
+DEFINE_TEST(test_read_format_tlz)
+DEFINE_TEST(test_read_format_txz)
+DEFINE_TEST(test_read_format_tz)
+DEFINE_TEST(test_read_format_xar)
+DEFINE_TEST(test_read_format_zip)
+DEFINE_TEST(test_read_large)
+DEFINE_TEST(test_read_pax_truncated)
+DEFINE_TEST(test_read_position)
+DEFINE_TEST(test_read_truncated)
+DEFINE_TEST(test_read_uu)
+DEFINE_TEST(test_tar_filenames)
+DEFINE_TEST(test_tar_large)
+DEFINE_TEST(test_ustar_filenames)
+DEFINE_TEST(test_write_compress)
+DEFINE_TEST(test_write_compress_bzip2)
+DEFINE_TEST(test_write_compress_gzip)
+DEFINE_TEST(test_write_compress_lzma)
+DEFINE_TEST(test_write_compress_program)
+DEFINE_TEST(test_write_compress_xz)
+DEFINE_TEST(test_write_disk)
+DEFINE_TEST(test_write_disk_failures)
+DEFINE_TEST(test_write_disk_hardlink)
+DEFINE_TEST(test_write_disk_perms)
+DEFINE_TEST(test_write_disk_secure)
+DEFINE_TEST(test_write_disk_sparse)
+DEFINE_TEST(test_write_disk_symlink)
+DEFINE_TEST(test_write_disk_times)
+DEFINE_TEST(test_write_format_ar)
+DEFINE_TEST(test_write_format_cpio)
+DEFINE_TEST(test_write_format_cpio_empty)
+DEFINE_TEST(test_write_format_cpio_newc)
+DEFINE_TEST(test_write_format_cpio_odc)
+DEFINE_TEST(test_write_format_mtree)
+DEFINE_TEST(test_write_format_pax)
+DEFINE_TEST(test_write_format_shar_empty)
+DEFINE_TEST(test_write_format_tar)
+DEFINE_TEST(test_write_format_tar_empty)
+DEFINE_TEST(test_write_format_tar_ustar)
+DEFINE_TEST(test_write_format_zip)
+DEFINE_TEST(test_write_format_zip_empty)
+DEFINE_TEST(test_write_format_zip_no_compression)
+DEFINE_TEST(test_write_open_memory)
diff --git a/archivers/libarchive/files/libarchive/test/main.c b/archivers/libarchive/files/libarchive/test/main.c
new file mode 100644
index 00000000000..b143074d119
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/main.c
@@ -0,0 +1,2114 @@
+/*
+ * Copyright (c) 2003-2009 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"
+#include <errno.h>
+#include <locale.h>
+#include <stdarg.h>
+#include <time.h>
+
+/*
+ * This same file is used pretty much verbatim for all test harnesses.
+ *
+ * The next few lines are the only differences.
+ * TODO: Move this into a separate configuration header, have all test
+ * suites share one copy of this file.
+ */
+__FBSDID("$FreeBSD: head/lib/libarchive/test/main.c 201247 2009-12-30 05:59:21Z kientzle $");
+#define KNOWNREF "test_compat_gtar_1.tar.uu"
+#define ENVBASE "LIBARCHIVE" /* Prefix for environment variables. */
+#undef PROGRAM /* Testing a library, not a program. */
+#define LIBRARY "libarchive"
+#define EXTRA_DUMP(x) archive_error_string((struct archive *)(x))
+#define EXTRA_VERSION archive_version()
+
+/*
+ *
+ * Windows support routines
+ *
+ * Note: Configuration is a tricky issue. Using HAVE_* feature macros
+ * in the test harness is dangerous because they cover up
+ * configuration errors. The classic example of this is omitting a
+ * configure check. If libarchive and libarchive_test both look for
+ * the same feature macro, such errors are hard to detect. Platform
+ * macros (e.g., _WIN32 or __GNUC__) are a little better, but can
+ * easily lead to very messy code. It's best to limit yourself
+ * to only the most generic programming techniques in the test harness
+ * and thus avoid conditionals altogether. Where that's not possible,
+ * try to minimize conditionals by grouping platform-specific tests in
+ * one place (e.g., test_acl_freebsd) or by adding new assert()
+ * functions (e.g., assertMakeHardlink()) to cover up platform
+ * differences. Platform-specific coding in libarchive_test is often
+ * a symptom that some capability is missing from libarchive itself.
+ */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#include <io.h>
+#include <windows.h>
+#ifndef F_OK
+#define F_OK (0)
+#endif
+#ifndef S_ISDIR
+#define S_ISDIR(m) ((m) & _S_IFDIR)
+#endif
+#ifndef S_ISREG
+#define S_ISREG(m) ((m) & _S_IFREG)
+#endif
+#if !defined(__BORLANDC__)
+#define access _access
+#define chdir _chdir
+#endif
+#ifndef fileno
+#define fileno _fileno
+#endif
+/*#define fstat _fstat64*/
+#if !defined(__BORLANDC__)
+#define getcwd _getcwd
+#endif
+#define lstat stat
+/*#define lstat _stat64*/
+/*#define stat _stat64*/
+#define rmdir _rmdir
+#if !defined(__BORLANDC__)
+#define strdup _strdup
+#define umask _umask
+#endif
+#define int64_t __int64
+#endif
+
+#if defined(HAVE__CrtSetReportMode)
+# include <crtdbg.h>
+#endif
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+void *GetFunctionKernel32(const char *name)
+{
+ static HINSTANCE lib;
+ static int set;
+ if (!set) {
+ set = 1;
+ lib = LoadLibrary("kernel32.dll");
+ }
+ if (lib == NULL) {
+ fprintf(stderr, "Can't load kernel32.dll?!\n");
+ exit(1);
+ }
+ return (void *)GetProcAddress(lib, name);
+}
+
+static int
+my_CreateSymbolicLinkA(const char *linkname, const char *target, int flags)
+{
+ static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, DWORD);
+ static int set;
+ if (!set) {
+ set = 1;
+ f = GetFunctionKernel32("CreateSymbolicLinkA");
+ }
+ return f == NULL ? 0 : (*f)(linkname, target, flags);
+}
+
+static int
+my_CreateHardLinkA(const char *linkname, const char *target)
+{
+ static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES);
+ static int set;
+ if (!set) {
+ set = 1;
+ f = GetFunctionKernel32("CreateHardLinkA");
+ }
+ return f == NULL ? 0 : (*f)(linkname, target, NULL);
+}
+
+int
+my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi)
+{
+ HANDLE h;
+ int r;
+
+ memset(bhfi, 0, sizeof(*bhfi));
+ h = CreateFile(path, FILE_READ_ATTRIBUTES, 0, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (h == INVALID_HANDLE_VALUE)
+ return (0);
+ r = GetFileInformationByHandle(h, bhfi);
+ CloseHandle(h);
+ return (r);
+}
+#endif
+
+#if defined(HAVE__CrtSetReportMode)
+static void
+invalid_parameter_handler(const wchar_t * expression,
+ const wchar_t * function, const wchar_t * file,
+ unsigned int line, uintptr_t pReserved)
+{
+ /* nop */
+}
+#endif
+
+/*
+ *
+ * OPTIONS FLAGS
+ *
+ */
+
+/* Enable core dump on failure. */
+static int dump_on_failure = 0;
+/* Default is to remove temp dirs and log data for successful tests. */
+static int keep_temp_files = 0;
+/* Default is to just report pass/fail for each test. */
+static int verbosity = 0;
+#define VERBOSITY_SUMMARY_ONLY -1 /* -q */
+#define VERBOSITY_PASSFAIL 0 /* Default */
+#define VERBOSITY_LIGHT_REPORT 1 /* -v */
+#define VERBOSITY_FULL 2 /* -vv */
+/* A few places generate even more output for verbosity > VERBOSITY_FULL,
+ * mostly for debugging the test harness itself. */
+/* Cumulative count of assertion failures. */
+static int failures = 0;
+/* Cumulative count of reported skips. */
+static int skips = 0;
+/* Cumulative count of assertions checked. */
+static int assertions = 0;
+
+/* Directory where uuencoded reference files can be found. */
+static const char *refdir;
+
+/*
+ * Report log information selectively to console and/or disk log.
+ */
+static int log_console = 0;
+static FILE *logfile;
+static void
+vlogprintf(const char *fmt, va_list ap)
+{
+#ifdef va_copy
+ va_list lfap;
+ va_copy(lfap, ap);
+#endif
+ if (log_console)
+ vfprintf(stdout, fmt, ap);
+ if (logfile != NULL)
+#ifdef va_copy
+ vfprintf(logfile, fmt, lfap);
+ va_end(lfap);
+#else
+ vfprintf(logfile, fmt, ap);
+#endif
+}
+
+static void
+logprintf(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vlogprintf(fmt, ap);
+ va_end(ap);
+}
+
+/* Set up a message to display only if next assertion fails. */
+static char msgbuff[4096];
+static const char *msg, *nextmsg;
+void
+failure(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vsprintf(msgbuff, fmt, ap);
+ va_end(ap);
+ nextmsg = msgbuff;
+}
+
+/*
+ * Copy arguments into file-local variables.
+ * This was added to permit vararg assert() functions without needing
+ * variadic wrapper macros. Turns out that the vararg capability is almost
+ * never used, so almost all of the vararg assertions can be simplified
+ * by removing the vararg capability and reworking the wrapper macro to
+ * pass __FILE__, __LINE__ directly into the function instead of using
+ * this hook. I suspect this machinery is used so rarely that we
+ * would be better off just removing it entirely. That would simplify
+ * the code here noticably.
+ */
+static const char *test_filename;
+static int test_line;
+static void *test_extra;
+void assertion_setup(const char *filename, int line)
+{
+ test_filename = filename;
+ test_line = line;
+}
+
+/* Called at the beginning of each assert() function. */
+static void
+assertion_count(const char *file, int line)
+{
+ (void)file; /* UNUSED */
+ (void)line; /* UNUSED */
+ ++assertions;
+ /* Proper handling of "failure()" message. */
+ msg = nextmsg;
+ nextmsg = NULL;
+ /* Uncomment to print file:line after every assertion.
+ * Verbose, but occasionally useful in tracking down crashes. */
+ /* printf("Checked %s:%d\n", file, line); */
+}
+
+/*
+ * For each test source file, we remember how many times each
+ * assertion was reported. Cleared before each new test,
+ * used by test_summarize().
+ */
+static struct line {
+ int count;
+ int skip;
+} failed_lines[10000];
+
+/* Count this failure, setup up log destination and handle initial report. */
+static void
+failure_start(const char *filename, int line, const char *fmt, ...)
+{
+ va_list ap;
+
+ /* Record another failure for this line. */
+ ++failures;
+ /* test_filename = filename; */
+ failed_lines[line].count++;
+
+ /* Determine whether to log header to console. */
+ switch (verbosity) {
+ case VERBOSITY_LIGHT_REPORT:
+ log_console = (failed_lines[line].count < 2);
+ break;
+ default:
+ log_console = (verbosity >= VERBOSITY_FULL);
+ }
+
+ /* Log file:line header for this failure */
+ va_start(ap, fmt);
+#if _MSC_VER
+ logprintf("%s(%d): ", filename, line);
+#else
+ logprintf("%s:%d: ", filename, line);
+#endif
+ vlogprintf(fmt, ap);
+ va_end(ap);
+ logprintf("\n");
+
+ if (msg != NULL && msg[0] != '\0') {
+ logprintf(" Description: %s\n", msg);
+ msg = NULL;
+ }
+
+ /* Determine whether to log details to console. */
+ if (verbosity == VERBOSITY_LIGHT_REPORT)
+ log_console = 0;
+}
+
+/* Complete reporting of failed tests. */
+/*
+ * The 'extra' hook here is used by libarchive to include libarchive
+ * error messages with assertion failures. It could also be used
+ * to add strerror() output, for example. Just define the EXTRA_DUMP()
+ * macro appropriately.
+ */
+static void
+failure_finish(void *extra)
+{
+ (void)extra; /* UNUSED (maybe) */
+#ifdef EXTRA_DUMP
+ if (extra != NULL)
+ logprintf(" detail: %s\n", EXTRA_DUMP(extra));
+#endif
+
+ if (dump_on_failure) {
+ fprintf(stderr,
+ " *** forcing core dump so failure can be debugged ***\n");
+ abort();
+ exit(1);
+ }
+}
+
+/* Inform user that we're skipping some checks. */
+void
+test_skipping(const char *fmt, ...)
+{
+ char buff[1024];
+ va_list ap;
+
+ va_start(ap, fmt);
+ vsprintf(buff, fmt, ap);
+ va_end(ap);
+ /* failure_start() isn't quite right, but is awfully convenient. */
+ failure_start(test_filename, test_line, "SKIPPING: %s", buff);
+ --failures; /* Undo failures++ in failure_start() */
+ /* Don't failure_finish() here. */
+ /* Mark as skip, so doesn't count as failed test. */
+ failed_lines[test_line].skip = 1;
+ ++skips;
+}
+
+/*
+ *
+ * ASSERTIONS
+ *
+ */
+
+/* Generic assert() just displays the failed condition. */
+int
+assertion_assert(const char *file, int line, int value,
+ const char *condition, void *extra)
+{
+ assertion_count(file, line);
+ if (!value) {
+ failure_start(file, line, "Assertion failed: %s", condition);
+ failure_finish(extra);
+ }
+ return (value);
+}
+
+/* chdir() and report any errors */
+int
+assertion_chdir(const char *file, int line, const char *pathname)
+{
+ assertion_count(file, line);
+ if (chdir(pathname) == 0)
+ return (1);
+ failure_start(file, line, "chdir(\"%s\")", pathname);
+ failure_finish(NULL);
+ return (0);
+
+}
+
+/* Verify two integers are equal. */
+int
+assertion_equal_int(const char *file, int line,
+ long long v1, const char *e1, long long v2, const char *e2, void *extra)
+{
+ assertion_count(file, line);
+ if (v1 == v2)
+ return (1);
+ failure_start(file, line, "%s != %s", e1, e2);
+ logprintf(" %s=%lld (0x%llx, 0%llo)\n", e1, v1, v1, v1);
+ logprintf(" %s=%lld (0x%llx, 0%llo)\n", e2, v2, v2, v2);
+ failure_finish(extra);
+ return (0);
+}
+
+static void strdump(const char *e, const char *p)
+{
+ const char *q = p;
+
+ logprintf(" %s = ", e);
+ if (p == NULL) {
+ logprintf("NULL");
+ return;
+ }
+ logprintf("\"");
+ while (*p != '\0') {
+ unsigned int c = 0xff & *p++;
+ switch (c) {
+ case '\a': printf("\a"); break;
+ case '\b': printf("\b"); break;
+ case '\n': printf("\n"); break;
+ case '\r': printf("\r"); break;
+ default:
+ if (c >= 32 && c < 127)
+ logprintf("%c", c);
+ else
+ logprintf("\\x%02X", c);
+ }
+ }
+ logprintf("\"");
+ logprintf(" (length %d)\n", q == NULL ? -1 : (int)strlen(q));
+}
+
+/* Verify two strings are equal, dump them if not. */
+int
+assertion_equal_string(const char *file, int line,
+ const char *v1, const char *e1,
+ const char *v2, const char *e2,
+ void *extra)
+{
+ assertion_count(file, line);
+ if (v1 == v2 || (v1 != NULL && v2 != NULL && strcmp(v1, v2) == 0))
+ return (1);
+ failure_start(file, line, "%s != %s", e1, e2);
+ strdump(e1, v1);
+ strdump(e2, v2);
+ failure_finish(extra);
+ return (0);
+}
+
+static void
+wcsdump(const char *e, const wchar_t *w)
+{
+ logprintf(" %s = ", e);
+ if (w == NULL) {
+ logprintf("(null)");
+ return;
+ }
+ logprintf("\"");
+ while (*w != L'\0') {
+ unsigned int c = *w++;
+ if (c >= 32 && c < 127)
+ logprintf("%c", c);
+ else if (c < 256)
+ logprintf("\\x%02X", c);
+ else if (c < 0x10000)
+ logprintf("\\u%04X", c);
+ else
+ logprintf("\\U%08X", c);
+ }
+ logprintf("\"\n");
+}
+
+/* Verify that two wide strings are equal, dump them if not. */
+int
+assertion_equal_wstring(const char *file, int line,
+ const wchar_t *v1, const char *e1,
+ const wchar_t *v2, const char *e2,
+ void *extra)
+{
+ assertion_count(file, line);
+ if (v1 == v2 || wcscmp(v1, v2) == 0)
+ return (1);
+ failure_start(file, line, "%s != %s", e1, e2);
+ wcsdump(e1, v1);
+ wcsdump(e2, v2);
+ failure_finish(extra);
+ return (0);
+}
+
+/*
+ * Pretty standard hexdump routine. As a bonus, if ref != NULL, then
+ * any bytes in p that differ from ref will be highlighted with '_'
+ * before and after the hex value.
+ */
+static void
+hexdump(const char *p, const char *ref, size_t l, size_t offset)
+{
+ size_t i, j;
+ char sep;
+
+ if (p == NULL) {
+ logprintf("(null)\n");
+ return;
+ }
+ for(i=0; i < l; i+=16) {
+ logprintf("%04x", (unsigned)(i + offset));
+ sep = ' ';
+ for (j = 0; j < 16 && i + j < l; j++) {
+ if (ref != NULL && p[i + j] != ref[i + j])
+ sep = '_';
+ logprintf("%c%02x", sep, 0xff & (int)p[i+j]);
+ if (ref != NULL && p[i + j] == ref[i + j])
+ sep = ' ';
+ }
+ for (; j < 16; j++) {
+ logprintf("%c ", sep);
+ sep = ' ';
+ }
+ logprintf("%c", sep);
+ for (j=0; j < 16 && i + j < l; j++) {
+ int c = p[i + j];
+ if (c >= ' ' && c <= 126)
+ logprintf("%c", c);
+ else
+ logprintf(".");
+ }
+ logprintf("\n");
+ }
+}
+
+/* Verify that two blocks of memory are the same, display the first
+ * block of differences if they're not. */
+int
+assertion_equal_mem(const char *file, int line,
+ const void *_v1, const char *e1,
+ const void *_v2, const char *e2,
+ size_t l, const char *ld, void *extra)
+{
+ const char *v1 = (const char *)_v1;
+ const char *v2 = (const char *)_v2;
+ size_t offset;
+
+ assertion_count(file, line);
+ if (v1 == v2 || (v1 != NULL && v2 != NULL && memcmp(v1, v2, l) == 0))
+ return (1);
+
+ failure_start(file, line, "%s != %s", e1, e2);
+ logprintf(" size %s = %d\n", ld, (int)l);
+ /* Dump 48 bytes (3 lines) so that the first difference is
+ * in the second line. */
+ offset = 0;
+ while (l > 64 && memcmp(v1, v2, 32) == 0) {
+ /* Two lines agree, so step forward one line. */
+ v1 += 16;
+ v2 += 16;
+ l -= 16;
+ offset += 16;
+ }
+ logprintf(" Dump of %s\n", e1);
+ hexdump(v1, v2, l < 64 ? l : 64, offset);
+ logprintf(" Dump of %s\n", e2);
+ hexdump(v2, v1, l < 64 ? l : 64, offset);
+ logprintf("\n");
+ failure_finish(extra);
+ return (0);
+}
+
+/* Verify that the named file exists and is empty. */
+int
+assertion_empty_file(const char *f1fmt, ...)
+{
+ char buff[1024];
+ char f1[1024];
+ struct stat st;
+ va_list ap;
+ ssize_t s;
+ FILE *f;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, f1fmt);
+ vsprintf(f1, f1fmt, ap);
+ va_end(ap);
+
+ if (stat(f1, &st) != 0) {
+ failure_start(test_filename, test_line, "Stat failed: %s", f1);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (st.st_size == 0)
+ return (1);
+
+ failure_start(test_filename, test_line, "File should be empty: %s", f1);
+ logprintf(" File size: %d\n", (int)st.st_size);
+ logprintf(" Contents:\n");
+ f = fopen(f1, "rb");
+ if (f == NULL) {
+ logprintf(" Unable to open %s\n", f1);
+ } else {
+ s = ((off_t)sizeof(buff) < st.st_size) ?
+ (ssize_t)sizeof(buff) : (ssize_t)st.st_size;
+ s = fread(buff, 1, s, f);
+ hexdump(buff, NULL, s, 0);
+ fclose(f);
+ }
+ failure_finish(NULL);
+ return (0);
+}
+
+/* Verify that the named file exists and is not empty. */
+int
+assertion_non_empty_file(const char *f1fmt, ...)
+{
+ char f1[1024];
+ struct stat st;
+ va_list ap;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, f1fmt);
+ vsprintf(f1, f1fmt, ap);
+ va_end(ap);
+
+ if (stat(f1, &st) != 0) {
+ failure_start(test_filename, test_line, "Stat failed: %s", f1);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (st.st_size == 0) {
+ failure_start(test_filename, test_line, "File empty: %s", f1);
+ failure_finish(NULL);
+ return (0);
+ }
+ return (1);
+}
+
+/* Verify that two files have the same contents. */
+/* TODO: hexdump the first bytes that actually differ. */
+int
+assertion_equal_file(const char *fn1, const char *f2pattern, ...)
+{
+ char fn2[1024];
+ va_list ap;
+ char buff1[1024];
+ char buff2[1024];
+ FILE *f1, *f2;
+ int n1, n2;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, f2pattern);
+ vsprintf(fn2, f2pattern, ap);
+ va_end(ap);
+
+ f1 = fopen(fn1, "rb");
+ f2 = fopen(fn2, "rb");
+ for (;;) {
+ n1 = fread(buff1, 1, sizeof(buff1), f1);
+ n2 = fread(buff2, 1, sizeof(buff2), f2);
+ if (n1 != n2)
+ break;
+ if (n1 == 0 && n2 == 0) {
+ fclose(f1);
+ fclose(f2);
+ return (1);
+ }
+ if (memcmp(buff1, buff2, n1) != 0)
+ break;
+ }
+ fclose(f1);
+ fclose(f2);
+ failure_start(test_filename, test_line, "Files not identical");
+ logprintf(" file1=\"%s\"\n", fn1);
+ logprintf(" file2=\"%s\"\n", fn2);
+ failure_finish(test_extra);
+ return (0);
+}
+
+/* Verify that the named file does exist. */
+int
+assertion_file_exists(const char *fpattern, ...)
+{
+ char f[1024];
+ va_list ap;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, fpattern);
+ vsprintf(f, fpattern, ap);
+ va_end(ap);
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ if (!_access(f, 0))
+ return (1);
+#else
+ if (!access(f, F_OK))
+ return (1);
+#endif
+ failure_start(test_filename, test_line, "File should exist: %s", f);
+ failure_finish(test_extra);
+ return (0);
+}
+
+/* Verify that the named file doesn't exist. */
+int
+assertion_file_not_exists(const char *fpattern, ...)
+{
+ char f[1024];
+ va_list ap;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, fpattern);
+ vsprintf(f, fpattern, ap);
+ va_end(ap);
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ if (_access(f, 0))
+ return (1);
+#else
+ if (access(f, F_OK))
+ return (1);
+#endif
+ failure_start(test_filename, test_line, "File should not exist: %s", f);
+ failure_finish(test_extra);
+ return (0);
+}
+
+/* Compare the contents of a file to a block of memory. */
+int
+assertion_file_contents(const void *buff, int s, const char *fpattern, ...)
+{
+ char fn[1024];
+ va_list ap;
+ char *contents;
+ FILE *f;
+ int n;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, fpattern);
+ vsprintf(fn, fpattern, ap);
+ va_end(ap);
+
+ f = fopen(fn, "rb");
+ if (f == NULL) {
+ failure_start(test_filename, test_line,
+ "File should exist: %s", fn);
+ failure_finish(test_extra);
+ return (0);
+ }
+ contents = malloc(s * 2);
+ n = fread(contents, 1, s * 2, f);
+ fclose(f);
+ if (n == s && memcmp(buff, contents, s) == 0) {
+ free(contents);
+ return (1);
+ }
+ failure_start(test_filename, test_line, "File contents don't match");
+ logprintf(" file=\"%s\"\n", fn);
+ if (n > 0)
+ hexdump(contents, buff, n > 512 ? 512 : n, 0);
+ else {
+ logprintf(" File empty, contents should be:\n");
+ hexdump(buff, NULL, s > 512 ? 512 : n, 0);
+ }
+ failure_finish(test_extra);
+ free(contents);
+ return (0);
+}
+
+/* Check the contents of a text file, being tolerant of line endings. */
+int
+assertion_text_file_contents(const char *buff, const char *fn)
+{
+ char *contents;
+ const char *btxt, *ftxt;
+ FILE *f;
+ int n, s;
+
+ assertion_count(test_filename, test_line);
+ f = fopen(fn, "r");
+ s = strlen(buff);
+ contents = malloc(s * 2 + 128);
+ n = fread(contents, 1, s * 2 + 128 - 1, f);
+ if (n >= 0)
+ contents[n] = '\0';
+ fclose(f);
+ /* Compare texts. */
+ btxt = buff;
+ ftxt = (const char *)contents;
+ while (*btxt != '\0' && *ftxt != '\0') {
+ if (*btxt == *ftxt) {
+ ++btxt;
+ ++ftxt;
+ continue;
+ }
+ if (btxt[0] == '\n' && ftxt[0] == '\r' && ftxt[1] == '\n') {
+ /* Pass over different new line characters. */
+ ++btxt;
+ ftxt += 2;
+ continue;
+ }
+ break;
+ }
+ if (*btxt == '\0' && *ftxt == '\0') {
+ free(contents);
+ return (1);
+ }
+ failure_start(test_filename, test_line, "Contents don't match");
+ logprintf(" file=\"%s\"\n", fn);
+ if (n > 0)
+ hexdump(contents, buff, n, 0);
+ else {
+ logprintf(" File empty, contents should be:\n");
+ hexdump(buff, NULL, s, 0);
+ }
+ failure_finish(test_extra);
+ free(contents);
+ return (0);
+}
+
+/* Test that two paths point to the same file. */
+/* As a side-effect, asserts that both files exist. */
+static int
+is_hardlink(const char *file, int line,
+ const char *path1, const char *path2)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ BY_HANDLE_FILE_INFORMATION bhfi1, bhfi2;
+ int r;
+
+ assertion_count(file, line);
+ r = my_GetFileInformationByName(path1, &bhfi1);
+ if (r == 0) {
+ failure_start(file, line, "File %s can't be inspected?", path1);
+ failure_finish(NULL);
+ return (0);
+ }
+ r = my_GetFileInformationByName(path2, &bhfi2);
+ if (r == 0) {
+ failure_start(file, line, "File %s can't be inspected?", path2);
+ failure_finish(NULL);
+ return (0);
+ }
+ return (bhfi1.dwVolumeSerialNumber == bhfi2.dwVolumeSerialNumber
+ && bhfi1.nFileIndexHigh == bhfi2.nFileIndexHigh
+ && bhfi1.nFileIndexLow == bhfi2.nFileIndexLow);
+#else
+ struct stat st1, st2;
+ int r;
+
+ assertion_count(file, line);
+ r = lstat(path1, &st1);
+ if (r != 0) {
+ failure_start(file, line, "File should exist: %s", path1);
+ failure_finish(NULL);
+ return (0);
+ }
+ r = lstat(path2, &st2);
+ if (r != 0) {
+ failure_start(file, line, "File should exist: %s", path2);
+ failure_finish(NULL);
+ return (0);
+ }
+ return (st1.st_ino == st2.st_ino && st1.st_dev == st2.st_dev);
+#endif
+}
+
+int
+assertion_is_hardlink(const char *file, int line,
+ const char *path1, const char *path2)
+{
+ if (is_hardlink(file, line, path1, path2))
+ return (1);
+ failure_start(file, line,
+ "Files %s and %s are not hardlinked", path1, path2);
+ failure_finish(NULL);
+ return (0);
+}
+
+int
+assertion_is_not_hardlink(const char *file, int line,
+ const char *path1, const char *path2)
+{
+ if (!is_hardlink(file, line, path1, path2))
+ return (1);
+ failure_start(file, line,
+ "Files %s and %s should not be hardlinked", path1, path2);
+ failure_finish(NULL);
+ return (0);
+}
+
+/* Verify a/b/mtime of 'pathname'. */
+/* If 'recent', verify that it's within last 10 seconds. */
+static int
+assertion_file_time(const char *file, int line,
+ const char *pathname, long t, long nsec, char type, int recent)
+{
+ long long filet, filet_nsec;
+ int r;
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define EPOC_TIME (116444736000000000ULL)
+ FILETIME ftime, fbirthtime, fatime, fmtime;
+ ULARGE_INTEGER wintm;
+ HANDLE h;
+ ftime.dwLowDateTime = 0;
+ ftime.dwHighDateTime = 0;
+
+ assertion_count(file, line);
+ h = CreateFile(pathname, FILE_READ_ATTRIBUTES, 0, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (h == INVALID_HANDLE_VALUE) {
+ failure_start(file, line, "Can't access %s\n", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ r = GetFileTime(h, &fbirthtime, &fatime, &fmtime);
+ switch (type) {
+ case 'a': ftime = fatime; break;
+ case 'b': ftime = fbirthtime; break;
+ case 'm': ftime = fmtime; break;
+ }
+ CloseHandle(h);
+ if (r == 0) {
+ failure_start(file, line, "Can't GetFileTime %s\n", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ wintm.LowPart = ftime.dwLowDateTime;
+ wintm.HighPart = ftime.dwHighDateTime;
+ filet = (wintm.QuadPart - EPOC_TIME) / 10000000;
+ filet_nsec = ((wintm.QuadPart - EPOC_TIME) % 10000000) * 100;
+ nsec = (nsec / 100) * 100; /* Round the request */
+#else
+ struct stat st;
+
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r != 0) {
+ failure_start(file, line, "Can't stat %s\n", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ switch (type) {
+ case 'a': filet = st.st_atime; break;
+ case 'm': filet = st.st_mtime; break;
+ case 'b': filet = 0; break;
+ default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type);
+ exit(1);
+ }
+#if defined(__FreeBSD__)
+ switch (type) {
+ case 'a': filet_nsec = st.st_atimespec.tv_nsec; break;
+ case 'b': filet = st.st_birthtime;
+ filet_nsec = st.st_birthtimespec.tv_nsec; break;
+ case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break;
+ default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type);
+ exit(1);
+ }
+ /* FreeBSD generally only stores to microsecond res, so round. */
+ filet_nsec = (filet_nsec / 1000) * 1000;
+ nsec = (nsec / 1000) * 1000;
+#else
+ filet_nsec = nsec = 0; /* Generic POSIX only has whole seconds. */
+ if (type == 'b') return (1); /* Generic POSIX doesn't have birthtime */
+#if defined(__HAIKU__)
+ if (type == 'a') return (1); /* Haiku doesn't have atime. */
+#endif
+#endif
+#endif
+ if (recent) {
+ /* Check that requested time is up-to-date. */
+ time_t now = time(NULL);
+ if (filet < now - 10 || filet > now + 1) {
+ failure_start(file, line,
+ "File %s has %ctime %ld, %ld seconds ago\n",
+ pathname, type, filet, now - filet);
+ failure_finish(NULL);
+ return (0);
+ }
+ } else if (filet != t || filet_nsec != nsec) {
+ failure_start(file, line,
+ "File %s has %ctime %ld.%09ld, expected %ld.%09ld",
+ pathname, type, filet, filet_nsec, t, nsec);
+ failure_finish(NULL);
+ return (0);
+ }
+ return (1);
+}
+
+/* Verify atime of 'pathname'. */
+int
+assertion_file_atime(const char *file, int line,
+ const char *pathname, long t, long nsec)
+{
+ return assertion_file_time(file, line, pathname, t, nsec, 'a', 0);
+}
+
+/* Verify atime of 'pathname' is up-to-date. */
+int
+assertion_file_atime_recent(const char *file, int line, const char *pathname)
+{
+ return assertion_file_time(file, line, pathname, 0, 0, 'a', 1);
+}
+
+/* Verify birthtime of 'pathname'. */
+int
+assertion_file_birthtime(const char *file, int line,
+ const char *pathname, long t, long nsec)
+{
+ return assertion_file_time(file, line, pathname, t, nsec, 'b', 0);
+}
+
+/* Verify birthtime of 'pathname' is up-to-date. */
+int
+assertion_file_birthtime_recent(const char *file, int line,
+ const char *pathname)
+{
+ return assertion_file_time(file, line, pathname, 0, 0, 'b', 1);
+}
+
+/* Verify mtime of 'pathname'. */
+int
+assertion_file_mtime(const char *file, int line,
+ const char *pathname, long t, long nsec)
+{
+ return assertion_file_time(file, line, pathname, t, nsec, 'm', 0);
+}
+
+/* Verify mtime of 'pathname' is up-to-date. */
+int
+assertion_file_mtime_recent(const char *file, int line, const char *pathname)
+{
+ return assertion_file_time(file, line, pathname, 0, 0, 'm', 1);
+}
+
+/* Verify number of links to 'pathname'. */
+int
+assertion_file_nlinks(const char *file, int line,
+ const char *pathname, int nlinks)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ BY_HANDLE_FILE_INFORMATION bhfi;
+ int r;
+
+ assertion_count(file, line);
+ r = my_GetFileInformationByName(pathname, &bhfi);
+ if (r != 0 && bhfi.nNumberOfLinks == (DWORD)nlinks)
+ return (1);
+ failure_start(file, line, "File %s has %d links, expected %d",
+ pathname, bhfi.nNumberOfLinks, nlinks);
+ failure_finish(NULL);
+ return (0);
+#else
+ struct stat st;
+ int r;
+
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r == 0 && st.st_nlink == nlinks)
+ return (1);
+ failure_start(file, line, "File %s has %d links, expected %d",
+ pathname, st.st_nlink, nlinks);
+ failure_finish(NULL);
+ return (0);
+#endif
+}
+
+/* Verify size of 'pathname'. */
+int
+assertion_file_size(const char *file, int line, const char *pathname, long size)
+{
+ int64_t filesize;
+ int r;
+
+ assertion_count(file, line);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ {
+ BY_HANDLE_FILE_INFORMATION bhfi;
+ r = !my_GetFileInformationByName(pathname, &bhfi);
+ filesize = ((int64_t)bhfi.nFileSizeHigh << 32) + bhfi.nFileSizeLow;
+ }
+#else
+ {
+ struct stat st;
+ r = lstat(pathname, &st);
+ filesize = st.st_size;
+ }
+#endif
+ if (r == 0 && filesize == size)
+ return (1);
+ failure_start(file, line, "File %s has size %ld, expected %ld",
+ pathname, (long)filesize, (long)size);
+ failure_finish(NULL);
+ return (0);
+}
+
+/* Assert that 'pathname' is a dir. If mode >= 0, verify that too. */
+int
+assertion_is_dir(const char *file, int line, const char *pathname, int mode)
+{
+ struct stat st;
+ int r;
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ (void)mode; /* UNUSED */
+#endif
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r != 0) {
+ failure_start(file, line, "Dir should exist: %s", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (!S_ISDIR(st.st_mode)) {
+ failure_start(file, line, "%s is not a dir", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ /* Windows doesn't handle permissions the same way as POSIX,
+ * so just ignore the mode tests. */
+ /* TODO: Can we do better here? */
+ if (mode >= 0 && mode != (st.st_mode & 07777)) {
+ failure_start(file, line, "Dir %s has wrong mode", pathname);
+ logprintf(" Expected: 0%3o\n", mode);
+ logprintf(" Found: 0%3o\n", st.st_mode & 07777);
+ failure_finish(NULL);
+ return (0);
+ }
+#endif
+ return (1);
+}
+
+/* Verify that 'pathname' is a regular file. If 'mode' is >= 0,
+ * verify that too. */
+int
+assertion_is_reg(const char *file, int line, const char *pathname, int mode)
+{
+ struct stat st;
+ int r;
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ (void)mode; /* UNUSED */
+#endif
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r != 0 || !S_ISREG(st.st_mode)) {
+ failure_start(file, line, "File should exist: %s", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ /* Windows doesn't handle permissions the same way as POSIX,
+ * so just ignore the mode tests. */
+ /* TODO: Can we do better here? */
+ if (mode >= 0 && mode != (st.st_mode & 07777)) {
+ failure_start(file, line, "File %s has wrong mode", pathname);
+ logprintf(" Expected: 0%3o\n", mode);
+ logprintf(" Found: 0%3o\n", st.st_mode & 07777);
+ failure_finish(NULL);
+ return (0);
+ }
+#endif
+ return (1);
+}
+
+/* Check whether 'pathname' is a symbolic link. If 'contents' is
+ * non-NULL, verify that the symlink has those contents. */
+static int
+is_symlink(const char *file, int line,
+ const char *pathname, const char *contents)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ (void)pathname; /* UNUSED */
+ (void)contents; /* UNUSED */
+ assertion_count(file, line);
+ /* Windows sort-of has real symlinks, but they're only usable
+ * by privileged users and are crippled even then, so there's
+ * really not much point in bothering with this. */
+ return (0);
+#else
+ char buff[300];
+ struct stat st;
+ ssize_t linklen;
+ int r;
+
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r != 0) {
+ failure_start(file, line,
+ "Symlink should exist: %s", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (!S_ISLNK(st.st_mode))
+ return (0);
+ if (contents == NULL)
+ return (1);
+ linklen = readlink(pathname, buff, sizeof(buff));
+ if (linklen < 0) {
+ failure_start(file, line, "Can't read symlink %s", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ buff[linklen] = '\0';
+ if (strcmp(buff, contents) != 0)
+ return (0);
+ return (1);
+#endif
+}
+
+/* Assert that path is a symlink that (optionally) contains contents. */
+int
+assertion_is_symlink(const char *file, int line,
+ const char *path, const char *contents)
+{
+ if (is_symlink(file, line, path, contents))
+ return (1);
+ if (contents)
+ failure_start(file, line, "File %s is not a symlink to %s",
+ path, contents);
+ else
+ failure_start(file, line, "File %s is not a symlink", path);
+ failure_finish(NULL);
+ return (0);
+}
+
+
+/* Create a directory and report any errors. */
+int
+assertion_make_dir(const char *file, int line, const char *dirname, int mode)
+{
+ assertion_count(file, line);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ (void)mode; /* UNUSED */
+ if (0 == _mkdir(dirname))
+ return (1);
+#else
+ if (0 == mkdir(dirname, mode))
+ return (1);
+#endif
+ failure_start(file, line, "Could not create directory %s", dirname);
+ failure_finish(NULL);
+ return(0);
+}
+
+/* Create a file with the specified contents and report any failures. */
+int
+assertion_make_file(const char *file, int line,
+ const char *path, int mode, const char *contents)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* TODO: Rework this to set file mode as well. */
+ FILE *f;
+ (void)mode; /* UNUSED */
+ assertion_count(file, line);
+ f = fopen(path, "wb");
+ if (f == NULL) {
+ failure_start(file, line, "Could not create file %s", path);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (contents != NULL) {
+ if (strlen(contents)
+ != fwrite(contents, 1, strlen(contents), f)) {
+ fclose(f);
+ failure_start(file, line,
+ "Could not write file %s", path);
+ failure_finish(NULL);
+ return (0);
+ }
+ }
+ fclose(f);
+ return (1);
+#else
+ int fd;
+ assertion_count(file, line);
+ fd = open(path, O_CREAT | O_WRONLY, mode >= 0 ? mode : 0644);
+ if (fd < 0) {
+ failure_start(file, line, "Could not create %s", path);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (contents != NULL) {
+ if ((ssize_t)strlen(contents)
+ != write(fd, contents, strlen(contents))) {
+ close(fd);
+ failure_start(file, line, "Could not write to %s", path);
+ failure_finish(NULL);
+ return (0);
+ }
+ }
+ close(fd);
+ return (1);
+#endif
+}
+
+/* Create a hardlink and report any failures. */
+int
+assertion_make_hardlink(const char *file, int line,
+ const char *newpath, const char *linkto)
+{
+ int succeeded;
+
+ assertion_count(file, line);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ succeeded = my_CreateHardLinkA(newpath, linkto);
+#elif HAVE_LINK
+ succeeded = !link(linkto, newpath);
+#else
+ succeeded = 0;
+#endif
+ if (succeeded)
+ return (1);
+ failure_start(file, line, "Could not create hardlink");
+ logprintf(" New link: %s\n", newpath);
+ logprintf(" Old name: %s\n", linkto);
+ failure_finish(NULL);
+ return(0);
+}
+
+/* Create a symlink and report any failures. */
+int
+assertion_make_symlink(const char *file, int line,
+ const char *newpath, const char *linkto)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ int targetIsDir = 0; /* TODO: Fix this */
+ assertion_count(file, line);
+ if (my_CreateSymbolicLinkA(newpath, linkto, targetIsDir))
+ return (1);
+#elif HAVE_SYMLINK
+ assertion_count(file, line);
+ if (0 == symlink(linkto, newpath))
+ return (1);
+#endif
+ failure_start(file, line, "Could not create symlink");
+ logprintf(" New link: %s\n", newpath);
+ logprintf(" Old name: %s\n", linkto);
+ failure_finish(NULL);
+ return(0);
+}
+
+/* Set umask, report failures. */
+int
+assertion_umask(const char *file, int line, int mask)
+{
+ assertion_count(file, line);
+ (void)file; /* UNUSED */
+ (void)line; /* UNUSED */
+ umask(mask);
+ return (1);
+}
+
+/*
+ *
+ * UTILITIES for use by tests.
+ *
+ */
+
+/*
+ * Check whether platform supports symlinks. This is intended
+ * for tests to use in deciding whether to bother testing symlink
+ * support; if the platform doesn't support symlinks, there's no point
+ * in checking whether the program being tested can create them.
+ *
+ * Note that the first time this test is called, we actually go out to
+ * disk to create and verify a symlink. This is necessary because
+ * symlink support is actually a property of a particular filesystem
+ * and can thus vary between directories on a single system. After
+ * the first call, this returns the cached result from memory, so it's
+ * safe to call it as often as you wish.
+ */
+int
+canSymlink(void)
+{
+ /* Remember the test result */
+ static int value = 0, tested = 0;
+ if (tested)
+ return (value);
+
+ ++tested;
+ assertion_make_file(__FILE__, __LINE__, "canSymlink.0", 0644, "a");
+ /* Note: Cygwin has its own symlink() emulation that does not
+ * use the Win32 CreateSymbolicLink() function. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ value = my_CreateSymbolicLinkA("canSymlink.1", "canSymlink.0", 0)
+ && is_symlink(__FILE__, __LINE__, "canSymlink.1", "canSymlink.0");
+#elif HAVE_SYMLINK
+ value = (0 == symlink("canSymlink.0", "canSymlink.1"))
+ && is_symlink(__FILE__, __LINE__, "canSymlink.1","canSymlink.0");
+#endif
+ return (value);
+}
+
+/*
+ * Can this platform run the gzip program?
+ */
+/* Platform-dependent options for hiding the output of a subcommand. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+static const char *redirectArgs = ">NUL 2>NUL"; /* Win32 cmd.exe */
+#else
+static const char *redirectArgs = ">/dev/null 2>/dev/null"; /* POSIX 'sh' */
+#endif
+int
+canGzip(void)
+{
+ static int tested = 0, value = 0;
+ if (!tested) {
+ tested = 1;
+ if (systemf("gzip -V %s", redirectArgs) == 0)
+ value = 1;
+ }
+ return (value);
+}
+
+/*
+ * Can this platform run the gunzip program?
+ */
+int
+canGunzip(void)
+{
+ static int tested = 0, value = 0;
+ if (!tested) {
+ tested = 1;
+ if (systemf("gunzip -V %s", redirectArgs) == 0)
+ value = 1;
+ }
+ return (value);
+}
+
+/*
+ * Sleep as needed; useful for verifying disk timestamp changes by
+ * ensuring that the wall-clock time has actually changed before we
+ * go back to re-read something from disk.
+ */
+void
+sleepUntilAfter(time_t t)
+{
+ while (t >= time(NULL))
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ Sleep(500);
+#else
+ sleep(1);
+#endif
+}
+
+/*
+ * Call standard system() call, but build up the command line using
+ * sprintf() conventions.
+ */
+int
+systemf(const char *fmt, ...)
+{
+ char buff[8192];
+ va_list ap;
+ int r;
+
+ va_start(ap, fmt);
+ vsprintf(buff, fmt, ap);
+ if (verbosity > VERBOSITY_FULL)
+ logprintf("Cmd: %s\n", buff);
+ r = system(buff);
+ va_end(ap);
+ return (r);
+}
+
+/*
+ * Slurp a file into memory for ease of comparison and testing.
+ * Returns size of file in 'sizep' if non-NULL, null-terminates
+ * data in memory for ease of use.
+ */
+char *
+slurpfile(size_t * sizep, const char *fmt, ...)
+{
+ char filename[8192];
+ struct stat st;
+ va_list ap;
+ char *p;
+ ssize_t bytes_read;
+ FILE *f;
+ int r;
+
+ va_start(ap, fmt);
+ vsprintf(filename, fmt, ap);
+ va_end(ap);
+
+ f = fopen(filename, "rb");
+ if (f == NULL) {
+ /* Note: No error; non-existent file is okay here. */
+ return (NULL);
+ }
+ r = fstat(fileno(f), &st);
+ if (r != 0) {
+ logprintf("Can't stat file %s\n", filename);
+ fclose(f);
+ return (NULL);
+ }
+ p = malloc((size_t)st.st_size + 1);
+ if (p == NULL) {
+ logprintf("Can't allocate %ld bytes of memory to read file %s\n",
+ (long int)st.st_size, filename);
+ fclose(f);
+ return (NULL);
+ }
+ bytes_read = fread(p, 1, (size_t)st.st_size, f);
+ if (bytes_read < st.st_size) {
+ logprintf("Can't read file %s\n", filename);
+ fclose(f);
+ free(p);
+ return (NULL);
+ }
+ p[st.st_size] = '\0';
+ if (sizep != NULL)
+ *sizep = (size_t)st.st_size;
+ fclose(f);
+ return (p);
+}
+
+/* Read a uuencoded file from the reference directory, decode, and
+ * write the result into the current directory. */
+#define UUDECODE(c) (((c) - 0x20) & 0x3f)
+void
+extract_reference_file(const char *name)
+{
+ char buff[1024];
+ FILE *in, *out;
+
+ sprintf(buff, "%s/%s.uu", refdir, name);
+ in = fopen(buff, "r");
+ failure("Couldn't open reference file %s", buff);
+ assert(in != NULL);
+ if (in == NULL)
+ return;
+ /* Read up to and including the 'begin' line. */
+ for (;;) {
+ if (fgets(buff, sizeof(buff), in) == NULL) {
+ /* TODO: This is a failure. */
+ return;
+ }
+ if (memcmp(buff, "begin ", 6) == 0)
+ break;
+ }
+ /* Now, decode the rest and write it. */
+ /* Not a lot of error checking here; the input better be right. */
+ out = fopen(name, "wb");
+ while (fgets(buff, sizeof(buff), in) != NULL) {
+ char *p = buff;
+ int bytes;
+
+ if (memcmp(buff, "end", 3) == 0)
+ break;
+
+ bytes = UUDECODE(*p++);
+ while (bytes > 0) {
+ int n = 0;
+ /* Write out 1-3 bytes from that. */
+ if (bytes > 0) {
+ n = UUDECODE(*p++) << 18;
+ n |= UUDECODE(*p++) << 12;
+ fputc(n >> 16, out);
+ --bytes;
+ }
+ if (bytes > 0) {
+ n |= UUDECODE(*p++) << 6;
+ fputc((n >> 8) & 0xFF, out);
+ --bytes;
+ }
+ if (bytes > 0) {
+ n |= UUDECODE(*p++);
+ fputc(n & 0xFF, out);
+ --bytes;
+ }
+ }
+ }
+ fclose(out);
+ fclose(in);
+}
+
+/*
+ *
+ * TEST management
+ *
+ */
+
+/*
+ * "list.h" is simply created by "grep DEFINE_TEST test_*.c"; it has
+ * a line like
+ * DEFINE_TEST(test_function)
+ * for each test.
+ */
+
+/* Use "list.h" to declare all of the test functions. */
+#undef DEFINE_TEST
+#define DEFINE_TEST(name) void name(void);
+#include "list.h"
+
+/* Use "list.h" to create a list of all tests (functions and names). */
+#undef DEFINE_TEST
+#define DEFINE_TEST(n) { n, #n, 0 },
+struct { void (*func)(void); const char *name; int failures; } tests[] = {
+ #include "list.h"
+};
+
+/*
+ * Summarize repeated failures in the just-completed test.
+ */
+static void
+test_summarize(const char *filename, int failed)
+{
+ unsigned int i;
+
+ switch (verbosity) {
+ case VERBOSITY_SUMMARY_ONLY:
+ printf(failed ? "E" : ".");
+ fflush(stdout);
+ break;
+ case VERBOSITY_PASSFAIL:
+ printf(failed ? "FAIL\n" : "ok\n");
+ break;
+ }
+
+ log_console = (verbosity == VERBOSITY_LIGHT_REPORT);
+
+ for (i = 0; i < sizeof(failed_lines)/sizeof(failed_lines[0]); i++) {
+ if (failed_lines[i].count > 1 && !failed_lines[i].skip)
+ logprintf("%s:%d: Summary: Failed %d times\n",
+ filename, i, failed_lines[i].count);
+ }
+ /* Clear the failure history for the next file. */
+ memset(failed_lines, 0, sizeof(failed_lines));
+}
+
+/*
+ * Actually run a single test, with appropriate setup and cleanup.
+ */
+static int
+test_run(int i, const char *tmpdir)
+{
+ char logfilename[64];
+ int failures_before = failures;
+ int oldumask;
+
+ switch (verbosity) {
+ case VERBOSITY_SUMMARY_ONLY: /* No per-test reports at all */
+ break;
+ case VERBOSITY_PASSFAIL: /* rest of line will include ok/FAIL marker */
+ printf("%3d: %-50s", i, tests[i].name);
+ fflush(stdout);
+ break;
+ default: /* Title of test, details will follow */
+ printf("%3d: %s\n", i, tests[i].name);
+ }
+
+ /* Chdir to the top-level work directory. */
+ if (!assertChdir(tmpdir)) {
+ fprintf(stderr,
+ "ERROR: Can't chdir to top work dir %s\n", tmpdir);
+ exit(1);
+ }
+ /* Create a log file for this test. */
+ sprintf(logfilename, "%s.log", tests[i].name);
+ logfile = fopen(logfilename, "w");
+ fprintf(logfile, "%s\n\n", tests[i].name);
+ /* Chdir() to a work dir for this specific test. */
+ if (!assertMakeDir(tests[i].name, 0755)
+ || !assertChdir(tests[i].name)) {
+ fprintf(stderr,
+ "ERROR: Can't chdir to work dir %s/%s\n",
+ tmpdir, tests[i].name);
+ exit(1);
+ }
+ /* Explicitly reset the locale before each test. */
+ setlocale(LC_ALL, "C");
+ /* Record the umask before we run the test. */
+ umask(oldumask = umask(0));
+ /*
+ * Run the actual test.
+ */
+ (*tests[i].func)();
+ /*
+ * Clean up and report afterwards.
+ */
+ /* Restore umask */
+ umask(oldumask);
+ /* Reset locale. */
+ setlocale(LC_ALL, "C");
+ /* Reset directory. */
+ if (!assertChdir(tmpdir)) {
+ fprintf(stderr, "ERROR: Couldn't chdir to temp dir %s\n",
+ tmpdir);
+ exit(1);
+ }
+ /* Report per-test summaries. */
+ tests[i].failures = failures - failures_before;
+ test_summarize(test_filename, tests[i].failures);
+ /* Close the per-test log file. */
+ fclose(logfile);
+ logfile = NULL;
+ /* If there were no failures, we can remove the work dir and logfile. */
+ if (tests[i].failures == 0) {
+ if (!keep_temp_files && assertChdir(tmpdir)) {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Make sure not to leave empty directories.
+ * Sometimes a processing of closing files used by tests
+ * is not done, then rmdir will be failed and it will
+ * leave a empty test directory. So we should wait a few
+ * seconds and retry rmdir. */
+ int r, t;
+ for (t = 0; t < 10; t++) {
+ if (t > 0)
+ Sleep(1000);
+ r = systemf("rmdir /S /Q %s", tests[i].name);
+ if (r == 0)
+ break;
+ }
+ systemf("del %s", logfilename);
+#else
+ systemf("rm -rf %s", tests[i].name);
+ systemf("rm %s", logfilename);
+#endif
+ }
+ }
+ /* Return appropriate status. */
+ return (tests[i].failures);
+}
+
+/*
+ *
+ *
+ * MAIN and support routines.
+ *
+ *
+ */
+
+static void
+usage(const char *program)
+{
+ static const int limit = sizeof(tests) / sizeof(tests[0]);
+ int i;
+
+ printf("Usage: %s [options] <test> <test> ...\n", program);
+ printf("Default is to run all tests.\n");
+ printf("Otherwise, specify the numbers of the tests you wish to run.\n");
+ printf("Options:\n");
+ printf(" -d Dump core after any failure, for debugging.\n");
+ printf(" -k Keep all temp files.\n");
+ printf(" Default: temp files for successful tests deleted.\n");
+#ifdef PROGRAM
+ printf(" -p <path> Path to executable to be tested.\n");
+ printf(" Default: path taken from " ENVBASE " environment variable.\n");
+#endif
+ printf(" -q Quiet.\n");
+ printf(" -r <dir> Path to dir containing reference files.\n");
+ printf(" Default: Current directory.\n");
+ printf(" -v Verbose.\n");
+ printf("Available tests:\n");
+ for (i = 0; i < limit; i++)
+ printf(" %d: %s\n", i, tests[i].name);
+ exit(1);
+}
+
+static char *
+get_refdir(const char *d)
+{
+ char tried[512] = { '\0' };
+ char buff[128];
+ char *pwd, *p;
+
+ /* If a dir was specified, try that */
+ if (d != NULL) {
+ pwd = NULL;
+ snprintf(buff, sizeof(buff), "%s", d);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+ goto failure;
+ }
+
+ /* Get the current dir. */
+ pwd = getcwd(NULL, 0);
+ while (pwd[strlen(pwd) - 1] == '\n')
+ pwd[strlen(pwd) - 1] = '\0';
+
+ /* Look for a known file. */
+ snprintf(buff, sizeof(buff), "%s", pwd);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+
+ snprintf(buff, sizeof(buff), "%s/test", pwd);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+
+#if defined(LIBRARY)
+ snprintf(buff, sizeof(buff), "%s/%s/test", pwd, LIBRARY);
+#else
+ snprintf(buff, sizeof(buff), "%s/%s/test", pwd, PROGRAM);
+#endif
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+
+ if (memcmp(pwd, "/usr/obj", 8) == 0) {
+ snprintf(buff, sizeof(buff), "%s", pwd + 8);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+
+ snprintf(buff, sizeof(buff), "%s/test", pwd + 8);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+ }
+
+failure:
+ printf("Unable to locate known reference file %s\n", KNOWNREF);
+ printf(" Checked following directories:\n%s\n", tried);
+#if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG)
+ DebugBreak();
+#endif
+ exit(1);
+
+success:
+ free(p);
+ free(pwd);
+ return strdup(buff);
+}
+
+int
+main(int argc, char **argv)
+{
+ static const int limit = sizeof(tests) / sizeof(tests[0]);
+ int i, tests_run = 0, tests_failed = 0, option;
+ time_t now;
+ char *refdir_alloc = NULL;
+ const char *progname;
+ const char *tmp, *option_arg, *p;
+ char tmpdir[256];
+ char tmpdir_timestamp[256];
+
+ (void)argc; /* UNUSED */
+
+#if defined(HAVE__CrtSetReportMode)
+ /* To stop to run the default invalid parameter handler. */
+ _set_invalid_parameter_handler(invalid_parameter_handler);
+ /* Disable annoying assertion message box. */
+ _CrtSetReportMode(_CRT_ASSERT, 0);
+#endif
+
+ /*
+ * Name of this program, used to build root of our temp directory
+ * tree.
+ */
+ progname = p = argv[0];
+ while (*p != '\0') {
+ /* Support \ or / dir separators for Windows compat. */
+ if (*p == '/' || *p == '\\')
+ progname = p + 1;
+ ++p;
+ }
+
+#ifdef PROGRAM
+ /* Get the target program from environment, if available. */
+ testprogfile = getenv(ENVBASE);
+#endif
+
+ if (getenv("TMPDIR") != NULL)
+ tmp = getenv("TMPDIR");
+ else if (getenv("TMP") != NULL)
+ tmp = getenv("TMP");
+ else if (getenv("TEMP") != NULL)
+ tmp = getenv("TEMP");
+ else if (getenv("TEMPDIR") != NULL)
+ tmp = getenv("TEMPDIR");
+ else
+ tmp = "/tmp";
+
+ /* Allow -d to be controlled through the environment. */
+ if (getenv(ENVBASE "_DEBUG") != NULL)
+ dump_on_failure = 1;
+
+ /* Get the directory holding test files from environment. */
+ refdir = getenv(ENVBASE "_TEST_FILES");
+
+ /*
+ * Parse options, without using getopt(), which isn't available
+ * on all platforms.
+ */
+ ++argv; /* Skip program name */
+ while (*argv != NULL) {
+ if (**argv != '-')
+ break;
+ p = *argv++;
+ ++p; /* Skip '-' */
+ while (*p != '\0') {
+ option = *p++;
+ option_arg = NULL;
+ /* If 'opt' takes an argument, parse that. */
+ if (option == 'p' || option == 'r') {
+ if (*p != '\0')
+ option_arg = p;
+ else if (*argv == NULL) {
+ fprintf(stderr,
+ "Option -%c requires argument.\n",
+ option);
+ usage(progname);
+ } else
+ option_arg = *argv++;
+ p = ""; /* End of this option word. */
+ }
+
+ /* Now, handle the option. */
+ switch (option) {
+ case 'd':
+ dump_on_failure = 1;
+ break;
+ case 'k':
+ keep_temp_files = 1;
+ break;
+ case 'p':
+#ifdef PROGRAM
+ testprogfile = option_arg;
+#else
+ usage(progname);
+#endif
+ break;
+ case 'q':
+ verbosity--;
+ break;
+ case 'r':
+ refdir = option_arg;
+ break;
+ case 'v':
+ verbosity++;
+ break;
+ default:
+ usage(progname);
+ }
+ }
+ }
+
+ /*
+ * Sanity-check that our options make sense.
+ */
+#ifdef PROGRAM
+ if (testprogfile == NULL)
+ usage(progname);
+ {
+ char *testprg;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Command.com sometimes rejects '/' separators. */
+ testprg = strdup(testprogfile);
+ for (i = 0; testprg[i] != '\0'; i++) {
+ if (testprg[i] == '/')
+ testprg[i] = '\\';
+ }
+ testprogfile = testprg;
+#endif
+ /* Quote the name that gets put into shell command lines. */
+ testprg = malloc(strlen(testprogfile) + 3);
+ strcpy(testprg, "\"");
+ strcat(testprg, testprogfile);
+ strcat(testprg, "\"");
+ testprog = testprg;
+ }
+#endif
+
+ /*
+ * Create a temp directory for the following tests.
+ * Include the time the tests started as part of the name,
+ * to make it easier to track the results of multiple tests.
+ */
+ now = time(NULL);
+ for (i = 0; ; i++) {
+ strftime(tmpdir_timestamp, sizeof(tmpdir_timestamp),
+ "%Y-%m-%dT%H.%M.%S",
+ localtime(&now));
+ sprintf(tmpdir, "%s/%s.%s-%03d", tmp, progname,
+ tmpdir_timestamp, i);
+ if (assertMakeDir(tmpdir,0755))
+ break;
+ if (i >= 999) {
+ fprintf(stderr,
+ "ERROR: Unable to create temp directory %s\n",
+ tmpdir);
+ exit(1);
+ }
+ }
+
+ /*
+ * If the user didn't specify a directory for locating
+ * reference files, try to find the reference files in
+ * the "usual places."
+ */
+ refdir = refdir_alloc = get_refdir(refdir);
+
+ /*
+ * Banner with basic information.
+ */
+ printf("\n");
+ printf("If tests fail or crash, details will be in:\n");
+ printf(" %s\n", tmpdir);
+ printf("\n");
+ if (verbosity > VERBOSITY_SUMMARY_ONLY) {
+ printf("Reference files will be read from: %s\n", refdir);
+#ifdef PROGRAM
+ printf("Running tests on: %s\n", testprog);
+#endif
+ printf("Exercising: ");
+ fflush(stdout);
+ printf("%s\n", EXTRA_VERSION);
+ } else {
+ printf("Running ");
+ fflush(stdout);
+ }
+
+ /*
+ * Run some or all of the individual tests.
+ */
+ if (*argv == NULL) {
+ /* Default: Run all tests. */
+ for (i = 0; i < limit; i++) {
+ if (test_run(i, tmpdir))
+ tests_failed++;
+ tests_run++;
+ }
+ } else {
+ while (*(argv) != NULL) {
+ if (**argv >= '0' && **argv <= '9') {
+ i = atoi(*argv);
+ if (i < 0 || i >= limit) {
+ printf("*** INVALID Test %s\n", *argv);
+ free(refdir_alloc);
+ usage(progname);
+ /* usage() never returns */
+ }
+ } else {
+ for (i = 0; i < limit; ++i) {
+ if (strcmp(*argv, tests[i].name) == 0)
+ break;
+ }
+ if (i >= limit) {
+ printf("*** INVALID Test ``%s''\n",
+ *argv);
+ free(refdir_alloc);
+ usage(progname);
+ /* usage() never returns */
+ }
+ }
+ if (test_run(i, tmpdir))
+ tests_failed++;
+ tests_run++;
+ argv++;
+ }
+ }
+
+ /*
+ * Report summary statistics.
+ */
+ if (verbosity > VERBOSITY_SUMMARY_ONLY) {
+ printf("\n");
+ printf("Totals:\n");
+ printf(" Tests run: %8d\n", tests_run);
+ printf(" Tests failed: %8d\n", tests_failed);
+ printf(" Assertions checked:%8d\n", assertions);
+ printf(" Assertions failed: %8d\n", failures);
+ printf(" Skips reported: %8d\n", skips);
+ }
+ if (failures) {
+ printf("\n");
+ printf("Failing tests:\n");
+ for (i = 0; i < limit; ++i) {
+ if (tests[i].failures)
+ printf(" %d: %s (%d failures)\n", i,
+ tests[i].name, tests[i].failures);
+ }
+ printf("\n");
+ printf("Details for failing tests: %s\n", tmpdir);
+ printf("\n");
+ } else {
+ if (verbosity == VERBOSITY_SUMMARY_ONLY)
+ printf("\n");
+ printf("%d tests passed, no failures\n", tests_run);
+ }
+
+ free(refdir_alloc);
+
+ /* If the final tmpdir is empty, we can remove it. */
+ /* This should be the usual case when all tests succeed. */
+ assertChdir("..");
+ rmdir(tmpdir);
+
+ return (tests_failed ? 1 : 0);
+}
diff --git a/archivers/libarchive/files/libarchive/test/read_open_memory.c b/archivers/libarchive/files/libarchive/test/read_open_memory.c
new file mode 100644
index 00000000000..e4e911c2f8b
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/read_open_memory.c
@@ -0,0 +1,167 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/read_open_memory.c 191183 2009-04-17 01:06:31Z kientzle $");
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * Read an archive from a block of memory.
+ *
+ * This is identical to archive_read_open_memory(), except
+ * that it goes out of its way to be a little bit unpleasant,
+ * in order to better test the libarchive internals.
+ */
+
+struct read_memory_data {
+ unsigned char *buffer;
+ unsigned char *end;
+ size_t read_size;
+ size_t copy_buff_size;
+ size_t copy_buff_offset;
+ char *copy_buff;
+};
+
+static int memory_read_close(struct archive *, void *);
+static int memory_read_open(struct archive *, void *);
+static off_t memory_read_skip(struct archive *, void *, off_t request);
+static ssize_t memory_read(struct archive *, void *, const void **buff);
+static int read_open_memory_internal(struct archive *a, void *buff,
+ size_t size, size_t read_size, int fullapi);
+
+
+int
+read_open_memory(struct archive *a, void *buff, size_t size, size_t read_size)
+{
+ return read_open_memory_internal(a, buff, size, read_size, 1);
+}
+
+/*
+ * As above, but don't register any optional part of the API, to verify
+ * that internals work correctly with just the minimal entry points.
+ */
+int
+read_open_memory2(struct archive *a, void *buff, size_t size, size_t read_size)
+{
+ return read_open_memory_internal(a, buff, size, read_size, 0);
+}
+
+static int
+read_open_memory_internal(struct archive *a, void *buff,
+ size_t size, size_t read_size, int fullapi)
+{
+ struct read_memory_data *mine;
+
+ mine = (struct read_memory_data *)malloc(sizeof(*mine));
+ if (mine == NULL) {
+ archive_set_error(a, ENOMEM, "No memory");
+ return (ARCHIVE_FATAL);
+ }
+ memset(mine, 0, sizeof(*mine));
+ mine->buffer = (unsigned char *)buff;
+ mine->end = mine->buffer + size;
+ mine->read_size = read_size;
+ mine->copy_buff_offset = 32;
+ mine->copy_buff_size = read_size + mine->copy_buff_offset * 2;
+ mine->copy_buff = malloc(mine->copy_buff_size);
+ memset(mine->copy_buff, 0xA5, mine->copy_buff_size);
+ if (fullapi)
+ return (archive_read_open2(a, mine, memory_read_open,
+ memory_read, memory_read_skip, memory_read_close));
+ else
+ return (archive_read_open2(a, mine, NULL,
+ memory_read, NULL, memory_read_close));
+}
+
+/*
+ * There's nothing to open.
+ */
+static int
+memory_read_open(struct archive *a, void *client_data)
+{
+ (void)a; /* UNUSED */
+ (void)client_data; /* UNUSED */
+ return (ARCHIVE_OK);
+}
+
+/*
+ * In order to exercise libarchive's internal read-combining logic,
+ * we deliberately copy data for each read to a separate buffer.
+ * That way, code that runs off the end of the provided data
+ * will screw up.
+ */
+static ssize_t
+memory_read(struct archive *a, void *client_data, const void **buff)
+{
+ struct read_memory_data *mine = (struct read_memory_data *)client_data;
+ size_t size;
+
+ (void)a; /* UNUSED */
+ size = mine->end - mine->buffer;
+ if (size > mine->read_size)
+ size = mine->read_size;
+ else
+ memset(mine->copy_buff, 0xA5, mine->copy_buff_size);
+ memcpy(mine->copy_buff + mine->copy_buff_offset, mine->buffer, size);
+ *buff = mine->copy_buff + mine->copy_buff_offset;
+
+ mine->buffer += size;
+ return ((ssize_t)size);
+}
+
+/*
+ * How mean can a skip() routine be? Let's try to find out.
+ */
+static off_t
+memory_read_skip(struct archive *a, void *client_data, off_t skip)
+{
+ struct read_memory_data *mine = (struct read_memory_data *)client_data;
+
+ (void)a; /* UNUSED */
+ /* We can't skip by more than is available. */
+ if ((off_t)skip > (off_t)(mine->end - mine->buffer))
+ skip = mine->end - mine->buffer;
+ /* Always do small skips by prime amounts. */
+ if (skip > 71)
+ skip = 71;
+ mine->buffer += skip;
+ return (skip);
+}
+
+/*
+ * Close is just cleaning up our one small bit of data.
+ */
+static int
+memory_read_close(struct archive *a, void *client_data)
+{
+ struct read_memory_data *mine = (struct read_memory_data *)client_data;
+ (void)a; /* UNUSED */
+ free(mine->copy_buff);
+ free(mine);
+ return (ARCHIVE_OK);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test.h b/archivers/libarchive/files/libarchive/test/test.h
new file mode 100644
index 00000000000..40c31e13dba
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test.h
@@ -0,0 +1,302 @@
+/*
+ * 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: head/lib/libarchive/test/test.h 201247 2009-12-30 05:59:21Z kientzle $
+ */
+
+/* Every test program should #include "test.h" as the first thing. */
+
+/*
+ * The goal of this file (and the matching test.c) is to
+ * simplify the very repetitive test-*.c test programs.
+ */
+#if defined(HAVE_CONFIG_H)
+/* Most POSIX platforms use the 'configure' script to build config.h */
+#include "config.h"
+#elif defined(__FreeBSD__)
+/* Building as part of FreeBSD system requires a pre-built config.h. */
+#include "config_freebsd.h"
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+/* Win32 can't run the 'configure' script. */
+#include "config_windows.h"
+#else
+/* Warn if the library hasn't been (automatically or manually) configured. */
+#error Oops: No config.h and no pre-built configuration in test.h.
+#endif
+
+#include <sys/types.h> /* Windows requires this before sys/stat.h */
+#include <sys/stat.h>
+
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+#ifdef HAVE_DIRECT_H
+#include <direct.h>
+#define dirent direct
+#endif
+#include <errno.h>
+#include <fcntl.h>
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <wchar.h>
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+
+/*
+ * System-specific tweaks. We really want to minimize these
+ * as much as possible, since they make it harder to understand
+ * the mainline code.
+ */
+
+/* Windows (including Visual Studio and MinGW but not Cygwin) */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#if !defined(__BORLANDC__)
+#define strdup _strdup
+#endif
+#define LOCALE_UTF8 NULL
+#else
+#define LOCALE_UTF8 "de_DE.UTF-8"
+#endif
+
+/* Visual Studio */
+#ifdef _MSC_VER
+#define snprintf sprintf_s
+#endif
+
+#if defined(__BORLANDC__)
+#pragma warn -8068 /* Constant out of range in comparison. */
+#endif
+
+/* Cygwin */
+#if defined(__CYGWIN__)
+/* Cygwin-1.7.x is lazy about populating nlinks, so don't
+ * expect it to be accurate. */
+# define NLINKS_INACCURATE_FOR_DIRS
+#endif
+
+/* Haiku OS */
+#if defined(__HAIKU__)
+/* Haiku has typedefs in stdint.h (needed for int64_t) */
+#include <stdint.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
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+/*
+ * Redefine DEFINE_TEST for use in defining the test functions.
+ */
+#undef DEFINE_TEST
+#define DEFINE_TEST(name) void name(void); void name(void)
+
+/* An implementation of the standard assert() macro */
+#define assert(e) assertion_assert(__FILE__, __LINE__, (e), #e, NULL)
+/* chdir() and error if it fails */
+#define assertChdir(path) \
+ assertion_chdir(__FILE__, __LINE__, path)
+/* Assert two integers are the same. Reports value of each one if not. */
+#define assertEqualInt(v1,v2) \
+ assertion_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
+/* Assert two strings are the same. Reports value of each one if not. */
+#define assertEqualString(v1,v2) \
+ assertion_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
+/* As above, but v1 and v2 are wchar_t * */
+#define assertEqualWString(v1,v2) \
+ assertion_equal_wstring(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
+/* As above, but raw blocks of bytes. */
+#define assertEqualMem(v1, v2, l) \
+ assertion_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL)
+/* Assert two files are the same; allow printf-style expansion of second name.
+ * See below for comments about variable arguments here...
+ */
+#define assertEqualFile \
+ assertion_setup(__FILE__, __LINE__);assertion_equal_file
+/* Assert that a file is empty; supports printf-style arguments. */
+#define assertEmptyFile \
+ assertion_setup(__FILE__, __LINE__);assertion_empty_file
+/* Assert that a file is not empty; supports printf-style arguments. */
+#define assertNonEmptyFile \
+ assertion_setup(__FILE__, __LINE__);assertion_non_empty_file
+#define assertFileAtime(pathname, sec, nsec) \
+ assertion_file_atime(__FILE__, __LINE__, pathname, sec, nsec)
+#define assertFileAtimeRecent(pathname) \
+ assertion_file_atime_recent(__FILE__, __LINE__, pathname)
+#define assertFileBirthtime(pathname, sec, nsec) \
+ assertion_file_birthtime(__FILE__, __LINE__, pathname, sec, nsec)
+#define assertFileBirthtimeRecent(pathname) \
+ assertion_file_birthtime_recent(__FILE__, __LINE__, pathname)
+/* Assert that a file exists; supports printf-style arguments. */
+#define assertFileExists \
+ assertion_setup(__FILE__, __LINE__);assertion_file_exists
+/* Assert that a file exists; supports printf-style arguments. */
+#define assertFileNotExists \
+ assertion_setup(__FILE__, __LINE__);assertion_file_not_exists
+/* Assert that file contents match a string; supports printf-style arguments. */
+#define assertFileContents \
+ assertion_setup(__FILE__, __LINE__);assertion_file_contents
+#define assertFileMtime(pathname, sec, nsec) \
+ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec)
+#define assertFileMtimeRecent(pathname) \
+ assertion_file_mtime_recent(__FILE__, __LINE__, pathname)
+#define assertFileNLinks(pathname, nlinks) \
+ assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks)
+#define assertFileSize(pathname, size) \
+ assertion_file_size(__FILE__, __LINE__, pathname, size)
+#define assertTextFileContents \
+ assertion_setup(__FILE__, __LINE__);assertion_text_file_contents
+#define assertIsDir(pathname, mode) \
+ assertion_is_dir(__FILE__, __LINE__, pathname, mode)
+#define assertIsHardlink(path1, path2) \
+ assertion_is_hardlink(__FILE__, __LINE__, path1, path2)
+#define assertIsNotHardlink(path1, path2) \
+ assertion_is_not_hardlink(__FILE__, __LINE__, path1, path2)
+#define assertIsReg(pathname, mode) \
+ assertion_is_reg(__FILE__, __LINE__, pathname, mode)
+#define assertIsSymlink(pathname, contents) \
+ assertion_is_symlink(__FILE__, __LINE__, pathname, contents)
+/* Create a directory, report error if it fails. */
+#define assertMakeDir(dirname, mode) \
+ assertion_make_dir(__FILE__, __LINE__, dirname, mode)
+#define assertMakeFile(path, mode, contents) \
+ assertion_make_file(__FILE__, __LINE__, path, mode, contents)
+#define assertMakeHardlink(newfile, oldfile) \
+ assertion_make_hardlink(__FILE__, __LINE__, newfile, oldfile)
+#define assertMakeSymlink(newfile, linkto) \
+ assertion_make_symlink(__FILE__, __LINE__, newfile, linkto)
+#define assertUmask(mask) \
+ assertion_umask(__FILE__, __LINE__, mask)
+
+/*
+ * This would be simple with C99 variadic macros, but I don't want to
+ * require that. Instead, I insert a function call before each
+ * skipping() call to pass the file and line information down. Crude,
+ * but effective.
+ */
+#define skipping \
+ assertion_setup(__FILE__, __LINE__);test_skipping
+
+/* Function declarations. These are defined in test_utility.c. */
+void failure(const char *fmt, ...);
+int assertion_assert(const char *, int, int, const char *, void *);
+int assertion_chdir(const char *, int, const char *);
+int assertion_empty_file(const char *, ...);
+int assertion_equal_file(const char *, const char *, ...);
+int assertion_equal_int(const char *, int, long long, const char *, long long, const char *, void *);
+int assertion_equal_mem(const char *, int, const void *, const char *, const void *, const char *, size_t, const char *, void *);
+int assertion_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *);
+int assertion_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *);
+int assertion_file_atime(const char *, int, const char *, long, long);
+int assertion_file_atime_recent(const char *, int, const char *);
+int assertion_file_birthtime(const char *, int, const char *, long, long);
+int assertion_file_birthtime_recent(const char *, int, const char *);
+int assertion_file_contents(const void *, int, const char *, ...);
+int assertion_file_exists(const char *, ...);
+int assertion_file_mtime(const char *, int, const char *, long, long);
+int assertion_file_mtime_recent(const char *, int, const char *);
+int assertion_file_nlinks(const char *, int, const char *, int);
+int assertion_file_not_exists(const char *, ...);
+int assertion_file_size(const char *, int, const char *, long);
+int assertion_is_dir(const char *, int, const char *, int);
+int assertion_is_hardlink(const char *, int, const char *, const char *);
+int assertion_is_not_hardlink(const char *, int, const char *, const char *);
+int assertion_is_reg(const char *, int, const char *, int);
+int assertion_is_symlink(const char *, int, const char *, const char *);
+int assertion_make_dir(const char *, int, const char *, int);
+int assertion_make_file(const char *, int, const char *, int, const char *);
+int assertion_make_hardlink(const char *, int, const char *newpath, const char *);
+int assertion_make_symlink(const char *, int, const char *newpath, const char *);
+int assertion_non_empty_file(const char *, ...);
+int assertion_text_file_contents(const char *buff, const char *f);
+int assertion_umask(const char *, int, int);
+void assertion_setup(const char *, int);
+
+void test_skipping(const char *fmt, ...);
+
+/* Like sprintf, then system() */
+int systemf(const char * fmt, ...);
+
+/* Delay until time() returns a value after this. */
+void sleepUntilAfter(time_t);
+
+/* Return true if this platform can create symlinks. */
+int canSymlink(void);
+
+/* Return true if this platform can run the "gzip" program. */
+int canGzip(void);
+
+/* Return true if this platform can run the "gunzip" program. */
+int canGunzip(void);
+
+/* Suck file into string allocated via malloc(). Call free() when done. */
+/* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */
+char *slurpfile(size_t *, const char *fmt, ...);
+
+/* Extracts named reference file to the current directory. */
+void extract_reference_file(const char *);
+
+/*
+ * Special interfaces for libarchive test harness.
+ */
+
+#include "archive.h"
+#include "archive_entry.h"
+
+/* Special customized read-from-memory interface. */
+int read_open_memory(struct archive *, void *, size_t, size_t);
+/* "2" version exercises a slightly different set of libarchive APIs. */
+int read_open_memory2(struct archive *, void *, size_t, size_t);
+
+/* Versions of above that accept an archive argument for additional info. */
+#define assertA(e) assertion_assert(__FILE__, __LINE__, (e), #e, (a))
+#define assertEqualIntA(a,v1,v2) \
+ assertion_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a))
+#define assertEqualStringA(a,v1,v2) \
+ assertion_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (a))
+
+#ifdef USE_DMALLOC
+#include <dmalloc.h>
+#endif
diff --git a/archivers/libarchive/files/libarchive/test/test_acl_basic.c b/archivers/libarchive/files/libarchive/test/test_acl_basic.c
new file mode 100644
index 00000000000..f66014cdd31
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_acl_basic.c
@@ -0,0 +1,229 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_acl_basic.c,v 1.6 2008/10/19 00:13:57 kientzle Exp $");
+
+/*
+ * Exercise the system-independent portion of the ACL support.
+ * Check that archive_entry objects can save and restore ACL data.
+ *
+ * This should work on all systems, regardless of whether local
+ * filesystems support ACLs or not.
+ */
+
+struct acl_t {
+ int type; /* Type of ACL: "access" or "default" */
+ int permset; /* Permissions for this class of users. */
+ int tag; /* Owner, User, Owning group, group, other, etc. */
+ int qual; /* GID or UID of user/group, depending on tag. */
+ const char *name; /* Name of user/group, depending on tag. */
+};
+
+static struct acl_t acls0[] = {
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE,
+ ARCHIVE_ENTRY_ACL_USER_OBJ, 0, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
+ ARCHIVE_ENTRY_ACL_GROUP_OBJ, 0, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_WRITE,
+ ARCHIVE_ENTRY_ACL_OTHER, 0, "" },
+};
+
+static struct acl_t acls1[] = {
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE,
+ ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
+ ARCHIVE_ENTRY_ACL_USER, 77, "user77" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
+ ARCHIVE_ENTRY_ACL_GROUP_OBJ, -1, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_WRITE,
+ ARCHIVE_ENTRY_ACL_OTHER, -1, "" },
+};
+
+static struct acl_t acls2[] = {
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE | ARCHIVE_ENTRY_ACL_READ,
+ ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
+ ARCHIVE_ENTRY_ACL_USER, 77, "user77" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0,
+ ARCHIVE_ENTRY_ACL_USER, 78, "user78" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
+ ARCHIVE_ENTRY_ACL_GROUP_OBJ, -1, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0007,
+ ARCHIVE_ENTRY_ACL_GROUP, 78, "group78" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_WRITE | ARCHIVE_ENTRY_ACL_EXECUTE,
+ ARCHIVE_ENTRY_ACL_OTHER, -1, "" },
+};
+
+static void
+set_acls(struct archive_entry *ae, struct acl_t *acls, int n)
+{
+ int i;
+
+ archive_entry_acl_clear(ae);
+ for (i = 0; i < n; i++) {
+ archive_entry_acl_add_entry(ae,
+ acls[i].type, acls[i].permset, acls[i].tag, acls[i].qual,
+ acls[i].name);
+ }
+}
+
+static int
+acl_match(struct acl_t *acl, int type, int permset, int tag, int qual, const char *name)
+{
+ if (type != acl->type)
+ return (0);
+ if (permset != acl->permset)
+ return (0);
+ if (tag != acl->tag)
+ return (0);
+ if (tag == ARCHIVE_ENTRY_ACL_USER_OBJ)
+ return (1);
+ if (tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ)
+ return (1);
+ if (tag == ARCHIVE_ENTRY_ACL_OTHER)
+ return (1);
+ if (qual != acl->qual)
+ return (0);
+ if (name == NULL) {
+ if (acl->name == NULL || acl->name[0] == '\0')
+ return (1);
+ }
+ if (acl->name == NULL) {
+ if (name[0] == '\0')
+ return (1);
+ }
+ return (0 == strcmp(name, acl->name));
+}
+
+static void
+compare_acls(struct archive_entry *ae, struct acl_t *acls, int n, int mode)
+{
+ int *marker = malloc(sizeof(marker[0]) * n);
+ int i;
+ int r;
+ int type, permset, tag, qual;
+ int matched;
+ const char *name;
+
+ for (i = 0; i < n; i++)
+ marker[i] = i;
+
+ while (0 == (r = archive_entry_acl_next(ae,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ &type, &permset, &tag, &qual, &name))) {
+ for (i = 0, matched = 0; i < n && !matched; i++) {
+ if (acl_match(&acls[marker[i]], type, permset,
+ tag, qual, name)) {
+ /* We found a match; remove it. */
+ marker[i] = marker[n - 1];
+ n--;
+ matched = 1;
+ }
+ }
+ if (tag == ARCHIVE_ENTRY_ACL_USER_OBJ) {
+ if (!matched) printf("No match for user_obj perm\n");
+ failure("USER_OBJ permset (%02o) != user mode (%02o)",
+ permset, 07 & (mode >> 6));
+ assert((permset << 6) == (mode & 0700));
+ } else if (tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ) {
+ if (!matched) printf("No match for group_obj perm\n");
+ failure("GROUP_OBJ permset %02o != group mode %02o",
+ permset, 07 & (mode >> 3));
+ assert((permset << 3) == (mode & 0070));
+ } else if (tag == ARCHIVE_ENTRY_ACL_OTHER) {
+ if (!matched) printf("No match for other perm\n");
+ failure("OTHER permset (%02o) != other mode (%02o)",
+ permset, mode & 07);
+ assert((permset << 0) == (mode & 0007));
+ } else {
+ failure("Could not find match for ACL "
+ "(type=%d,permset=%d,tag=%d,qual=%d,name=``%s'')",
+ type, permset, tag, qual, name);
+ assert(matched == 1);
+ }
+ }
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ /* Known broken before 1.9.0. */
+ skipping("archive_entry_acl_next() exits with ARCHIVE_EOF");
+#else
+ assertEqualInt(ARCHIVE_EOF, r);
+#endif
+ assert((mode & 0777) == (archive_entry_mode(ae) & 0777));
+ failure("Could not find match for ACL "
+ "(type=%d,permset=%d,tag=%d,qual=%d,name=``%s'')",
+ acls[marker[0]].type, acls[marker[0]].permset,
+ acls[marker[0]].tag, acls[marker[0]].qual, acls[marker[0]].name);
+ assert(n == 0); /* Number of ACLs not matched should == 0 */
+ free(marker);
+}
+
+DEFINE_TEST(test_acl_basic)
+{
+ struct archive_entry *ae;
+
+ /* Create a simple archive_entry. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_set_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0777);
+
+ /* Basic owner/owning group should just update mode bits. */
+ set_acls(ae, acls0, sizeof(acls0)/sizeof(acls0[0]));
+ failure("Basic ACLs shouldn't be stored as extended ACLs");
+ assert(0 == archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS));
+ failure("Basic ACLs should set mode to 0142, not %04o",
+ archive_entry_mode(ae)&0777);
+ assert((archive_entry_mode(ae) & 0777) == 0142);
+
+
+ /* With any extended ACL entry, we should read back a full set. */
+ set_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]));
+ failure("One extended ACL should flag all ACLs to be returned.");
+ assert(4 == archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS));
+ compare_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]), 0142);
+ failure("Basic ACLs should set mode to 0142, not %04o",
+ archive_entry_mode(ae)&0777);
+ assert((archive_entry_mode(ae) & 0777) == 0142);
+
+
+ /* A more extensive set of ACLs. */
+ set_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]));
+ assertEqualInt(6, archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS));
+ compare_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]), 0543);
+ failure("Basic ACLs should set mode to 0543, not %04o",
+ archive_entry_mode(ae)&0777);
+ assert((archive_entry_mode(ae) & 0777) == 0543);
+
+ /*
+ * Check that clearing ACLs gets rid of them all by repeating
+ * the first test.
+ */
+ set_acls(ae, acls0, sizeof(acls0)/sizeof(acls0[0]));
+ failure("Basic ACLs shouldn't be stored as extended ACLs");
+ assert(0 == archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS));
+ failure("Basic ACLs should set mode to 0142, not %04o",
+ archive_entry_mode(ae)&0777);
+ assert((archive_entry_mode(ae) & 0777) == 0142);
+ archive_entry_free(ae);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_acl_pax.c b/archivers/libarchive/files/libarchive/test/test_acl_pax.c
new file mode 100644
index 00000000000..1f0468ca115
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_acl_pax.c
@@ -0,0 +1,517 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_acl_pax.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+/*
+ * Exercise the system-independent portion of the ACL support.
+ * Check that pax archive can save and restore ACL data.
+ *
+ * This should work on all systems, regardless of whether local
+ * filesystems support ACLs or not.
+ */
+
+static unsigned char buff[16384];
+
+static unsigned char reference[] = {
+'P','a','x','H','e','a','d','e','r','/','f','i','l','e',0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,'0','0','0','1','4','2',' ',0,'0','0','0','0','0','0',' ',0,'0','0',
+'0','0','0','0',' ',0,'0','0','0','0','0','0','0','0','0','6','2',' ','0',
+'0','0','0','0','0','0','0','0','0','0',' ','0','1','1','7','6','7',0,' ',
+'x',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r',
+0,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0','0',
+'0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,'1','6',' ','S','C','H','I','L','Y','.','d','e','v','=','0',10,
+'1','6',' ','S','C','H','I','L','Y','.','i','n','o','=','0',10,'1','8',' ',
+'S','C','H','I','L','Y','.','n','l','i','n','k','=','0',10,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,'f','i','l','e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,'0','0','0','1','4','2',' ',0,'0','0','0','0','0','0',' ',0,'0','0',
+'0','0','0','0',' ',0,'0','0','0','0','0','0','0','0','0','0','0',' ','0',
+'0','0','0','0','0','0','0','0','0','0',' ','0','1','0','0','0','6',0,' ',
+'0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r',
+0,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0','0',
+'0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,'P','a','x','H','e','a','d','e','r','/','f','i','l','e',0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,'0','0','0','1','4','2',' ',0,'0','0','0','0','0','0',' ',
+0,'0','0','0','0','0','0',' ',0,'0','0','0','0','0','0','0','0','1','7','2',
+' ','0','0','0','0','0','0','0','0','0','0','0',' ','0','1','1','7','7','1',
+0,' ','x',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t',
+'a','r',0,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0',
+'0','0','0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,'7','2',' ','S','C','H','I','L','Y','.','a','c','l','.',
+'a','c','c','e','s','s','=','u','s','e','r',':',':','-','-','x',',','g','r',
+'o','u','p',':',':','r','-','-',',','o','t','h','e','r',':',':','-','w','-',
+',','u','s','e','r',':','u','s','e','r','7','7',':','r','-','-',':','7','7',
+10,'1','6',' ','S','C','H','I','L','Y','.','d','e','v','=','0',10,'1','6',
+' ','S','C','H','I','L','Y','.','i','n','o','=','0',10,'1','8',' ','S','C',
+'H','I','L','Y','.','n','l','i','n','k','=','0',10,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,'f','i','l','e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,'0','0','0','1','4','2',' ',0,'0','0','0','0','0','0',' ',0,'0','0','0',
+'0','0','0',' ',0,'0','0','0','0','0','0','0','0','0','0','0',' ','0','0',
+'0','0','0','0','0','0','0','0','0',' ','0','1','0','0','0','6',0,' ','0',
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r',0,
+'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0','0',
+'0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,'P','a','x','H','e','a','d','e','r','/','f','i','l','e',0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,'0','0','0','5','4','3',' ',0,'0','0','0','0','0','0',' ',
+0,'0','0','0','0','0','0',' ',0,'0','0','0','0','0','0','0','0','2','4','3',
+' ','0','0','0','0','0','0','0','0','0','0','0',' ','0','1','1','7','7','5',
+0,' ','x',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t',
+'a','r',0,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0',
+'0','0','0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,'1','1','3',' ','S','C','H','I','L','Y','.','a','c','l',
+'.','a','c','c','e','s','s','=','u','s','e','r',':',':','r','-','x',',','g',
+'r','o','u','p',':',':','r','-','-',',','o','t','h','e','r',':',':','-','w',
+'x',',','u','s','e','r',':','u','s','e','r','7','7',':','r','-','-',':','7',
+'7',',','u','s','e','r',':','u','s','e','r','7','8',':','-','-','-',':','7',
+'8',',','g','r','o','u','p',':','g','r','o','u','p','7','8',':','r','w','x',
+':','7','8',10,'1','6',' ','S','C','H','I','L','Y','.','d','e','v','=','0',
+10,'1','6',' ','S','C','H','I','L','Y','.','i','n','o','=','0',10,'1','8',
+' ','S','C','H','I','L','Y','.','n','l','i','n','k','=','0',10,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,'f','i','l','e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,'0','0','0','5','4','3',' ',0,'0','0','0','0','0','0',' ',0,'0','0',
+'0','0','0','0',' ',0,'0','0','0','0','0','0','0','0','0','0','0',' ','0',
+'0','0','0','0','0','0','0','0','0','0',' ','0','1','0','0','1','3',0,' ',
+'0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r',
+0,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0','0',
+'0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,'P','a','x','H','e','a','d','e','r','/','f','i','l','e',0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,'0','0','0','1','4','2',' ',0,'0','0','0','0','0','0',' ',
+0,'0','0','0','0','0','0',' ',0,'0','0','0','0','0','0','0','0','0','6','2',
+' ','0','0','0','0','0','0','0','0','0','0','0',' ','0','1','1','7','6','7',
+0,' ','x',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t',
+'a','r',0,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0',
+'0','0','0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,'1','6',' ','S','C','H','I','L','Y','.','d','e','v','=',
+'0',10,'1','6',' ','S','C','H','I','L','Y','.','i','n','o','=','0',10,'1',
+'8',' ','S','C','H','I','L','Y','.','n','l','i','n','k','=','0',10,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'f','i','l','e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,'0','0','0','1','4','2',' ',0,'0','0','0','0','0','0',' ',
+0,'0','0','0','0','0','0',' ',0,'0','0','0','0','0','0','0','0','0','0','0',
+' ','0','0','0','0','0','0','0','0','0','0','0',' ','0','1','0','0','0','6',
+0,' ','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t',
+'a','r',0,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0',
+'0','0','0','0','0',' ',0,'0','0','0','0','0','0',' ',0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+
+
+struct acl_t {
+ int type; /* Type of ACL: "access" or "default" */
+ int permset; /* Permissions for this class of users. */
+ int tag; /* Owner, User, Owning group, group, other, etc. */
+ int qual; /* GID or UID of user/group, depending on tag. */
+ const char *name; /* Name of user/group, depending on tag. */
+};
+
+static struct acl_t acls0[] = {
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE,
+ ARCHIVE_ENTRY_ACL_USER_OBJ, 0, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
+ ARCHIVE_ENTRY_ACL_GROUP_OBJ, 0, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_WRITE,
+ ARCHIVE_ENTRY_ACL_OTHER, 0, "" },
+};
+
+static struct acl_t acls1[] = {
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE,
+ ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
+ ARCHIVE_ENTRY_ACL_USER, 77, "user77" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
+ ARCHIVE_ENTRY_ACL_GROUP_OBJ, -1, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_WRITE,
+ ARCHIVE_ENTRY_ACL_OTHER, -1, "" },
+};
+
+static struct acl_t acls2[] = {
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE | ARCHIVE_ENTRY_ACL_READ,
+ ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
+ ARCHIVE_ENTRY_ACL_USER, 77, "user77" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0,
+ ARCHIVE_ENTRY_ACL_USER, 78, "user78" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
+ ARCHIVE_ENTRY_ACL_GROUP_OBJ, -1, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0007,
+ ARCHIVE_ENTRY_ACL_GROUP, 78, "group78" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_WRITE | ARCHIVE_ENTRY_ACL_EXECUTE,
+ ARCHIVE_ENTRY_ACL_OTHER, -1, "" },
+};
+
+static void
+set_acls(struct archive_entry *ae, struct acl_t *acls, int n)
+{
+ int i;
+
+ archive_entry_acl_clear(ae);
+ for (i = 0; i < n; i++) {
+ archive_entry_acl_add_entry(ae,
+ acls[i].type, acls[i].permset, acls[i].tag, acls[i].qual,
+ acls[i].name);
+ }
+}
+
+static int
+acl_match(struct acl_t *acl, int type, int permset, int tag, int qual, const char *name)
+{
+ if (type != acl->type)
+ return (0);
+ if (permset != acl->permset)
+ return (0);
+ if (tag != acl->tag)
+ return (0);
+ if (tag == ARCHIVE_ENTRY_ACL_USER_OBJ)
+ return (1);
+ if (tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ)
+ return (1);
+ if (tag == ARCHIVE_ENTRY_ACL_OTHER)
+ return (1);
+ if (qual != acl->qual)
+ return (0);
+ if (name == NULL)
+ return (acl->name == NULL || acl->name[0] == '\0');
+ if (acl->name == NULL)
+ return (name == NULL || name[0] == '\0');
+ return (0 == strcmp(name, acl->name));
+}
+
+static void
+compare_acls(struct archive_entry *ae, struct acl_t *acls, int n, int mode)
+{
+ int *marker = malloc(sizeof(marker[0]) * n);
+ int i;
+ int r;
+ int type, permset, tag, qual;
+ int matched;
+ const char *name;
+
+ for (i = 0; i < n; i++)
+ marker[i] = i;
+
+ while (0 == (r = archive_entry_acl_next(ae,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ &type, &permset, &tag, &qual, &name))) {
+ for (i = 0, matched = 0; i < n && !matched; i++) {
+ if (acl_match(&acls[marker[i]], type, permset,
+ tag, qual, name)) {
+ /* We found a match; remove it. */
+ marker[i] = marker[n - 1];
+ n--;
+ matched = 1;
+ }
+ }
+ if (tag == ARCHIVE_ENTRY_ACL_USER_OBJ) {
+ if (!matched) printf("No match for user_obj perm\n");
+ failure("USER_OBJ permset (%02o) != user mode (%02o)",
+ permset, 07 & (mode >> 6));
+ assert((permset << 6) == (mode & 0700));
+ } else if (tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ) {
+ if (!matched) printf("No match for group_obj perm\n");
+ failure("GROUP_OBJ permset %02o != group mode %02o",
+ permset, 07 & (mode >> 3));
+ assert((permset << 3) == (mode & 0070));
+ } else if (tag == ARCHIVE_ENTRY_ACL_OTHER) {
+ if (!matched) printf("No match for other perm\n");
+ failure("OTHER permset (%02o) != other mode (%02o)",
+ permset, mode & 07);
+ assert((permset << 0) == (mode & 0007));
+ } else {
+ failure("Could not find match for ACL "
+ "(type=%d,permset=%d,tag=%d,qual=%d,name=``%s'')",
+ type, permset, tag, qual, name);
+ assert(matched == 1);
+ }
+ }
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ /* Known broken before 1.9.0. */
+ skipping("archive_entry_acl_next() exits with ARCHIVE_EOF");
+#else
+ assertEqualInt(ARCHIVE_EOF, r);
+#endif
+ assert((mode & 0777) == (archive_entry_mode(ae) & 0777));
+ failure("Could not find match for ACL "
+ "(type=%d,permset=%d,tag=%d,qual=%d,name=``%s'')",
+ acls[marker[0]].type, acls[marker[0]].permset,
+ acls[marker[0]].tag, acls[marker[0]].qual, acls[marker[0]].name);
+ assert(n == 0); /* Number of ACLs not matched should == 0 */
+ free(marker);
+}
+
+DEFINE_TEST(test_acl_pax)
+{
+ struct archive *a;
+ struct archive_entry *ae;
+ size_t used;
+ FILE *f;
+
+ /* Write an archive to memory. */
+ assert(NULL != (a = archive_write_new()));
+ assertA(0 == archive_write_set_format_pax(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ assertA(0 == archive_write_set_bytes_per_block(a, 1));
+ assertA(0 == archive_write_set_bytes_in_last_block(a, 1));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+ /* Write a series of files to the archive with different ACL info. */
+
+ /* Create a simple archive_entry. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_set_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0777);
+
+ /* Basic owner/owning group should just update mode bits. */
+ set_acls(ae, acls0, sizeof(acls0)/sizeof(acls0[0]));
+ assertA(0 == archive_write_header(a, ae));
+
+ /* With any extended ACL entry, we should read back a full set. */
+ set_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]));
+ assertA(0 == archive_write_header(a, ae));
+
+
+ /* A more extensive set of ACLs. */
+ set_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]));
+ assertA(0 == archive_write_header(a, ae));
+
+ /*
+ * Check that clearing ACLs gets rid of them all by repeating
+ * the first test.
+ */
+ set_acls(ae, acls0, sizeof(acls0)/sizeof(acls0[0]));
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertA(0 == archive_write_finish(a));
+#endif
+
+ /* Write out the data we generated to a file for manual inspection. */
+ assert(NULL != (f = fopen("testout", "wb")));
+ assertEqualInt(used, (size_t)fwrite(buff, 1, (unsigned int)used, f));
+ fclose(f);
+
+ /* Write out the reference data to a file for manual inspection. */
+ assert(NULL != (f = fopen("reference", "wb")));
+ assert(sizeof(reference) == fwrite(reference, 1, sizeof(reference), f));
+ fclose(f);
+
+ /* Assert that the generated data matches the built-in reference data.*/
+ failure("Generated pax archive does not match reference; check 'testout' and 'reference' files.");
+ assertEqualMem(buff, reference, sizeof(reference));
+ failure("Generated pax archive does not match reference; check 'testout' and 'reference' files.");
+ assertEqualInt((int)used, sizeof(reference));
+
+ /* Read back each entry and check that the ACL data is right. */
+ assert(NULL != (a = archive_read_new()));
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff, used));
+
+ /* First item has no ACLs */
+ assertA(0 == archive_read_next_header(a, &ae));
+ failure("Basic ACLs shouldn't be stored as extended ACLs");
+ assert(0 == archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS));
+ failure("Basic ACLs should set mode to 0142, not %04o",
+ archive_entry_mode(ae)&0777);
+ assert((archive_entry_mode(ae) & 0777) == 0142);
+
+ /* Second item has a few ACLs */
+ assertA(0 == archive_read_next_header(a, &ae));
+ failure("One extended ACL should flag all ACLs to be returned.");
+ assert(4 == archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS));
+ compare_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]), 0142);
+ failure("Basic ACLs should set mode to 0142, not %04o",
+ archive_entry_mode(ae)&0777);
+ assert((archive_entry_mode(ae) & 0777) == 0142);
+
+ /* Third item has pretty extensive ACLs */
+ assertA(0 == archive_read_next_header(a, &ae));
+ assertEqualInt(6, archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS));
+ compare_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]), 0543);
+ failure("Basic ACLs should set mode to 0543, not %04o",
+ archive_entry_mode(ae)&0777);
+ assert((archive_entry_mode(ae) & 0777) == 0543);
+
+ /* Fourth item has no ACLs */
+ assertA(0 == archive_read_next_header(a, &ae));
+ failure("Basic ACLs shouldn't be stored as extended ACLs");
+ assert(0 == archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_ACCESS));
+ failure("Basic ACLs should set mode to 0142, not %04o",
+ archive_entry_mode(ae)&0777);
+ assert((archive_entry_mode(ae) & 0777) == 0142);
+
+ /* Close the archive. */
+ assertA(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assertA(0 == archive_read_finish(a));
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_archive_api_feature.c b/archivers/libarchive/files/libarchive/test/test_archive_api_feature.c
new file mode 100644
index 00000000000..23a7083c07f
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_archive_api_feature.c
@@ -0,0 +1,76 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_archive_api_feature.c,v 1.5 2008/05/26 17:00:24 kientzle Exp $");
+
+DEFINE_TEST(test_archive_api_feature)
+{
+ char buff[128];
+ const char *p;
+
+ /* This is the (hopefully) final versioning API. */
+ assertEqualInt(ARCHIVE_VERSION_NUMBER, archive_version_number());
+ sprintf(buff, "libarchive %d.%d.%d",
+ archive_version_number() / 1000000,
+ (archive_version_number() / 1000) % 1000,
+ archive_version_number() % 1000);
+ failure("Version string is: %s, computed is: %s",
+ archive_version_string(), buff);
+ assert(memcmp(buff, archive_version_string(), strlen(buff)) == 0);
+ if (strlen(buff) < strlen(archive_version_string())) {
+ p = archive_version_string() + strlen(buff);
+ failure("Version string is: %s", archive_version_string());
+ assert(*p == 'a' || *p == 'b' || *p == 'c' || *p == 'd');
+ ++p;
+ failure("Version string is: %s", archive_version_string());
+ assert(*p == '\0');
+ }
+
+/* This is all scheduled to disappear in libarchive 3.0 */
+#if ARCHIVE_VERSION_NUMBER < 3000000
+ assertEqualInt(ARCHIVE_VERSION_STAMP, ARCHIVE_VERSION_NUMBER);
+ assertEqualInt(ARCHIVE_API_FEATURE, archive_api_feature());
+ assertEqualInt(ARCHIVE_API_VERSION, archive_api_version());
+ /*
+ * Even though ARCHIVE_VERSION_STAMP only appears in
+ * archive.h after 1.9.0 and 2.2.3, the macro is synthesized
+ * in test.h, so this test is always valid.
+ */
+ assertEqualInt(ARCHIVE_VERSION_STAMP / 1000, ARCHIVE_API_VERSION * 1000 + ARCHIVE_API_FEATURE);
+ /*
+ * The function, however, isn't always available. It appeared
+ * sometime in the middle of 2.2.3, but the synthesized value
+ * never has a release version, so the following conditional
+ * exactly determines whether the current library has the
+ * function.
+ */
+#if ARCHIVE_VERSION_STAMP / 1000 == 1009 || ARCHIVE_VERSION_STAMP > 2002000
+ assertEqualInt(ARCHIVE_VERSION_STAMP, archive_version_stamp());
+#else
+ skipping("archive_version_stamp()");
+#endif
+ assertEqualString(ARCHIVE_LIBRARY_VERSION, archive_version());
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_bad_fd.c b/archivers/libarchive/files/libarchive/test/test_bad_fd.c
new file mode 100644
index 00000000000..3ea7daacf2e
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_bad_fd.c
@@ -0,0 +1,41 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_bad_fd.c,v 1.2 2008/09/01 05:38:33 kientzle Exp $");
+
+/* Verify that attempting to open an invalid fd returns correct error. */
+DEFINE_TEST(test_bad_fd)
+{
+ struct archive *a;
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(ARCHIVE_FATAL == archive_read_open_fd(a, -1, 1024));
+ assertA(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assertA(0 == archive_read_finish(a));
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_compat_gtar.c b/archivers/libarchive/files/libarchive/test/test_compat_gtar.c
new file mode 100644
index 00000000000..c0a69598e98
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_compat_gtar.c
@@ -0,0 +1,119 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_compat_gtar.c 189308 2009-03-03 17:02:51Z kientzle $");
+
+/*
+ * Verify our ability to read sample files created by GNU tar.
+ * It should be easy to add any new sample files sent in by users
+ * to this collection of tests.
+ */
+
+/* Copy this function for each test file and adjust it accordingly. */
+
+/*
+ * test_compat_gtar_1.tgz exercises reading long filenames and
+ * symlink targets stored in the GNU tar format.
+ */
+static void
+test_compat_gtar_1(void)
+{
+ char name[] = "test_compat_gtar_1.tar";
+ struct archive_entry *ae;
+ struct archive *a;
+ int r;
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+ extract_reference_file(name);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240));
+
+ /* Read first entry. */
+ assertEqualIntA(a, ARCHIVE_OK, r = archive_read_next_header(a, &ae));
+ if (r != ARCHIVE_OK) {
+ archive_read_finish(a);
+ return;
+ }
+ assertEqualString(
+ "12345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890",
+ archive_entry_pathname(ae));
+ assertEqualInt(1197179003, archive_entry_mtime(ae));
+ assertEqualInt(1000, archive_entry_uid(ae));
+ assertEqualString("tim", archive_entry_uname(ae));
+ assertEqualInt(1000, archive_entry_gid(ae));
+ assertEqualString("tim", archive_entry_gname(ae));
+ assertEqualInt(0100644, archive_entry_mode(ae));
+
+ /* Read second entry. */
+ assertEqualIntA(a, ARCHIVE_OK, r = archive_read_next_header(a, &ae));
+ if (r != ARCHIVE_OK) {
+ archive_read_finish(a);
+ return;
+ }
+ assertEqualString(
+ "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij"
+ "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij"
+ "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij"
+ "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij",
+ archive_entry_pathname(ae));
+ assertEqualString(
+ "12345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890"
+ "12345678901234567890123456789012345678901234567890",
+ archive_entry_symlink(ae));
+ assertEqualInt(1197179043, archive_entry_mtime(ae));
+ assertEqualInt(1000, archive_entry_uid(ae));
+ assertEqualString("tim", archive_entry_uname(ae));
+ assertEqualInt(1000, archive_entry_gid(ae));
+ assertEqualString("tim", archive_entry_gname(ae));
+ assertEqualInt(0120755, archive_entry_mode(ae));
+
+ /* Verify the end-of-archive. */
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+
+ /* Verify that the format detection worked. */
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_GNUTAR);
+
+ assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+#endif
+}
+
+
+DEFINE_TEST(test_compat_gtar)
+{
+ test_compat_gtar_1();
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink.c b/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink.c
new file mode 100644
index 00000000000..30785d1fb0c
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink.c
@@ -0,0 +1,108 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_compat_tar_hardlink.c,v 1.3 2008/08/11 01:19:36 kientzle Exp $");
+
+/*
+ * Background: There are two written standards for the tar file format.
+ * The first is the POSIX 1988 "ustar" format, the second is the 2001
+ * "pax extended" format that builds on the "ustar" format by adding
+ * support for generic additional attributes. Buried in the details
+ * is one frustrating incompatibility: The 1988 standard says that
+ * tar readers MUST ignore the size field on hardlink entries; the
+ * 2001 standard says that tar readers MUST obey the size field on
+ * hardlink entries. libarchive tries to navigate this particular
+ * minefield by using auto-detect logic to guess whether it should
+ * or should not obey the size field.
+ *
+ * This test tries to probe the boundaries of such handling; the test
+ * archives here were adapted from real archives created by real
+ * tar implementations that are (as of early 2008) apparently still
+ * in use.
+ */
+
+static void
+test_compat_tar_hardlink_1(void)
+{
+ char name[] = "test_compat_tar_hardlink_1.tar";
+ struct archive_entry *ae;
+ struct archive *a;
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+ extract_reference_file(name);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240));
+
+ /* Read first entry, which is a regular file. */
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString("xmcd-3.3.2/docs_d/READMf",
+ archive_entry_pathname(ae));
+ assertEqualString(NULL, archive_entry_hardlink(ae));
+ assertEqualInt(321, archive_entry_size(ae));
+ assertEqualInt(1082575645, archive_entry_mtime(ae));
+ assertEqualInt(1851, archive_entry_uid(ae));
+ assertEqualInt(3, archive_entry_gid(ae));
+ assertEqualInt(0100444, archive_entry_mode(ae));
+
+ /* Read second entry, which is a hard link at the end of archive. */
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString("xmcd-3.3.2/README",
+ archive_entry_pathname(ae));
+ assertEqualString(
+ "xmcd-3.3.2/docs_d/READMf",
+ archive_entry_hardlink(ae));
+ assertEqualInt(0, archive_entry_size(ae));
+ assertEqualInt(1082575645, archive_entry_mtime(ae));
+ assertEqualInt(1851, archive_entry_uid(ae));
+ assertEqualInt(3, archive_entry_gid(ae));
+ assertEqualInt(0100444, archive_entry_mode(ae));
+
+ /* Verify the end-of-archive. */
+ /*
+ * This failed in libarchive 2.4.12 because the tar reader
+ * tried to obey the size field for the hard link and ended
+ * up running past the end of the file.
+ */
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+
+ /* Verify that the format detection worked. */
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR);
+
+ assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+#endif
+}
+
+DEFINE_TEST(test_compat_tar_hardlink)
+{
+ test_compat_tar_hardlink_1();
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink_1.tar.uu b/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink_1.tar.uu
new file mode 100644
index 00000000000..95dba54c256
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_compat_tar_hardlink_1.tar.uu
@@ -0,0 +1,39 @@
+$FreeBSD: src/lib/libarchive/test/test_compat_tar_hardlink_1.tar.uu,v 1.1 2008/01/31 07:47:38 kientzle Exp $
+begin 644 test_compat_tar_hardlink_1.tar
+M>&UC9"TS+C,N,B]D;V-S7V0O4D5!1$UF````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````"`@(#0T-"``("`S-#<S(``@("`@(#,@`"`@("`@("`@-3`Q
+M(#$P,#0Q-30U-#,U("`@-S8U-``@````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````!X>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX
+M>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX
+M>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX
+M>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX
+M>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX
+M>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX
+M>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'AX
+M>'AX>'AX>'AX>'AX>'AX>'AX>'AX>'@`````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````'AM8V0M,RXS+C(O
+M4D5!1$U%````````````````````````````````````````````````````
+M```````````````````````````````````````````````````````````@
+M("`T-#0@`"`@,S0W,R``("`@("`S(``@("`@("`@(#4P,2`Q,#`T,34T-30S
+M-2`@,3(R,#<`(#%X;6-D+3,N,RXR+V1O8W-?9"]214%$368`````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+&````````
+`
+end
diff --git a/archivers/libarchive/files/libarchive/test/test_compat_zip.c b/archivers/libarchive/files/libarchive/test/test_compat_zip.c
new file mode 100644
index 00000000000..d8bc4de3608
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_compat_zip.c
@@ -0,0 +1,80 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_compat_zip.c 196962 2009-09-08 05:02:41Z kientzle $");
+
+/* Copy this function for each test file and adjust it accordingly. */
+static void
+test_compat_zip_1(void)
+{
+ char name[] = "test_compat_zip_1.zip";
+ struct archive_entry *ae;
+ struct archive *a;
+ int r;
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a));
+ extract_reference_file(name);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240));
+
+ /* Read first entry. */
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString("META-INF/MANIFEST.MF", archive_entry_pathname(ae));
+
+ /* Read second entry. */
+ r = archive_read_next_header(a, &ae);
+ if (r != ARCHIVE_OK) {
+ if (strcmp(archive_error_string(a),
+ "libarchive compiled without deflate support (no libz)") == 0) {
+ skipping("Skipping ZIP compression check: %s",
+ archive_error_string(a));
+ goto finish;
+ }
+ }
+ assertEqualIntA(a, ARCHIVE_OK, r);
+ assertEqualString("tmp.class", archive_entry_pathname(ae));
+
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ZIP);
+
+ assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+finish:
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+#endif
+}
+
+
+DEFINE_TEST(test_compat_zip)
+{
+ test_compat_zip_1();
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_compat_zip_1.zip.uu b/archivers/libarchive/files/libarchive/test/test_compat_zip_1.zip.uu
new file mode 100644
index 00000000000..29cdf96b029
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_compat_zip_1.zip.uu
@@ -0,0 +1,15 @@
+$FreeBSD: src/lib/libarchive/test/test_compat_zip_1.zip.uu,v 1.2 2008/06/30 15:49:12 des Exp $
+begin 644 test_compat_zip_1.zip
+M4$L#!!0`"``(``B$@S<````````````````4````345402U)3D8O34%.249%
+M4U0N34;S3<S+3$LM+M$-2RTJSLS/LU(PU#/@Y7+,0Q)Q+$A,SDA5`(H!)<U!
+MTLY%J8DEJ2FZ3I56"BF9B4DY^;J&>J9Z!O$&YKI)!H8*&L&E>0J^F<E%^<65
+MQ26IN<4*GGG)>IJ\7+Q<`%!+!PAHTY\490```'$```!02P,$%``(``@`"(2#
+M-P````````````````D```!T;7`N8VQA<W,[]6_7/@8&!D,&+G8&#G8&3BX&
+M1@86'@8V!E9&!F8-S3!&!C:;S+S,$CN@L'-^2BHC@T!68EFB?DYB7KJ^?U)6
+M:G()4&%);@&#(@,34"\(,`(AT``@R0[D"8+Y#`RL6ML9F#>"%3```%!+!P@+
+M(*8V:````'8```!02P$"%``4``@`"``(A(,W:-.?%&4```!Q````%```````
+M````````````````345402U)3D8O34%.249%4U0N34902P$"%``4``@`"``(
+MA(,W"R"F-F@```!V````"0````````````````"G````=&UP+F-L87-S4$L%
+J!@`````"``(`>0```$8!```7`%!R;T=U87)D+"!V97)S:6]N(#0N,"XQ
+`
+end
diff --git a/archivers/libarchive/files/libarchive/test/test_empty_write.c b/archivers/libarchive/files/libarchive/test/test_empty_write.c
new file mode 100644
index 00000000000..0523ec362c3
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_empty_write.c
@@ -0,0 +1,120 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_empty_write.c 189308 2009-03-03 17:02:51Z kientzle $");
+
+DEFINE_TEST(test_empty_write)
+{
+ char buff[32768];
+ struct archive_entry *ae;
+ struct archive *a;
+ size_t used;
+ int r;
+
+ /*
+ * Exercise a zero-byte write to a gzip-compressed archive.
+ */
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ r = archive_write_set_compression_gzip(a);
+ if (r == ARCHIVE_FATAL) {
+ skipping("Empty write to gzip-compressed archive");
+ } else {
+ assertEqualIntA(a, ARCHIVE_OK, r);
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_write_open_memory(a, buff, sizeof(buff), &used));
+ /* Write a file to it. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, 0);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+
+ /* THE TEST: write zero bytes to this entry. */
+ /* This used to crash. */
+ assertEqualIntA(a, 0, archive_write_data(a, "", 0));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+ assertA(0 == archive_write_finish(a));
+ }
+
+ /*
+ * Again, with bzip2 compression.
+ */
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ r = archive_write_set_compression_bzip2(a);
+ if (r == ARCHIVE_FATAL) {
+ skipping("Empty write to bzip2-compressed archive");
+ } else {
+ assertEqualIntA(a, ARCHIVE_OK, r);
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_write_open_memory(a, buff, sizeof(buff), &used));
+ /* Write a file to it. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, 0);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+
+ /* THE TEST: write zero bytes to this entry. */
+ assertEqualIntA(a, 0, archive_write_data(a, "", 0));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+ assertA(0 == archive_write_finish(a));
+ }
+
+ /*
+ * For good measure, one more time with no compression.
+ */
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+ /* Write a file to it. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, 0);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+
+ /* THE TEST: write zero bytes to this entry. */
+ assertEqualIntA(a, 0, archive_write_data(a, "", 0));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+ assertA(0 == archive_write_finish(a));
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_entry.c b/archivers/libarchive/files/libarchive/test/test_entry.c
new file mode 100644
index 00000000000..b6a2da177ac
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_entry.c
@@ -0,0 +1,891 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_entry.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+#include <locale.h>
+
+/*
+ * Most of these tests are system-independent, though a few depend on
+ * features of the local system. Such tests are conditionalized on
+ * the platform name. On unsupported platforms, only the
+ * system-independent features will be tested.
+ *
+ * No, I don't want to use config.h in the test files because I want
+ * the tests to also serve as a check on the correctness of config.h.
+ * A mis-configured library build should cause tests to fail.
+ */
+
+DEFINE_TEST(test_entry)
+{
+ char buff[128];
+ wchar_t wbuff[128];
+ struct stat st;
+ struct archive_entry *e, *e2;
+ const struct stat *pst;
+ unsigned long set, clear; /* For fflag testing. */
+ int type, permset, tag, qual; /* For ACL testing. */
+ const char *name; /* For ACL testing. */
+ const char *xname; /* For xattr tests. */
+ const void *xval; /* For xattr tests. */
+ size_t xsize; /* For xattr tests. */
+ wchar_t wc;
+ long l;
+
+ assert((e = archive_entry_new()) != NULL);
+
+ /*
+ * Verify that the AE_IF* defines match S_IF* defines
+ * on this platform. See comments in archive_entry.h.
+ */
+#ifdef S_IFREG
+ assertEqualInt(S_IFREG, AE_IFREG);
+#endif
+#ifdef S_IFLNK
+ assertEqualInt(S_IFLNK, AE_IFLNK);
+#endif
+#ifdef S_IFSOCK
+ assertEqualInt(S_IFSOCK, AE_IFSOCK);
+#endif
+#ifdef S_IFCHR
+ assertEqualInt(S_IFCHR, AE_IFCHR);
+#endif
+/* Work around MinGW, which defines S_IFBLK wrong. */
+/* sourceforge.net/tracker/?func=detail&atid=102435&aid=1942809&group_id=2435 */
+#if defined(S_IFBLK) && !defined(_WIN32)
+ assertEqualInt(S_IFBLK, AE_IFBLK);
+#endif
+#ifdef S_IFDIR
+ assertEqualInt(S_IFDIR, AE_IFDIR);
+#endif
+#ifdef S_IFIFO
+ assertEqualInt(S_IFIFO, AE_IFIFO);
+#endif
+
+ /*
+ * Basic set/read tests for all fields.
+ * We should be able to set any field and read
+ * back the same value.
+ *
+ * For methods that "copy" a string, we should be able
+ * to overwrite the original passed-in string without
+ * changing the value in the entry.
+ *
+ * The following tests are ordered alphabetically by the
+ * name of the field.
+ */
+
+ /* atime */
+ archive_entry_set_atime(e, 13579, 24680);
+ assertEqualInt(archive_entry_atime(e), 13579);
+ assertEqualInt(archive_entry_atime_nsec(e), 24680);
+ archive_entry_unset_atime(e);
+ assertEqualInt(archive_entry_atime(e), 0);
+ assertEqualInt(archive_entry_atime_nsec(e), 0);
+ assert(!archive_entry_atime_is_set(e));
+
+ /* birthtime */
+ archive_entry_set_birthtime(e, 17579, 24990);
+ assertEqualInt(archive_entry_birthtime(e), 17579);
+ assertEqualInt(archive_entry_birthtime_nsec(e), 24990);
+ archive_entry_unset_birthtime(e);
+ assertEqualInt(archive_entry_birthtime(e), 0);
+ assertEqualInt(archive_entry_birthtime_nsec(e), 0);
+ assert(!archive_entry_birthtime_is_set(e));
+
+ /* ctime */
+ archive_entry_set_ctime(e, 13580, 24681);
+ assertEqualInt(archive_entry_ctime(e), 13580);
+ assertEqualInt(archive_entry_ctime_nsec(e), 24681);
+ archive_entry_unset_ctime(e);
+ assertEqualInt(archive_entry_ctime(e), 0);
+ assertEqualInt(archive_entry_ctime_nsec(e), 0);
+ assert(!archive_entry_ctime_is_set(e));
+
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ /* dev */
+ archive_entry_set_dev(e, 235);
+ assertEqualInt(archive_entry_dev(e), 235);
+#else
+ skipping("archive_entry_dev()");
+#endif
+ /* devmajor/devminor are tested specially below. */
+
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ /* filetype */
+ archive_entry_set_filetype(e, AE_IFREG);
+ assertEqualInt(archive_entry_filetype(e), AE_IFREG);
+#else
+ skipping("archive_entry_filetype()");
+#endif
+
+ /* fflags are tested specially below */
+
+ /* gid */
+ archive_entry_set_gid(e, 204);
+ assertEqualInt(archive_entry_gid(e), 204);
+
+ /* gname */
+ archive_entry_set_gname(e, "group");
+ assertEqualString(archive_entry_gname(e), "group");
+ wcscpy(wbuff, L"wgroup");
+ archive_entry_copy_gname_w(e, wbuff);
+ assertEqualWString(archive_entry_gname_w(e), L"wgroup");
+ memset(wbuff, 0, sizeof(wbuff));
+ assertEqualWString(archive_entry_gname_w(e), L"wgroup");
+
+ /* hardlink */
+ archive_entry_set_hardlink(e, "hardlinkname");
+ assertEqualString(archive_entry_hardlink(e), "hardlinkname");
+ strcpy(buff, "hardlinkname2");
+ archive_entry_copy_hardlink(e, buff);
+ assertEqualString(archive_entry_hardlink(e), "hardlinkname2");
+ memset(buff, 0, sizeof(buff));
+ assertEqualString(archive_entry_hardlink(e), "hardlinkname2");
+ archive_entry_copy_hardlink(e, NULL);
+ assertEqualString(archive_entry_hardlink(e), NULL);
+ assertEqualWString(archive_entry_hardlink_w(e), NULL);
+ wcscpy(wbuff, L"whardlink");
+ archive_entry_copy_hardlink_w(e, wbuff);
+ assertEqualWString(archive_entry_hardlink_w(e), L"whardlink");
+ memset(wbuff, 0, sizeof(wbuff));
+ assertEqualWString(archive_entry_hardlink_w(e), L"whardlink");
+ archive_entry_copy_hardlink_w(e, NULL);
+ assertEqualString(archive_entry_hardlink(e), NULL);
+ assertEqualWString(archive_entry_hardlink_w(e), NULL);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ /* ino */
+ archive_entry_set_ino(e, 8593);
+ assertEqualInt(archive_entry_ino(e), 8593);
+#else
+ skipping("archive_entry_ino()");
+#endif
+
+ /* link */
+ archive_entry_set_hardlink(e, "hardlinkname");
+ archive_entry_set_symlink(e, NULL);
+ archive_entry_set_link(e, "link");
+ assertEqualString(archive_entry_hardlink(e), "link");
+ assertEqualString(archive_entry_symlink(e), NULL);
+ archive_entry_copy_link(e, "link2");
+ assertEqualString(archive_entry_hardlink(e), "link2");
+ assertEqualString(archive_entry_symlink(e), NULL);
+ archive_entry_copy_link_w(e, L"link3");
+ assertEqualString(archive_entry_hardlink(e), "link3");
+ assertEqualString(archive_entry_symlink(e), NULL);
+ archive_entry_set_hardlink(e, NULL);
+ archive_entry_set_symlink(e, "symlink");
+ archive_entry_set_link(e, "link");
+ assertEqualString(archive_entry_hardlink(e), NULL);
+ assertEqualString(archive_entry_symlink(e), "link");
+ archive_entry_copy_link(e, "link2");
+ assertEqualString(archive_entry_hardlink(e), NULL);
+ assertEqualString(archive_entry_symlink(e), "link2");
+ archive_entry_copy_link_w(e, L"link3");
+ assertEqualString(archive_entry_hardlink(e), NULL);
+ assertEqualString(archive_entry_symlink(e), "link3");
+ /* Arbitrarily override symlink if both hardlink and symlink set. */
+ archive_entry_set_hardlink(e, "hardlink");
+ archive_entry_set_symlink(e, "symlink");
+ archive_entry_set_link(e, "link");
+ assertEqualString(archive_entry_hardlink(e), "hardlink");
+ assertEqualString(archive_entry_symlink(e), "link");
+
+ /* mode */
+ archive_entry_set_mode(e, 0123456);
+ assertEqualInt(archive_entry_mode(e), 0123456);
+
+ /* mtime */
+ archive_entry_set_mtime(e, 13581, 24682);
+ assertEqualInt(archive_entry_mtime(e), 13581);
+ assertEqualInt(archive_entry_mtime_nsec(e), 24682);
+ archive_entry_unset_mtime(e);
+ assertEqualInt(archive_entry_mtime(e), 0);
+ assertEqualInt(archive_entry_mtime_nsec(e), 0);
+ assert(!archive_entry_mtime_is_set(e));
+
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ /* nlink */
+ archive_entry_set_nlink(e, 736);
+ assertEqualInt(archive_entry_nlink(e), 736);
+#else
+ skipping("archive_entry_nlink()");
+#endif
+
+ /* pathname */
+ archive_entry_set_pathname(e, "path");
+ assertEqualString(archive_entry_pathname(e), "path");
+ archive_entry_set_pathname(e, "path");
+ assertEqualString(archive_entry_pathname(e), "path");
+ strcpy(buff, "path2");
+ archive_entry_copy_pathname(e, buff);
+ assertEqualString(archive_entry_pathname(e), "path2");
+ memset(buff, 0, sizeof(buff));
+ assertEqualString(archive_entry_pathname(e), "path2");
+ wcscpy(wbuff, L"wpath");
+ archive_entry_copy_pathname_w(e, wbuff);
+ assertEqualWString(archive_entry_pathname_w(e), L"wpath");
+ memset(wbuff, 0, sizeof(wbuff));
+ assertEqualWString(archive_entry_pathname_w(e), L"wpath");
+
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ /* rdev */
+ archive_entry_set_rdev(e, 532);
+ assertEqualInt(archive_entry_rdev(e), 532);
+#else
+ skipping("archive_entry_rdev()");
+#endif
+ /* rdevmajor/rdevminor are tested specially below. */
+
+ /* size */
+ archive_entry_set_size(e, 987654321);
+ assertEqualInt(archive_entry_size(e), 987654321);
+ archive_entry_unset_size(e);
+ assertEqualInt(archive_entry_size(e), 0);
+ assert(!archive_entry_size_is_set(e));
+
+ /* sourcepath */
+ archive_entry_copy_sourcepath(e, "path1");
+ assertEqualString(archive_entry_sourcepath(e), "path1");
+
+ /* symlink */
+ archive_entry_set_symlink(e, "symlinkname");
+ assertEqualString(archive_entry_symlink(e), "symlinkname");
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ strcpy(buff, "symlinkname2");
+ archive_entry_copy_symlink(e, buff);
+ assertEqualString(archive_entry_symlink(e), "symlinkname2");
+ memset(buff, 0, sizeof(buff));
+ assertEqualString(archive_entry_symlink(e), "symlinkname2");
+#endif
+ archive_entry_copy_symlink_w(e, NULL);
+ assertEqualWString(archive_entry_symlink_w(e), NULL);
+ assertEqualString(archive_entry_symlink(e), NULL);
+ archive_entry_copy_symlink_w(e, L"wsymlink");
+ assertEqualWString(archive_entry_symlink_w(e), L"wsymlink");
+ archive_entry_copy_symlink(e, NULL);
+ assertEqualWString(archive_entry_symlink_w(e), NULL);
+ assertEqualString(archive_entry_symlink(e), NULL);
+
+ /* uid */
+ archive_entry_set_uid(e, 83);
+ assertEqualInt(archive_entry_uid(e), 83);
+
+ /* uname */
+ archive_entry_set_uname(e, "user");
+ assertEqualString(archive_entry_uname(e), "user");
+ wcscpy(wbuff, L"wuser");
+ archive_entry_copy_gname_w(e, wbuff);
+ assertEqualWString(archive_entry_gname_w(e), L"wuser");
+ memset(wbuff, 0, sizeof(wbuff));
+ assertEqualWString(archive_entry_gname_w(e), L"wuser");
+
+ /* Test fflags interface. */
+ archive_entry_set_fflags(e, 0x55, 0xAA);
+ archive_entry_fflags(e, &set, &clear);
+ failure("Testing set/get of fflags data.");
+ assertEqualInt(set, 0x55);
+ failure("Testing set/get of fflags data.");
+ assertEqualInt(clear, 0xAA);
+#ifdef __FreeBSD__
+ /* Converting fflags bitmap to string is currently system-dependent. */
+ /* TODO: Make this system-independent. */
+ assertEqualString(archive_entry_fflags_text(e),
+ "uappnd,nouchg,nodump,noopaque,uunlnk");
+ /* Test archive_entry_copy_fflags_text_w() */
+ archive_entry_copy_fflags_text_w(e, L" ,nouappnd, nouchg, dump,uunlnk");
+ archive_entry_fflags(e, &set, &clear);
+ assertEqualInt(16, set);
+ assertEqualInt(7, clear);
+ /* Test archive_entry_copy_fflags_text() */
+ archive_entry_copy_fflags_text(e, " ,nouappnd, nouchg, dump,uunlnk");
+ archive_entry_fflags(e, &set, &clear);
+ assertEqualInt(16, set);
+ assertEqualInt(7, clear);
+#endif
+
+ /* See test_acl_basic.c for tests of ACL set/get consistency. */
+
+ /* Test xattrs set/get consistency. */
+ archive_entry_xattr_add_entry(e, "xattr1", "xattrvalue1", 12);
+ assertEqualInt(1, archive_entry_xattr_reset(e));
+ assertEqualInt(0, archive_entry_xattr_next(e, &xname, &xval, &xsize));
+ assertEqualString(xname, "xattr1");
+ assertEqualString(xval, "xattrvalue1");
+ assertEqualInt((int)xsize, 12);
+ assertEqualInt(1, archive_entry_xattr_count(e));
+ assertEqualInt(ARCHIVE_WARN,
+ archive_entry_xattr_next(e, &xname, &xval, &xsize));
+ assertEqualString(xname, NULL);
+ assertEqualString(xval, NULL);
+ assertEqualInt((int)xsize, 0);
+ archive_entry_xattr_clear(e);
+ assertEqualInt(0, archive_entry_xattr_reset(e));
+ assertEqualInt(ARCHIVE_WARN,
+ archive_entry_xattr_next(e, &xname, &xval, &xsize));
+ assertEqualString(xname, NULL);
+ assertEqualString(xval, NULL);
+ assertEqualInt((int)xsize, 0);
+ archive_entry_xattr_add_entry(e, "xattr1", "xattrvalue1", 12);
+ assertEqualInt(1, archive_entry_xattr_reset(e));
+ archive_entry_xattr_add_entry(e, "xattr2", "xattrvalue2", 12);
+ assertEqualInt(2, archive_entry_xattr_reset(e));
+ assertEqualInt(0, archive_entry_xattr_next(e, &xname, &xval, &xsize));
+ assertEqualInt(0, archive_entry_xattr_next(e, &xname, &xval, &xsize));
+ assertEqualInt(ARCHIVE_WARN,
+ archive_entry_xattr_next(e, &xname, &xval, &xsize));
+ assertEqualString(xname, NULL);
+ assertEqualString(xval, NULL);
+ assertEqualInt((int)xsize, 0);
+
+
+ /*
+ * Test clone() implementation.
+ */
+
+ /* Set values in 'e' */
+ archive_entry_clear(e);
+ archive_entry_set_atime(e, 13579, 24680);
+ archive_entry_set_birthtime(e, 13779, 24990);
+ archive_entry_set_ctime(e, 13580, 24681);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_dev(e, 235);
+#endif
+ archive_entry_set_fflags(e, 0x55, 0xAA);
+ archive_entry_set_gid(e, 204);
+ archive_entry_set_gname(e, "group");
+ archive_entry_set_hardlink(e, "hardlinkname");
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_ino(e, 8593);
+#endif
+ archive_entry_set_mode(e, 0123456);
+ archive_entry_set_mtime(e, 13581, 24682);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_nlink(e, 736);
+#endif
+ archive_entry_set_pathname(e, "path");
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_rdev(e, 532);
+#endif
+ archive_entry_set_size(e, 987654321);
+ archive_entry_copy_sourcepath(e, "source");
+ archive_entry_set_symlink(e, "symlinkname");
+ archive_entry_set_uid(e, 83);
+ archive_entry_set_uname(e, "user");
+ /* Add an ACL entry. */
+ archive_entry_acl_add_entry(e, ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ ARCHIVE_ENTRY_ACL_READ, ARCHIVE_ENTRY_ACL_USER, 77, "user77");
+ /* Add an extended attribute. */
+ archive_entry_xattr_add_entry(e, "xattr1", "xattrvalue", 11);
+
+ /* Make a clone. */
+ e2 = archive_entry_clone(e);
+
+ /* Clone should have same contents. */
+ assertEqualInt(archive_entry_atime(e2), 13579);
+ assertEqualInt(archive_entry_atime_nsec(e2), 24680);
+ assertEqualInt(archive_entry_birthtime(e2), 13779);
+ assertEqualInt(archive_entry_birthtime_nsec(e2), 24990);
+ assertEqualInt(archive_entry_ctime(e2), 13580);
+ assertEqualInt(archive_entry_ctime_nsec(e2), 24681);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ assertEqualInt(archive_entry_dev(e2), 235);
+#endif
+ archive_entry_fflags(e, &set, &clear);
+ assertEqualInt(clear, 0xAA);
+ assertEqualInt(set, 0x55);
+ assertEqualInt(archive_entry_gid(e2), 204);
+ assertEqualString(archive_entry_gname(e2), "group");
+ assertEqualString(archive_entry_hardlink(e2), "hardlinkname");
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ assertEqualInt(archive_entry_ino(e2), 8593);
+#endif
+ assertEqualInt(archive_entry_mode(e2), 0123456);
+ assertEqualInt(archive_entry_mtime(e2), 13581);
+ assertEqualInt(archive_entry_mtime_nsec(e2), 24682);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ assertEqualInt(archive_entry_nlink(e2), 736);
+#endif
+ assertEqualString(archive_entry_pathname(e2), "path");
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ assertEqualInt(archive_entry_rdev(e2), 532);
+#endif
+ assertEqualInt(archive_entry_size(e2), 987654321);
+ assertEqualString(archive_entry_sourcepath(e2), "source");
+ assertEqualString(archive_entry_symlink(e2), "symlinkname");
+ assertEqualInt(archive_entry_uid(e2), 83);
+ assertEqualString(archive_entry_uname(e2), "user");
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ skipping("ACL preserved by archive_entry_clone()");
+#else
+ /* Verify ACL was copied. */
+ assertEqualInt(4, archive_entry_acl_reset(e2,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS));
+ /* First three are standard permission bits. */
+ assertEqualInt(0, archive_entry_acl_next(e2,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ &type, &permset, &tag, &qual, &name));
+ assertEqualInt(type, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ assertEqualInt(permset, 4);
+ assertEqualInt(tag, ARCHIVE_ENTRY_ACL_USER_OBJ);
+ assertEqualInt(qual, -1);
+ assertEqualString(name, NULL);
+ assertEqualInt(0, archive_entry_acl_next(e2,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ &type, &permset, &tag, &qual, &name));
+ assertEqualInt(type, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ assertEqualInt(permset, 5);
+ assertEqualInt(tag, ARCHIVE_ENTRY_ACL_GROUP_OBJ);
+ assertEqualInt(qual, -1);
+ assertEqualString(name, NULL);
+ assertEqualInt(0, archive_entry_acl_next(e2,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ &type, &permset, &tag, &qual, &name));
+ assertEqualInt(type, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ assertEqualInt(permset, 6);
+ assertEqualInt(tag, ARCHIVE_ENTRY_ACL_OTHER);
+ assertEqualInt(qual, -1);
+ assertEqualString(name, NULL);
+ /* Fourth is custom one. */
+ assertEqualInt(0, archive_entry_acl_next(e2,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ &type, &permset, &tag, &qual, &name));
+ assertEqualInt(type, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ assertEqualInt(permset, ARCHIVE_ENTRY_ACL_READ);
+ assertEqualInt(tag, ARCHIVE_ENTRY_ACL_USER);
+ assertEqualInt(qual, 77);
+ assertEqualString(name, "user77");
+#endif
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ skipping("xattr data preserved by archive_entry_clone");
+#else
+ /* Verify xattr was copied. */
+ assertEqualInt(1, archive_entry_xattr_reset(e2));
+ assertEqualInt(0, archive_entry_xattr_next(e2, &xname, &xval, &xsize));
+ assertEqualString(xname, "xattr1");
+ assertEqualString(xval, "xattrvalue");
+ assertEqualInt((int)xsize, 11);
+ assertEqualInt(ARCHIVE_WARN,
+ archive_entry_xattr_next(e2, &xname, &xval, &xsize));
+ assertEqualString(xname, NULL);
+ assertEqualString(xval, NULL);
+ assertEqualInt((int)xsize, 0);
+#endif
+
+ /* Change the original */
+ archive_entry_set_atime(e, 13580, 24690);
+ archive_entry_set_birthtime(e, 13980, 24999);
+ archive_entry_set_ctime(e, 13590, 24691);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_dev(e, 245);
+#endif
+ archive_entry_set_fflags(e, 0x85, 0xDA);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_filetype(e, AE_IFLNK);
+#endif
+ archive_entry_set_gid(e, 214);
+ archive_entry_set_gname(e, "grouper");
+ archive_entry_set_hardlink(e, "hardlinkpath");
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_ino(e, 8763);
+#endif
+ archive_entry_set_mode(e, 0123654);
+ archive_entry_set_mtime(e, 18351, 28642);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_nlink(e, 73);
+#endif
+ archive_entry_set_pathname(e, "pathest");
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_rdev(e, 132);
+#endif
+ archive_entry_set_size(e, 987456321);
+ archive_entry_copy_sourcepath(e, "source2");
+ archive_entry_set_symlink(e, "symlinkpath");
+ archive_entry_set_uid(e, 93);
+ archive_entry_set_uname(e, "username");
+ archive_entry_acl_clear(e);
+ archive_entry_xattr_clear(e);
+
+ /* Clone should still have same contents. */
+ assertEqualInt(archive_entry_atime(e2), 13579);
+ assertEqualInt(archive_entry_atime_nsec(e2), 24680);
+ assertEqualInt(archive_entry_birthtime(e2), 13779);
+ assertEqualInt(archive_entry_birthtime_nsec(e2), 24990);
+ assertEqualInt(archive_entry_ctime(e2), 13580);
+ assertEqualInt(archive_entry_ctime_nsec(e2), 24681);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ assertEqualInt(archive_entry_dev(e2), 235);
+#endif
+ archive_entry_fflags(e2, &set, &clear);
+ assertEqualInt(clear, 0xAA);
+ assertEqualInt(set, 0x55);
+ assertEqualInt(archive_entry_gid(e2), 204);
+ assertEqualString(archive_entry_gname(e2), "group");
+ assertEqualString(archive_entry_hardlink(e2), "hardlinkname");
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ assertEqualInt(archive_entry_ino(e2), 8593);
+#endif
+ assertEqualInt(archive_entry_mode(e2), 0123456);
+ assertEqualInt(archive_entry_mtime(e2), 13581);
+ assertEqualInt(archive_entry_mtime_nsec(e2), 24682);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ assertEqualInt(archive_entry_nlink(e2), 736);
+#endif
+ assertEqualString(archive_entry_pathname(e2), "path");
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ assertEqualInt(archive_entry_rdev(e2), 532);
+#endif
+ assertEqualInt(archive_entry_size(e2), 987654321);
+ assertEqualString(archive_entry_sourcepath(e2), "source");
+ assertEqualString(archive_entry_symlink(e2), "symlinkname");
+ assertEqualInt(archive_entry_uid(e2), 83);
+ assertEqualString(archive_entry_uname(e2), "user");
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ skipping("ACL held by clone of archive_entry");
+#else
+ /* Verify ACL was unchanged. */
+ assertEqualInt(4, archive_entry_acl_reset(e2,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS));
+ /* First three are standard permission bits. */
+ assertEqualInt(0, archive_entry_acl_next(e2,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ &type, &permset, &tag, &qual, &name));
+ assertEqualInt(type, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ assertEqualInt(permset, 4);
+ assertEqualInt(tag, ARCHIVE_ENTRY_ACL_USER_OBJ);
+ assertEqualInt(qual, -1);
+ assertEqualString(name, NULL);
+ assertEqualInt(0, archive_entry_acl_next(e2,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ &type, &permset, &tag, &qual, &name));
+ assertEqualInt(type, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ assertEqualInt(permset, 5);
+ assertEqualInt(tag, ARCHIVE_ENTRY_ACL_GROUP_OBJ);
+ assertEqualInt(qual, -1);
+ assertEqualString(name, NULL);
+ assertEqualInt(0, archive_entry_acl_next(e2,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ &type, &permset, &tag, &qual, &name));
+ assertEqualInt(type, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ assertEqualInt(permset, 6);
+ assertEqualInt(tag, ARCHIVE_ENTRY_ACL_OTHER);
+ assertEqualInt(qual, -1);
+ assertEqualString(name, NULL);
+ /* Fourth is custom one. */
+ assertEqualInt(0, archive_entry_acl_next(e2,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ &type, &permset, &tag, &qual, &name));
+ assertEqualInt(type, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ assertEqualInt(permset, ARCHIVE_ENTRY_ACL_READ);
+ assertEqualInt(tag, ARCHIVE_ENTRY_ACL_USER);
+ assertEqualInt(qual, 77);
+ assertEqualString(name, "user77");
+ assertEqualInt(1, archive_entry_acl_next(e2,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ &type, &permset, &tag, &qual, &name));
+ assertEqualInt(type, 0);
+ assertEqualInt(permset, 0);
+ assertEqualInt(tag, 0);
+ assertEqualInt(qual, -1);
+ assertEqualString(name, NULL);
+#endif
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ skipping("xattr preserved in archive_entry copy");
+#else
+ /* Verify xattr was unchanged. */
+ assertEqualInt(1, archive_entry_xattr_reset(e2));
+#endif
+
+ /* Release clone. */
+ archive_entry_free(e2);
+
+ /*
+ * Test clear() implementation.
+ */
+ archive_entry_clear(e);
+ assertEqualInt(archive_entry_atime(e), 0);
+ assertEqualInt(archive_entry_atime_nsec(e), 0);
+ assertEqualInt(archive_entry_birthtime(e), 0);
+ assertEqualInt(archive_entry_birthtime_nsec(e), 0);
+ assertEqualInt(archive_entry_ctime(e), 0);
+ assertEqualInt(archive_entry_ctime_nsec(e), 0);
+ assertEqualInt(archive_entry_dev(e), 0);
+ archive_entry_fflags(e, &set, &clear);
+ assertEqualInt(clear, 0);
+ assertEqualInt(set, 0);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ assertEqualInt(archive_entry_filetype(e), 0);
+#endif
+ assertEqualInt(archive_entry_gid(e), 0);
+ assertEqualString(archive_entry_gname(e), NULL);
+ assertEqualString(archive_entry_hardlink(e), NULL);
+ assertEqualInt(archive_entry_ino(e), 0);
+ assertEqualInt(archive_entry_mode(e), 0);
+ assertEqualInt(archive_entry_mtime(e), 0);
+ assertEqualInt(archive_entry_mtime_nsec(e), 0);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ assertEqualInt(archive_entry_nlink(e), 0);
+#endif
+ assertEqualString(archive_entry_pathname(e), NULL);
+ assertEqualInt(archive_entry_rdev(e), 0);
+ assertEqualInt(archive_entry_size(e), 0);
+ assertEqualString(archive_entry_symlink(e), NULL);
+ assertEqualInt(archive_entry_uid(e), 0);
+ assertEqualString(archive_entry_uname(e), NULL);
+ /* ACLs should be cleared. */
+ assertEqualInt(archive_entry_acl_count(e, ARCHIVE_ENTRY_ACL_TYPE_ACCESS), 0);
+ assertEqualInt(archive_entry_acl_count(e, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT), 0);
+ /* Extended attributes should be cleared. */
+ assertEqualInt(archive_entry_xattr_count(e), 0);
+
+ /*
+ * Test archive_entry_copy_stat().
+ */
+ memset(&st, 0, sizeof(st));
+ /* Set all of the standard 'struct stat' fields. */
+ st.st_atime = 456789;
+ st.st_ctime = 345678;
+ st.st_dev = 123;
+ st.st_gid = 34;
+ st.st_ino = 234;
+ st.st_mode = 077777;
+ st.st_mtime = 234567;
+ st.st_nlink = 345;
+ st.st_size = 123456789;
+ st.st_uid = 23;
+#ifdef __FreeBSD__
+ /* On FreeBSD, high-res timestamp data should come through. */
+ st.st_atimespec.tv_nsec = 6543210;
+ st.st_ctimespec.tv_nsec = 5432109;
+ st.st_mtimespec.tv_nsec = 3210987;
+ st.st_birthtimespec.tv_nsec = 7459386;
+#endif
+ /* Copy them into the entry. */
+ archive_entry_copy_stat(e, &st);
+ /* Read each one back separately and compare. */
+ assertEqualInt(archive_entry_atime(e), 456789);
+ assertEqualInt(archive_entry_ctime(e), 345678);
+ assertEqualInt(archive_entry_dev(e), 123);
+ assertEqualInt(archive_entry_gid(e), 34);
+ assertEqualInt(archive_entry_ino(e), 234);
+ assertEqualInt(archive_entry_mode(e), 077777);
+ assertEqualInt(archive_entry_mtime(e), 234567);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ assertEqualInt(archive_entry_nlink(e), 345);
+#endif
+ assertEqualInt(archive_entry_size(e), 123456789);
+ assertEqualInt(archive_entry_uid(e), 23);
+#if __FreeBSD__
+ /* On FreeBSD, high-res timestamp data should come through. */
+ assertEqualInt(archive_entry_atime_nsec(e), 6543210);
+ assertEqualInt(archive_entry_ctime_nsec(e), 5432109);
+ assertEqualInt(archive_entry_mtime_nsec(e), 3210987);
+ assertEqualInt(archive_entry_birthtime_nsec(e), 7459386);
+#endif
+
+ /*
+ * Test archive_entry_stat().
+ */
+ /* First, clear out any existing stat data. */
+ memset(&st, 0, sizeof(st));
+ archive_entry_copy_stat(e, &st);
+ /* Set a bunch of fields individually. */
+ archive_entry_set_atime(e, 456789, 321);
+ archive_entry_set_ctime(e, 345678, 432);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_dev(e, 123);
+#endif
+ archive_entry_set_gid(e, 34);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_ino(e, 234);
+#endif
+ archive_entry_set_mode(e, 012345);
+ archive_entry_set_mode(e, 012345);
+ archive_entry_set_mtime(e, 234567, 543);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_nlink(e, 345);
+#endif
+ archive_entry_set_size(e, 123456789);
+ archive_entry_set_uid(e, 23);
+ /* Retrieve a stat structure. */
+ assert((pst = archive_entry_stat(e)) != NULL);
+ /* Check that the values match. */
+ assertEqualInt(pst->st_atime, 456789);
+ assertEqualInt(pst->st_ctime, 345678);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ assertEqualInt(pst->st_dev, 123);
+#endif
+ assertEqualInt(pst->st_gid, 34);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ assertEqualInt(pst->st_ino, 234);
+#endif
+ assertEqualInt(pst->st_mode, 012345);
+ assertEqualInt(pst->st_mtime, 234567);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ assertEqualInt(pst->st_nlink, 345);
+#endif
+ assertEqualInt(pst->st_size, 123456789);
+ assertEqualInt(pst->st_uid, 23);
+#ifdef __FreeBSD__
+ /* On FreeBSD, high-res timestamp data should come through. */
+ assertEqualInt(pst->st_atimespec.tv_nsec, 321);
+ assertEqualInt(pst->st_ctimespec.tv_nsec, 432);
+ assertEqualInt(pst->st_mtimespec.tv_nsec, 543);
+#endif
+
+ /* Changing any one value should update struct stat. */
+ archive_entry_set_atime(e, 456788, 0);
+ assert((pst = archive_entry_stat(e)) != NULL);
+ assertEqualInt(pst->st_atime, 456788);
+ archive_entry_set_ctime(e, 345677, 431);
+ assert((pst = archive_entry_stat(e)) != NULL);
+ assertEqualInt(pst->st_ctime, 345677);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_dev(e, 122);
+ assert((pst = archive_entry_stat(e)) != NULL);
+ assertEqualInt(pst->st_dev, 122);
+#endif
+ archive_entry_set_gid(e, 33);
+ assert((pst = archive_entry_stat(e)) != NULL);
+ assertEqualInt(pst->st_gid, 33);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_ino(e, 233);
+ assert((pst = archive_entry_stat(e)) != NULL);
+ assertEqualInt(pst->st_ino, 233);
+#endif
+ archive_entry_set_mode(e, 012344);
+ assert((pst = archive_entry_stat(e)) != NULL);
+ assertEqualInt(pst->st_mode, 012344);
+ archive_entry_set_mtime(e, 234566, 542);
+ assert((pst = archive_entry_stat(e)) != NULL);
+ assertEqualInt(pst->st_mtime, 234566);
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_nlink(e, 344);
+ assert((pst = archive_entry_stat(e)) != NULL);
+ assertEqualInt(pst->st_nlink, 344);
+#endif
+ archive_entry_set_size(e, 123456788);
+ assert((pst = archive_entry_stat(e)) != NULL);
+ assertEqualInt(pst->st_size, 123456788);
+ archive_entry_set_uid(e, 22);
+ assert((pst = archive_entry_stat(e)) != NULL);
+ assertEqualInt(pst->st_uid, 22);
+ /* We don't need to check high-res fields here. */
+
+ /*
+ * Test dev/major/minor interfaces. Setting 'dev' or 'rdev'
+ * should change the corresponding major/minor values, and
+ * vice versa.
+ *
+ * The test here is system-specific because it assumes that
+ * makedev(), major(), and minor() are defined in sys/stat.h.
+ * I'm not too worried about it, though, because the code is
+ * simple. If it works on FreeBSD, it's unlikely to be broken
+ * anywhere else. Note: The functionality is present on every
+ * platform even if these tests only run some places;
+ * libarchive's more extensive configuration logic should find
+ * the necessary definitions on every platform.
+ */
+#if __FreeBSD__
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ archive_entry_set_dev(e, 0x12345678);
+ assertEqualInt(archive_entry_devmajor(e), major(0x12345678));
+ assertEqualInt(archive_entry_devminor(e), minor(0x12345678));
+ assertEqualInt(archive_entry_dev(e), 0x12345678);
+ archive_entry_set_devmajor(e, 0xfe);
+ archive_entry_set_devminor(e, 0xdcba98);
+ assertEqualInt(archive_entry_devmajor(e), 0xfe);
+ assertEqualInt(archive_entry_devminor(e), 0xdcba98);
+ assertEqualInt(archive_entry_dev(e), makedev(0xfe, 0xdcba98));
+ archive_entry_set_rdev(e, 0x12345678);
+ assertEqualInt(archive_entry_rdevmajor(e), major(0x12345678));
+ assertEqualInt(archive_entry_rdevminor(e), minor(0x12345678));
+ assertEqualInt(archive_entry_rdev(e), 0x12345678);
+ archive_entry_set_rdevmajor(e, 0xfe);
+ archive_entry_set_rdevminor(e, 0xdcba98);
+ assertEqualInt(archive_entry_rdevmajor(e), 0xfe);
+ assertEqualInt(archive_entry_rdevminor(e), 0xdcba98);
+ assertEqualInt(archive_entry_rdev(e), makedev(0xfe, 0xdcba98));
+#endif
+#endif
+
+ /*
+ * Exercise the character-conversion logic, if we can.
+ */
+ if (NULL == LOCALE_UTF8 || NULL == setlocale(LC_ALL, LOCALE_UTF8)) {
+ skipping("Can't exercise charset-conversion logic without"
+ " a suitable locale.");
+ } else {
+ /* A filename that cannot be converted to wide characters. */
+ archive_entry_copy_pathname(e, "abc\314\214mno\374xyz");
+ failure("Converting invalid chars to Unicode should fail.");
+ assert(NULL == archive_entry_pathname_w(e));
+ //failure("Converting invalid chars to UTF-8 should fail.");
+ //assert(NULL == archive_entry_pathname_utf8(e));
+
+ /* A group name that cannot be converted. */
+ archive_entry_copy_gname(e, "abc\314\214mno\374xyz");
+ failure("Converting invalid chars to Unicode should fail.");
+ assert(NULL == archive_entry_gname_w(e));
+
+ /* A user name that cannot be converted. */
+ archive_entry_copy_uname(e, "abc\314\214mno\374xyz");
+ failure("Converting invalid chars to Unicode should fail.");
+ assert(NULL == archive_entry_uname_w(e));
+
+ /* A hardlink target that cannot be converted. */
+ archive_entry_copy_hardlink(e, "abc\314\214mno\374xyz");
+ failure("Converting invalid chars to Unicode should fail.");
+ assert(NULL == archive_entry_hardlink_w(e));
+
+ /* A symlink target that cannot be converted. */
+ archive_entry_copy_symlink(e, "abc\314\214mno\374xyz");
+ failure("Converting invalid chars to Unicode should fail.");
+ assert(NULL == archive_entry_symlink_w(e));
+ }
+
+ l = 0x12345678L;
+ wc = (wchar_t)l; /* Wide character too big for UTF-8. */
+ if (NULL == setlocale(LC_ALL, "C") || (long)wc != l) {
+ skipping("Testing charset conversion failure requires 32-bit wchar_t and support for \"C\" locale.");
+ } else {
+ /*
+ * Build the string L"xxx\U12345678yyy\u5678zzz" without
+ * using C99 \u#### syntax, which isn't uniformly
+ * supported. (GCC 3.4.6, for instance, defaults to
+ * "c89 plus GNU extensions.")
+ */
+ wcscpy(wbuff, L"xxxAyyyBzzz");
+ wbuff[3] = (wchar_t)0x12345678;
+ wbuff[7] = (wchar_t)0x5678;
+ /* A wide filename that cannot be converted to narrow. */
+ archive_entry_copy_pathname_w(e, wbuff);
+ failure("Converting wide characters from Unicode should fail.");
+ assertEqualString(NULL, archive_entry_pathname(e));
+ }
+
+ /* Release the experimental entry. */
+ archive_entry_free(e);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_entry_strmode.c b/archivers/libarchive/files/libarchive/test/test_entry_strmode.c
new file mode 100644
index 00000000000..ba183db025a
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_entry_strmode.c
@@ -0,0 +1,71 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_entry_strmode.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+DEFINE_TEST(test_entry_strmode)
+{
+ struct archive_entry *entry;
+
+ assert((entry = archive_entry_new()) != NULL);
+
+ archive_entry_set_mode(entry, AE_IFREG | 0642);
+ assertEqualString(archive_entry_strmode(entry), "-rw-r---w- ");
+
+ /* Regular file + hardlink still shows as regular file. */
+ archive_entry_set_mode(entry, AE_IFREG | 0644);
+ archive_entry_set_hardlink(entry, "link");
+ assertEqualString(archive_entry_strmode(entry), "-rw-r--r-- ");
+
+ archive_entry_set_mode(entry, 0640);
+ archive_entry_set_hardlink(entry, "link");
+ assertEqualString(archive_entry_strmode(entry), "hrw-r----- ");
+ archive_entry_set_hardlink(entry, NULL);
+
+ archive_entry_set_mode(entry, AE_IFDIR | 0777);
+ assertEqualString(archive_entry_strmode(entry), "drwxrwxrwx ");
+
+ archive_entry_set_mode(entry, AE_IFBLK | 03642);
+ assertEqualString(archive_entry_strmode(entry), "brw-r-S-wT ");
+
+ archive_entry_set_mode(entry, AE_IFCHR | 05777);
+ assertEqualString(archive_entry_strmode(entry), "crwsrwxrwt ");
+
+ archive_entry_set_mode(entry, AE_IFSOCK | 0222);
+ assertEqualString(archive_entry_strmode(entry), "s-w--w--w- ");
+
+ archive_entry_set_mode(entry, AE_IFIFO | 0444);
+ assertEqualString(archive_entry_strmode(entry), "pr--r--r-- ");
+
+ archive_entry_set_mode(entry, AE_IFLNK | 04000);
+ assertEqualString(archive_entry_strmode(entry), "l--S------ ");
+
+ archive_entry_acl_add_entry(entry, ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ 0007, ARCHIVE_ENTRY_ACL_GROUP, 78, "group78");
+ assertEqualString(archive_entry_strmode(entry), "l--S------+");
+
+ /* Release the experimental entry. */
+ archive_entry_free(entry);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_link_resolver.c b/archivers/libarchive/files/libarchive/test/test_link_resolver.c
new file mode 100644
index 00000000000..8332c4f985b
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_link_resolver.c
@@ -0,0 +1,205 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_link_resolver.c,v 1.2 2008/06/15 04:31:43 kientzle Exp $");
+
+static void test_linkify_tar(void)
+{
+ struct archive_entry *entry, *e2;
+ struct archive_entry_linkresolver *resolver;
+
+ /* Initialize the resolver. */
+ assert(NULL != (resolver = archive_entry_linkresolver_new()));
+ archive_entry_linkresolver_set_strategy(resolver,
+ ARCHIVE_FORMAT_TAR_USTAR);
+
+ /* Create an entry with only 1 link and try to linkify it. */
+ assert(NULL != (entry = archive_entry_new()));
+ archive_entry_set_pathname(entry, "test1");
+ archive_entry_set_ino(entry, 1);
+ archive_entry_set_dev(entry, 2);
+ archive_entry_set_nlink(entry, 1);
+ archive_entry_set_size(entry, 10);
+ archive_entry_linkify(resolver, &entry, &e2);
+
+ /* Shouldn't have been changed. */
+ assert(e2 == NULL);
+ assertEqualInt(10, archive_entry_size(entry));
+ assertEqualString("test1", archive_entry_pathname(entry));
+
+ /* Now, try again with an entry that has 2 links. */
+ archive_entry_set_pathname(entry, "test2");
+ archive_entry_set_nlink(entry, 2);
+ archive_entry_set_ino(entry, 2);
+ archive_entry_linkify(resolver, &entry, &e2);
+ /* Shouldn't be altered, since it wasn't seen before. */
+ assert(e2 == NULL);
+ assertEqualString("test2", archive_entry_pathname(entry));
+ assertEqualString(NULL, archive_entry_hardlink(entry));
+ assertEqualInt(10, archive_entry_size(entry));
+
+ /* Match again and make sure it does get altered. */
+ archive_entry_linkify(resolver, &entry, &e2);
+ assert(e2 == NULL);
+ assertEqualString("test2", archive_entry_pathname(entry));
+ assertEqualString("test2", archive_entry_hardlink(entry));
+ assertEqualInt(0, archive_entry_size(entry));
+
+
+ /* Dirs should never be matched as hardlinks, regardless. */
+ archive_entry_set_pathname(entry, "test3");
+ archive_entry_set_nlink(entry, 2);
+ archive_entry_set_filetype(entry, AE_IFDIR);
+ archive_entry_set_ino(entry, 3);
+ archive_entry_set_hardlink(entry, NULL);
+ archive_entry_linkify(resolver, &entry, &e2);
+ /* Shouldn't be altered, since it wasn't seen before. */
+ assert(e2 == NULL);
+ assertEqualString("test3", archive_entry_pathname(entry));
+ assertEqualString(NULL, archive_entry_hardlink(entry));
+
+ /* Dir, so it shouldn't get matched. */
+ archive_entry_linkify(resolver, &entry, &e2);
+ assert(e2 == NULL);
+ assertEqualString("test3", archive_entry_pathname(entry));
+ assertEqualString(NULL, archive_entry_hardlink(entry));
+
+ archive_entry_free(entry);
+ archive_entry_linkresolver_free(resolver);
+}
+
+static void test_linkify_old_cpio(void)
+{
+ struct archive_entry *entry, *e2;
+ struct archive_entry_linkresolver *resolver;
+
+ /* Initialize the resolver. */
+ assert(NULL != (resolver = archive_entry_linkresolver_new()));
+ archive_entry_linkresolver_set_strategy(resolver,
+ ARCHIVE_FORMAT_CPIO_POSIX);
+
+ /* Create an entry with 2 link and try to linkify it. */
+ assert(NULL != (entry = archive_entry_new()));
+ archive_entry_set_pathname(entry, "test1");
+ archive_entry_set_ino(entry, 1);
+ archive_entry_set_dev(entry, 2);
+ archive_entry_set_nlink(entry, 2);
+ archive_entry_set_size(entry, 10);
+ archive_entry_linkify(resolver, &entry, &e2);
+
+ /* Shouldn't have been changed. */
+ assert(e2 == NULL);
+ assertEqualInt(10, archive_entry_size(entry));
+ assertEqualString("test1", archive_entry_pathname(entry));
+
+ /* Still shouldn't be matched. */
+ archive_entry_linkify(resolver, &entry, &e2);
+ assert(e2 == NULL);
+ assertEqualString("test1", archive_entry_pathname(entry));
+ assertEqualString(NULL, archive_entry_hardlink(entry));
+ assertEqualInt(10, archive_entry_size(entry));
+
+ archive_entry_free(entry);
+ archive_entry_linkresolver_free(resolver);
+}
+
+static void test_linkify_new_cpio(void)
+{
+ struct archive_entry *entry, *e2;
+ struct archive_entry_linkresolver *resolver;
+
+ /* Initialize the resolver. */
+ assert(NULL != (resolver = archive_entry_linkresolver_new()));
+ archive_entry_linkresolver_set_strategy(resolver,
+ ARCHIVE_FORMAT_CPIO_SVR4_NOCRC);
+
+ /* Create an entry with only 1 link and try to linkify it. */
+ assert(NULL != (entry = archive_entry_new()));
+ archive_entry_set_pathname(entry, "test1");
+ archive_entry_set_ino(entry, 1);
+ archive_entry_set_dev(entry, 2);
+ archive_entry_set_nlink(entry, 1);
+ archive_entry_set_size(entry, 10);
+ archive_entry_linkify(resolver, &entry, &e2);
+
+ /* Shouldn't have been changed. */
+ assert(e2 == NULL);
+ assertEqualInt(10, archive_entry_size(entry));
+ assertEqualString("test1", archive_entry_pathname(entry));
+
+ /* Now, try again with an entry that has 3 links. */
+ archive_entry_set_pathname(entry, "test2");
+ archive_entry_set_nlink(entry, 3);
+ archive_entry_set_ino(entry, 2);
+ archive_entry_linkify(resolver, &entry, &e2);
+
+ /* First time, it just gets swallowed. */
+ assert(entry == NULL);
+ assert(e2 == NULL);
+
+ /* Match again. */
+ assert(NULL != (entry = archive_entry_new()));
+ archive_entry_set_pathname(entry, "test3");
+ archive_entry_set_ino(entry, 2);
+ archive_entry_set_dev(entry, 2);
+ archive_entry_set_nlink(entry, 2);
+ archive_entry_set_size(entry, 10);
+ archive_entry_linkify(resolver, &entry, &e2);
+
+ /* Should get back "test2" and nothing else. */
+ assertEqualString("test2", archive_entry_pathname(entry));
+ assertEqualInt(0, archive_entry_size(entry));
+ archive_entry_free(entry);
+ assert(NULL == e2);
+ archive_entry_free(e2); /* This should be a no-op. */
+
+ /* Match a third time. */
+ assert(NULL != (entry = archive_entry_new()));
+ archive_entry_set_pathname(entry, "test4");
+ archive_entry_set_ino(entry, 2);
+ archive_entry_set_dev(entry, 2);
+ archive_entry_set_nlink(entry, 3);
+ archive_entry_set_size(entry, 10);
+ archive_entry_linkify(resolver, &entry, &e2);
+
+ /* Should get back "test3". */
+ assertEqualString("test3", archive_entry_pathname(entry));
+ assertEqualInt(0, archive_entry_size(entry));
+
+ /* Since "test4" was the last link, should get it back also. */
+ assertEqualString("test4", archive_entry_pathname(e2));
+ assertEqualInt(10, archive_entry_size(e2));
+
+ archive_entry_free(entry);
+ archive_entry_free(e2);
+ archive_entry_linkresolver_free(resolver);
+}
+
+DEFINE_TEST(test_link_resolver)
+{
+ test_linkify_tar();
+ test_linkify_old_cpio();
+ test_linkify_new_cpio();
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c b/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c
new file mode 100644
index 00000000000..5f1ac935c1e
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_pax_filename_encoding.c
@@ -0,0 +1,333 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_pax_filename_encoding.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+#include <locale.h>
+
+/*
+ * Pax interchange is supposed to encode filenames into
+ * UTF-8. Of course, that's not always possible. This
+ * test is intended to verify that filenames always get
+ * stored and restored correctly, regardless of the encodings.
+ */
+
+/*
+ * Read a manually-created archive that has filenames that are
+ * stored in binary instead of UTF-8 and verify that we get
+ * the right filename returned and that we get a warning only
+ * if the header isn't marked as binary.
+ */
+static void
+test_pax_filename_encoding_1(void)
+{
+ static const char testname[] = "test_pax_filename_encoding.tar";
+ /*
+ * \314\214 is a valid 2-byte UTF-8 sequence.
+ * \374 is invalid in UTF-8.
+ */
+ char filename[] = "abc\314\214mno\374xyz";
+ struct archive *a;
+ struct archive_entry *entry;
+
+ /*
+ * Read an archive that has non-UTF8 pax filenames in it.
+ */
+ extract_reference_file(testname);
+ a = archive_read_new();
+ assertEqualInt(ARCHIVE_OK, archive_read_support_format_tar(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_support_compression_all(a));
+ assertEqualInt(ARCHIVE_OK,
+ archive_read_open_filename(a, testname, 10240));
+ /*
+ * First entry in this test archive has an invalid UTF-8 sequence
+ * in it, but the header is not marked as hdrcharset=BINARY, so that
+ * requires a warning.
+ */
+ failure("Invalid UTF8 in a pax archive pathname should cause a warning");
+ assertEqualInt(ARCHIVE_WARN, archive_read_next_header(a, &entry));
+ assertEqualString(filename, archive_entry_pathname(entry));
+ /*
+ * Second entry is identical except that it does have
+ * hdrcharset=BINARY, so no warning should be generated.
+ */
+ failure("A pathname with hdrcharset=BINARY can have invalid UTF8\n"
+ " characters in it without generating a warning");
+ assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &entry));
+ assertEqualString(filename, archive_entry_pathname(entry));
+ archive_read_finish(a);
+}
+
+/*
+ * Set the locale and write a pathname containing invalid characters.
+ * This should work; the underlying implementation should automatically
+ * fall back to storing the pathname in binary.
+ */
+static void
+test_pax_filename_encoding_2(void)
+{
+ char filename[] = "abc\314\214mno\374xyz";
+ struct archive *a;
+ struct archive_entry *entry;
+ char buff[65536];
+ char longname[] = "abc\314\214mno\374xyz"
+ "/abc\314\214mno\374xyz/abcdefghijklmnopqrstuvwxyz"
+ "/abc\314\214mno\374xyz/abcdefghijklmnopqrstuvwxyz"
+ "/abc\314\214mno\374xyz/abcdefghijklmnopqrstuvwxyz"
+ "/abc\314\214mno\374xyz/abcdefghijklmnopqrstuvwxyz"
+ "/abc\314\214mno\374xyz/abcdefghijklmnopqrstuvwxyz"
+ "/abc\314\214mno\374xyz/abcdefghijklmnopqrstuvwxyz"
+ ;
+ size_t used;
+
+ /*
+ * We need a starting locale which has invalid sequences.
+ * de_DE.UTF-8 seems to be commonly supported.
+ */
+ /* If it doesn't exist, just warn and return. */
+ if (LOCALE_UTF8 == NULL
+ || NULL == setlocale(LC_ALL, LOCALE_UTF8)) {
+ skipping("invalid encoding tests require a suitable locale;"
+ " %s not available on this system", LOCALE_UTF8);
+ return;
+ }
+
+ assert((a = archive_write_new()) != NULL);
+ assertEqualIntA(a, 0, archive_write_set_format_pax(a));
+ assertEqualIntA(a, 0, archive_write_set_compression_none(a));
+ assertEqualIntA(a, 0, archive_write_set_bytes_per_block(a, 0));
+ assertEqualInt(0,
+ archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+ assert((entry = archive_entry_new()) != NULL);
+ /* Set pathname, gname, uname, hardlink to nonconvertible values. */
+ archive_entry_copy_pathname(entry, filename);
+ archive_entry_copy_gname(entry, filename);
+ archive_entry_copy_uname(entry, filename);
+ archive_entry_copy_hardlink(entry, filename);
+ archive_entry_set_filetype(entry, AE_IFREG);
+ failure("This should generate a warning for nonconvertible names.");
+ assertEqualInt(ARCHIVE_WARN, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+ assert((entry = archive_entry_new()) != NULL);
+ /* Set path, gname, uname, and symlink to nonconvertible values. */
+ archive_entry_copy_pathname(entry, filename);
+ archive_entry_copy_gname(entry, filename);
+ archive_entry_copy_uname(entry, filename);
+ archive_entry_copy_symlink(entry, filename);
+ archive_entry_set_filetype(entry, AE_IFLNK);
+ failure("This should generate a warning for nonconvertible names.");
+ assertEqualInt(ARCHIVE_WARN, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+ assert((entry = archive_entry_new()) != NULL);
+ /* Set pathname to a very long nonconvertible value. */
+ archive_entry_copy_pathname(entry, longname);
+ archive_entry_set_filetype(entry, AE_IFREG);
+ failure("This should generate a warning for nonconvertible names.");
+ assertEqualInt(ARCHIVE_WARN, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+ assertEqualInt(0, archive_write_close(a));
+ assertEqualInt(0, archive_write_finish(a));
+
+ /*
+ * Now read the entries back.
+ */
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualInt(0, archive_read_support_format_tar(a));
+ assertEqualInt(0, archive_read_open_memory(a, buff, used));
+
+ assertEqualInt(0, archive_read_next_header(a, &entry));
+ assertEqualString(filename, archive_entry_pathname(entry));
+ assertEqualString(filename, archive_entry_gname(entry));
+ assertEqualString(filename, archive_entry_uname(entry));
+ assertEqualString(filename, archive_entry_hardlink(entry));
+
+ assertEqualInt(0, archive_read_next_header(a, &entry));
+ assertEqualString(filename, archive_entry_pathname(entry));
+ assertEqualString(filename, archive_entry_gname(entry));
+ assertEqualString(filename, archive_entry_uname(entry));
+ assertEqualString(filename, archive_entry_symlink(entry));
+
+ assertEqualInt(0, archive_read_next_header(a, &entry));
+ assertEqualString(longname, archive_entry_pathname(entry));
+
+ assertEqualInt(0, archive_read_close(a));
+ assertEqualInt(0, archive_read_finish(a));
+}
+
+/*
+ * Create an entry starting from a wide-character Unicode pathname,
+ * read it back into "C" locale, which doesn't support the name.
+ * TODO: Figure out the "right" behavior here.
+ */
+static void
+test_pax_filename_encoding_3(void)
+{
+ wchar_t badname[] = L"xxxAyyyBzzz";
+ const char badname_utf8[] = "xxx\xE1\x88\xB4yyy\xE5\x99\xB8zzz";
+ struct archive *a;
+ struct archive_entry *entry;
+ char buff[65536];
+ size_t used;
+
+ badname[3] = 0x1234;
+ badname[7] = 0x5678;
+
+ /* If it doesn't exist, just warn and return. */
+ if (NULL == setlocale(LC_ALL, "C")) {
+ skipping("Can't set \"C\" locale, so can't exercise "
+ "certain character-conversion failures");
+ return;
+ }
+
+ /* If wctomb is broken, warn and return. */
+ if (wctomb(buff, 0x1234) > 0) {
+ skipping("Cannot test conversion failures because \"C\" "
+ "locale on this system has no invalid characters.");
+ return;
+ }
+
+ /* If wctomb is broken, warn and return. */
+ if (wctomb(buff, 0x1234) > 0) {
+ skipping("Cannot test conversion failures because \"C\" "
+ "locale on this system has no invalid characters.");
+ return;
+ }
+
+ /* Skip test if archive_entry_update_pathname_utf8() is broken. */
+ /* In particular, this is currently broken on Win32 because
+ * setlocale() does not set the default encoding for CP_ACP. */
+ entry = archive_entry_new();
+ if (archive_entry_update_pathname_utf8(entry, badname_utf8)) {
+ archive_entry_free(entry);
+ skipping("Cannot test conversion failures.");
+ return;
+ }
+ archive_entry_free(entry);
+
+ assert((a = archive_write_new()) != NULL);
+ assertEqualIntA(a, 0, archive_write_set_format_pax(a));
+ assertEqualIntA(a, 0, archive_write_set_compression_none(a));
+ assertEqualIntA(a, 0, archive_write_set_bytes_per_block(a, 0));
+ assertEqualInt(0,
+ archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+ assert((entry = archive_entry_new()) != NULL);
+ /* Set pathname to non-convertible wide value. */
+ archive_entry_copy_pathname_w(entry, badname);
+ archive_entry_set_filetype(entry, AE_IFREG);
+ assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname_w(entry, L"abc");
+ /* Set gname to non-convertible wide value. */
+ archive_entry_copy_gname_w(entry, badname);
+ archive_entry_set_filetype(entry, AE_IFREG);
+ assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname_w(entry, L"abc");
+ /* Set uname to non-convertible wide value. */
+ archive_entry_copy_uname_w(entry, badname);
+ archive_entry_set_filetype(entry, AE_IFREG);
+ assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname_w(entry, L"abc");
+ /* Set hardlink to non-convertible wide value. */
+ archive_entry_copy_hardlink_w(entry, badname);
+ archive_entry_set_filetype(entry, AE_IFREG);
+ assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname_w(entry, L"abc");
+ /* Set symlink to non-convertible wide value. */
+ archive_entry_copy_symlink_w(entry, badname);
+ archive_entry_set_filetype(entry, AE_IFLNK);
+ assertEqualInt(ARCHIVE_OK, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+ assertEqualInt(0, archive_write_close(a));
+ assertEqualInt(0, archive_write_finish(a));
+
+ /*
+ * Now read the entries back.
+ */
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualInt(0, archive_read_support_format_tar(a));
+ assertEqualInt(0, archive_read_open_memory(a, buff, used));
+
+ failure("A non-convertible pathname should cause a warning.");
+ assertEqualInt(ARCHIVE_WARN, archive_read_next_header(a, &entry));
+ assertEqualWString(badname, archive_entry_pathname_w(entry));
+ failure("If native locale can't convert, we should get UTF-8 back.");
+ assertEqualString(badname_utf8, archive_entry_pathname(entry));
+
+ failure("A non-convertible gname should cause a warning.");
+ assertEqualInt(ARCHIVE_WARN, archive_read_next_header(a, &entry));
+ assertEqualWString(badname, archive_entry_gname_w(entry));
+ failure("If native locale can't convert, we should get UTF-8 back.");
+ assertEqualString(badname_utf8, archive_entry_gname(entry));
+
+ failure("A non-convertible uname should cause a warning.");
+ assertEqualInt(ARCHIVE_WARN, archive_read_next_header(a, &entry));
+ assertEqualWString(badname, archive_entry_uname_w(entry));
+ failure("If native locale can't convert, we should get UTF-8 back.");
+ assertEqualString(badname_utf8, archive_entry_uname(entry));
+
+ failure("A non-convertible hardlink should cause a warning.");
+ assertEqualInt(ARCHIVE_WARN, archive_read_next_header(a, &entry));
+ assertEqualWString(badname, archive_entry_hardlink_w(entry));
+ failure("If native locale can't convert, we should get UTF-8 back.");
+ assertEqualString(badname_utf8, archive_entry_hardlink(entry));
+
+ failure("A non-convertible symlink should cause a warning.");
+ assertEqualInt(ARCHIVE_WARN, archive_read_next_header(a, &entry));
+ assertEqualWString(badname, archive_entry_symlink_w(entry));
+ assertEqualWString(NULL, archive_entry_hardlink_w(entry));
+ failure("If native locale can't convert, we should get UTF-8 back.");
+ assertEqualString(badname_utf8, archive_entry_symlink(entry));
+
+ assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &entry));
+
+ assertEqualInt(0, archive_read_close(a));
+ assertEqualInt(0, archive_read_finish(a));
+}
+
+DEFINE_TEST(test_pax_filename_encoding)
+{
+ test_pax_filename_encoding_1();
+ test_pax_filename_encoding_2();
+ test_pax_filename_encoding_3();
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_read_compress_program.c b/archivers/libarchive/files/libarchive/test/test_read_compress_program.c
new file mode 100644
index 00000000000..4e6c610de25
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_compress_program.c
@@ -0,0 +1,84 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_compress_program.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+static unsigned char archive[] = {
+31,139,8,0,222,'C','p','C',0,3,211,'c',160,'=','0','0','0','0','7','5','U',
+0,210,134,230,166,6,200,'4',28,'(',24,26,24,27,155,24,152,24,154,27,155,')',
+24,24,26,152,154,25,'2','(',152,210,193,'m',12,165,197,'%',137,'E','@',167,
+148,'d',230,226,'U','G','H',30,234,15,'8','=',10,'F',193,'(',24,5,131,28,
+0,0,29,172,5,240,0,6,0,0};
+
+DEFINE_TEST(test_read_compress_program)
+{
+ int r;
+ struct archive_entry *ae;
+ struct archive *a;
+
+ /*
+ * First, test handling when a non-existent compression
+ * program is requested.
+ */
+ assert((a = archive_read_new()) != NULL);
+ r = archive_read_support_compression_program(a, "nonexistent");
+ if (r == ARCHIVE_FATAL) {
+ skipping("archive_read_support_compression_program() "
+ "unsupported on this platform");
+ return;
+ }
+ assertEqualIntA(a, ARCHIVE_OK, r);
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_format_all(a));
+ assertEqualIntA(a, ARCHIVE_FATAL,
+ archive_read_open_memory(a, archive, sizeof(archive)));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+
+ /*
+ * If we have "gzip -d", try using that.
+ */
+ if (!canGunzip()) {
+ skipping("Can't run gunzip program on this platform");
+ return;
+ }
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_compression_none(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_compression_program(a, "gunzip"));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_format_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_open_memory(a, archive, sizeof(archive)));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_next_header(a, &ae));
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_PROGRAM);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_data_large.c b/archivers/libarchive/files/libarchive/test/test_read_data_large.c
new file mode 100644
index 00000000000..fe9120b5954
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_data_large.c
@@ -0,0 +1,125 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_data_large.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+/*
+ * Test read/write of a 10M block of data in a single operation.
+ * Uses an in-memory archive with a single 10M entry. Exercises
+ * archive_read_data() to ensure it can handle large blocks like
+ * this and also exercises archive_read_data_into_fd() (which
+ * had a bug relating to this, fixed in Nov 2006).
+ */
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define open _open
+#define close _close
+#endif
+
+char buff1[11000000];
+char buff2[10000000];
+char buff3[10000000];
+
+DEFINE_TEST(test_read_data_large)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ char tmpfilename[] = "largefile";
+ int tmpfilefd;
+ FILE *f;
+ unsigned int i;
+ size_t used;
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ assertA(0 == archive_write_open_memory(a, buff1, sizeof(buff1), &used));
+
+ /*
+ * Write a file (with random contents) to it.
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ for (i = 0; i < sizeof(buff2); i++)
+ buff2[i] = (unsigned char)rand();
+ archive_entry_set_size(ae, sizeof(buff2));
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assertA((int)sizeof(buff2) == archive_write_data(a, buff2, sizeof(buff2)));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertA(0 == archive_write_finish(a));
+#endif
+
+ /* Check that archive_read_data can handle 10*10^6 at a pop. */
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff1, sizeof(buff1)));
+ assertA(0 == archive_read_next_header(a, &ae));
+ failure("Wrote 10MB, but didn't read the same amount");
+ assertEqualIntA(a, sizeof(buff2),archive_read_data(a, buff3, sizeof(buff3)));
+ failure("Read expected 10MB, but data read didn't match what was written");
+ assert(0 == memcmp(buff2, buff3, sizeof(buff3)));
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+
+ /* Check archive_read_data_into_fd */
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff1, sizeof(buff1)));
+ assertA(0 == archive_read_next_header(a, &ae));
+#if defined(__BORLANDC__)
+ tmpfilefd = open(tmpfilename, O_WRONLY | O_CREAT | O_BINARY);
+#else
+ tmpfilefd = open(tmpfilename, O_WRONLY | O_CREAT | O_BINARY, 0777);
+#endif
+ assert(tmpfilefd != 0);
+ assertEqualIntA(a, 0, archive_read_data_into_fd(a, tmpfilefd));
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+ close(tmpfilefd);
+
+ f = fopen(tmpfilename, "rb");
+ assert(f != NULL);
+ assertEqualInt(sizeof(buff3), fread(buff3, 1, sizeof(buff3), f));
+ fclose(f);
+ assert(0 == memcmp(buff2, buff3, sizeof(buff3)));
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_read_extract.c b/archivers/libarchive/files/libarchive/test/test_read_extract.c
new file mode 100644
index 00000000000..5696e0d356f
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_extract.c
@@ -0,0 +1,168 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_extract.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+#define BUFF_SIZE 1000000
+#define FILE_BUFF_SIZE 100000
+
+DEFINE_TEST(test_read_extract)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ size_t used;
+ int i, numEntries = 0;
+ char *buff, *file_buff;
+
+ buff = malloc(BUFF_SIZE);
+ file_buff = malloc(FILE_BUFF_SIZE);
+
+ /* Force the umask to something predictable. */
+ assertUmask(022);
+
+ /* Create a new archive in memory containing various types of entries. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ assertA(0 == archive_write_open_memory(a, buff, BUFF_SIZE, &used));
+ /* A directory to be restored with EXTRACT_PERM. */
+ ++numEntries;
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "dir_0775");
+ archive_entry_set_mode(ae, S_IFDIR | 0775);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ /* A regular file. */
+ ++numEntries;
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ for (i = 0; i < FILE_BUFF_SIZE; i++)
+ file_buff[i] = (unsigned char)rand();
+ archive_entry_set_size(ae, FILE_BUFF_SIZE);
+ assertA(0 == archive_write_header(a, ae));
+ assertA(FILE_BUFF_SIZE == archive_write_data(a, file_buff, FILE_BUFF_SIZE));
+ archive_entry_free(ae);
+ /* A directory that should obey umask when restored. */
+ ++numEntries;
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "dir");
+ archive_entry_set_mode(ae, S_IFDIR | 0777);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ /* A file in the directory. */
+ ++numEntries;
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "dir/file");
+ archive_entry_set_mode(ae, S_IFREG | 0700);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ /* A file in a dir that is not already in the archive. */
+ ++numEntries;
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "dir2/file");
+ archive_entry_set_mode(ae, S_IFREG | 0000);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ /* A dir with a trailing /. */
+ ++numEntries;
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "dir3/.");
+ archive_entry_set_mode(ae, S_IFDIR | 0710);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ /* Multiple dirs with a single entry. */
+ ++numEntries;
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "dir4/a/../b/../c/");
+ archive_entry_set_mode(ae, S_IFDIR | 0711);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ /* A symlink. */
+ if (canSymlink()) {
+ ++numEntries;
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "symlink");
+ archive_entry_set_mode(ae, AE_IFLNK | 0755);
+ archive_entry_set_symlink(ae, "file");
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ }
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+ assertA(0 == archive_write_finish(a));
+
+ /* Extract the entries to disk. */
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff, BUFF_SIZE));
+ /* Restore first entry with _EXTRACT_PERM. */
+ failure("Error reading first entry", i);
+ assertA(0 == archive_read_next_header(a, &ae));
+ assertA(0 == archive_read_extract(a, ae, ARCHIVE_EXTRACT_PERM));
+ /* Rest of entries get restored with no flags. */
+ for (i = 1; i < numEntries; i++) {
+ failure("Error reading entry %d", i);
+ assertA(0 == archive_read_next_header(a, &ae));
+ failure("Failed to extract entry %d: %s", i,
+ archive_entry_pathname(ae));
+ assertA(0 == archive_read_extract(a, ae, 0));
+ }
+ assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae));
+ assert(0 == archive_read_close(a));
+ assert(0 == archive_read_finish(a));
+
+ /* Test the entries on disk. */
+ /* This first entry was extracted with ARCHIVE_EXTRACT_PERM,
+ * so the permissions should have been restored exactly,
+ * including resetting the gid bit on those platforms
+ * where gid is inherited by subdirs. */
+ failure("This was 0775 in archive, and should be 0775 on disk");
+ assertIsDir("dir_0775", 0775);
+ /* Everything else was extracted without ARCHIVE_EXTRACT_PERM,
+ * so there may be some sloppiness about gid bits on directories. */
+ assertIsReg("file", 0755);
+ assertFileSize("file", FILE_BUFF_SIZE);
+ assertFileContents(file_buff, FILE_BUFF_SIZE, "file");
+ /* If EXTRACT_PERM wasn't used, be careful to ignore sgid bit
+ * when checking dir modes, as some systems inherit sgid bit
+ * from the parent dir. */
+ failure("This was 0777 in archive, but umask should make it 0755");
+ assertIsDir("dir", 0755);
+ assertIsReg("dir/file", 0700);
+ assertIsDir("dir2", 0755);
+ assertIsReg("dir2/file", 0000);
+ assertIsDir("dir3", 0710);
+ assertIsDir("dir4", 0755);
+ assertIsDir("dir4/a", 0755);
+ assertIsDir("dir4/b", 0755);
+ assertIsDir("dir4/c", 0711);
+ if (canSymlink())
+ assertIsSymlink("symlink", "file");
+
+ free(buff);
+ free(file_buff);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_ar.c b/archivers/libarchive/files/libarchive/test/test_read_format_ar.c
new file mode 100644
index 00000000000..efea38d2c53
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_ar.c
@@ -0,0 +1,87 @@
+/*-
+ * Copyright (c) 2007 Kai Wang
+ * Copyright (c) 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
+ * 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.
+ */
+
+#include "test.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_ar.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+
+DEFINE_TEST(test_read_format_ar)
+{
+ char buff[64];
+ const char reffile[] = "test_read_format_ar.ar";
+ struct archive_entry *ae;
+ struct archive *a;
+
+ extract_reference_file(reffile);
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_open_file(a, reffile, 7));
+
+ /* Filename table. */
+ assertA(0 == archive_read_next_header(a, &ae));
+ assertEqualString("//", archive_entry_pathname(ae));
+ assertEqualInt(0, archive_entry_mtime(ae));
+ assertEqualInt(0, archive_entry_uid(ae));
+ assertEqualInt(0, archive_entry_gid(ae));
+ assertEqualInt(0, archive_entry_size(ae));
+
+ /* First Entry */
+ assertA(0 == archive_read_next_header(a, &ae));
+ assertEqualString("yyytttsssaaafff.o", archive_entry_pathname(ae));
+ assertEqualInt(1175465652, archive_entry_mtime(ae));
+ assertEqualInt(1001, archive_entry_uid(ae));
+ assertEqualInt(0, archive_entry_gid(ae));
+ assert(8 == archive_entry_size(ae));
+ assertA(8 == archive_read_data(a, buff, 10));
+ assert(0 == memcmp(buff, "55667788", 8));
+
+ /* Second Entry */
+ assertA(0 == archive_read_next_header(a, &ae));
+ assertEqualString("gghh.o", archive_entry_pathname(ae));
+ assertEqualInt(1175465668, archive_entry_mtime(ae));
+ assertEqualInt(1001, archive_entry_uid(ae));
+ assertEqualInt(0, archive_entry_gid(ae));
+ assert(4 == archive_entry_size(ae));
+ assertA(4 == archive_read_data(a, buff, 10));
+ assert(0 == memcmp(buff, "3333", 4));
+
+ /* Third Entry */
+ assertA(0 == archive_read_next_header(a, &ae));
+ assertEqualString("hhhhjjjjkkkkllll.o", archive_entry_pathname(ae));
+ assertEqualInt(1175465713, archive_entry_mtime(ae));
+ assertEqualInt(1001, archive_entry_uid(ae));
+ assertEqualInt(0, archive_entry_gid(ae));
+ assert(9 == archive_entry_size(ae));
+ assertA(9 == archive_read_data(a, buff, 9));
+ assert(0 == memcmp(buff, "987654321", 9));
+
+ /* Test EOF */
+ assertA(1 == archive_read_next_header(a, &ae));
+ assert(0 == archive_read_close(a));
+ assert(0 == archive_read_finish(a));
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin.c b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin.c
new file mode 100644
index 00000000000..fecc0ab4834
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin.c
@@ -0,0 +1,64 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_cpio_bin.c,v 1.2 2008/09/01 05:38:33 kientzle Exp $");
+
+static unsigned char archive[] = {
+199,'q',21,4,177,'y',237,'A',232,3,232,3,2,0,0,0,'p','C',244,'M',2,0,0,0,
+0,0,'.',0,199,'q',0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,11,0,0,0,0,0,'T','R',
+'A','I','L','E','R','!','!','!',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
+
+DEFINE_TEST(test_read_format_cpio_bin)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_open_memory(a, archive, sizeof(archive)));
+ assertA(0 == archive_read_next_header(a, &ae));
+ assertA(archive_compression(a) == ARCHIVE_COMPRESSION_NONE);
+ assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_BIN_LE);
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin_Z.c b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin_Z.c
new file mode 100644
index 00000000000..bae370b1717
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin_Z.c
@@ -0,0 +1,61 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_cpio_bin_Z.c 189464 2009-03-07 00:25:33Z kientzle $");
+
+static unsigned char archive[] = {
+31,157,144,199,226,'T',' ',16,'+','O',187,' ',232,6,'$',20,0,160,'!',156,
+'!',244,154,'0','l',216,208,5,128,128,20,'3','R',12,160,177,225,2,141,'T',
+164,4,'I',194,164,136,148,16,'(',';',170,'\\',201,178,165,203,151,'0','c',
+202,156,'I',179,166,205,155,'8','s',234,220,201,179,167,207,159,'@',127,2};
+
+DEFINE_TEST(test_read_format_cpio_bin_Z)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_format_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_open_memory(a, archive, sizeof(archive)));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ failure("archive_compression_name(a)=\"%s\"",
+ archive_compression_name(a));
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS);
+ assertEqualString(archive_compression_name(a), "compress (.Z)");
+ failure("archive_format_name(a)=\"%s\"",
+ archive_format_name(a));
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+#endif
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin_bz2.c b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin_bz2.c
new file mode 100644
index 00000000000..598c6256ad1
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin_bz2.c
@@ -0,0 +1,58 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_cpio_bin_bz2.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+static unsigned char archive[] = {
+'B','Z','h','9','1','A','Y','&','S','Y',134,'J',208,'4',0,0,30,246,141,253,
+8,2,0,' ',1,'*','&',20,0,'`',' ',' ',2,0,128,0,'B',4,8,' ',0,'T','P',0,'4',
+0,13,6,137,168,245,27,'Q',160,'a',25,169,5,'I',187,'(',10,'d','E',177,177,
+142,218,232,'r',130,'4','D',247,'<','Z',190,'U',237,236,'d',227,31,' ','z',
+192,'E','_',23,'r','E','8','P',144,134,'J',208,'4'};
+
+DEFINE_TEST(test_read_format_cpio_bin_bz2)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ int r;
+
+ assert((a = archive_read_new()) != NULL);
+ r = archive_read_support_compression_bzip2(a);
+ if (r != ARCHIVE_OK) {
+ skipping("bzip2 support unavailable");
+ archive_read_close(a);
+ return;
+ }
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_open_memory(a, archive, sizeof(archive)));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assert(archive_compression(a) == ARCHIVE_COMPRESSION_BZIP2);
+ assert(archive_format(a) == ARCHIVE_FORMAT_CPIO_BIN_LE);
+ assert(0 == archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin_gz.c b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin_gz.c
new file mode 100644
index 00000000000..4457fb3c6ff
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_bin_gz.c
@@ -0,0 +1,61 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_cpio_bin_gz.c 191183 2009-04-17 01:06:31Z kientzle $");
+
+static unsigned char archive[] = {
+31,139,8,0,244,'M','p','C',0,3,';','^','(',202,178,177,242,173,227,11,230,
+23,204,'L',12,12,12,5,206,'_','|','A','4',3,131,30,195,241,'B',6,'8','`',
+132,210,220,'`','2','$',200,209,211,199,'5','H','Q','Q',145,'a',20,12,'i',
+0,0,170,199,228,195,0,2,0,0};
+
+DEFINE_TEST(test_read_format_cpio_bin_gz)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ int r;
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualInt(ARCHIVE_OK, archive_read_support_compression_all(a));
+ r = archive_read_support_compression_gzip(a);
+ if (r == ARCHIVE_WARN) {
+ skipping("gzip reading not fully supported on this platform");
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+ return;
+ }
+ failure("archive_read_support_compression_gzip");
+ assertEqualInt(ARCHIVE_OK, r);
+ assertEqualInt(ARCHIVE_OK, archive_read_support_format_all(a));
+ assertEqualInt(ARCHIVE_OK,
+ archive_read_open_memory(a, archive, sizeof(archive)));
+ assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_compression(a),
+ ARCHIVE_COMPRESSION_GZIP);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE);
+ assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_cpio_odc.c b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_odc.c
new file mode 100644
index 00000000000..6563fcd7e9e
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_odc.c
@@ -0,0 +1,68 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_cpio_odc.c,v 1.3 2008/09/01 05:38:33 kientzle Exp $");
+
+static unsigned char archive[] = {
+'0','7','0','7','0','7','0','0','2','0','2','5','0','7','4','6','6','1','0',
+'4','0','7','5','5','0','0','1','7','5','0','0','0','1','7','5','0','0','0',
+'0','0','0','2','0','0','0','0','0','0','1','0','3','3','4','0','5','0','0',
+'5','3','0','0','0','0','0','2','0','0','0','0','0','0','0','0','0','0','0',
+'.',0,'0','7','0','7','0','7','0','0','0','0','0','0','0','0','0','0','0',
+'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0',
+'0','0','0','0','0','1','0','0','0','0','0','0','0','0','0','0','0','0','0',
+'0','0','0','0','0','0','0','0','1','3','0','0','0','0','0','0','0','0','0',
+'0','0','T','R','A','I','L','E','R','!','!','!',0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0};
+
+DEFINE_TEST(test_read_format_cpio_odc)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_open_memory(a, archive, sizeof(archive)));
+ assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
+ assertA(archive_compression(a) == ARCHIVE_COMPRESSION_NONE);
+ assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_POSIX);
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_cpio_svr4_gzip.c b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_svr4_gzip.c
new file mode 100644
index 00000000000..8b19a021b0d
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_svr4_gzip.c
@@ -0,0 +1,61 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_cpio_svr4_gzip.c 191183 2009-04-17 01:06:31Z kientzle $");
+
+static unsigned char archive[] = {
+31,139,8,0,236,'c',217,'D',0,3,'3','0','7','0','7','0','4','0','0',181,'0',
+183,'L',2,210,6,6,'&',134,169,')',' ',218,192,'8',213,2,133,'6','0','0','2',
+'1','6','7','0','5','0','N','6','@',5,'&',16,202,208,212,0,';','0',130,'1',
+244,24,12,160,246,17,5,136,'U',135,14,146,'`',140,144,' ','G','O',31,215,
+' ','E','E','E',134,'Q',128,21,0,0,'%',215,202,221,0,2,0,0};
+
+DEFINE_TEST(test_read_format_cpio_svr4_gzip)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ int r;
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualInt(ARCHIVE_OK, archive_read_support_compression_all(a));
+ r = archive_read_support_compression_gzip(a);
+ if (r == ARCHIVE_WARN) {
+ skipping("gzip reading not fully supported on this platform");
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+ return;
+ }
+ assertEqualInt(ARCHIVE_OK, archive_read_support_format_all(a));
+ assertEqualInt(ARCHIVE_OK,
+ archive_read_open_memory(a, archive, sizeof(archive)));
+ assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_compression(a),
+ ARCHIVE_COMPRESSION_GZIP);
+ assertEqualInt(archive_format(a),
+ ARCHIVE_FORMAT_CPIO_SVR4_NOCRC);
+ assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_cpio_svr4c_Z.c b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_svr4c_Z.c
new file mode 100644
index 00000000000..d3f086bbd51
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_cpio_svr4c_Z.c
@@ -0,0 +1,62 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_cpio_svr4c_Z.c 189381 2009-03-05 00:31:48Z kientzle $");
+
+static unsigned char archive[] = {
+31,157,144,'0','n',4,132,'!',3,6,140,26,'8','n',228,16,19,195,160,'A',26,
+'1',202,144,'q','h','p','F',25,28,20,'a','X',196,152,145,' ',141,25,2,'k',
+192,160,'A',163,163,201,135,29,'c',136,'<',201,'2','c','A',147,'.',0,12,20,
+248,178,165,205,155,20,27,226,220,201,243,166,152,147,'T',164,4,'I',194,164,
+136,148,16,'H',1,'(',']',202,180,169,211,167,'P',163,'J',157,'J',181,170,
+213,171,'X',179,'j',221,202,181,171,215,175,'L',1};
+
+DEFINE_TEST(test_read_format_cpio_svr4c_Z)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+/* printf("Archive address: start=%X, end=%X\n", archive, archive+sizeof(archive)); */
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_format_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_open_memory(a, archive, sizeof(archive)));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ failure("archive_compression_name(a)=\"%s\"",
+ archive_compression_name(a));
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS);
+ failure("archive_format_name(a)=\"%s\"", archive_format_name(a));
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_SVR4_CRC);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+#endif
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_empty.c b/archivers/libarchive/files/libarchive/test/test_read_format_empty.c
new file mode 100644
index 00000000000..98cfdfa26f5
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_empty.c
@@ -0,0 +1,47 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_empty.c 189308 2009-03-03 17:02:51Z kientzle $");
+
+static unsigned char archive[] = { 0 };
+
+DEFINE_TEST(test_read_format_empty)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_open_memory(a, archive, 0));
+ assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae));
+ assertA(archive_compression(a) == ARCHIVE_COMPRESSION_NONE);
+ assertA(archive_format(a) == ARCHIVE_FORMAT_EMPTY);
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_gtar_gz.c b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_gz.c
new file mode 100644
index 00000000000..3071b1d0b49
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_gz.c
@@ -0,0 +1,60 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_gtar_gz.c 191183 2009-04-17 01:06:31Z kientzle $");
+
+static unsigned char archive[] = {
+31,139,8,0,'+','e',217,'D',0,3,211,211,'g',160,'9','0',0,2,'s','S','S',16,
+'m','h','n','j',128,'L',195,0,131,161,129,177,177,137,129,137,185,185,161,
+'!',131,129,161,129,153,161,'9',131,130,')',237,157,198,192,'P','Z','\\',
+146,'X',164,160,192,'P',146,153,139,'W',29,'!','y',152,'G','`',244,'(',24,
+5,163,'`',20,12,'r',0,0,226,234,'6',162,0,6,0,0};
+
+DEFINE_TEST(test_read_format_gtar_gz)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ int r;
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualInt(ARCHIVE_OK, archive_read_support_compression_all(a));
+ r = archive_read_support_compression_gzip(a);
+ if (r == ARCHIVE_WARN) {
+ skipping("gzip reading not fully supported on this platform");
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+ return;
+ }
+ assertEqualInt(ARCHIVE_OK, archive_read_support_format_all(a));
+ assertEqualInt(ARCHIVE_OK,
+ archive_read_open_memory(a, archive, sizeof(archive)));
+ assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_compression(a),
+ ARCHIVE_COMPRESSION_GZIP);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_GNUTAR);
+ assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse.c b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse.c
new file mode 100644
index 00000000000..d055fc249a7
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse.c
@@ -0,0 +1,318 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_gtar_sparse.c 189308 2009-03-03 17:02:51Z kientzle $");
+
+
+struct contents {
+ off_t o;
+ size_t s;
+ const char *d;
+};
+
+struct contents archive_contents_sparse[] = {
+ { 1000000, 1, "a" },
+ { 2000000, 1, "a" },
+ { 3145728, 0, NULL }
+};
+
+struct contents archive_contents_sparse2[] = {
+ { 1000000, 1, "a" },
+ { 2000000, 1, "a" },
+ { 3000000, 1, "a" },
+ { 4000000, 1, "a" },
+ { 5000000, 1, "a" },
+ { 6000000, 1, "a" },
+ { 7000000, 1, "a" },
+ { 8000000, 1, "a" },
+ { 9000000, 1, "a" },
+ { 10000000, 1, "a" },
+ { 11000000, 1, "a" },
+ { 12000000, 1, "a" },
+ { 13000000, 1, "a" },
+ { 14000000, 1, "a" },
+ { 15000000, 1, "a" },
+ { 16000000, 1, "a" },
+ { 17000000, 1, "a" },
+ { 18000000, 1, "a" },
+ { 19000000, 1, "a" },
+ { 20000000, 1, "a" },
+ { 21000000, 1, "a" },
+ { 22000000, 1, "a" },
+ { 23000000, 1, "a" },
+ { 24000000, 1, "a" },
+ { 25000000, 1, "a" },
+ { 26000000, 1, "a" },
+ { 27000000, 1, "a" },
+ { 28000000, 1, "a" },
+ { 29000000, 1, "a" },
+ { 30000000, 1, "a" },
+ { 31000000, 1, "a" },
+ { 32000000, 1, "a" },
+ { 33000000, 1, "a" },
+ { 34000000, 1, "a" },
+ { 35000000, 1, "a" },
+ { 36000000, 1, "a" },
+ { 37000000, 1, "a" },
+ { 38000000, 1, "a" },
+ { 39000000, 1, "a" },
+ { 40000000, 1, "a" },
+ { 41000000, 1, "a" },
+ { 42000000, 1, "a" },
+ { 43000000, 1, "a" },
+ { 44000000, 1, "a" },
+ { 45000000, 1, "a" },
+ { 46000000, 1, "a" },
+ { 47000000, 1, "a" },
+ { 48000000, 1, "a" },
+ { 49000000, 1, "a" },
+ { 50000000, 1, "a" },
+ { 51000000, 1, "a" },
+ { 52000000, 1, "a" },
+ { 53000000, 1, "a" },
+ { 54000000, 1, "a" },
+ { 55000000, 1, "a" },
+ { 56000000, 1, "a" },
+ { 57000000, 1, "a" },
+ { 58000000, 1, "a" },
+ { 59000000, 1, "a" },
+ { 60000000, 1, "a" },
+ { 61000000, 1, "a" },
+ { 62000000, 1, "a" },
+ { 63000000, 1, "a" },
+ { 64000000, 1, "a" },
+ { 65000000, 1, "a" },
+ { 66000000, 1, "a" },
+ { 67000000, 1, "a" },
+ { 68000000, 1, "a" },
+ { 69000000, 1, "a" },
+ { 70000000, 1, "a" },
+ { 71000000, 1, "a" },
+ { 72000000, 1, "a" },
+ { 73000000, 1, "a" },
+ { 74000000, 1, "a" },
+ { 75000000, 1, "a" },
+ { 76000000, 1, "a" },
+ { 77000000, 1, "a" },
+ { 78000000, 1, "a" },
+ { 79000000, 1, "a" },
+ { 80000000, 1, "a" },
+ { 81000000, 1, "a" },
+ { 82000000, 1, "a" },
+ { 83000000, 1, "a" },
+ { 84000000, 1, "a" },
+ { 85000000, 1, "a" },
+ { 86000000, 1, "a" },
+ { 87000000, 1, "a" },
+ { 88000000, 1, "a" },
+ { 89000000, 1, "a" },
+ { 90000000, 1, "a" },
+ { 91000000, 1, "a" },
+ { 92000000, 1, "a" },
+ { 93000000, 1, "a" },
+ { 94000000, 1, "a" },
+ { 95000000, 1, "a" },
+ { 96000000, 1, "a" },
+ { 97000000, 1, "a" },
+ { 98000000, 1, "a" },
+ { 99000000, 1, "a" },
+ { 99000001, 0, NULL }
+};
+
+struct contents archive_contents_nonsparse[] = {
+ { 0, 1, "a" },
+ { 1, 0, NULL }
+};
+
+/*
+ * Describe an archive with three entries:
+ *
+ * File 1: named "sparse"
+ * * a length of 3145728 bytes (3MiB)
+ * * a single 'a' byte at offset 1000000
+ * * a single 'a' byte at offset 2000000
+ * File 2: named "sparse2"
+ * * a single 'a' byte at offset 1,000,000, 2,000,000, ..., 99,000,000
+ * * length of 99,000,001
+ * File 3: named 'non-sparse'
+ * * length of 1 byte
+ * * contains a single byte 'a'
+ */
+
+struct archive_contents {
+ const char *filename;
+ struct contents *contents;
+} files[] = {
+ { "sparse", archive_contents_sparse },
+ { "sparse2", archive_contents_sparse2 },
+ { "non-sparse", archive_contents_nonsparse },
+ { NULL, NULL }
+};
+
+static void
+verify_archive_file(const char *name, struct archive_contents *ac)
+{
+ struct archive_entry *ae;
+ int err;
+ /* data, size, offset of next expected block. */
+ struct contents expect;
+ /* data, size, offset of block read from archive. */
+ struct contents actual;
+ const void *p;
+ struct archive *a;
+
+ extract_reference_file(name);
+
+ assert((a = archive_read_new()) != NULL);
+ assert(0 == archive_read_support_compression_all(a));
+ assert(0 == archive_read_support_format_tar(a));
+ failure("Can't open %s", name);
+ assert(0 == archive_read_open_filename(a, name, 3));
+
+ while (ac->filename != NULL) {
+ struct contents *cts = ac->contents;
+
+ if (!assertEqualIntA(a, 0, archive_read_next_header(a, &ae))) {
+ assert(0 == archive_read_finish(a));
+ return;
+ }
+ failure("Name mismatch in archive %s", name);
+ assertEqualString(ac->filename, archive_entry_pathname(ae));
+
+ expect = *cts++;
+ while (0 == (err = archive_read_data_block(a,
+ &p, &actual.s, &actual.o))) {
+ actual.d = p;
+ while (actual.s > 0) {
+ char c = *actual.d;
+ if(actual.o < expect.o) {
+ /*
+ * Any byte before the expected
+ * data must be NULL.
+ */
+ failure("%s: pad at offset %d "
+ "should be zero", name, actual.o);
+ assertEqualInt(c, 0);
+ } else if (actual.o == expect.o) {
+ /*
+ * Data at matching offsets must match.
+ */
+ assertEqualInt(c, *expect.d);
+ expect.d++;
+ expect.o++;
+ expect.s--;
+ /* End of expected? step to next expected. */
+ if (expect.s <= 0)
+ expect = *cts++;
+ } else {
+ /*
+ * We found data beyond that expected.
+ */
+ failure("%s: Unexpected trailing data",
+ name);
+ assert(actual.o <= expect.o);
+ archive_read_finish(a);
+ return;
+ }
+ actual.d++;
+ actual.o++;
+ actual.s--;
+ }
+ }
+ failure("%s: should be end of entry", name);
+ assertEqualIntA(a, err, ARCHIVE_EOF);
+ failure("%s: Size returned at EOF must be zero", name);
+ assertEqualInt((int)actual.s, 0);
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ /* libarchive < 1.9 doesn't get this right */
+ skipping("offset of final sparse chunk");
+#else
+ failure("%s: Offset of final empty chunk must be same as file size", name);
+ assertEqualInt(actual.o, expect.o);
+#endif
+ /* Step to next file description. */
+ ++ac;
+ }
+
+ err = archive_read_next_header(a, &ae);
+ assertEqualIntA(a, ARCHIVE_EOF, err);
+
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+}
+
+
+DEFINE_TEST(test_read_format_gtar_sparse)
+{
+ /* Two archives that use the "GNU tar sparse format". */
+ verify_archive_file("test_read_format_gtar_sparse_1_13.tar", files);
+ verify_archive_file("test_read_format_gtar_sparse_1_17.tar", files);
+
+ /*
+ * libarchive < 1.9 doesn't support the newer --posix sparse formats
+ * from GNU tar 1.15 and later.
+ */
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ skipping("read support for GNUtar --posix sparse formats");
+#else
+ /*
+ * An archive created by GNU tar 1.17 using --posix --sparse-format=0.1
+ */
+ verify_archive_file(
+ "test_read_format_gtar_sparse_1_17_posix00.tar",
+ files);
+ /*
+ * An archive created by GNU tar 1.17 using --posix --sparse-format=0.1
+ */
+ verify_archive_file(
+ "test_read_format_gtar_sparse_1_17_posix01.tar",
+ files);
+ /*
+ * An archive created by GNU tar 1.17 using --posix --sparse-format=1.0
+ */
+ verify_archive_file(
+ "test_read_format_gtar_sparse_1_17_posix10.tar",
+ files);
+ /*
+ * The last test archive here is a little odd. First, it's
+ * uncompressed, because that exercises some of the block
+ * reassembly code a little harder. Second, it includes some
+ * leading comments prior to the sparse block description.
+ * GNU tar doesn't do this, but I think it should, so I want
+ * to ensure that libarchive correctly ignores such comments.
+ * Dump the file, looking for "#!gnu-sparse-format" starting
+ * at byte 0x600.
+ */
+ verify_archive_file(
+ "test_read_format_gtar_sparse_1_17_posix10_modified.tar",
+ files);
+#endif
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu
new file mode 100644
index 00000000000..a9120a21af2
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu
@@ -0,0 +1,1370 @@
+$FreeBSD: src/lib/libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu,v 1.2 2008/07/03 03:26:30 peter Exp $
+begin 644 test_read_format_gtar_sparse_1_17_posix10_modified.tar
+M+B]087A(96%D97)S+C,X-C8S+W-P87)S90``````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````#`P,#`V-#0`,#`P,3<U,``P,#`Q-S4P`#`P,#`P,#`P,C$U
+M`#$P-S,S,3`Q,30S`#`Q,S0V-@`@>```````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````!U<W1A<@`P,```````
+M````````````````````````````````````````````````````````````
+M```````````````````P,#`P,#`P`#`P,#`P,#``````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M```````````````````````R,B!'3E4N<W!A<G-E+FUA:F]R/3$*,C(@1TY5
+M+G-P87)S92YM:6YO<CTP"C(V($=.52YS<&%R<V4N;F%M93US<&%R<V4*,S$@
+M1TY5+G-P87)S92YR96%L<VEZ93TS,30U-S(X"C(P(&%T:6UE/3$Q.3@R.3,V
+M,#(*,C`@8W1I;64],3$Y.#(Y,S8P,`H`````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````"XO1TY54W!A<G-E
+M1FEL92XS.#8V,R]S<&%R<V4`````````````````````````````````````
+M```````````````````````````````````````````````````````````P
+M,#`P-C0T`#`P,#$W-3``,#`P,3<U,``P,#`P,#`P,S`P,``Q,#<S,S$P,3$T
+M,``P,34Q-34`(#``````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````=7-T87(`,#!T:6T`````````````````
+M`````````````````````'1I;0``````````````````````````````````
+M````,#`P,#`P,``P,#`P,#`P````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````(R%G;G4M<W!A<G-E+69O<FUA=`HC9F]R;6%T.C$N,`HS"CDY.3DS
+M-@HU,3(*,3DY.3@W,@HU,3(*,S$T-3<R.`HP"@``````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````80``
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````80``````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````+B]087A(96%D97)S+C,X-C8S+W-P87)S93(`````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````#`P,#`V-#0`,#`P,3<U,``P,#`Q-S4P
+M`#`P,#`P,#`P,C$W`#$P-S,S,3`Q,30S`#`Q,S4U,@`@>```````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````````````!U
+M<W1A<@`P,```````````````````````````````````````````````````
+M```````````````````````````````````P,#`P,#`P`#`P,#`P,#``````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M```````````````````````````````````````R,B!'3E4N<W!A<G-E+FUA
+M:F]R/3$*,C(@1TY5+G-P87)S92YM:6YO<CTP"C(W($=.52YS<&%R<V4N;F%M
+M93US<&%R<V4R"C,R($=.52YS<&%R<V4N<F5A;'-I>F4].3DP,#`P,#$*,C`@
+M871I;64],3$Y.#(Y,S8P,PHR,"!C=&EM93TQ,3DX,CDS-C`Q"@``````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`"XO1TY54W!A<G-E1FEL92XS.#8V,R]S<&%R<V4R````````````````````
+M````````````````````````````````````````````````````````````
+M```````````````P,#`P-C0T`#`P,#$W-3``,#`P,3<U,``P,#`P,#$T-3,P
+M,0`Q,#<S,S$P,3$T,0`P,34R-3,`(#``````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````=7-T87(`,#!T:6T`
+M`````````````````````````````````````'1I;0``````````````````
+M````````````````````,#`P,#`P,``P,#`P,#`P````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````.3D*.3DY.3,V"C4Q,@HQ.3DY.#<R"C4Q,@HR
+M.3DY.#`X"C4Q,@HS.3DY-S0T"C4Q,@HT.3DY-C@P"C4Q,@HU.3DY-C$V"C4Q
+M,@HV.3DY-34R"C4Q,@HX,#`P,#`P"C4Q,@HX.3DY.3,V"C4Q,@HY.3DY.#<R
+M"C4Q,@HQ,#DY.3@P.`HU,3(*,3$Y.3DW-#0*-3$R"C$R.3DY-C@P"C4Q,@HQ
+M,SDY.38Q-@HU,3(*,30Y.3DU-3(*-3$R"C$V,#`P,#`P"C4Q,@HQ-CDY.3DS
+M-@HU,3(*,3<Y.3DX-S(*-3$R"C$X.3DY.#`X"C4Q,@HQ.3DY.3<T-`HU,3(*
+M,C`Y.3DV.#`*-3$R"C(Q.3DY-C$V"C4Q,@HR,CDY.34U,@HU,3(*,C0P,#`P
+M,#`*-3$R"C(T.3DY.3,V"C4Q,@HR-3DY.3@W,@HU,3(*,C8Y.3DX,#@*-3$R
+M"C(W.3DY-S0T"C4Q,@HR.#DY.38X,`HU,3(*,CDY.3DV,38*-3$R"C,P.3DY
+M-34R"C4Q,@HS,C`P,#`P,`HU,3(*,S(Y.3DY,S8*-3$R"C,S.3DY.#<R"C4Q
+M,@HS-#DY.3@P.`HU,3(*,S4Y.3DW-#0*-3$R"C,V.3DY-C@P"C4Q,@HS-SDY
+M.38Q-@HU,3(*,S@Y.3DU-3(*-3$R"C0P,#`P,#`P"C4Q,@HT,#DY.3DS-@HU
+M,3(*-#$Y.3DX-S(*-3$R"C0R.3DY.#`X"C4Q,@HT,SDY.3<T-`HU,3(*-#0Y
+M.3DV.#`*-3$R"C0U.3DY-C$V"C4Q,@HT-CDY.34U,@HU,3(*-#@P,#`P,#`*
+M-3$R"C0X.3DY.3,V"C4Q,@HT.3DY.3@W,@HU,3(*-3`Y.3DX,#@*-3$R"C4Q
+M.3DY-S0T"C4Q,@HU,CDY.38X,`HU,3(*-3,Y.3DV,38*-3$R"C4T.3DY-34R
+M"C4Q,@HU-C`P,#`P,`HU,3(*-38Y.3DY,S8*-3$R"C4W.3DY.#<R"C4Q,@HU
+M.#DY.3@P.`HU,3(*-3DY.3DW-#0*-3$R"C8P.3DY-C@P"C4Q,@HV,3DY.38Q
+M-@HU,3(*-C(Y.3DU-3(*-3$R"C8T,#`P,#`P"C4Q,@HV-#DY.3DS-@HU,3(*
+M-C4Y.3DX-S(*-3$R"C8V.3DY.#`X"C4Q,@HV-SDY.3<T-`HU,3(*-C@Y.3DV
+M.#`*-3$R"C8Y.3DY-C$V"C4Q,@HW,#DY.34U,@HU,3(*-S(P,#`P,#`*-3$R
+M"C<R.3DY.3,V"C4Q,@HW,SDY.3@W,@HU,3(*-S0Y.3DX,#@*-3$R"C<U.3DY
+M-S0T"C4Q,@HW-CDY.38X,`HU,3(*-S<Y.3DV,38*-3$R"C<X.3DY-34R"C4Q
+M,@HX,#`P,#`P,`HU,3(*.#`Y.3DY,S8*-3$R"C@Q.3DY.#<R"C4Q,@HX,CDY
+M.3@P.`HU,3(*.#,Y.3DW-#0*-3$R"C@T.3DY-C@P"C4Q,@HX-3DY.38Q-@HU
+M,3(*.#8Y.3DU-3(*-3$R"C@X,#`P,#`P"C4Q,@HX.#DY.3DS-@HU,3(*.#DY
+M.3DX-S(*-3$R"CDP.3DY.#`X"C4Q,@HY,3DY.3<T-`HU,3(*.3(Y.3DV.#`*
+M-3$R"CDS.3DY-C$V"C4Q,@HY-#DY.34U,@HU,3(*.38P,#`P,#`*-3$R"CDV
+M.3DY.3,V"C4Q,@HY-SDY.3@W,@HU,3(*.3@Y.3DX,#@*,3DS"@``````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````````````&$`
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````&$`````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````&$`````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````&$`````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````&$`````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````````````&$`
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````&$`````````````
+M````````````````````````````````````````````````````````````
+M``````````!A````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````````````!A
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````!A````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````!A````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````!A````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````!A````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````````````!A
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````!A````````````
+M````````````````````````````````````````````````````````````
+M````````````80``````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M80``````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````80``````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````80``````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````80``````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````80``````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M80``````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````80``````````
+M````````````````````````````````````````````````````````````
+M`````````````&$`````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`&$`````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````&$`````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````&$`````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````&$`````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````&$`````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`&$`````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````&$`````````
+M````````````````````````````````````````````````````````````
+M``````````````!A````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``!A````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````!A````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````!A````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````!A````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````!A````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``!A````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````!A````````
+M````````````````````````````````````````````````````````````
+M````````````````80``````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````80``````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````80``````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````80``````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````80``````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````80``````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````80``````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````80``````
+M````````````````````````````````````````````````````````````
+M`````````````````&$`````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````&$`````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````````&$`````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````&$`````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````&$`````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````&$`````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````&$`````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````````&$`````
+M````````````````````````````````````````````````````````````
+M``````````````````!A````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````!A````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````````!A````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````!A````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````!A````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````!A````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````!A````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````````!A````
+M````````````````````````````````````````````````````````````
+M````````````````````80``````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````80``````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````80``
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````80``````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````80``````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````80``````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````80``````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````80``
+M````````````````````````````````````````````````````````````
+M`````````````````````&$`````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````&$`````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````````````&$`
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````&$`````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````&$`````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````&$`````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````&$`````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````````````&$`
+M````````````````````````````````````````````````````````````
+M``````````````````````!A````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````!A````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````````````!A
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````!A````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````!A````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````!A````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````!A````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````````````````````!A
+M````````````````````````````````````````````````````````````
+M````````````````````````80``````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````80``````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M80``````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````80``````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````80``````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````80``````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````80``````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M80``````````````````````````````````````````````````````````
+M`````````````````````````&$`````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````&$`````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`&$`````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````````````&$`````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````+B]0
+M87A(96%D97)S+C,X-C8S+VYO;BUS<&%R<V4`````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````#`P,#`V-#0`,#`P,3<U,``P,#`Q-S4P`#`P,#`P,#`P,#4P`#$P
+M-S,S,3`Q,30S`#`Q-#(U,P`@>```````````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````!U<W1A<@`P,```````````
+M````````````````````````````````````````````````````````````
+M```````````````P,#`P,#`P`#`P,#`P,#``````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M```````````````````R,"!A=&EM93TQ,3DX,CDS-C`Q"C(P(&-T:6UE/3$Q
+M.3@R.3,V,#$*````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````````````````````````````````&YO;BUS<&%R<V4`````
+M````````````````````````````````````````````````````````````
+M```````````````````````````````````````````````````````P,#`P
+M-C0T`#`P,#$W-3``,#`P,3<U,``P,#`P,#`P,#`P,``Q,#<S,S$P,3$T,0`P
+M,3(U,#<`(#``````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````=7-T87(`,#!T:6T`````````````````````
+M`````````````````'1I;0``````````````````````````````````````
+M,#`P,#`P,``P,#`P,#`P````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+/````````````````````
+`
+end
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_iso_gz.c b/archivers/libarchive/files/libarchive/test/test_read_format_iso_gz.c
new file mode 100644
index 00000000000..822b969e335
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_iso_gz.c
@@ -0,0 +1,52 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_iso_gz.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+DEFINE_TEST(test_read_format_iso_gz)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ const char *name = "test_read_format_iso.iso.Z";
+
+ extract_reference_file(name);
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_format_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_open_filename(a, name, 512));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_next_header(a, &ae));
+ assertEqualInt(archive_compression(a),
+ ARCHIVE_COMPRESSION_COMPRESS);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c b/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c
new file mode 100644
index 00000000000..cb5a969d621
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_isorr_bz2.c
@@ -0,0 +1,203 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_isorr_bz2.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+/*
+PLEASE use old cdrtools; mkisofs verion is 2.01.
+This version mkisofs made wrong "SL" System Use Entry of RRIP.
+
+Execute the following command to rebuild the data for this program:
+ tail -n +34 test_read_format_isorr_bz2.c | /bin/sh
+
+rm -rf /tmp/iso
+mkdir /tmp/iso
+mkdir /tmp/iso/dir
+echo "hello" >/tmp/iso/file
+dd if=/dev/zero count=1 bs=12345678 >>/tmp/iso/file
+ln /tmp/iso/file /tmp/iso/hardlink
+(cd /tmp/iso; ln -s file symlink)
+(cd /tmp/iso; ln -s /tmp/ symlink2)
+(cd /tmp/iso; ln -s /tmp/../ symlink3)
+(cd /tmp/iso; ln -s .././../tmp/ symlink4)
+(cd /tmp/iso; ln -s .///file symlink5)
+(cd /tmp/iso; ln -s /tmp//../ symlink6)
+TZ=utc touch -afhm -t 197001020000.01 /tmp/iso /tmp/iso/file /tmp/iso/dir
+TZ=utc touch -afhm -t 197001030000.02 /tmp/iso/symlink /tmp/iso/symlink5
+F=test_read_format_iso_rockridge.iso.Z
+mkhybrid -R -uid 1 -gid 2 /tmp/iso | compress > $F
+uuencode $F $F > $F.uu
+exit 1
+ */
+
+DEFINE_TEST(test_read_format_isorr_bz2)
+{
+ const char *refname = "test_read_format_iso_rockridge.iso.Z";
+ struct archive_entry *ae;
+ struct archive *a;
+ const void *p;
+ size_t size;
+ off_t offset;
+ int i;
+
+ extract_reference_file(refname);
+ assert((a = archive_read_new()) != NULL);
+ assertEqualInt(0, archive_read_support_compression_all(a));
+ assertEqualInt(0, archive_read_support_format_all(a));
+ assertEqualInt(ARCHIVE_OK,
+ archive_read_open_filename(a, refname, 10240));
+
+ /* Retrieve each of the 8 files on the ISO image and
+ * verify that each one is what we expect. */
+ for (i = 0; i < 10; ++i) {
+ assertEqualInt(0, archive_read_next_header(a, &ae));
+
+ if (strcmp(".", archive_entry_pathname(ae)) == 0) {
+ /* '.' root directory. */
+ assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
+ assertEqualInt(2048, archive_entry_size(ae));
+ /* Now, we read timestamp recorded by RRIP "TF". */
+ assertEqualInt(86401, archive_entry_mtime(ae));
+ assertEqualInt(0, archive_entry_mtime_nsec(ae));
+ /* Now, we read links recorded by RRIP "PX". */
+ assertEqualInt(3, archive_entry_stat(ae)->st_nlink);
+ assertEqualInt(1, archive_entry_uid(ae));
+ assertEqualIntA(a, ARCHIVE_EOF,
+ archive_read_data_block(a, &p, &size, &offset));
+ assertEqualInt((int)size, 0);
+ } else if (strcmp("dir", archive_entry_pathname(ae)) == 0) {
+ /* A directory. */
+ assertEqualString("dir", archive_entry_pathname(ae));
+ assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
+ assertEqualInt(2048, archive_entry_size(ae));
+ assertEqualInt(86401, archive_entry_mtime(ae));
+ assertEqualInt(86401, archive_entry_atime(ae));
+ assertEqualInt(2, archive_entry_stat(ae)->st_nlink);
+ assertEqualInt(1, archive_entry_uid(ae));
+ assertEqualInt(2, archive_entry_gid(ae));
+ } else if (strcmp("hardlink", archive_entry_pathname(ae)) == 0) {
+ /* A regular file. */
+ assertEqualString("hardlink", archive_entry_pathname(ae));
+ assertEqualInt(AE_IFREG, archive_entry_filetype(ae));
+ assertEqualInt(12345684, archive_entry_size(ae));
+ assertEqualInt(0,
+ archive_read_data_block(a, &p, &size, &offset));
+ assertEqualInt(0, offset);
+ assertEqualMem(p, "hello\n", 6);
+ assertEqualInt(86401, archive_entry_mtime(ae));
+ assertEqualInt(86401, archive_entry_atime(ae));
+ assertEqualInt(2, archive_entry_stat(ae)->st_nlink);
+ assertEqualInt(1, archive_entry_uid(ae));
+ assertEqualInt(2, archive_entry_gid(ae));
+ } else if (strcmp("file", archive_entry_pathname(ae)) == 0) {
+ /* A hardlink to the regular file. */
+ /* Note: If "hardlink" gets returned before "file",
+ * then "hardlink" will get returned as a regular file
+ * and "file" will get returned as the hardlink.
+ * This test should tolerate that, since it's a
+ * perfectly permissible thing for libarchive to do. */
+ assertEqualString("file", archive_entry_pathname(ae));
+ assertEqualInt(AE_IFREG, archive_entry_filetype(ae));
+ assertEqualString("hardlink", archive_entry_hardlink(ae));
+ assertEqualInt(0, archive_entry_size_is_set(ae));
+ assertEqualInt(0, archive_entry_size(ae));
+ assertEqualInt(86401, archive_entry_mtime(ae));
+ assertEqualInt(86401, archive_entry_atime(ae));
+ assertEqualInt(2, archive_entry_stat(ae)->st_nlink);
+ assertEqualInt(1, archive_entry_uid(ae));
+ assertEqualInt(2, archive_entry_gid(ae));
+ } else if (strcmp("symlink", archive_entry_pathname(ae)) == 0) {
+ /* A symlink to the regular file. */
+ assertEqualInt(AE_IFLNK, archive_entry_filetype(ae));
+ assertEqualString("file", archive_entry_symlink(ae));
+ assertEqualInt(0, archive_entry_size(ae));
+ assertEqualInt(172802, archive_entry_mtime(ae));
+ assertEqualInt(172802, archive_entry_atime(ae));
+ assertEqualInt(1, archive_entry_stat(ae)->st_nlink);
+ assertEqualInt(1, archive_entry_uid(ae));
+ assertEqualInt(2, archive_entry_gid(ae));
+ } else if (strcmp("symlink2", archive_entry_pathname(ae)) == 0) {
+ /* A symlink to /tmp (an absolute path) */
+ assertEqualInt(AE_IFLNK, archive_entry_filetype(ae));
+ assertEqualString("/tmp", archive_entry_symlink(ae));
+ assertEqualInt(0, archive_entry_size(ae));
+ assertEqualInt(1, archive_entry_stat(ae)->st_nlink);
+ assertEqualInt(1, archive_entry_uid(ae));
+ assertEqualInt(2, archive_entry_gid(ae));
+ } else if (strcmp("symlink3", archive_entry_pathname(ae)) == 0) {
+ /* A symlink to /tmp/.. (with a ".." component) */
+ assertEqualInt(AE_IFLNK, archive_entry_filetype(ae));
+ assertEqualString("/tmp/..", archive_entry_symlink(ae));
+ assertEqualInt(0, archive_entry_size(ae));
+ assertEqualInt(1, archive_entry_stat(ae)->st_nlink);
+ assertEqualInt(1, archive_entry_uid(ae));
+ assertEqualInt(2, archive_entry_gid(ae));
+ } else if (strcmp("symlink4", archive_entry_pathname(ae)) == 0) {
+ /* A symlink to a path with ".." and "." components */
+ assertEqualInt(AE_IFLNK, archive_entry_filetype(ae));
+ assertEqualString(".././../tmp",
+ archive_entry_symlink(ae));
+ assertEqualInt(0, archive_entry_size(ae));
+ assertEqualInt(1, archive_entry_stat(ae)->st_nlink);
+ assertEqualInt(1, archive_entry_uid(ae));
+ assertEqualInt(2, archive_entry_gid(ae));
+ } else if (strcmp("symlink5", archive_entry_pathname(ae)) == 0) {
+ /* A symlink to the regular file with "/" components. */
+ assertEqualInt(AE_IFLNK, archive_entry_filetype(ae));
+ assertEqualString(".///file", archive_entry_symlink(ae));
+ assertEqualInt(0, archive_entry_size(ae));
+ assertEqualInt(172802, archive_entry_mtime(ae));
+ assertEqualInt(172802, archive_entry_atime(ae));
+ assertEqualInt(1, archive_entry_stat(ae)->st_nlink);
+ assertEqualInt(1, archive_entry_uid(ae));
+ assertEqualInt(2, archive_entry_gid(ae));
+ } else if (strcmp("symlink6", archive_entry_pathname(ae)) == 0) {
+ /* A symlink to /tmp//..
+ * (with "/" and ".." components) */
+ assertEqualInt(AE_IFLNK, archive_entry_filetype(ae));
+ assertEqualString("/tmp//..", archive_entry_symlink(ae));
+ assertEqualInt(0, archive_entry_size(ae));
+ assertEqualInt(1, archive_entry_stat(ae)->st_nlink);
+ assertEqualInt(1, archive_entry_uid(ae));
+ assertEqualInt(2, archive_entry_gid(ae));
+ } else {
+ failure("Saw a file that shouldn't have been there");
+ assertEqualString(archive_entry_pathname(ae), "");
+ }
+ }
+
+ /* End of archive. */
+ assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae));
+
+ /* Verify archive format. */
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660_ROCKRIDGE);
+
+ /* Close the archive. */
+ assertEqualInt(0, archive_read_close(a));
+ assertEqualInt(0, archive_read_finish(a));
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c b/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c
new file mode 100644
index 00000000000..ce6e92086dc
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_mtree.c
@@ -0,0 +1,143 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_mtree.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+static void
+test_read_format_mtree1(void)
+{
+ const char reffile[] = "test_read_format_mtree.mtree";
+ char buff[16];
+ struct archive_entry *ae;
+ struct archive *a;
+ FILE *f;
+
+ extract_reference_file(reffile);
+
+ /*
+ * An access error occurred on some platform when mtree
+ * format handling open a directory. It is for through
+ * the routine which open a directory that we create
+ * "dir" and "dir2" directories.
+ */
+ assertMakeDir("dir", 0775);
+ assertMakeDir("dir2", 0775);
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_format_all(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_open_file(a, reffile, 11));
+
+ /*
+ * Read "file", whose data is available on disk.
+ */
+ f = fopen("file", "wb");
+ assert(f != NULL);
+ assertEqualInt(3, fwrite("hi\n", 1, 3, f));
+ fclose(f);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_MTREE);
+ assertEqualString(archive_entry_pathname(ae), "file");
+ assertEqualInt(archive_entry_uid(ae), 18);
+ assertEqualInt(AE_IFREG, archive_entry_filetype(ae));
+ assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0123);
+ assertEqualInt(archive_entry_size(ae), 3);
+ assertEqualInt(3, archive_read_data(a, buff, 3));
+ assertEqualMem(buff, "hi\n", 3);
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString(archive_entry_pathname(ae), "dir");
+ assertEqualInt(AE_IFDIR, archive_entry_filetype(ae));
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString(archive_entry_pathname(ae), "dir/file with space");
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString(archive_entry_pathname(ae), "file with space");
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString(archive_entry_pathname(ae), "dir2");
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString(archive_entry_pathname(ae), "dir2/dir3a");
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString(archive_entry_pathname(ae), "dir2/dir3a/indir3a");
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString(archive_entry_pathname(ae), "dir2/fullindir2");
+ assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644);
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString(archive_entry_pathname(ae), "dir2/indir2");
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString(archive_entry_pathname(ae), "dir2/dir3b");
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString(archive_entry_pathname(ae), "dir2/dir3b/indir3b");
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString(archive_entry_pathname(ae), "notindir");
+
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+ assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+}
+
+static void
+test_read_format_mtree2(void)
+{
+ static char archive[] =
+ "#mtree\n"
+ "d type=dir content=.\n";
+ struct archive_entry *ae;
+ struct archive *a;
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_format_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_open_memory(a, archive, sizeof(archive)));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_MTREE);
+ assertEqualString(archive_entry_pathname(ae), "d");
+ assertEqualInt(archive_entry_filetype(ae), AE_IFDIR);
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+ assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+}
+
+
+
+DEFINE_TEST(test_read_format_mtree)
+{
+ test_read_format_mtree1();
+ test_read_format_mtree2();
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_pax_bz2.c b/archivers/libarchive/files/libarchive/test/test_read_format_pax_bz2.c
new file mode 100644
index 00000000000..af70b366308
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_pax_bz2.c
@@ -0,0 +1,66 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_pax_bz2.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+static unsigned char archive[] = {
+'B','Z','h','9','1','A','Y','&','S','Y',152,180,30,185,0,0,140,127,176,212,
+144,0,' ','@',1,255,226,8,'d','H',' ',238,'/',159,'@',0,16,4,'@',0,8,'0',
+0,216,'A',164,167,147,'Q',147,'!',180,'#',0,'L',153,162,'i',181,'?','P',192,
+26,'h','h',209,136,200,6,128,13,12,18,132,202,'5','O',209,'5','=',26,'2',
+154,7,168,12,2,'d',252,13,254,29,'4',247,181,'l','T','i',130,5,195,1,'2',
+'@',146,18,251,245,'c','J',130,224,172,'$','l','4',235,170,186,'c','1',255,
+179,'K',188,136,18,208,152,192,149,153,10,'{','|','0','8',166,3,6,9,128,172,
+'(',164,220,244,149,6,' ',243,212,'B',25,17,'6',237,13,'I',152,'L',129,209,
+'G','J','<',137,'Y',16,'b',21,18,'a','Y','l','t','r',160,128,147,'l','f',
+'~',219,206,'=','?','S',233,'3',251,'L','~',17,176,169,'%',23,'_',225,'M',
+'C','u','k',218,8,'q',216,'(',22,235,'K',131,136,146,136,147,202,0,158,134,
+'F',23,160,184,'s','0','a',246,'*','P',7,2,238,'H',167,10,18,19,22,131,215,
+' '};
+
+DEFINE_TEST(test_read_format_pax_bz2)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ int r;
+
+ assert((a = archive_read_new()) != NULL);
+ r = archive_read_support_compression_bzip2(a);
+ if (r != ARCHIVE_OK) {
+ archive_read_close(a);
+ skipping("Bzip2 unavailable");
+ return;
+ }
+ assertEqualIntA(a,ARCHIVE_OK, archive_read_support_format_all(a));
+ assertEqualIntA(a,ARCHIVE_OK,
+ archive_read_open_memory(a, archive, sizeof(archive)));
+ assertEqualIntA(a,ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_BZIP2);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE);
+ assertEqualIntA(a,ARCHIVE_OK, archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_tar.c b/archivers/libarchive/files/libarchive/test/test_read_format_tar.c
new file mode 100644
index 00000000000..9c197df0946
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_tar.c
@@ -0,0 +1,480 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_tar.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+/*
+ * Each of these archives is a short archive with a single entry. The
+ * corresponding verify function verifies the entry structure returned
+ * from libarchive is what it should be. The support functions pad with
+ * lots of zeros, so we can trim trailing zero bytes from each hardcoded
+ * archive to save space.
+ *
+ * The naming here follows the tar file type flags. E.g. '1' is a hardlink,
+ * '2' is a symlink, '5' is a dir, etc.
+ */
+
+/* Empty archive. */
+static unsigned char archiveEmpty[] = {
+ /* 512 zero bytes */
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
+ 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0
+};
+
+static void verifyEmpty(void)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_open_memory(a, archiveEmpty, 512));
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE);
+ assertEqualString(archive_compression_name(a), "none");
+ failure("512 zero bytes should be recognized as a tar archive.");
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR);
+
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+}
+
+/* Single entry with a hardlink. */
+static unsigned char archive1[] = {
+'h','a','r','d','l','i','n','k',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0',
+'0','6','4','4',' ',0,'0','0','1','7','5','0',' ',0,'0','0','1','7','5','0',
+' ',0,'0','0','0','0','0','0','0','0','0','0','0',' ','1','0','6','4','6',
+'0','5','2','6','6','2',' ','0','1','3','0','5','7',0,' ','1','f','i','l',
+'e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r',0,'0',
+'0','t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+'t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0',
+'0','0','0','0','0',' ',0,'0','0','0','0','0','0',' '};
+
+static void verify1(struct archive_entry *ae)
+{
+ /* A hardlink is not a symlink. */
+ assert(archive_entry_filetype(ae) != AE_IFLNK);
+ /* Nor is it a directory. */
+ assert(archive_entry_filetype(ae) != AE_IFDIR);
+ assertEqualInt(archive_entry_mode(ae) & 0777, 0644);
+ assertEqualInt(archive_entry_uid(ae), 1000);
+ assertEqualInt(archive_entry_gid(ae), 1000);
+ assertEqualString(archive_entry_uname(ae), "tim");
+ assertEqualString(archive_entry_gname(ae), "tim");
+ assertEqualString(archive_entry_pathname(ae), "hardlink");
+ assertEqualString(archive_entry_hardlink(ae), "file");
+ assert(archive_entry_symlink(ae) == NULL);
+ assertEqualInt(archive_entry_mtime(ae), 1184388530);
+}
+
+/* Verify that symlinks are read correctly. */
+static unsigned char archive2[] = {
+'s','y','m','l','i','n','k',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0',
+'0','0','7','5','5',' ','0','0','0','1','7','5','0',' ','0','0','0','1','7',
+'5','0',' ','0','0','0','0','0','0','0','0','0','0','0',' ','1','0','6','4',
+'6','0','5','4','1','0','1',' ','0','0','1','3','3','2','3',' ','2','f','i',
+'l','e',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r',0,
+'0','0','t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,'t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+'0','0','0','0','0','0','0',' ','0','0','0','0','0','0','0',' '};
+
+static void verify2(struct archive_entry *ae)
+{
+ assertEqualInt(archive_entry_filetype(ae), AE_IFLNK);
+ assertEqualInt(archive_entry_mode(ae) & 0777, 0755);
+ assertEqualInt(archive_entry_uid(ae), 1000);
+ assertEqualInt(archive_entry_gid(ae), 1000);
+ assertEqualString(archive_entry_uname(ae), "tim");
+ assertEqualString(archive_entry_gname(ae), "tim");
+ assertEqualString(archive_entry_pathname(ae), "symlink");
+ assertEqualString(archive_entry_symlink(ae), "file");
+ assert(archive_entry_hardlink(ae) == NULL);
+ assertEqualInt(archive_entry_mtime(ae), 1184389185);
+}
+
+/* Character device node. */
+static unsigned char archive3[] = {
+'d','e','v','c','h','a','r',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0',
+'0','0','7','5','5',' ','0','0','0','1','7','5','0',' ','0','0','0','1','7',
+'5','0',' ','0','0','0','0','0','0','0','0','0','0','0',' ','1','0','6','4',
+'6','0','5','4','1','0','1',' ','0','0','1','2','4','1','2',' ','3',0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r',0,
+'0','0','t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,'t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+'0','0','0','0','0','0','0',' ','0','0','0','0','0','0','0',' '};
+
+static void verify3(struct archive_entry *ae)
+{
+ assertEqualInt(archive_entry_filetype(ae), AE_IFCHR);
+ assertEqualInt(archive_entry_mode(ae) & 0777, 0755);
+ assertEqualInt(archive_entry_uid(ae), 1000);
+ assertEqualInt(archive_entry_gid(ae), 1000);
+ assertEqualString(archive_entry_uname(ae), "tim");
+ assertEqualString(archive_entry_gname(ae), "tim");
+ assertEqualString(archive_entry_pathname(ae), "devchar");
+ assert(archive_entry_symlink(ae) == NULL);
+ assert(archive_entry_hardlink(ae) == NULL);
+ assertEqualInt(archive_entry_mtime(ae), 1184389185);
+}
+
+/* Block device node. */
+static unsigned char archive4[] = {
+'d','e','v','b','l','o','c','k',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0',
+'0','0','7','5','5',' ','0','0','0','1','7','5','0',' ','0','0','0','1','7',
+'5','0',' ','0','0','0','0','0','0','0','0','0','0','0',' ','1','0','6','4',
+'6','0','5','4','1','0','1',' ','0','0','1','2','5','7','0',' ','4',0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r',0,
+'0','0','t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,'t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+'0','0','0','0','0','0','0',' ','0','0','0','0','0','0','0',' '};
+
+static void verify4(struct archive_entry *ae)
+{
+ assertEqualInt(archive_entry_filetype(ae), AE_IFBLK);
+ assertEqualInt(archive_entry_mode(ae) & 0777, 0755);
+ assertEqualInt(archive_entry_uid(ae), 1000);
+ assertEqualInt(archive_entry_gid(ae), 1000);
+ assertEqualString(archive_entry_uname(ae), "tim");
+ assertEqualString(archive_entry_gname(ae), "tim");
+ assertEqualString(archive_entry_pathname(ae), "devblock");
+ assert(archive_entry_symlink(ae) == NULL);
+ assert(archive_entry_hardlink(ae) == NULL);
+ assertEqualInt(archive_entry_mtime(ae), 1184389185);
+}
+
+/* Directory. */
+static unsigned char archive5[] = {
+'.',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0','0',
+'7','5','5',' ',0,'0','0','1','7','5','0',' ',0,'0','0','1','7','5','0',
+' ',0,'0','0','0','0','0','0','0','0','0','0','0',' ','1','0','3','3',
+'4','0','4','1','7','3','6',' ','0','1','0','5','6','1',0,' ','5',0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r',0,
+'0','0','t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,'t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,'0','0','0','0','0','0',' ',0,'0','0','0','0','0','0',' '};
+
+static void verify5(struct archive_entry *ae)
+{
+ assertEqualInt(archive_entry_filetype(ae), AE_IFDIR);
+ assertEqualInt(archive_entry_mtime(ae), 1131430878);
+ assertEqualInt(archive_entry_mode(ae) & 0777, 0755);
+ assertEqualInt(archive_entry_uid(ae), 1000);
+ assertEqualInt(archive_entry_gid(ae), 1000);
+ assertEqualString(archive_entry_uname(ae), "tim");
+ assertEqualString(archive_entry_gname(ae), "tim");
+}
+
+/* fifo */
+static unsigned char archive6[] = {
+'f','i','f','o',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0',
+'0','0','7','5','5',' ','0','0','0','1','7','5','0',' ','0','0','0','1','7',
+'5','0',' ','0','0','0','0','0','0','0','0','0','0','0',' ','1','0','6','4',
+'6','0','5','4','1','0','1',' ','0','0','1','1','7','2','4',' ','6',0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r',0,
+'0','0','t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,'t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+'0','0','0','0','0','0','0',' ','0','0','0','0','0','0','0',' '};
+
+static void verify6(struct archive_entry *ae)
+{
+ assertEqualInt(archive_entry_filetype(ae), AE_IFIFO);
+ assertEqualInt(archive_entry_mode(ae) & 0777, 0755);
+ assertEqualInt(archive_entry_uid(ae), 1000);
+ assertEqualInt(archive_entry_gid(ae), 1000);
+ assertEqualString(archive_entry_uname(ae), "tim");
+ assertEqualString(archive_entry_gname(ae), "tim");
+ assertEqualString(archive_entry_pathname(ae), "fifo");
+ assert(archive_entry_symlink(ae) == NULL);
+ assert(archive_entry_hardlink(ae) == NULL);
+ assertEqualInt(archive_entry_mtime(ae), 1184389185);
+}
+
+/* GNU long link name */
+static unsigned char archiveK[] = {
+'.','/','.','/','@','L','o','n','g','L','i','n','k',0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,'0','0','0','0','0','0','0',0,'0','0','0','0','0','0','0',0,'0','0','0',
+'0','0','0','0',0,'0','0','0','0','0','0','0','0','6','6','6',0,'0','0','0',
+'0','0','0','0','0','0','0','0',0,'0','1','1','7','1','5',0,' ','K',0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u','s','t','a','r',' ',' ',
+0,'r','o','o','t',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+'w','h','e','e','l',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'t',
+'h','i','s','_','i','s','_','a','_','v','e','r','y','_','l','o','n','g','_',
+'s','y','m','l','i','n','k','_','b','o','d','y','_','a','b','c','d','e','f',
+'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y',
+'z','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
+'r','s','t','u','v','w','x','y','z','_','a','b','c','d','e','f','g','h','i',
+'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','_','a',
+'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t',
+'u','v','w','x','y','z','_','a','b','c','d','e','f','g','h','i','j','k','l',
+'m','n','o','p','q','r','s','t','u','v','w','x','y','z','_','a','b','c','d',
+'e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w',
+'x','y','z','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o',
+'p','q','r','s','t','u','v','w','x','y','z','_','a','b','c','d','e','f','g',
+'h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
+'_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r',
+'s','t','u','v','w','x','y','z','_','a','b','c','d','e','f','g','h','i','j',
+'k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','_','a','b',
+'c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u',
+'v','w','x','y','z','_','a','b','c','d','e','f','g','h','i','j','k','l','m',
+'n','o','p','q','r','s','t','u','v','w','x','y','z','_','a','b','c','d','e',
+'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x',
+'y','z','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p',
+'q','r','s','t','u','v','w','x','y','z','_','a','b','c','d','e','f','g','h',
+'i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+'s','y','m','l','i','n','k',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','1',
+'2','0','7','5','5',0,'0','0','0','1','7','5','0',0,'0','0','0','1','7','5',
+'0',0,'0','0','0','0','0','0','0','0','0','0','0',0,'1','0','6','4','6','0',
+'5','6','7','7','0',0,'0','3','5','4','4','7',0,' ','2','t','h','i','s','_',
+'i','s','_','a','_','v','e','r','y','_','l','o','n','g','_','s','y','m','l',
+'i','n','k','_','b','o','d','y','_','a','b','c','d','e','f','g','h','i','j',
+'k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','_','a','b',
+'c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u',
+'v','w','x','y','z','_','a','b','c','d','e','f','g','h','i','j','k','l',0,
+'u','s','t','a','r',' ',' ',0,'t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,'t','i','m'};
+
+static void verifyK(struct archive_entry *ae)
+{
+ assertEqualInt(archive_entry_filetype(ae), AE_IFLNK);
+ assertEqualInt(archive_entry_mode(ae) & 0777, 0755);
+ assertEqualInt(archive_entry_uid(ae), 1000);
+ assertEqualInt(archive_entry_gid(ae), 1000);
+ assertEqualString(archive_entry_uname(ae), "tim");
+ assertEqualString(archive_entry_gname(ae), "tim");
+ assertEqualString(archive_entry_pathname(ae), "symlink");
+ assertEqualString(archive_entry_symlink(ae),
+ "this_is_a_very_long_symlink_body_abcdefghijklmnopqrstuvwxyz_"
+ "abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_"
+ "abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_"
+ "abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_"
+ "abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_"
+ "abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_"
+ "abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_"
+ "abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz");
+ assert(archive_entry_hardlink(ae) == NULL);
+ assertEqualInt(archive_entry_mtime(ae), 1184390648);
+}
+
+/* TODO: GNU long name */
+
+/* TODO: Solaris ACL */
+
+/* Pax extended long link name */
+static unsigned char archivexL[] = {
+'.','/','P','a','x','H','e','a','d','e','r','s','.','8','6','9','7','5','/',
+'s','y','m','l','i','n','k',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0','0','0','6','4','4',0,'0','0','0','1',
+'7','5','0',0,'0','0','0','1','7','5','0',0,'0','0','0','0','0','0','0','0',
+'7','5','3',0,'1','0','6','4','6','0','5','7','6','1','1',0,'0','1','3','7',
+'1','4',0,' ','x',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'u',
+'s','t','a','r',0,'0','0',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,'0','0','0','0','0','0','0',0,'0','0','0','0','0','0','0',0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'4','5','1',' ','l','i','n','k','p','a','t',
+'h','=','t','h','i','s','_','i','s','_','a','_','v','e','r','y','_','l','o',
+'n','g','_','s','y','m','l','i','n','k','_','b','o','d','y','_','a','b','c',
+'d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
+'w','x','y','z','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n',
+'o','p','q','r','s','t','u','v','w','x','y','z','_','a','b','c','d','e','f',
+'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y',
+'z','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q',
+'r','s','t','u','v','w','x','y','z','_','a','b','c','d','e','f','g','h','i',
+'j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','_','a',
+'b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t',
+'u','v','w','x','y','z','_','a','b','c','d','e','f','g','h','i','j','k','l',
+'m','n','o','p','q','r','s','t','u','v','w','x','y','z','_','a','b','c','d',
+'e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w',
+'x','y','z','_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o',
+'p','q','r','s','t','u','v','w','x','y','z','_','a','b','c','d','e','f','g',
+'h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
+'_','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r',
+'s','t','u','v','w','x','y','z','_','a','b','c','d','e','f','g','h','i','j',
+'k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','_','a','b',
+'c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u',
+'v','w','x','y','z','_','a','b','c','d','e','f','g','h','i','j','k','l','m',
+'n','o','p','q','r','s','t','u','v','w','x','y','z','_','a','b','c','d','e',
+'f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x',
+'y','z',10,'2','0',' ','a','t','i','m','e','=','1','1','8','4','3','9','1',
+'0','2','5',10,'2','0',' ','c','t','i','m','e','=','1','1','8','4','3','9',
+'0','6','4','8',10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'s','y','m',
+'l','i','n','k',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'0','0','0','0','7',
+'5','5',0,'0','0','0','1','7','5','0',0,'0','0','0','1','7','5','0',0,'0',
+'0','0','0','0','0','0','0','0','0','0',0,'1','0','6','4','6','0','5','6',
+'7','7','0',0,'0','3','7','1','2','1',0,' ','2','t','h','i','s','_','i','s',
+'_','a','_','v','e','r','y','_','l','o','n','g','_','s','y','m','l','i','n',
+'k','_','b','o','d','y','_','a','b','c','d','e','f','g','h','i','j','k','l',
+'m','n','o','p','q','r','s','t','u','v','w','x','y','z','_','a','b','c','d',
+'e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w',
+'x','y','z','_','a','b','c','d','e','f','g','h','i','j','k','l','m','u','s',
+'t','a','r',0,'0','0','t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,'t','i','m',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,'0','0','0','0','0','0','0',0,'0','0','0','0','0','0','0'};
+
+static void verifyxL(struct archive_entry *ae)
+{
+ assertEqualInt(archive_entry_filetype(ae), AE_IFLNK);
+ assertEqualInt(archive_entry_mode(ae) & 0777, 0755);
+ assertEqualInt(archive_entry_uid(ae), 1000);
+ assertEqualInt(archive_entry_gid(ae), 1000);
+ assertEqualString(archive_entry_uname(ae), "tim");
+ assertEqualString(archive_entry_gname(ae), "tim");
+ assertEqualString(archive_entry_pathname(ae), "symlink");
+ assertEqualString(archive_entry_symlink(ae),
+ "this_is_a_very_long_symlink_body_abcdefghijklmnopqrstuvwxyz_"
+ "abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_"
+ "abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_"
+ "abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_"
+ "abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_"
+ "abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_"
+ "abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz_"
+ "abcdefghijklmnopqrstuvwxyz_abcdefghijklmnopqrstuvwxyz");
+ assert(archive_entry_hardlink(ae) == NULL);
+ assertEqualInt(archive_entry_mtime(ae), 1184390648);
+}
+
+
+/* TODO: Any other types of headers? */
+
+static void verify(unsigned char *d, size_t s,
+ void (*f)(struct archive_entry *),
+ int compression, int format)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ unsigned char *buff = malloc(100000);
+
+ memcpy(buff, d, s);
+ memset(buff + s, 0, 2048);
+
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_open_memory(a, buff, s + 1024));
+ assertA(0 == archive_read_next_header(a, &ae));
+ assertEqualInt(archive_compression(a), compression);
+ assertEqualInt(archive_format(a), format);
+
+ /* Verify the only entry. */
+ f(ae);
+
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+ free(buff);
+}
+
+DEFINE_TEST(test_read_format_tar)
+{
+ verifyEmpty();
+ verify(archive1, sizeof(archive1), verify1,
+ ARCHIVE_COMPRESSION_NONE, ARCHIVE_FORMAT_TAR_USTAR);
+ verify(archive2, sizeof(archive2), verify2,
+ ARCHIVE_COMPRESSION_NONE, ARCHIVE_FORMAT_TAR_USTAR);
+ verify(archive3, sizeof(archive3), verify3,
+ ARCHIVE_COMPRESSION_NONE, ARCHIVE_FORMAT_TAR_USTAR);
+ verify(archive4, sizeof(archive4), verify4,
+ ARCHIVE_COMPRESSION_NONE, ARCHIVE_FORMAT_TAR_USTAR);
+ verify(archive5, sizeof(archive5), verify5,
+ ARCHIVE_COMPRESSION_NONE, ARCHIVE_FORMAT_TAR_USTAR);
+ verify(archive6, sizeof(archive6), verify6,
+ ARCHIVE_COMPRESSION_NONE, ARCHIVE_FORMAT_TAR_USTAR);
+ verify(archiveK, sizeof(archiveK), verifyK,
+ ARCHIVE_COMPRESSION_NONE, ARCHIVE_FORMAT_TAR_GNUTAR);
+ verify(archivexL, sizeof(archivexL), verifyxL,
+ ARCHIVE_COMPRESSION_NONE, ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE);
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_tar_empty_filename.c b/archivers/libarchive/files/libarchive/test/test_read_format_tar_empty_filename.c
new file mode 100644
index 00000000000..8d917144448
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_tar_empty_filename.c
@@ -0,0 +1,66 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_format_tar_empty_filename.c,v 1.2 2008/09/01 05:38:33 kientzle Exp $");
+
+/*
+ * Tar entries with empty filenames are unusual, but shouldn't crash us.
+ */
+DEFINE_TEST(test_read_format_tar_empty_filename)
+{
+ char name[] = "test_read_format_tar_empty_filename.tar";
+ struct archive_entry *ae;
+ struct archive *a;
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+ extract_reference_file(name);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240));
+
+ /* Read first entry. */
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString("", archive_entry_pathname(ae));
+ assertEqualInt(1208628157, archive_entry_mtime(ae));
+ assertEqualInt(1000, archive_entry_uid(ae));
+ assertEqualString("tim", archive_entry_uname(ae));
+ assertEqualInt(0, archive_entry_gid(ae));
+ assertEqualString("wheel", archive_entry_gname(ae));
+ assertEqualInt(040775, archive_entry_mode(ae));
+
+ /* Verify the end-of-archive. */
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+
+ /* Verify that the format detection worked. */
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_NONE);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR);
+
+ assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_tar_empty_filename.tar.uu b/archivers/libarchive/files/libarchive/test/test_read_format_tar_empty_filename.tar.uu
new file mode 100644
index 00000000000..f8a4f4f2f1b
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_tar_empty_filename.tar.uu
@@ -0,0 +1,39 @@
+$FreeBSD: src/lib/libarchive/test/test_read_format_tar_empty_filename.tar.uu,v 1.2 2008/07/03 03:26:30 peter Exp $
+begin 644 test_compat_tar_1.tar
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M`````````````#`P,#<W-2``,#`Q-S4P(``P,#`P,#`@`#`P,#`P,#`P,#`P
+M(#$Q,#`R-#,Q-C<U(#`Q,3`P,0`@-0``````````````````````````````
+M````````````````````````````````````````````````````````````
+M``````````````````````````````````````````!U<W1A<@`P,'1I;0``
+M````````````````````````````````````=VAE96P`````````````````
+M```````````````````P,#`P,#`@`#`P,#`P,"``````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+M````````````````````````````````````````````````````````````
+&````````
+`
+end
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_tbz.c b/archivers/libarchive/files/libarchive/test/test_read_format_tbz.c
new file mode 100644
index 00000000000..06d8cad4798
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_tbz.c
@@ -0,0 +1,59 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_tbz.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+static unsigned char archive[] = {
+'B','Z','h','9','1','A','Y','&','S','Y',237,7,140,'W',0,0,27,251,144,208,
+128,0,' ','@',1,'o',128,0,0,224,'"',30,0,0,'@',0,8,' ',0,'T','2',26,163,'&',
+129,160,211,212,18,'I',169,234,13,168,26,6,150,'1',155,134,'p',8,173,3,183,
+'J','S',26,20,'2',222,'b',240,160,'a','>',205,'f',29,170,227,'[',179,139,
+'\'','L','o',211,':',178,'0',162,134,'*','>','8',24,153,230,147,'R','?',23,
+'r','E','8','P',144,237,7,140,'W'};
+
+DEFINE_TEST(test_read_format_tbz)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ int r;
+
+ assert((a = archive_read_new()) != NULL);
+ r = archive_read_support_compression_bzip2(a);
+ if (r != ARCHIVE_OK) {
+ skipping("Bzip2 support");
+ archive_read_finish(a);
+ return;
+ }
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_open_memory(a, archive, sizeof(archive)));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_BZIP2);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_tgz.c b/archivers/libarchive/files/libarchive/test/test_read_format_tgz.c
new file mode 100644
index 00000000000..f411b433802
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_tgz.c
@@ -0,0 +1,60 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_tgz.c 191183 2009-04-17 01:06:31Z kientzle $");
+
+static unsigned char archive[] = {
+31,139,8,0,222,'C','p','C',0,3,211,'c',160,'=','0','0','0','0','7','5','U',
+0,210,134,230,166,6,200,'4',28,'(',24,26,24,27,155,24,152,24,154,27,155,')',
+24,24,26,152,154,25,'2','(',152,210,193,'m',12,165,197,'%',137,'E','@',167,
+148,'d',230,226,'U','G','H',30,234,15,'8','=',10,'F',193,'(',24,5,131,28,
+0,0,29,172,5,240,0,6,0,0};
+
+DEFINE_TEST(test_read_format_tgz)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ int r;
+
+ assert((a = archive_read_new()) != NULL);
+ assertEqualInt(ARCHIVE_OK, archive_read_support_compression_all(a));
+ r = archive_read_support_compression_gzip(a);
+ if (r == ARCHIVE_WARN) {
+ skipping("gzip reading not fully supported on this platform");
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+ return;
+ }
+ assertEqualInt(ARCHIVE_OK, archive_read_support_format_all(a));
+ assertEqualInt(ARCHIVE_OK,
+ archive_read_open_memory(a, archive, sizeof(archive)));
+ assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(archive_compression(a),
+ ARCHIVE_COMPRESSION_GZIP);
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR);
+ assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK,archive_read_finish(a));
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_tz.c b/archivers/libarchive/files/libarchive/test/test_read_format_tz.c
new file mode 100644
index 00000000000..eb066013842
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_tz.c
@@ -0,0 +1,61 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_tz.c 189381 2009-03-05 00:31:48Z kientzle $");
+
+static unsigned char archive[] = {
+31,157,144,'.',0,8,28,'H',176,160,193,131,8,19,'*','\\',200,176,'!','B',24,
+16,'o',212,168,1,2,0,196,24,18,'a','T',188,152,'q','#',196,143,' ','5',198,
+128,'1','c',6,13,24,'4','0',206,176,1,2,198,200,26,'6','b',0,0,'Q',195,161,
+205,155,'8','s',234,4,'P','g',14,157,'0','r',',',194,160,147,166,205,206,
+132,'D',141,30,'=',24,'R',163,'P',144,21,151,'J',157,'J',181,170,213,171,
+'X',179,'j',221,202,181,171,215,175,'`',195,138,29,'K',182,172,217,179,'h',
+211,170,']',203,182,173,219,183,'g',1};
+
+DEFINE_TEST(test_read_format_tz)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_open_memory(a, archive, sizeof(archive)));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ failure("archive_compression_name(a)=\"%s\"",
+ archive_compression_name(a));
+ assertEqualInt(archive_compression(a), ARCHIVE_COMPRESSION_COMPRESS);
+ failure("archive_format_name(a)=\"%s\"", archive_format_name(a));
+ assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+#endif
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_zip.c b/archivers/libarchive/files/libarchive/test/test_read_format_zip.c
new file mode 100644
index 00000000000..680e7ede360
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_zip.c
@@ -0,0 +1,92 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_zip.c 189482 2009-03-07 03:30:35Z kientzle $");
+
+/*
+ * The reference file for this has been manually tweaked so that:
+ * * file2 has length-at-end but file1 does not
+ * * file2 has an invalid CRC
+ */
+
+DEFINE_TEST(test_read_format_zip)
+{
+ const char *refname = "test_read_format_zip.zip";
+ struct archive_entry *ae;
+ struct archive *a;
+ char *buff[128];
+ const void *pv;
+ size_t s;
+ off_t o;
+ int r;
+
+ extract_reference_file(refname);
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_open_filename(a, refname, 10240));
+ assertA(0 == archive_read_next_header(a, &ae));
+ assertEqualString("dir/", archive_entry_pathname(ae));
+ assertEqualInt(1179604249, archive_entry_mtime(ae));
+ assertEqualInt(0, archive_entry_size(ae));
+ assertEqualIntA(a, ARCHIVE_EOF,
+ archive_read_data_block(a, &pv, &s, &o));
+ assertEqualInt((int)s, 0);
+ assertA(0 == archive_read_next_header(a, &ae));
+ assertEqualString("file1", archive_entry_pathname(ae));
+ assertEqualInt(1179604289, archive_entry_mtime(ae));
+ assertEqualInt(18, archive_entry_size(ae));
+ failure("archive_read_data() returns number of bytes read");
+ r = archive_read_data(a, buff, 19);
+ if (r < ARCHIVE_OK) {
+ if (strcmp(archive_error_string(a),
+ "libarchive compiled without deflate support (no libz)") == 0) {
+ skipping("Skipping ZIP compression check: %s",
+ archive_error_string(a));
+ goto finish;
+ }
+ }
+ assertEqualInt(18, r);
+ assert(0 == memcmp(buff, "hello\nhello\nhello\n", 18));
+ assertA(0 == archive_read_next_header(a, &ae));
+ assertEqualString("file2", archive_entry_pathname(ae));
+ assertEqualInt(1179605932, archive_entry_mtime(ae));
+ failure("file2 has length-at-end, so we shouldn't see a valid size");
+ assertEqualInt(0, archive_entry_size_is_set(ae));
+ failure("file2 has a bad CRC, so reading to end should fail");
+ assertEqualInt(ARCHIVE_WARN, archive_read_data(a, buff, 19));
+ assert(0 == memcmp(buff, "hello\nhello\nhello\n", 18));
+ assertA(archive_compression(a) == ARCHIVE_COMPRESSION_NONE);
+ assertA(archive_format(a) == ARCHIVE_FORMAT_ZIP);
+ assert(0 == archive_read_close(a));
+finish:
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+}
+
+
diff --git a/archivers/libarchive/files/libarchive/test/test_read_format_zip.zip.uu b/archivers/libarchive/files/libarchive/test/test_read_format_zip.zip.uu
new file mode 100644
index 00000000000..b1f04c4fea0
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_format_zip.zip.uu
@@ -0,0 +1,14 @@
+$FreeBSD: src/lib/libarchive/test/test_read_format_zip.zip.uu,v 1.3 2008/10/21 05:08:35 kientzle Exp $
+begin 644 test_read_format_zip.zip
+M4$L#!`H`"````%EFLS8````````````````$`!4`9&ER+U54"0`#&55/1M19
+M_4A5>`0`Z`/H`U!+!P@```````````````!02P,$%`````@`;V:S-CHW9CT*
+M````$@````4`%0!F:6QE,554"0`#055/1L!9_4A5>`0`Z`/H`\M(S<G)Y\I`
+M(@%02P,$%``(``@`6FJS-@``````````$@````4`%0!F:6QE,E54"0`#K%M/
+M1L!9_4A5>`0`Z`/H`\M(S<G)Y\I`(@%02P<(.C=F$@H````2````4$L!`A<#
+M"@`(````66:S-@````````````````0`#0`````````0`.U!`````&1I<B]5
+M5`4``QE53T95>```4$L!`A<#%``(``@`;V:S-CHW9CT*````$@````4`#0``
+M`````0```.V!1P```&9I;&4Q550%``-!54]&57@``%!+`0(7`Q0`"``(`%IJ
+MLS8Z-V8]"@```!(````%``T```````$```#M@8D```!F:6QE,E54!0`#K%M/
+;1E5X``!02P4&``````,``P"_````VP``````
+`
+end
diff --git a/archivers/libarchive/files/libarchive/test/test_read_large.c b/archivers/libarchive/files/libarchive/test/test_read_large.c
new file mode 100644
index 00000000000..a2be6017865
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_large.c
@@ -0,0 +1,93 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_large.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+static unsigned char testdata[10 * 1024 * 1024];
+static unsigned char testdatacopy[10 * 1024 * 1024];
+static unsigned char buff[11 * 1024 * 1024];
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define open _open
+#define close _close
+#endif
+
+/* Check correct behavior on large reads. */
+DEFINE_TEST(test_read_large)
+{
+ unsigned int i;
+ int tmpfilefd;
+ char tmpfilename[] = "test-read_large.XXXXXX";
+ size_t used;
+ struct archive *a;
+ struct archive_entry *entry;
+ FILE *f;
+
+ for (i = 0; i < sizeof(testdata); i++)
+ testdata[i] = (unsigned char)(rand());
+
+ assert(NULL != (a = archive_write_new()));
+ assertA(0 == archive_write_set_format_ustar(a));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+ assert(NULL != (entry = archive_entry_new()));
+ archive_entry_set_size(entry, sizeof(testdata));
+ archive_entry_set_mode(entry, S_IFREG | 0777);
+ archive_entry_set_pathname(entry, "test");
+ assertA(0 == archive_write_header(a, entry));
+ archive_entry_free(entry);
+ assertA((int)sizeof(testdata) == archive_write_data(a, testdata, sizeof(testdata)));
+ assertA(0 == archive_write_finish(a));
+
+ assert(NULL != (a = archive_read_new()));
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff, sizeof(buff)));
+ assertA(0 == archive_read_next_header(a, &entry));
+ assertA(0 == archive_read_data_into_buffer(a, testdatacopy, sizeof(testdatacopy)));
+ assertA(0 == archive_read_finish(a));
+ assert(0 == memcmp(testdata, testdatacopy, sizeof(testdata)));
+
+
+ assert(NULL != (a = archive_read_new()));
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff, sizeof(buff)));
+ assertA(0 == archive_read_next_header(a, &entry));
+#if defined(__BORLANDC__)
+ tmpfilefd = open(tmpfilename, O_WRONLY | O_CREAT | O_BINARY);
+#else
+ tmpfilefd = open(tmpfilename, O_WRONLY | O_CREAT | O_BINARY, 0755);
+#endif
+ assert(0 < tmpfilefd);
+ assertA(0 == archive_read_data_into_fd(a, tmpfilefd));
+ close(tmpfilefd);
+ assertA(0 == archive_read_finish(a));
+
+ f = fopen(tmpfilename, "rb");
+ assertEqualInt(sizeof(testdatacopy),
+ fread(testdatacopy, 1, sizeof(testdatacopy), f));
+ fclose(f);
+ assert(0 == memcmp(testdata, testdatacopy, sizeof(testdata)));
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_read_pax_truncated.c b/archivers/libarchive/files/libarchive/test/test_read_pax_truncated.c
new file mode 100644
index 00000000000..4e2a8134ec2
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_pax_truncated.c
@@ -0,0 +1,288 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_pax_truncated.c 189483 2009-03-07 03:34:34Z kientzle $");
+
+DEFINE_TEST(test_read_pax_truncated)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ size_t used, i, buff_size = 1000000;
+ size_t filedata_size = 100000;
+ char *buff = malloc(buff_size);
+ char *buff2 = malloc(buff_size);
+ char *filedata = malloc(filedata_size);
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_pax(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_write_open_memory(a, buff, buff_size, &used));
+
+ /*
+ * Write a file to it.
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ for (i = 0; i < filedata_size; i++)
+ filedata[i] = (unsigned char)rand();
+ archive_entry_set_atime(ae, 1, 2);
+ archive_entry_set_ctime(ae, 3, 4);
+ archive_entry_set_mtime(ae, 5, 6);
+ archive_entry_set_size(ae, filedata_size);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assertA((ssize_t)filedata_size
+ == archive_write_data(a, filedata, filedata_size));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertA(0 == archive_write_finish(a));
+#endif
+
+ /* Now, read back a truncated version of the archive and
+ * verify that we get an appropriate error. */
+ for (i = 1; i < used + 100; i += 100) {
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == read_open_memory2(a, buff, i, 13));
+
+ if (i < 1536) {
+ assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae));
+ goto wrap_up;
+ } else {
+ failure("Archive truncated to %d bytes", i);
+ assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
+ }
+
+ if (i < 1536 + filedata_size) {
+ assertA(ARCHIVE_FATAL == archive_read_data(a, filedata, filedata_size));
+ goto wrap_up;
+ } else {
+ failure("Archive truncated to %d bytes", i);
+ assertEqualIntA(a, filedata_size,
+ archive_read_data(a, filedata, filedata_size));
+ }
+
+ /* Verify the end of the archive. */
+ /* Archive must be long enough to capture a 512-byte
+ * block of zeroes after the entry. (POSIX requires a
+ * second block of zeros to be written but libarchive
+ * does not return an error if it can't consume
+ * it.) */
+ if (i < 1536 + 512*((filedata_size + 511)/512) + 512) {
+ failure("i=%d minsize=%d", i,
+ 1536 + 512*((filedata_size + 511)/512) + 512);
+ assertEqualIntA(a, ARCHIVE_FATAL,
+ archive_read_next_header(a, &ae));
+ } else {
+ assertEqualIntA(a, ARCHIVE_EOF,
+ archive_read_next_header(a, &ae));
+ }
+ wrap_up:
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+ }
+
+
+
+ /* Same as above, except skip the body instead of reading it. */
+ for (i = 1; i < used + 100; i += 100) {
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == read_open_memory(a, buff, i, 7));
+
+ if (i < 1536) {
+ assertA(ARCHIVE_FATAL == archive_read_next_header(a, &ae));
+ goto wrap_up2;
+ } else {
+ assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
+ }
+
+ if (i < 1536 + 512*((filedata_size+511)/512)) {
+ assertA(ARCHIVE_FATAL == archive_read_data_skip(a));
+ goto wrap_up2;
+ } else {
+ assertA(ARCHIVE_OK == archive_read_data_skip(a));
+ }
+
+ /* Verify the end of the archive. */
+ /* Archive must be long enough to capture a 512-byte
+ * block of zeroes after the entry. (POSIX requires a
+ * second block of zeros to be written but libarchive
+ * does not return an error if it can't consume
+ * it.) */
+ if (i < 1536 + 512*((filedata_size + 511)/512) + 512) {
+ assertEqualIntA(a, ARCHIVE_FATAL,
+ archive_read_next_header(a, &ae));
+ } else {
+ assertEqualIntA(a, ARCHIVE_EOF,
+ archive_read_next_header(a, &ae));
+ }
+ wrap_up2:
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+ }
+
+ /* Now, damage the archive in various ways and test the responses. */
+
+ /* Damage the first size field in the pax attributes. */
+ memcpy(buff2, buff, buff_size);
+ buff2[512] = '9';
+ buff2[513] = '9';
+ buff2[514] = 'A'; /* Non-digit in size. */
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff2, used));
+ assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+
+ /* Damage the size field in the pax attributes. */
+ memcpy(buff2, buff, buff_size);
+ buff2[512] = 'A'; /* First character not a digit. */
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff2, used));
+ assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+
+ /* Damage the size field in the pax attributes. */
+ memcpy(buff2, buff, buff_size);
+ for (i = 512; i < 520; i++) /* Size over 999999. */
+ buff2[i] = '9';
+ buff2[i] = ' ';
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff2, used));
+ assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+
+ /* Damage the size field in the pax attributes. */
+ memcpy(buff2, buff, buff_size);
+ buff2[512] = '9'; /* Valid format, but larger than attribute area. */
+ buff2[513] = '9';
+ buff2[514] = '9';
+ buff2[515] = ' ';
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff2, used));
+ assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+
+ /* Damage the size field in the pax attributes. */
+ memcpy(buff2, buff, buff_size);
+ buff2[512] = '1'; /* Too small. */
+ buff2[513] = ' ';
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff2, used));
+ assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+
+ /* Damage the size field in the pax attributes. */
+ memcpy(buff2, buff, buff_size);
+ buff2[512] = ' '; /* No size given. */
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff2, used));
+ assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+
+ /* Damage the ustar header. */
+ memcpy(buff2, buff, buff_size);
+ buff2[1024]++; /* Break the checksum. */
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff2, used));
+ assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae));
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+
+ /*
+ * TODO: Damage the ustar header in various ways and fixup the
+ * checksum in order to test boundary cases in the innermost
+ * ustar header parsing.
+ */
+
+ free(buff);
+ free(buff2);
+ free(filedata);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_read_position.c b/archivers/libarchive/files/libarchive/test/test_read_position.c
new file mode 100644
index 00000000000..85b79672142
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_position.c
@@ -0,0 +1,94 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_position.c 189389 2009-03-05 02:19:42Z kientzle $");
+
+static unsigned char nulls[10000];
+static unsigned char buff[10000000];
+
+/* Check that header_position tracks correctly on read. */
+DEFINE_TEST(test_read_position)
+{
+ struct archive *a;
+ struct archive_entry *ae;
+ size_t write_pos;
+ intmax_t read_position;
+ size_t i, j;
+ size_t data_sizes[] = {0, 5, 511, 512, 513};
+
+ /* Sanity test */
+ assert(sizeof(nulls) + 512 + 1024 <= sizeof(buff));
+
+ /* Create an archive. */
+ assert(NULL != (a = archive_write_new()));
+ assertA(0 == archive_write_set_format_pax_restricted(a));
+ assertA(0 == archive_write_set_bytes_per_block(a, 512));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &write_pos));
+
+ for (i = 0; i < sizeof(data_sizes)/sizeof(data_sizes[0]); ++i) {
+ /* Create a simple archive_entry. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_set_pathname(ae, "testfile");
+ archive_entry_set_mode(ae, S_IFREG);
+ archive_entry_set_size(ae, data_sizes[i]);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assertA(data_sizes[i]
+ == (size_t)archive_write_data(a, nulls, sizeof(nulls)));
+ }
+ assertA(0 == archive_write_close(a));
+ assertA(0 == archive_write_finish(a));
+
+ /* Read the archive back. */
+ assert(NULL != (a = archive_read_new()));
+ assertA(0 == archive_read_support_format_tar(a));
+ assertA(0 == archive_read_open_memory2(a, buff, sizeof(buff), 512));
+
+ read_position = 0;
+ /* Initial header position is zero. */
+ assert(read_position == (intmax_t)archive_read_header_position(a));
+ for (j = 0; j < i; ++j) {
+ assertA(0 == archive_read_next_header(a, &ae));
+ assert(read_position
+ == (intmax_t)archive_read_header_position(a));
+ /* Every other entry: read, then skip */
+ if (j & 1)
+ assertEqualInt(ARCHIVE_OK,
+ archive_read_data_into_buffer(a, buff, 1));
+ assertA(0 == archive_read_data_skip(a));
+ /* read_data_skip() doesn't change header_position */
+ assert(read_position
+ == (intmax_t)archive_read_header_position(a));
+
+ read_position += 512; /* Size of header. */
+ read_position += (data_sizes[j] + 511) & ~511;
+ }
+
+ assertA(1 == archive_read_next_header(a, &ae));
+ assert(read_position == (intmax_t)archive_read_header_position(a));
+ assertA(0 == archive_read_close(a));
+ assert(read_position == (intmax_t)archive_read_header_position(a));
+ archive_read_finish(a);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_read_truncated.c b/archivers/libarchive/files/libarchive/test/test_read_truncated.c
new file mode 100644
index 00000000000..9b26b59818a
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_read_truncated.c
@@ -0,0 +1,149 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_truncated.c,v 1.4 2008/09/01 05:38:33 kientzle Exp $");
+
+char buff[1000000];
+char buff2[100000];
+
+DEFINE_TEST(test_read_truncated)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ unsigned int i;
+ size_t used;
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+ /*
+ * Write a file to it.
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ for (i = 0; i < sizeof(buff2); i++)
+ buff2[i] = (unsigned char)rand();
+ archive_entry_set_size(ae, sizeof(buff2));
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assertA((int)sizeof(buff2) == archive_write_data(a, buff2, sizeof(buff2)));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertA(0 == archive_write_finish(a));
+#endif
+
+ /* Now, read back a truncated version of the archive and
+ * verify that we get an appropriate error. */
+ for (i = 1; i < used + 100; i += 100) {
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff, i));
+
+ if (i < 512) {
+ assertA(ARCHIVE_FATAL == archive_read_next_header(a, &ae));
+ goto wrap_up;
+ } else {
+ assertA(0 == archive_read_next_header(a, &ae));
+ }
+
+ if (i < 512 + sizeof(buff2)) {
+ assertA(ARCHIVE_FATAL == archive_read_data(a, buff2, sizeof(buff2)));
+ goto wrap_up;
+ } else {
+ assertA((int)sizeof(buff2) == archive_read_data(a, buff2, sizeof(buff2)));
+ }
+
+ /* Verify the end of the archive. */
+ /* Archive must be long enough to capture a 512-byte
+ * block of zeroes after the entry. (POSIX requires a
+ * second block of zeros to be written but libarchive
+ * does not return an error if it can't consume
+ * it.) */
+ if (i < 512 + 512*((sizeof(buff2) + 511)/512) + 512) {
+ assertA(ARCHIVE_FATAL == archive_read_next_header(a, &ae));
+ } else {
+ assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae));
+ }
+ wrap_up:
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+ }
+
+
+
+ /* Same as above, except skip the body instead of reading it. */
+ for (i = 1; i < used + 100; i += 100) {
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff, i));
+
+ if (i < 512) {
+ assertA(ARCHIVE_FATAL == archive_read_next_header(a, &ae));
+ goto wrap_up2;
+ } else {
+ assertA(0 == archive_read_next_header(a, &ae));
+ }
+
+ if (i < 512 + 512*((sizeof(buff2)+511)/512)) {
+ assertA(ARCHIVE_FATAL == archive_read_data_skip(a));
+ goto wrap_up2;
+ } else {
+ assertA(ARCHIVE_OK == archive_read_data_skip(a));
+ }
+
+ /* Verify the end of the archive. */
+ /* Archive must be long enough to capture a 512-byte
+ * block of zeroes after the entry. (POSIX requires a
+ * second block of zeros to be written but libarchive
+ * does not return an error if it can't consume
+ * it.) */
+ if (i < 512 + 512*((sizeof(buff2) + 511)/512) + 512) {
+ assertA(ARCHIVE_FATAL == archive_read_next_header(a, &ae));
+ } else {
+ assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae));
+ }
+ wrap_up2:
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+ }
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_tar_filenames.c b/archivers/libarchive/files/libarchive/test/test_tar_filenames.c
new file mode 100644
index 00000000000..b08373819df
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_tar_filenames.c
@@ -0,0 +1,186 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_tar_filenames.c,v 1.10 2008/09/01 05:38:33 kientzle Exp $");
+
+/*
+ * Exercise various lengths of filenames in tar archives,
+ * especially around the magic sizes where ustar breaks
+ * filenames into prefix/suffix.
+ */
+
+static void
+test_filename(const char *prefix, int dlen, int flen)
+{
+ char buff[8192];
+ char filename[400];
+ char dirname[400];
+ struct archive_entry *ae;
+ struct archive *a;
+ size_t used;
+ char *p;
+ int i;
+
+ p = filename;
+ if (prefix) {
+ strcpy(filename, prefix);
+ p += strlen(p);
+ }
+ if (dlen > 0) {
+ for (i = 0; i < dlen; i++)
+ *p++ = 'a';
+ *p++ = '/';
+ }
+ for (i = 0; i < flen; i++)
+ *p++ = 'b';
+ *p = '\0';
+
+ strcpy(dirname, filename);
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_pax_restricted(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ assertA(0 == archive_write_set_bytes_per_block(a,0));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+ /*
+ * Write a file to it.
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, filename);
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ failure("Pathname %d/%d", dlen, flen);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+
+ /*
+ * Write a dir to it (without trailing '/').
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, dirname);
+ archive_entry_set_mode(ae, S_IFDIR | 0755);
+ failure("Dirname %d/%d", dlen, flen);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+
+ /* Tar adds a '/' to directory names. */
+ strcat(dirname, "/");
+
+ /*
+ * Write a dir to it (with trailing '/').
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, dirname);
+ archive_entry_set_mode(ae, S_IFDIR | 0755);
+ failure("Dirname %d/%d", dlen, flen);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertA(0 == archive_write_finish(a));
+#endif
+
+ /*
+ * Now, read the data back.
+ */
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff, used));
+
+ /* Read the file and check the filename. */
+ assertA(0 == archive_read_next_header(a, &ae));
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ skipping("Leading '/' preserved on long filenames");
+#else
+ assertEqualString(filename, archive_entry_pathname(ae));
+#endif
+ assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae));
+
+ /*
+ * Read the two dirs and check the names.
+ *
+ * Both dirs should read back with the same name, since
+ * tar should add a trailing '/' to any dir that doesn't
+ * already have one. We only report the first such failure
+ * here.
+ */
+ assertA(0 == archive_read_next_header(a, &ae));
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ skipping("Trailing '/' preserved on dirnames");
+#else
+ assertEqualString(dirname, archive_entry_pathname(ae));
+#endif
+ assert((S_IFDIR | 0755) == archive_entry_mode(ae));
+
+ assertA(0 == archive_read_next_header(a, &ae));
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ skipping("Trailing '/' added to dir names");
+#else
+ assertEqualString(dirname, archive_entry_pathname(ae));
+#endif
+ assert((S_IFDIR | 0755) == archive_entry_mode(ae));
+
+ /* Verify the end of the archive. */
+ assert(1 == archive_read_next_header(a, &ae));
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+}
+
+DEFINE_TEST(test_tar_filenames)
+{
+ int dlen, flen;
+
+ /* Repeat the following for a variety of dir/file lengths. */
+ for (dlen = 45; dlen < 55; dlen++) {
+ for (flen = 45; flen < 55; flen++) {
+ test_filename(NULL, dlen, flen);
+ test_filename("/", dlen, flen);
+ }
+ }
+
+ for (dlen = 0; dlen < 140; dlen += 10) {
+ for (flen = 98; flen < 102; flen++) {
+ test_filename(NULL, dlen, flen);
+ test_filename("/", dlen, flen);
+ }
+ }
+
+ for (dlen = 140; dlen < 160; dlen++) {
+ for (flen = 95; flen < 105; flen++) {
+ test_filename(NULL, dlen, flen);
+ test_filename("/", dlen, flen);
+ }
+ }
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_tar_large.c b/archivers/libarchive/files/libarchive/test/test_tar_large.c
new file mode 100644
index 00000000000..adc81551cec
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_tar_large.c
@@ -0,0 +1,312 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_tar_large.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+
+/*
+ * This is a somewhat tricky test that verifies the ability to
+ * write and read very large entries to tar archives. It
+ * writes entries from 2GB up to 1TB to an archive in memory.
+ * The memory storage here carefully avoids actually storing
+ * any part of the file bodies, so it runs very quickly and requires
+ * very little memory. If you're willing to wait a few minutes,
+ * you should be able to exercise petabyte entries with this code.
+ */
+
+/*
+ * Each file is built up by duplicating the following block.
+ */
+static size_t filedatasize;
+static void *filedata;
+
+/*
+ * We store the archive as blocks of data generated by libarchive,
+ * each possibly followed by bytes of file data.
+ */
+struct memblock {
+ struct memblock *next;
+ size_t size;
+ void *buff;
+ int64_t filebytes;
+};
+
+/*
+ * The total memory store is just a list of memblocks plus
+ * some accounting overhead.
+ */
+struct memdata {
+ int64_t filebytes;
+ void *buff;
+ struct memblock *first;
+ struct memblock *last;
+};
+
+/* The following size definitions simplify things below. */
+#define KB ((int64_t)1024)
+#define MB ((int64_t)1024 * KB)
+#define GB ((int64_t)1024 * MB)
+#define TB ((int64_t)1024 * GB)
+
+#if ARCHIVE_VERSION_NUMBER < 2000000
+static ssize_t memory_read_skip(struct archive *, void *, size_t request);
+#else
+static off_t memory_read_skip(struct archive *, void *, off_t request);
+#endif
+static ssize_t memory_read(struct archive *, void *, const void **buff);
+static ssize_t memory_write(struct archive *, void *, const void *, size_t);
+
+
+static ssize_t
+memory_write(struct archive *a, void *_private, const void *buff, size_t size)
+{
+ struct memdata *private = _private;
+ struct memblock *block;
+
+ (void)a;
+
+ /*
+ * Since libarchive tries to behave in a zero-copy manner, if
+ * you give a pointer to filedata to the library, a pointer
+ * into that data will (usually) pop out here. This way, we
+ * can tell the difference between filedata and library header
+ * and metadata.
+ */
+ if ((const char *)filedata <= (const char *)buff
+ && (const char *)buff < (const char *)filedata + filedatasize) {
+ /* We don't need to store a block of file data. */
+ private->last->filebytes += (int64_t)size;
+ } else {
+ /* Yes, we're assuming the very first write is metadata. */
+ /* It's header or metadata, copy and save it. */
+ block = (struct memblock *)malloc(sizeof(*block));
+ memset(block, 0, sizeof(*block));
+ block->size = size;
+ block->buff = malloc(size);
+ memcpy(block->buff, buff, size);
+ if (private->last == NULL) {
+ private->first = private->last = block;
+ } else {
+ private->last->next = block;
+ private->last = block;
+ }
+ block->next = NULL;
+ }
+ return ((long)size);
+}
+
+static ssize_t
+memory_read(struct archive *a, void *_private, const void **buff)
+{
+ struct memdata *private = _private;
+ struct memblock *block;
+ ssize_t size;
+
+ (void)a;
+
+ free(private->buff);
+ private->buff = NULL;
+ if (private->first == NULL) {
+ private->last = NULL;
+ return (ARCHIVE_EOF);
+ }
+ if (private->filebytes > 0) {
+ /*
+ * We're returning file bytes, simulate it by
+ * passing blocks from the template data.
+ */
+ if (private->filebytes > (int64_t)filedatasize)
+ size = (ssize_t)filedatasize;
+ else
+ size = (ssize_t)private->filebytes;
+ private->filebytes -= size;
+ *buff = filedata;
+ } else {
+ /*
+ * We need to get some real data to return.
+ */
+ block = private->first;
+ private->first = block->next;
+ size = (ssize_t)block->size;
+ if (block->buff != NULL) {
+ private->buff = block->buff;
+ *buff = block->buff;
+ } else {
+ private->buff = NULL;
+ *buff = filedata;
+ }
+ private->filebytes = block->filebytes;
+ free(block);
+ }
+ return (size);
+}
+
+
+#if ARCHIVE_VERSION_NUMBER < 2000000
+static ssize_t
+memory_read_skip(struct archive *a, void *private, size_t skip)
+{
+ (void)a; /* UNUSED */
+ (void)private; /* UNUSED */
+ (void)skip; /* UNUSED */
+ return (0);
+}
+#else
+static off_t
+memory_read_skip(struct archive *a, void *_private, off_t skip)
+{
+ struct memdata *private = _private;
+
+ (void)a;
+
+ if (private->first == NULL) {
+ private->last = NULL;
+ return (0);
+ }
+ if (private->filebytes > 0) {
+ if (private->filebytes < skip)
+ skip = (off_t)private->filebytes;
+ private->filebytes -= skip;
+ } else {
+ skip = 0;
+ }
+ return (skip);
+}
+#endif
+
+DEFINE_TEST(test_tar_large)
+{
+ /* The sizes of the entries we're going to generate. */
+ static int64_t tests[] = {
+ /* Test for 32-bit signed overflow. */
+ 2 * GB - 1, 2 * GB, 2 * GB + 1,
+ /* Test for 32-bit unsigned overflow. */
+ 4 * GB - 1, 4 * GB, 4 * GB + 1,
+ /* 8GB is the "official" max for ustar. */
+ 8 * GB - 1, 8 * GB, 8 * GB + 1,
+ /* Bend ustar a tad and you can get 64GB (12 octal digits). */
+ 64 * GB - 1, 64 * GB,
+ /* And larger entries that require non-ustar extensions. */
+ 256 * GB, 1 * TB, 0 };
+ int i;
+ char namebuff[64];
+ struct memdata memdata;
+ struct archive_entry *ae;
+ struct archive *a;
+ int64_t filesize;
+ size_t writesize;
+
+ filedatasize = (size_t)(1 * MB);
+ filedata = malloc(filedatasize);
+ memset(filedata, 0xAA, filedatasize);
+ memset(&memdata, 0, sizeof(memdata));
+
+ /*
+ * Open an archive for writing.
+ */
+ a = archive_write_new();
+ archive_write_set_format_pax_restricted(a);
+ archive_write_set_bytes_per_block(a, 0); /* No buffering. */
+ archive_write_open(a, &memdata, NULL, memory_write, NULL);
+
+ /*
+ * Write a series of large files to it.
+ */
+ for (i = 0; tests[i] != 0; i++) {
+ assert((ae = archive_entry_new()) != NULL);
+ sprintf(namebuff, "file_%d", i);
+ archive_entry_copy_pathname(ae, namebuff);
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ filesize = tests[i];
+
+ archive_entry_set_size(ae, filesize);
+
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+
+ /*
+ * Write the actual data to the archive.
+ */
+ while (filesize > 0) {
+ writesize = filedatasize;
+ if ((int64_t)writesize > filesize)
+ writesize = (size_t)filesize;
+ assertA((int)writesize
+ == archive_write_data(a, filedata, writesize));
+ filesize -= writesize;
+ }
+ }
+
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "lastfile");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertA(0 == archive_write_finish(a));
+#endif
+
+ /*
+ * Open the same archive for reading.
+ */
+ a = archive_read_new();
+ archive_read_support_format_tar(a);
+ archive_read_open2(a, &memdata, NULL,
+ memory_read, memory_read_skip, NULL);
+
+ /*
+ * Read entries back.
+ */
+ for (i = 0; tests[i] > 0; i++) {
+ assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
+ sprintf(namebuff, "file_%d", i);
+ assertEqualString(namebuff, archive_entry_pathname(ae));
+ assert(tests[i] == archive_entry_size(ae));
+ }
+ assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
+ assertEqualString("lastfile", archive_entry_pathname(ae));
+
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+
+ /* Close out the archive. */
+ assertA(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assertA(0 == archive_read_finish(a));
+#endif
+
+ free(memdata.buff);
+ free(filedata);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_ustar_filenames.c b/archivers/libarchive/files/libarchive/test/test_ustar_filenames.c
new file mode 100644
index 00000000000..e3ebf3c92f0
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_ustar_filenames.c
@@ -0,0 +1,191 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_ustar_filenames.c 189308 2009-03-03 17:02:51Z kientzle $");
+
+/*
+ * Exercise various lengths of filenames in ustar archives.
+ */
+
+static void
+test_filename(const char *prefix, int dlen, int flen)
+{
+ char buff[8192];
+ char filename[400];
+ char dirname[400];
+ struct archive_entry *ae;
+ struct archive *a;
+ size_t used;
+ int separator = 0;
+ int i = 0;
+
+ if (prefix != NULL) {
+ strcpy(filename, prefix);
+ i = (int)strlen(prefix);
+ }
+ if (dlen > 0) {
+ for (; i < dlen; i++)
+ filename[i] = 'a';
+ filename[i++] = '/';
+ separator = 1;
+ }
+ for (; i < dlen + flen + separator; i++)
+ filename[i] = 'b';
+ filename[i] = '\0';
+
+ strcpy(dirname, filename);
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ assertA(0 == archive_write_set_bytes_per_block(a,0));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+ /*
+ * Write a file to it.
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, filename);
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ failure("dlen=%d, flen=%d", dlen, flen);
+ if (flen > 100) {
+ assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae));
+ } else {
+ assertEqualIntA(a, 0, archive_write_header(a, ae));
+ }
+ archive_entry_free(ae);
+
+ /*
+ * Write a dir to it (without trailing '/').
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, dirname);
+ archive_entry_set_mode(ae, S_IFDIR | 0755);
+ failure("dlen=%d, flen=%d", dlen, flen);
+ if (flen >= 100) {
+ assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae));
+ } else {
+ assertEqualIntA(a, 0, archive_write_header(a, ae));
+ }
+ archive_entry_free(ae);
+
+ /* Tar adds a '/' to directory names. */
+ strcat(dirname, "/");
+
+ /*
+ * Write a dir to it (with trailing '/').
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, dirname);
+ archive_entry_set_mode(ae, S_IFDIR | 0755);
+ failure("dlen=%d, flen=%d", dlen, flen);
+ if (flen >= 100) {
+ assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae));
+ } else {
+ assertEqualIntA(a, 0, archive_write_header(a, ae));
+ }
+ archive_entry_free(ae);
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertEqualInt(0, archive_write_finish(a));
+#endif
+
+ /*
+ * Now, read the data back.
+ */
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff, used));
+
+ if (flen <= 100) {
+ /* Read the file and check the filename. */
+ assertA(0 == archive_read_next_header(a, &ae));
+ failure("dlen=%d, flen=%d", dlen, flen);
+ assertEqualString(filename, archive_entry_pathname(ae));
+ assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae));
+ }
+
+ /*
+ * Read the two dirs and check the names.
+ *
+ * Both dirs should read back with the same name, since
+ * tar should add a trailing '/' to any dir that doesn't
+ * already have one.
+ */
+ if (flen <= 99) {
+ assertA(0 == archive_read_next_header(a, &ae));
+ assert((S_IFDIR | 0755) == archive_entry_mode(ae));
+ failure("dlen=%d, flen=%d", dlen, flen);
+ assertEqualString(dirname, archive_entry_pathname(ae));
+ }
+
+ if (flen <= 99) {
+ assertA(0 == archive_read_next_header(a, &ae));
+ assert((S_IFDIR | 0755) == archive_entry_mode(ae));
+ assertEqualString(dirname, archive_entry_pathname(ae));
+ }
+
+ /* Verify the end of the archive. */
+ failure("This fails if entries were written that should not have been written. dlen=%d, flen=%d", dlen, flen);
+ assertEqualInt(1, archive_read_next_header(a, &ae));
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assertEqualInt(0, archive_read_finish(a));
+#endif
+}
+
+DEFINE_TEST(test_ustar_filenames)
+{
+ int dlen, flen;
+
+ /* Try a bunch of different file/dir lengths that add up
+ * to just a little less or a little more than 100 bytes.
+ * This exercises the code that splits paths between ustar
+ * filename and prefix fields.
+ */
+ for (dlen = 5; dlen < 70; dlen += 5) {
+ for (flen = 100 - dlen - 5; flen < 100 - dlen + 5; flen++) {
+ test_filename(NULL, dlen, flen);
+ test_filename("/", dlen, flen);
+ }
+ }
+
+ /* Probe the 100-char limit for paths with no '/'. */
+ for (flen = 90; flen < 110; flen++) {
+ test_filename(NULL, 0, flen);
+ test_filename("/", dlen, flen);
+ }
+
+ /* XXXX TODO Probe the 100-char limit with a dir prefix. */
+ /* XXXX TODO Probe the 255-char total limit. */
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_compress.c b/archivers/libarchive/files/libarchive/test/test_write_compress.c
new file mode 100644
index 00000000000..aa590de8a91
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_compress.c
@@ -0,0 +1,102 @@
+/*-
+ * Copyright (c) 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
+ * 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.
+ */
+
+#include "test.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_compress.c 189308 2009-03-03 17:02:51Z kientzle $");
+
+/*
+ * A basic exercise of compress reading and writing.
+ *
+ * TODO: Add a reference file and make sure we can decompress that.
+ */
+
+DEFINE_TEST(test_write_compress)
+{
+ struct archive_entry *ae;
+ struct archive* a;
+ char *buff, *data;
+ size_t buffsize, datasize;
+ char path[16];
+ size_t used;
+ int i;
+
+ buffsize = 1000000;
+ assert(NULL != (buff = (char *)malloc(buffsize)));
+
+ datasize = 10000;
+ assert(NULL != (data = (char *)malloc(datasize)));
+ memset(data, 0, datasize);
+
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ assertA(0 == archive_write_set_compression_compress(a));
+ assertA(0 == archive_write_open_memory(a, buff, buffsize, &used));
+
+ for (i = 0; i < 100; i++) {
+ sprintf(path, "file%03d", i);
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, path);
+ archive_entry_set_size(ae, datasize);
+ archive_entry_set_filetype(ae, AE_IFREG);
+ assertA(0 == archive_write_header(a, ae));
+ assertA(datasize == (size_t)archive_write_data(a, data, datasize));
+ archive_entry_free(ae);
+ }
+
+
+ archive_write_close(a);
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assert(0 == archive_write_finish(a));
+#endif
+
+ /*
+ * Now, read the data back.
+ */
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff, used));
+
+
+ for (i = 0; i < 100; i++) {
+ sprintf(path, "file%03d", i);
+ if (!assertEqualInt(0, archive_read_next_header(a, &ae)))
+ break;
+ assertEqualString(path, archive_entry_pathname(ae));
+ assertEqualInt((int)datasize, archive_entry_size(ae));
+ }
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+
+ free(data);
+ free(buff);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_compress_program.c b/archivers/libarchive/files/libarchive/test/test_write_compress_program.c
new file mode 100644
index 00000000000..bae77e5341b
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_compress_program.c
@@ -0,0 +1,118 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_compress_program.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+char buff[1000000];
+char buff2[64];
+
+DEFINE_TEST(test_write_compress_program)
+{
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ skipping("archive_write_set_compress_program()");
+#else
+ struct archive_entry *ae;
+ struct archive *a;
+ size_t used;
+ int blocksize = 1024;
+ int r;
+
+ if (!canGzip()) {
+ skipping("Cannot run 'gzip'");
+ return;
+ }
+
+ /* Create a new archive in memory. */
+ /* Write it through an external "gzip" program. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ r = archive_write_set_compression_program(a, "gzip");
+ if (r == ARCHIVE_FATAL) {
+ skipping("Write compression via external "
+ "program unsupported on this platform");
+ archive_write_finish(a);
+ return;
+ }
+ assertA(0 == archive_write_set_bytes_per_block(a, blocksize));
+ assertA(0 == archive_write_set_bytes_in_last_block(a, blocksize));
+ assertA(blocksize == archive_write_get_bytes_in_last_block(a));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+ assertA(blocksize == archive_write_get_bytes_in_last_block(a));
+
+ /*
+ * Write a file to it.
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(ae, 1, 10);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, 8);
+
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assertA(8 == archive_write_data(a, "12345678", 9));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+ assertA(0 == archive_write_finish(a));
+
+ /*
+ * Now, read the data back through the built-in gzip support.
+ */
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
+ r = archive_read_support_compression_gzip(a);
+ /* The compression_gzip() handler will fall back to gunzip
+ * automatically, but if we know gunzip isn't available, then
+ * skip the rest. */
+ if (r != ARCHIVE_OK && !canGunzip()) {
+ skipping("No libz and no gunzip program, "
+ "unable to verify gzip compression");
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+ return;
+ }
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used));
+
+ if (!assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae))) {
+ archive_read_finish(a);
+ return;
+ }
+
+ assertEqualInt(1, archive_entry_mtime(ae));
+ assertEqualInt(0, archive_entry_atime(ae));
+ assertEqualInt(0, archive_entry_ctime(ae));
+ assertEqualString("file", archive_entry_pathname(ae));
+ assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae));
+ assertEqualInt(8, archive_entry_size(ae));
+ assertEqualIntA(a, 8, archive_read_data(a, buff2, 10));
+ assertEqualMem(buff2, "12345678", 8);
+
+ /* Verify the end of the archive. */
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
+ assertEqualInt(ARCHIVE_OK, archive_read_finish(a));
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_disk.c b/archivers/libarchive/files/libarchive/test/test_write_disk.c
new file mode 100644
index 00000000000..169f4f23996
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_disk.c
@@ -0,0 +1,332 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_disk.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+
+#define UMASK 022
+/*
+ * When comparing mode values, ignore high-order bits
+ * that are set on some OSes. This should cover the bits
+ * we're interested in (standard mode bits + file type bits)
+ * while ignoring extra markers such as Haiku/BeOS index
+ * flags.
+ */
+#define MODE_MASK 0777777
+
+static void create(struct archive_entry *ae, const char *msg)
+{
+ struct archive *ad;
+ struct stat st;
+
+ /* Write the entry to disk. */
+ assert((ad = archive_write_disk_new()) != NULL);
+ failure("%s", msg);
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(ad);
+#else
+ assertEqualInt(0, archive_write_finish(ad));
+#endif
+ /* Test the entries on disk. */
+ assert(0 == stat(archive_entry_pathname(ae), &st));
+ failure("%s", msg);
+
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ /* When verifying a dir, ignore the S_ISGID bit, as some systems set
+ * that automatically. */
+ if (archive_entry_filetype(ae) == AE_IFDIR)
+ st.st_mode &= ~S_ISGID;
+ assertEqualInt(st.st_mode & MODE_MASK,
+ archive_entry_mode(ae) & ~UMASK & MODE_MASK);
+#endif
+}
+
+static void create_reg_file(struct archive_entry *ae, const char *msg)
+{
+ static const char data[]="abcdefghijklmnopqrstuvwxyz";
+ struct archive *ad;
+
+ /* Write the entry to disk. */
+ assert((ad = archive_write_disk_new()) != NULL);
+ archive_write_disk_set_options(ad, ARCHIVE_EXTRACT_TIME);
+ failure("%s", msg);
+ /*
+ * A touchy API design issue: archive_write_data() does (as of
+ * 2.4.12) enforce the entry size as a limit on the data
+ * written to the file. This was not enforced prior to
+ * 2.4.12. The change was prompted by the refined
+ * hardlink-restore semantics introduced at that time. In
+ * short, libarchive needs to know whether a "hardlink entry"
+ * is going to overwrite the contents so that it can know
+ * whether or not to open the file for writing. This implies
+ * that there is a fundamental semantic difference between an
+ * entry with a zero size and one with a non-zero size in the
+ * case of hardlinks and treating the hardlink case
+ * differently from the regular file case is just asking for
+ * trouble. So, a zero size must always mean that no data
+ * will be accepted, which is consistent with the file size in
+ * the entry being a maximum size.
+ */
+ archive_entry_set_size(ae, sizeof(data));
+ archive_entry_set_mtime(ae, 123456789, 0);
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(ad);
+#else
+ assertEqualInt(0, archive_write_finish(ad));
+#endif
+ /* Test the entries on disk. */
+ assertIsReg(archive_entry_pathname(ae), archive_entry_mode(ae) & 0777);
+ assertFileSize(archive_entry_pathname(ae), sizeof(data));
+ /* test_write_disk_times has more detailed tests of this area. */
+ assertFileMtime(archive_entry_pathname(ae), 123456789, 0);
+ failure("No atime given, so atime should get set to current time");
+ assertFileAtimeRecent(archive_entry_pathname(ae));
+}
+
+static void create_reg_file2(struct archive_entry *ae, const char *msg)
+{
+ const int datasize = 100000;
+ char *data;
+ struct archive *ad;
+ int i;
+
+ data = malloc(datasize);
+ for (i = 0; i < datasize; i++)
+ data[i] = (char)(i % 256);
+
+ /* Write the entry to disk. */
+ assert((ad = archive_write_disk_new()) != NULL);
+ failure("%s", msg);
+ /*
+ * See above for an explanation why this next call
+ * is necessary.
+ */
+ archive_entry_set_size(ae, datasize);
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ for (i = 0; i < datasize - 999; i += 1000) {
+ assertEqualIntA(ad, ARCHIVE_OK,
+ archive_write_data_block(ad, data + i, 1000, i));
+ }
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ assertEqualInt(0, archive_write_finish(ad));
+
+ /* Test the entries on disk. */
+ assertIsReg(archive_entry_pathname(ae), archive_entry_mode(ae) & 0777);
+ assertFileSize(archive_entry_pathname(ae), i);
+ assertFileContents(data, datasize, archive_entry_pathname(ae));
+ free(data);
+}
+
+static void create_reg_file3(struct archive_entry *ae, const char *msg)
+{
+ static const char data[]="abcdefghijklmnopqrstuvwxyz";
+ struct archive *ad;
+ struct stat st;
+
+ /* Write the entry to disk. */
+ assert((ad = archive_write_disk_new()) != NULL);
+ failure("%s", msg);
+ /* Set the size smaller than the data and verify the truncation. */
+ archive_entry_set_size(ae, 5);
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualInt(5, archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(ad);
+#else
+ assertEqualInt(0, archive_write_finish(ad));
+#endif
+ /* Test the entry on disk. */
+ assert(0 == stat(archive_entry_pathname(ae), &st));
+ failure("st.st_mode=%o archive_entry_mode(ae)=%o",
+ st.st_mode, archive_entry_mode(ae));
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ assertEqualInt(st.st_mode, (archive_entry_mode(ae) & ~UMASK));
+#endif
+ assertEqualInt(st.st_size, 5);
+}
+
+
+static void create_reg_file4(struct archive_entry *ae, const char *msg)
+{
+ static const char data[]="abcdefghijklmnopqrstuvwxyz";
+ struct archive *ad;
+ struct stat st;
+
+ /* Write the entry to disk. */
+ assert((ad = archive_write_disk_new()) != NULL);
+ /* Leave the size unset. The data should not be truncated. */
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualInt(ARCHIVE_OK,
+ archive_write_data_block(ad, data, sizeof(data), 0));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(ad);
+#else
+ assertEqualInt(0, archive_write_finish(ad));
+#endif
+ /* Test the entry on disk. */
+ assert(0 == stat(archive_entry_pathname(ae), &st));
+ failure("st.st_mode=%o archive_entry_mode(ae)=%o",
+ st.st_mode, archive_entry_mode(ae));
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ assertEqualInt(st.st_mode, (archive_entry_mode(ae) & ~UMASK));
+#endif
+ failure(msg);
+ assertEqualInt(st.st_size, sizeof(data));
+}
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+static void create_reg_file_win(struct archive_entry *ae, const char *msg)
+{
+ static const char data[]="abcdefghijklmnopqrstuvwxyz";
+ struct archive *ad;
+ struct stat st;
+ char *p, *fname;
+ size_t l;
+
+ /* Write the entry to disk. */
+ assert((ad = archive_write_disk_new()) != NULL);
+ archive_write_disk_set_options(ad, ARCHIVE_EXTRACT_TIME);
+ failure("%s", msg);
+ archive_entry_set_size(ae, sizeof(data));
+ archive_entry_set_mtime(ae, 123456789, 0);
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(ad);
+#else
+ assertEqualInt(0, archive_write_finish(ad));
+#endif
+ /* Test the entries on disk. */
+ l = strlen(archive_entry_pathname(ae));
+ fname = malloc(l + 1);
+ assert(NULL != fname);
+ strcpy(fname, archive_entry_pathname(ae));
+ /* Replace unusable characters in Windows to '_' */
+ for (p = fname; *p != '\0'; p++)
+ if (*p == ':' || *p == '*' || *p == '?' ||
+ *p == '"' || *p == '<' || *p == '>' || *p == '|')
+ *p = '_';
+ assert(0 == stat(fname, &st));
+ failure("st.st_mode=%o archive_entry_mode(ae)=%o",
+ st.st_mode, archive_entry_mode(ae));
+ assertEqualInt(st.st_size, sizeof(data));
+}
+#endif /* _WIN32 && !__CYGWIN__ */
+#endif
+
+DEFINE_TEST(test_write_disk)
+{
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ skipping("archive_write_disk interface");
+#else
+ struct archive_entry *ae;
+
+ /* Force the umask to something predictable. */
+ assertUmask(UMASK);
+
+ /* A regular file. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ create_reg_file(ae, "Test creating a regular file");
+ archive_entry_free(ae);
+
+ /* Another regular file. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file2");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ create_reg_file2(ae, "Test creating another regular file");
+ archive_entry_free(ae);
+
+ /* A regular file with a size restriction */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file3");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ create_reg_file3(ae, "Regular file with size restriction");
+ archive_entry_free(ae);
+
+ /* A regular file with an unspecified size */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file3");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ create_reg_file4(ae, "Regular file with unspecified size");
+ archive_entry_free(ae);
+
+ /* A regular file over an existing file */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0724);
+ create(ae, "Test creating a file over an existing file.");
+ archive_entry_free(ae);
+
+ /* A directory. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "dir");
+ archive_entry_set_mode(ae, S_IFDIR | 0555);
+ create(ae, "Test creating a regular dir.");
+ archive_entry_free(ae);
+
+ /* A directory over an existing file. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFDIR | 0742);
+ create(ae, "Test creating a dir over an existing file.");
+ archive_entry_free(ae);
+
+ /* A file over an existing dir. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file");
+ archive_entry_set_mode(ae, S_IFREG | 0744);
+ create(ae, "Test creating a file over an existing dir.");
+ archive_entry_free(ae);
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* A file with unusable characters in its file name. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "f:i*l?e\"f<i>l|e");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ create_reg_file_win(ae, "Test creating a regular file"
+ " with unusable characters in its file name");
+ archive_entry_free(ae);
+
+ /* A file with unusable characters in its directory name. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "d:i*r?e\"c<t>o|ry/file1");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ create_reg_file_win(ae, "Test creating a regular file"
+ " with unusable characters in its file name");
+ archive_entry_free(ae);
+#endif /* _WIN32 && !__CYGWIN__ */
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_disk_hardlink.c b/archivers/libarchive/files/libarchive/test/test_write_disk_hardlink.c
new file mode 100644
index 00000000000..934aa08d578
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_disk_hardlink.c
@@ -0,0 +1,219 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_disk_hardlink.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+/* Execution bits, Group members bits and others bits do not work. */
+#define UMASK 0177
+#define E_MASK (~0177)
+#else
+#define UMASK 022
+#define E_MASK (~0)
+#endif
+
+/*
+ * Exercise hardlink recreation.
+ *
+ * File permissions are chosen so that the authoritive entry
+ * has the correct permission and the non-authoritive versions
+ * are just writeable files.
+ */
+DEFINE_TEST(test_write_disk_hardlink)
+{
+#if defined(__HAIKU__)
+ skipping("archive_write_disk_hardlink; hardlinks are not supported on bfs");
+#else
+ static const char data[]="abcdefghijklmnopqrstuvwxyz";
+ struct archive *ad;
+ struct archive_entry *ae;
+ int r;
+
+ /* Force the umask to something predictable. */
+ assertUmask(UMASK);
+
+ /* Write entries to disk. */
+ assert((ad = archive_write_disk_new()) != NULL);
+
+ /*
+ * First, use a tar-like approach; a regular file, then
+ * a separate "hardlink" entry.
+ */
+
+ /* Regular file. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link1a");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, sizeof(data));
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualInt(sizeof(data),
+ archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ archive_entry_free(ae);
+
+ /* Link. Size of zero means this doesn't carry data. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link1b");
+ archive_entry_set_mode(ae, S_IFREG | 0642);
+ archive_entry_set_size(ae, 0);
+ archive_entry_copy_hardlink(ae, "link1a");
+ assertEqualIntA(ad, 0, r = archive_write_header(ad, ae));
+ if (r >= ARCHIVE_WARN) {
+ assertEqualInt(ARCHIVE_WARN,
+ archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ }
+ archive_entry_free(ae);
+
+ /*
+ * Repeat tar approach test, but use unset to mark the
+ * hardlink as having no data.
+ */
+
+ /* Regular file. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link2a");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, sizeof(data));
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualInt(sizeof(data),
+ archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ archive_entry_free(ae);
+
+ /* Link. Unset size means this doesn't carry data. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link2b");
+ archive_entry_set_mode(ae, S_IFREG | 0642);
+ archive_entry_unset_size(ae);
+ archive_entry_copy_hardlink(ae, "link2a");
+ assertEqualIntA(ad, 0, r = archive_write_header(ad, ae));
+ if (r >= ARCHIVE_WARN) {
+ assertEqualInt(ARCHIVE_WARN,
+ archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ }
+ archive_entry_free(ae);
+
+ /*
+ * Second, try an old-cpio-like approach; a regular file, then
+ * another identical one (which has been marked hardlink).
+ */
+
+ /* Regular file. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link3a");
+ archive_entry_set_mode(ae, S_IFREG | 0600);
+ archive_entry_set_size(ae, sizeof(data));
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+ assertEqualInt(sizeof(data), archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ archive_entry_free(ae);
+
+ /* Link. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link3b");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, sizeof(data));
+ archive_entry_copy_hardlink(ae, "link3a");
+ assertEqualIntA(ad, 0, r = archive_write_header(ad, ae));
+ if (r > ARCHIVE_WARN) {
+ assertEqualInt(sizeof(data),
+ archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ }
+ archive_entry_free(ae);
+
+ /*
+ * Finally, try a new-cpio-like approach, where the initial
+ * regular file is empty and the hardlink has the data.
+ */
+
+ /* Regular file. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link4a");
+ archive_entry_set_mode(ae, S_IFREG | 0600);
+ archive_entry_set_size(ae, 0);
+ assertEqualIntA(ad, 0, archive_write_header(ad, ae));
+#if ARCHIVE_VERSION_NUMBER < 3000000
+ assertEqualInt(ARCHIVE_WARN, archive_write_data(ad, data, 1));
+#else
+ assertEqualInt(-1, archive_write_data(ad, data, 1));
+#endif
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ archive_entry_free(ae);
+
+ /* Link. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link4b");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, sizeof(data));
+ archive_entry_copy_hardlink(ae, "link4a");
+ assertEqualIntA(ad, 0, r = archive_write_header(ad, ae));
+ if (r > ARCHIVE_FAILED) {
+ assertEqualInt(sizeof(data),
+ archive_write_data(ad, data, sizeof(data)));
+ assertEqualIntA(ad, 0, archive_write_finish_entry(ad));
+ }
+ archive_entry_free(ae);
+ assertEqualInt(0, archive_write_finish(ad));
+
+ /* Test the entries on disk. */
+
+ /* Test #1 */
+ /* If the hardlink was successfully created and the archive
+ * doesn't carry data for it, we consider it to be
+ * non-authoritive for meta data as well. This is consistent
+ * with GNU tar and BSD pax. */
+ assertIsReg("link1a", 0755 & ~UMASK);
+ assertFileSize("link1a", sizeof(data));
+ assertFileNLinks("link1a", 2);
+ assertIsHardlink("link1a", "link1b");
+
+ /* Test #2: Should produce identical results to test #1 */
+ /* Note that marking a hardlink with size = 0 is treated the
+ * same as having an unset size. This is partly for backwards
+ * compatibility (we used to not have unset tracking, so
+ * relied on size == 0) and partly to match the model used by
+ * common file formats that store a size of zero for
+ * hardlinks. */
+ assertIsReg("link2a", 0755 & ~UMASK);
+ assertFileSize("link2a", sizeof(data));
+ assertFileNLinks("link2a", 2);
+ assertIsHardlink("link2a", "link2b");
+
+ /* Test #3 */
+ assertIsReg("link3a", 0755 & ~UMASK);
+ assertFileSize("link3a", sizeof(data));
+ assertFileNLinks("link3a", 2);
+ assertIsHardlink("link3a", "link3b");
+
+ /* Test #4 */
+ assertIsReg("link4a", 0755 & ~UMASK);
+ assertFileNLinks("link4a", 2);
+ assertFileSize("link4a", sizeof(data));
+ assertIsHardlink("link4a", "link4b");
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_disk_perms.c b/archivers/libarchive/files/libarchive/test/test_write_disk_perms.c
new file mode 100644
index 00000000000..207444833e7
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_disk_perms.c
@@ -0,0 +1,457 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_disk_perms.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+#if ARCHIVE_VERSION_NUMBER >= 1009000 && (!defined(_WIN32) || defined(__CYGWIN__))
+
+#define UMASK 022
+
+static long _default_gid = -1;
+static long _invalid_gid = -1;
+static long _alt_gid = -1;
+
+/*
+ * To fully test SGID restores, we need three distinct GIDs to work
+ * with:
+ * * the GID that files are created with by default (for the
+ * current user in the current directory)
+ * * An "alt gid" that this user can create files with
+ * * An "invalid gid" that this user is not permitted to create
+ * files with.
+ * The second fails if this user doesn't belong to at least two groups;
+ * the third fails if the current user is root.
+ */
+static void
+searchgid(void)
+{
+ static int _searched = 0;
+ uid_t uid = getuid();
+ gid_t gid = 0;
+ unsigned int n;
+ struct stat st;
+ int fd;
+
+ /* If we've already looked this up, we're done. */
+ if (_searched)
+ return;
+ _searched = 1;
+
+ /* Create a file on disk in the current default dir. */
+ fd = open("test_gid", O_CREAT | O_BINARY, 0664);
+ failure("Couldn't create a file for gid testing.");
+ assert(fd > 0);
+
+ /* See what GID it ended up with. This is our "valid" GID. */
+ assert(fstat(fd, &st) == 0);
+ _default_gid = st.st_gid;
+
+ /* Find a GID for which fchown() fails. This is our "invalid" GID. */
+ _invalid_gid = -1;
+ /* This loop stops when we wrap the gid or examine 10,000 gids. */
+ for (gid = 1, n = 1; gid == n && n < 10000 ; n++, gid++) {
+ if (fchown(fd, uid, gid) != 0) {
+ _invalid_gid = gid;
+ break;
+ }
+ }
+
+ /*
+ * Find a GID for which fchown() succeeds, but which isn't the
+ * default. This is the "alternate" gid.
+ */
+ _alt_gid = -1;
+ for (gid = 0, n = 0; gid == n && n < 10000 ; n++, gid++) {
+ /* _alt_gid must be different than _default_gid */
+ if (gid == (gid_t)_default_gid)
+ continue;
+ if (fchown(fd, uid, gid) == 0) {
+ _alt_gid = gid;
+ break;
+ }
+ }
+ close(fd);
+}
+
+static int
+altgid(void)
+{
+ searchgid();
+ return (_alt_gid);
+}
+
+static int
+invalidgid(void)
+{
+ searchgid();
+ return (_invalid_gid);
+}
+
+static int
+defaultgid(void)
+{
+ searchgid();
+ return (_default_gid);
+}
+#endif
+
+/*
+ * Exercise permission and ownership restores.
+ * In particular, try to exercise a bunch of border cases related
+ * to files/dirs that already exist, SUID/SGID bits, etc.
+ */
+
+DEFINE_TEST(test_write_disk_perms)
+{
+#if ARCHIVE_VERSION_NUMBER < 1009000 || (defined(_WIN32) && !defined(__CYGWIN__))
+ skipping("archive_write_disk interface");
+#else
+ struct archive *a;
+ struct archive_entry *ae;
+ struct stat st;
+
+ assertUmask(UMASK);
+
+ /*
+ * Set ownership of the current directory to the group of this
+ * process. Otherwise, the SGID tests below fail if the
+ * /tmp directory is owned by a group to which we don't belong
+ * and we're on a system where group ownership is inherited.
+ * (Because we're not allowed to SGID files with defaultgid().)
+ */
+ assertEqualInt(0, chown(".", getuid(), getgid()));
+
+ /* Create an archive_write_disk object. */
+ assert((a = archive_write_disk_new()) != NULL);
+
+ /* Write a regular file to it. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file_0755");
+ archive_entry_set_mode(ae, S_IFREG | 0777);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ archive_entry_free(ae);
+
+ /* Write a regular file, then write over it. */
+ /* For files, the perms should get updated. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file_overwrite_0144");
+ archive_entry_set_mode(ae, S_IFREG | 0777);
+ assert(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assert(0 == archive_write_finish_entry(a));
+ /* Check that file was created with different perms. */
+ assert(0 == stat("file_overwrite_0144", &st));
+ failure("file_overwrite_0144: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) != 0144);
+ /* Overwrite, this should change the perms. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file_overwrite_0144");
+ archive_entry_set_mode(ae, S_IFREG | 0144);
+ assert(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assert(0 == archive_write_finish_entry(a));
+
+ /* Write a regular dir. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "dir_0514");
+ archive_entry_set_mode(ae, S_IFDIR | 0514);
+ assert(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assert(0 == archive_write_finish_entry(a));
+
+ /* Overwrite an existing dir. */
+ /* For dir, the first perms should get left. */
+ assertMakeDir("dir_overwrite_0744", 0744);
+ /* Check original perms. */
+ assert(0 == stat("dir_overwrite_0744", &st));
+ failure("dir_overwrite_0744: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 0777) == 0744);
+ /* Overwrite shouldn't edit perms. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "dir_overwrite_0744");
+ archive_entry_set_mode(ae, S_IFDIR | 0777);
+ assert(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assert(0 == archive_write_finish_entry(a));
+ /* Make sure they're unchanged. */
+ assert(0 == stat("dir_overwrite_0744", &st));
+ failure("dir_overwrite_0744: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 0777) == 0744);
+
+ /* Write a regular file with SUID bit, but don't use _EXTRACT_PERM. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "file_no_suid");
+ archive_entry_set_mode(ae, S_IFREG | S_ISUID | 0777);
+ archive_write_disk_set_options(a, 0);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+
+ /* Write a regular file with ARCHIVE_EXTRACT_PERM. */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "file_0777");
+ archive_entry_set_mode(ae, S_IFREG | 0777);
+ archive_write_disk_set_options(a, ARCHIVE_EXTRACT_PERM);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+
+ /* Write a regular file with ARCHIVE_EXTRACT_PERM & SUID bit */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "file_4742");
+ archive_entry_set_mode(ae, S_IFREG | S_ISUID | 0742);
+ archive_entry_set_uid(ae, getuid());
+ archive_write_disk_set_options(a, ARCHIVE_EXTRACT_PERM);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+
+ /*
+ * Write a regular file with ARCHIVE_EXTRACT_PERM & SUID bit,
+ * but wrong uid. POSIX says you shouldn't restore SUID bit
+ * unless the UID could be restored.
+ */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "file_bad_suid");
+ archive_entry_set_mode(ae, S_IFREG | S_ISUID | 0742);
+ archive_entry_set_uid(ae, getuid() + 1);
+ archive_write_disk_set_options(a, ARCHIVE_EXTRACT_PERM);
+ assertA(0 == archive_write_header(a, ae));
+ /*
+ * Because we didn't ask for owner, the failure to
+ * restore SUID shouldn't return a failure.
+ * We check below to make sure SUID really wasn't set.
+ * See more detailed comments below.
+ */
+ failure("Opportunistic SUID failure shouldn't return error.");
+ assertEqualInt(0, archive_write_finish_entry(a));
+
+ if (getuid() != 0) {
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "file_bad_suid2");
+ archive_entry_set_mode(ae, S_IFREG | S_ISUID | 0742);
+ archive_entry_set_uid(ae, getuid() + 1);
+ archive_write_disk_set_options(a,
+ ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_OWNER);
+ assertA(0 == archive_write_header(a, ae));
+ /* Owner change should fail here. */
+ failure("Non-opportunistic SUID failure should return error.");
+ assertEqualInt(ARCHIVE_WARN, archive_write_finish_entry(a));
+ }
+
+ /* Write a regular file with ARCHIVE_EXTRACT_PERM & SGID bit */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "file_perm_sgid");
+ archive_entry_set_mode(ae, S_IFREG | S_ISGID | 0742);
+ archive_entry_set_gid(ae, defaultgid());
+ archive_write_disk_set_options(a, ARCHIVE_EXTRACT_PERM);
+ assert(0 == archive_write_header(a, ae));
+ failure("Setting SGID bit should succeed here.");
+ assertEqualIntA(a, 0, archive_write_finish_entry(a));
+
+ if (altgid() == -1) {
+ /*
+ * Current user must belong to at least two groups or
+ * else we can't test setting the GID to another group.
+ */
+ skipping("Current user can't test gid restore: must belong to more than one group.");
+ } else {
+ /*
+ * Write a regular file with ARCHIVE_EXTRACT_PERM & SGID bit
+ * but without ARCHIVE_EXTRACT_OWNER.
+ */
+ /*
+ * This is a weird case: The user has asked for permissions to
+ * be restored but not asked for ownership to be restored. As
+ * a result, the default file creation will create a file with
+ * the wrong group. There are several possible behaviors for
+ * libarchive in this scenario:
+ * = Set the SGID bit. It is wrong and a security hole to
+ * set SGID with the wrong group. Even POSIX thinks so.
+ * = Implicitly set the group. I don't like this.
+ * = drop the SGID bit and warn (the old libarchive behavior)
+ * = drop the SGID bit and don't warn (the current libarchive
+ * behavior).
+ * The current behavior sees SGID/SUID restore when you
+ * don't ask for owner restore as an "opportunistic"
+ * action. That is, libarchive should do it if it can,
+ * but if it can't, it's not an error.
+ */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "file_alt_sgid");
+ archive_entry_set_mode(ae, S_IFREG | S_ISGID | 0742);
+ archive_entry_set_uid(ae, getuid());
+ archive_entry_set_gid(ae, altgid());
+ archive_write_disk_set_options(a, ARCHIVE_EXTRACT_PERM);
+ assert(0 == archive_write_header(a, ae));
+ failure("Setting SGID bit should fail because of group mismatch but the failure should be silent because we didn't ask for the group to be set.");
+ assertEqualIntA(a, 0, archive_write_finish_entry(a));
+
+ /*
+ * As above, but add _EXTRACT_OWNER to verify that it
+ * does succeed.
+ */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "file_alt_sgid_owner");
+ archive_entry_set_mode(ae, S_IFREG | S_ISGID | 0742);
+ archive_entry_set_uid(ae, getuid());
+ archive_entry_set_gid(ae, altgid());
+ archive_write_disk_set_options(a,
+ ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_OWNER);
+ assert(0 == archive_write_header(a, ae));
+ failure("Setting SGID bit should succeed here.");
+ assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a));
+ }
+
+ /*
+ * Write a regular file with ARCHIVE_EXTRACT_PERM & SGID bit,
+ * but wrong GID. POSIX says you shouldn't restore SGID bit
+ * unless the GID could be restored.
+ */
+ if (invalidgid() == -1) {
+ /* This test always fails for root. */
+ printf("Running as root: Can't test SGID failures.\n");
+ } else {
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "file_bad_sgid");
+ archive_entry_set_mode(ae, S_IFREG | S_ISGID | 0742);
+ archive_entry_set_gid(ae, invalidgid());
+ archive_write_disk_set_options(a, ARCHIVE_EXTRACT_PERM);
+ assertA(0 == archive_write_header(a, ae));
+ failure("This SGID restore should fail without an error.");
+ assertEqualIntA(a, 0, archive_write_finish_entry(a));
+
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "file_bad_sgid2");
+ archive_entry_set_mode(ae, S_IFREG | S_ISGID | 0742);
+ archive_entry_set_gid(ae, invalidgid());
+ archive_write_disk_set_options(a,
+ ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_OWNER);
+ assertA(0 == archive_write_header(a, ae));
+ failure("This SGID restore should fail with an error.");
+ assertEqualIntA(a, ARCHIVE_WARN, archive_write_finish_entry(a));
+ }
+
+ /* Set ownership should fail if we're not root. */
+ if (getuid() == 0) {
+ printf("Running as root: Can't test setuid failures.\n");
+ } else {
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "file_bad_owner");
+ archive_entry_set_mode(ae, S_IFREG | 0744);
+ archive_entry_set_uid(ae, getuid() + 1);
+ archive_write_disk_set_options(a, ARCHIVE_EXTRACT_OWNER);
+ assertA(0 == archive_write_header(a, ae));
+ assertEqualIntA(a,ARCHIVE_WARN,archive_write_finish_entry(a));
+ }
+
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assert(0 == archive_write_finish(a));
+#endif
+ archive_entry_free(ae);
+
+ /* Test the entries on disk. */
+ assert(0 == stat("file_0755", &st));
+ failure("file_0755: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == 0755);
+
+ assert(0 == stat("file_overwrite_0144", &st));
+ failure("file_overwrite_0144: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == 0144);
+
+ assert(0 == stat("dir_0514", &st));
+ failure("dir_0514: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == 0514);
+
+ assert(0 == stat("dir_overwrite_0744", &st));
+ failure("dir_overwrite_0744: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 0777) == 0744);
+
+ assert(0 == stat("file_no_suid", &st));
+ failure("file_0755: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == 0755);
+
+ assert(0 == stat("file_0777", &st));
+ failure("file_0777: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == 0777);
+
+ /* SUID bit should get set here. */
+ assert(0 == stat("file_4742", &st));
+ failure("file_4742: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == (S_ISUID | 0742));
+
+ /* SUID bit should NOT have been set here. */
+ assert(0 == stat("file_bad_suid", &st));
+ failure("file_bad_suid: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == (0742));
+
+ /* Some things don't fail if you're root, so suppress this. */
+ if (getuid() != 0) {
+ /* SUID bit should NOT have been set here. */
+ assert(0 == stat("file_bad_suid2", &st));
+ failure("file_bad_suid2: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == (0742));
+ }
+
+ /* SGID should be set here. */
+ assert(0 == stat("file_perm_sgid", &st));
+ failure("file_perm_sgid: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == (S_ISGID | 0742));
+
+ if (altgid() != -1) {
+ /* SGID should not be set here. */
+ assert(0 == stat("file_alt_sgid", &st));
+ failure("file_alt_sgid: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == (0742));
+
+ /* SGID should be set here. */
+ assert(0 == stat("file_alt_sgid_owner", &st));
+ failure("file_alt_sgid: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == (S_ISGID | 0742));
+ }
+
+ if (invalidgid() != -1) {
+ /* SGID should NOT be set here. */
+ assert(0 == stat("file_bad_sgid", &st));
+ failure("file_bad_sgid: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == (0742));
+ /* SGID should NOT be set here. */
+ assert(0 == stat("file_bad_sgid2", &st));
+ failure("file_bad_sgid2: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == (0742));
+ }
+
+ if (getuid() != 0) {
+ assert(0 == stat("file_bad_owner", &st));
+ failure("file_bad_owner: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == (0744));
+ failure("file_bad_owner: st.st_uid=%d getuid()=%d",
+ st.st_uid, getuid());
+ /* The entry had getuid()+1, but because we're
+ * not root, we should not have been able to set that. */
+ assert(st.st_uid == getuid());
+ }
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_disk_secure.c b/archivers/libarchive/files/libarchive/test/test_write_disk_secure.c
new file mode 100644
index 00000000000..c14dadccfa6
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_disk_secure.c
@@ -0,0 +1,215 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_disk_secure.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+#define UMASK 022
+
+/*
+ * Exercise security checks that should prevent certain
+ * writes.
+ */
+
+DEFINE_TEST(test_write_disk_secure)
+{
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ skipping("archive_write_disk interface");
+#elif !defined(_WIN32) || defined(__CYGWIN__)
+ struct archive *a;
+ struct archive_entry *ae;
+ struct stat st;
+
+ /* Start with a known umask. */
+ assertUmask(UMASK);
+
+ /* Create an archive_write_disk object. */
+ assert((a = archive_write_disk_new()) != NULL);
+
+ /* Write a regular dir to it. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "dir");
+ archive_entry_set_mode(ae, S_IFDIR | 0777);
+ assert(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assert(0 == archive_write_finish_entry(a));
+
+ /* Write a symlink to the dir above. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir");
+ archive_entry_set_mode(ae, S_IFLNK | 0777);
+ archive_entry_set_symlink(ae, "dir");
+ archive_write_disk_set_options(a, 0);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+
+ /*
+ * Without security checks, we should be able to
+ * extract a file through the link.
+ */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir/filea");
+ archive_entry_set_mode(ae, S_IFREG | 0777);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+
+ /* But with security checks enabled, this should fail. */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir/fileb");
+ archive_entry_set_mode(ae, S_IFREG | 0777);
+ archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS);
+ failure("Extracting a file through a symlink should fail here.");
+ assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assert(0 == archive_write_finish_entry(a));
+
+ /* Create another link. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir2");
+ archive_entry_set_mode(ae, S_IFLNK | 0777);
+ archive_entry_set_symlink(ae, "dir");
+ archive_write_disk_set_options(a, 0);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+
+ /*
+ * With symlink check and unlink option, it should remove
+ * the link and create the dir.
+ */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir2/filec");
+ archive_entry_set_mode(ae, S_IFREG | 0777);
+ archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS | ARCHIVE_EXTRACT_UNLINK);
+ assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assert(0 == archive_write_finish_entry(a));
+
+ /*
+ * Without security checks, extracting a dir over a link to a
+ * dir should follow the link.
+ */
+ /* Create a symlink to a dir. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir3");
+ archive_entry_set_mode(ae, S_IFLNK | 0777);
+ archive_entry_set_symlink(ae, "dir");
+ archive_write_disk_set_options(a, 0);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ /* Extract a dir whose name matches the symlink. */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir3");
+ archive_entry_set_mode(ae, S_IFDIR | 0777);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ /* Verify link was followed. */
+ assertEqualInt(0, lstat("link_to_dir3", &st));
+ assert(S_ISLNK(st.st_mode));
+ archive_entry_free(ae);
+
+ /*
+ * As above, but a broken link, so the link should get replaced.
+ */
+ /* Create a symlink to a dir. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir4");
+ archive_entry_set_mode(ae, S_IFLNK | 0777);
+ archive_entry_set_symlink(ae, "nonexistent_dir");
+ archive_write_disk_set_options(a, 0);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ /* Extract a dir whose name matches the symlink. */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir4");
+ archive_entry_set_mode(ae, S_IFDIR | 0777);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ /* Verify link was replaced. */
+ assertEqualInt(0, lstat("link_to_dir4", &st));
+ assert(S_ISDIR(st.st_mode));
+ archive_entry_free(ae);
+
+ /*
+ * As above, but a link to a non-dir, so the link should get replaced.
+ */
+ /* Create a regular file and a symlink to it */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "non_dir");
+ archive_entry_set_mode(ae, S_IFREG | 0777);
+ archive_write_disk_set_options(a, 0);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ /* Create symlink to the file. */
+ archive_entry_copy_pathname(ae, "link_to_dir5");
+ archive_entry_set_mode(ae, S_IFLNK | 0777);
+ archive_entry_set_symlink(ae, "non_dir");
+ archive_write_disk_set_options(a, 0);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ /* Extract a dir whose name matches the symlink. */
+ assert(archive_entry_clear(ae) != NULL);
+ archive_entry_copy_pathname(ae, "link_to_dir5");
+ archive_entry_set_mode(ae, S_IFDIR | 0777);
+ assert(0 == archive_write_header(a, ae));
+ assert(0 == archive_write_finish_entry(a));
+ /* Verify link was replaced. */
+ assertEqualInt(0, lstat("link_to_dir5", &st));
+ assert(S_ISDIR(st.st_mode));
+ archive_entry_free(ae);
+
+ assert(0 == archive_write_finish(a));
+
+ /* Test the entries on disk. */
+ assert(0 == lstat("dir", &st));
+ failure("dir: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 0777) == 0755);
+
+ assert(0 == lstat("link_to_dir", &st));
+ failure("link_to_dir: st.st_mode=%o", st.st_mode);
+ assert(S_ISLNK(st.st_mode));
+#if HAVE_LCHMOD
+ /* Systems that lack lchmod() can't set symlink perms, so skip this. */
+ failure("link_to_dir: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == 0755);
+#endif
+
+ assert(0 == lstat("dir/filea", &st));
+ failure("dir/filea: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == 0755);
+
+ failure("dir/fileb: This file should not have been created");
+ assert(0 != lstat("dir/fileb", &st));
+
+ assert(0 == lstat("link_to_dir2", &st));
+ failure("link_to_dir2 should have been re-created as a true dir");
+ assert(S_ISDIR(st.st_mode));
+ failure("link_to_dir2: Implicit dir creation should obey umask, but st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 0777) == 0755);
+
+ assert(0 == lstat("link_to_dir2/filec", &st));
+ assert(S_ISREG(st.st_mode));
+ failure("link_to_dir2/filec: st.st_mode=%o", st.st_mode);
+ assert((st.st_mode & 07777) == 0755);
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_ar.c b/archivers/libarchive/files/libarchive/test/test_write_format_ar.c
new file mode 100644
index 00000000000..5822b3f3817
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_ar.c
@@ -0,0 +1,209 @@
+/*-
+ * Copyright (c) 2007 Kai Wang
+ * Copyright (c) 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
+ * 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.
+ */
+
+#include "test.h"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_format_ar.c 189308 2009-03-03 17:02:51Z kientzle $");
+
+char buff[4096];
+char buff2[64];
+static char strtab[] = "abcdefghijklmn.o/\nggghhhjjjrrrttt.o/\niiijjjdddsssppp.o/\n";
+
+DEFINE_TEST(test_write_format_ar)
+{
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ skipping("ar write support");
+#else
+ struct archive_entry *ae;
+ struct archive* a;
+ size_t used;
+
+ /*
+ * First we try to create a SVR4/GNU format archive.
+ */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ar_svr4(a));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+ /* write the filename table */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "//");
+ archive_entry_set_size(ae, strlen(strtab));
+ assertA(0 == archive_write_header(a, ae));
+ assertA(strlen(strtab) == (size_t)archive_write_data(a, strtab, strlen(strtab)));
+ archive_entry_free(ae);
+
+ /* write entries */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(ae, 1, 0);
+ assert(1 == archive_entry_mtime(ae));
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ assert((S_IFREG | 0755) == archive_entry_mode(ae));
+ archive_entry_copy_pathname(ae, "abcdefghijklmn.o");
+ archive_entry_set_size(ae, 8);
+ assertA(0 == archive_write_header(a, ae));
+ assertA(8 == archive_write_data(a, "87654321", 15));
+ archive_entry_free(ae);
+
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "ggghhhjjjrrrttt.o");
+ archive_entry_set_filetype(ae, AE_IFREG);
+ archive_entry_set_size(ae, 7);
+ assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
+ assertEqualIntA(a, 7, archive_write_data(a, "7777777", 7));
+ archive_entry_free(ae);
+
+ /* test full pathname */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "/usr/home/xx/iiijjjdddsssppp.o");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, 8);
+ assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
+ assertEqualIntA(a, 8, archive_write_data(a, "88877766", 8));
+ archive_entry_free(ae);
+
+ /* trailing "/" should be rejected */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "/usr/home/xx/iiijjj/");
+ archive_entry_set_size(ae, 8);
+ assertA(0 != archive_write_header(a, ae));
+ archive_entry_free(ae);
+
+ /* Non regular file should be rejected */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "gfgh.o");
+ archive_entry_set_mode(ae, S_IFDIR | 0755);
+ archive_entry_set_size(ae, 6);
+ assertA(0 != archive_write_header(a, ae));
+ archive_entry_free(ae);
+
+ archive_write_close(a);
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertEqualInt(0, archive_write_finish(a));
+#endif
+
+ /*
+ * Now, read the data back.
+ */
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used));
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(0, archive_entry_mtime(ae));
+ assertEqualString("//", archive_entry_pathname(ae));
+ assertEqualInt(0, archive_entry_size(ae));
+
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualInt(1, archive_entry_mtime(ae));
+ assertEqualString("abcdefghijklmn.o", archive_entry_pathname(ae));
+ assertEqualInt(8, archive_entry_size(ae));
+ assertEqualIntA(a, 8, archive_read_data(a, buff2, 10));
+ assertEqualMem(buff2, "87654321", 8);
+
+ assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae));
+ assertEqualString("ggghhhjjjrrrttt.o", archive_entry_pathname(ae));
+ assertEqualInt(7, archive_entry_size(ae));
+ assertEqualIntA(a, 7, archive_read_data(a, buff2, 11));
+ assertEqualMem(buff2, "7777777", 7);
+
+ assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
+ assertEqualString("iiijjjdddsssppp.o", archive_entry_pathname(ae));
+ assertEqualInt(8, archive_entry_size(ae));
+ assertEqualIntA(a, 8, archive_read_data(a, buff2, 17));
+ assertEqualMem(buff2, "88877766", 8);
+
+ assertEqualIntA(a, 0, archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assertEqualInt(0, archive_read_finish(a));
+#endif
+
+ /*
+ * Then, we try to create a BSD format archive.
+ */
+ memset(buff, 0, sizeof(buff));
+ assert((a = archive_write_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ar_bsd(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+ /* write a entry need long name extension */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "ttttyyyyuuuuiiii.o");
+ archive_entry_set_filetype(ae, AE_IFREG);
+ archive_entry_set_size(ae, 5);
+ assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
+ assertEqualInt(5, archive_entry_size(ae));
+ assertEqualIntA(a, 5, archive_write_data(a, "12345", 7));
+ archive_entry_free(ae);
+
+ /* write a entry with a short name */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_copy_pathname(ae, "ttyy.o");
+ archive_entry_set_filetype(ae, AE_IFREG);
+ archive_entry_set_size(ae, 6);
+ assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
+ assertEqualIntA(a, 6, archive_write_data(a, "555555", 7));
+ archive_entry_free(ae);
+ archive_write_close(a);
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertEqualInt(0, archive_write_finish(a));
+#endif
+
+ /* Now, Read the data back */
+ assert((a = archive_read_new()) != NULL);
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a));
+ assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used));
+
+ assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
+ assertEqualString("ttttyyyyuuuuiiii.o", archive_entry_pathname(ae));
+ assertEqualInt(5, archive_entry_size(ae));
+ assertEqualIntA(a, 5, archive_read_data(a, buff2, 10));
+ assertEqualMem(buff2, "12345", 5);
+
+ assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
+ assertEqualString("ttyy.o", archive_entry_pathname(ae));
+ assertEqualInt(6, archive_entry_size(ae));
+ assertEqualIntA(a, 6, archive_read_data(a, buff2, 10));
+ assertEqualMem(buff2, "555555", 6);
+
+ /* Test EOF */
+ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+ assertEqualIntA(a, 0, archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assertEqualInt(0, archive_read_finish(a));
+#endif
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_cpio.c b/archivers/libarchive/files/libarchive/test/test_write_format_cpio.c
new file mode 100644
index 00000000000..7bf2a41a528
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_cpio.c
@@ -0,0 +1,194 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_format_cpio.c 185672 2008-12-06 06:02:26Z kientzle $");
+
+/* The version stamp macro was introduced after cpio write support. */
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+static void
+test_format(int (*set_format)(struct archive *))
+{
+ char filedata[64];
+ struct archive_entry *ae;
+ struct archive *a;
+ char *p;
+ size_t used;
+ size_t buffsize = 1000000;
+ char *buff;
+ int damaged = 0;
+
+ buff = malloc(buffsize);
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == (*set_format)(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ assertA(0 == archive_write_open_memory(a, buff, buffsize, &used));
+
+ /*
+ * Write a file to it.
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(ae, 1, 10);
+ assert(1 == archive_entry_mtime(ae));
+ assert(10 == archive_entry_mtime_nsec(ae));
+ p = strdup("file");
+ archive_entry_copy_pathname(ae, p);
+ strcpy(p, "XXXX");
+ free(p);
+ assertEqualString("file", archive_entry_pathname(ae));
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ assert((S_IFREG | 0755) == archive_entry_mode(ae));
+ archive_entry_set_size(ae, 8);
+
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assertA(8 == archive_write_data(a, "12345678", 9));
+
+ /*
+ * Write another file to it.
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(ae, 1, 10);
+ assert(1 == archive_entry_mtime(ae));
+ assert(10 == archive_entry_mtime_nsec(ae));
+ p = strdup("file2");
+ archive_entry_copy_pathname(ae, p);
+ strcpy(p, "XXXX");
+ free(p);
+ assertEqualString("file2", archive_entry_pathname(ae));
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ assert((S_IFREG | 0755) == archive_entry_mode(ae));
+ archive_entry_set_size(ae, 4);
+
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assertA(4 == archive_write_data(a, "1234", 5));
+
+ /*
+ * Write a directory to it.
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(ae, 11, 110);
+ archive_entry_copy_pathname(ae, "dir");
+ archive_entry_set_mode(ae, S_IFDIR | 0755);
+ archive_entry_set_size(ae, 512);
+
+ assertA(0 == archive_write_header(a, ae));
+ assertEqualInt(0, archive_entry_size(ae));
+ archive_entry_free(ae);
+ assertEqualIntA(a, 0, archive_write_data(a, "12345678", 9));
+
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertA(0 == archive_write_finish(a));
+#endif
+
+ /*
+ * Damage the second entry to test the search-ahead recovery.
+ * TODO: Move the damage-recovery checking to a separate test;
+ * it doesn't really belong in this write test.
+ */
+ {
+ int i;
+ for (i = 80; i < 150; i++) {
+ if (memcmp(buff + i, "07070", 5) == 0) {
+ damaged = 1;
+ buff[i] = 'X';
+ break;
+ }
+ }
+ }
+ failure("Unable to locate the second header for damage-recovery test.");
+ assert(damaged == 1);
+
+ /*
+ * Now, read the data back.
+ */
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff, used));
+
+ if (!assertEqualIntA(a, 0, archive_read_next_header(a, &ae))) {
+ archive_read_finish(a);
+ return;
+ }
+
+ assertEqualInt(1, archive_entry_mtime(ae));
+ /* Not the same as above: cpio doesn't store hi-res times. */
+ assert(0 == archive_entry_mtime_nsec(ae));
+ assert(0 == archive_entry_atime(ae));
+ assert(0 == archive_entry_ctime(ae));
+ assertEqualString("file", archive_entry_pathname(ae));
+ assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae));
+ assertEqualInt(8, archive_entry_size(ae));
+ assertA(8 == archive_read_data(a, filedata, 10));
+ assert(0 == memcmp(filedata, "12345678", 8));
+
+ /*
+ * The second file can't be read because we damaged its header.
+ */
+
+ /*
+ * Read the dir entry back.
+ * ARCHIVE_WARN here because the damaged entry was skipped.
+ */
+ assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae));
+ assertEqualInt(11, archive_entry_mtime(ae));
+ assert(0 == archive_entry_mtime_nsec(ae));
+ assert(0 == archive_entry_atime(ae));
+ assert(0 == archive_entry_ctime(ae));
+ assertEqualString("dir", archive_entry_pathname(ae));
+ assertEqualInt((S_IFDIR | 0755), archive_entry_mode(ae));
+ assertEqualInt(0, archive_entry_size(ae));
+ assertEqualIntA(a, 0, archive_read_data(a, filedata, 10));
+
+ /* Verify the end of the archive. */
+ assertEqualIntA(a, 1, archive_read_next_header(a, &ae));
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+
+ free(buff);
+}
+#endif
+
+DEFINE_TEST(test_write_format_cpio)
+{
+#if ARCHIVE_VERSION_NUMBER >= 1009000
+ test_format(archive_write_set_format_cpio);
+ test_format(archive_write_set_format_cpio_newc);
+#else
+ skipping("cpio write support");
+#endif
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_cpio_empty.c b/archivers/libarchive/files/libarchive/test/test_write_format_cpio_empty.c
new file mode 100644
index 00000000000..131ac24617d
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_cpio_empty.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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_format_cpio_empty.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+/*
+ * Check that an "empty" cpio archive is correctly created.
+ */
+
+/* Here's what an empty cpio archive should look like. */
+static char ref[] =
+"070707" /* Magic number */
+"000000" /* Dev = 0 */
+"000000" /* ino = 0 */
+"000000" /* mode = 0 */
+"000000" /* uid = 0 */
+"000000" /* gid = 0 */
+"000001" /* nlink = 1 */
+"000000" /* rdev = 0 */
+"00000000000" /* mtime = 0 */
+"000013" /* Namesize = 11 */
+"00000000000" /* filesize = 0 */
+"TRAILER!!!\0"; /* Name */
+
+DEFINE_TEST(test_write_format_cpio_empty)
+{
+ struct archive *a;
+ char buff[2048];
+ size_t used;
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_cpio(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ /* 1-byte block size ensures we see only the required bytes. */
+ /* We're not testing the padding here. */
+ assertA(0 == archive_write_set_bytes_per_block(a, 1));
+ assertA(0 == archive_write_set_bytes_in_last_block(a, 1));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertA(0 == archive_write_finish(a));
+#endif
+
+ failure("Empty cpio archive should be exactly 87 bytes, was %d.", used);
+ assert(used == 87);
+ failure("Empty cpio archive is incorrectly formatted.");
+ assertEqualMem(buff, ref, 87);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_cpio_newc.c b/archivers/libarchive/files/libarchive/test/test_write_format_cpio_newc.c
new file mode 100644
index 00000000000..1c3c330b0e9
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_cpio_newc.c
@@ -0,0 +1,214 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_format_cpio_newc.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+
+static int
+is_hex(const char *p, size_t l)
+{
+ while (l > 0) {
+ if (*p >= 0 && *p <= '9') {
+ /* Ascii digit */
+ } else if (*p >= 'a' && *p <= 'f') {
+ /* lowercase letter a-f */
+ } else {
+ /* Not hex. */
+ return (0);
+ }
+ --l;
+ ++p;
+ }
+ return (1);
+}
+
+/*
+ * Detailed verification that cpio 'newc' archives are written with
+ * the correct format.
+ */
+DEFINE_TEST(test_write_format_cpio_newc)
+{
+ struct archive *a;
+ struct archive_entry *entry;
+ char *buff, *e, *file;
+ size_t buffsize = 100000;
+ size_t used;
+
+ buff = malloc(buffsize);
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertEqualIntA(a, 0, archive_write_set_format_cpio_newc(a));
+ assertEqualIntA(a, 0, archive_write_set_compression_none(a));
+ assertEqualIntA(a, 0, archive_write_open_memory(a, buff, buffsize, &used));
+
+ /*
+ * Add various files to it.
+ * TODO: Extend this to cover more filetypes.
+ */
+
+ /* Regular file */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 1, 10);
+ archive_entry_set_pathname(entry, "file");
+ archive_entry_set_mode(entry, S_IFREG | 0664);
+ archive_entry_set_size(entry, 10);
+ archive_entry_set_uid(entry, 80);
+ archive_entry_set_gid(entry, 90);
+ archive_entry_set_dev(entry, 12);
+ archive_entry_set_ino(entry, 89);
+ archive_entry_set_nlink(entry, 1);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ assertEqualIntA(a, 10, archive_write_data(a, "1234567890", 10));
+
+ /* Directory */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 2, 20);
+ archive_entry_set_pathname(entry, "dir");
+ archive_entry_set_mode(entry, S_IFDIR | 0775);
+ archive_entry_set_size(entry, 10);
+ archive_entry_set_nlink(entry, 2);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ assertEqualIntA(a, 0, archive_write_data(a, "1234567890", 10));
+
+ /* Symlink */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 3, 30);
+ archive_entry_set_pathname(entry, "lnk");
+ archive_entry_set_mode(entry, 0664);
+ archive_entry_set_filetype(entry, AE_IFLNK);
+ archive_entry_set_size(entry, 0);
+ archive_entry_set_uid(entry, 83);
+ archive_entry_set_gid(entry, 93);
+ archive_entry_set_dev(entry, 13);
+ archive_entry_set_ino(entry, 88);
+ archive_entry_set_nlink(entry, 1);
+ archive_entry_set_symlink(entry,"a");
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assert(0 == archive_write_finish(a));
+#endif
+
+ /*
+ * Verify the archive format.
+ */
+ e = buff;
+
+ /* First entry is "file" */
+ file = e;
+ assert(is_hex(e, 110)); /* Entire header is hex digits. */
+ assertEqualMem(e + 0, "070701", 6); /* Magic */
+ assert(memcmp(e + 6, "00000000", 8) != 0); /* ino != 0 */
+ assertEqualMem(e + 14, "000081b4", 8); /* Mode */
+ assertEqualMem(e + 22, "00000050", 8); /* uid */
+ assertEqualMem(e + 30, "0000005a", 8); /* gid */
+ assertEqualMem(e + 38, "00000001", 8); /* nlink */
+ assertEqualMem(e + 46, "00000001", 8); /* mtime */
+ assertEqualMem(e + 54, "0000000a", 8); /* File size */
+ assertEqualMem(e + 62, "00000000", 8); /* devmajor */
+ assertEqualMem(e + 70, "0000000c", 8); /* devminor */
+ assertEqualMem(e + 78, "00000000", 8); /* rdevmajor */
+ assertEqualMem(e + 86, "00000000", 8); /* rdevminor */
+ assertEqualMem(e + 94, "00000005", 8); /* Name size */
+ assertEqualMem(e + 102, "00000000", 8); /* CRC */
+ assertEqualMem(e + 110, "file\0\0", 6); /* Name contents */
+ assertEqualMem(e + 116, "1234567890", 10); /* File body */
+ assertEqualMem(e + 126, "\0\0", 2); /* Pad to multiple of 4 */
+ e += 128; /* Must be multiple of four here! */
+
+ /* Second entry is "dir" */
+ assert(is_hex(e, 110));
+ assertEqualMem(e + 0, "070701", 6); /* Magic */
+ assertEqualMem(e + 6, "00000000", 8); /* ino */
+ assertEqualMem(e + 14, "000041fd", 8); /* Mode */
+ assertEqualMem(e + 22, "00000000", 8); /* uid */
+ assertEqualMem(e + 30, "00000000", 8); /* gid */
+ assertEqualMem(e + 38, "00000002", 8); /* nlink */
+ assertEqualMem(e + 46, "00000002", 8); /* mtime */
+ assertEqualMem(e + 54, "00000000", 8); /* File size */
+ assertEqualMem(e + 62, "00000000", 8); /* devmajor */
+ assertEqualMem(e + 70, "00000000", 8); /* devminor */
+ assertEqualMem(e + 78, "00000000", 8); /* rdevmajor */
+ assertEqualMem(e + 86, "00000000", 8); /* rdevminor */
+ assertEqualMem(e + 94, "00000004", 8); /* Name size */
+ assertEqualMem(e + 102, "00000000", 8); /* CRC */
+ assertEqualMem(e + 110, "dir\0", 4); /* name */
+ assertEqualMem(e + 114, "\0\0", 2); /* Pad to multiple of 4 */
+ e += 116; /* Must be multiple of four here! */
+
+ /* Third entry is "lnk" */
+ assert(is_hex(e, 110)); /* Entire header is hex digits. */
+ assertEqualMem(e + 0, "070701", 6); /* Magic */
+ assert(memcmp(e + 6, file + 6, 8) != 0); /* ino != file ino */
+ assert(memcmp(e + 6, "00000000", 8) != 0); /* ino != 0 */
+ assertEqualMem(e + 14, "0000a1b4", 8); /* Mode */
+ assertEqualMem(e + 22, "00000053", 8); /* uid */
+ assertEqualMem(e + 30, "0000005d", 8); /* gid */
+ assertEqualMem(e + 38, "00000001", 8); /* nlink */
+ assertEqualMem(e + 46, "00000003", 8); /* mtime */
+ assertEqualMem(e + 54, "00000001", 8); /* File size */
+ assertEqualMem(e + 62, "00000000", 8); /* devmajor */
+ assertEqualMem(e + 70, "0000000d", 8); /* devminor */
+ assertEqualMem(e + 78, "00000000", 8); /* rdevmajor */
+ assertEqualMem(e + 86, "00000000", 8); /* rdevminor */
+ assertEqualMem(e + 94, "00000004", 8); /* Name size */
+ assertEqualMem(e + 102, "00000000", 8); /* CRC */
+ assertEqualMem(e + 110, "lnk\0\0\0", 6); /* Name contents */
+ assertEqualMem(e + 116, "a\0\0\0", 4); /* File body + pad */
+ e += 120; /* Must be multiple of four here! */
+
+ /* TODO: Verify other types of entries. */
+
+ /* Last entry is end-of-archive marker. */
+ assert(is_hex(e, 76));
+ assertEqualMem(e + 0, "070701", 6); /* Magic */
+ assertEqualMem(e + 6, "00000000", 8); /* ino */
+ assertEqualMem(e + 14, "00000000", 8); /* Mode */
+ assertEqualMem(e + 22, "00000000", 8); /* uid */
+ assertEqualMem(e + 30, "00000000", 8); /* gid */
+ assertEqualMem(e + 38, "00000001", 8); /* nlink */
+ assertEqualMem(e + 46, "00000000", 8); /* mtime */
+ assertEqualMem(e + 54, "00000000", 8); /* File size */
+ assertEqualMem(e + 62, "00000000", 8); /* devmajor */
+ assertEqualMem(e + 70, "00000000", 8); /* devminor */
+ assertEqualMem(e + 78, "00000000", 8); /* rdevmajor */
+ assertEqualMem(e + 86, "00000000", 8); /* rdevminor */
+ assertEqualMem(e + 94, "0000000b", 8); /* Name size */
+ assertEqualMem(e + 102, "00000000", 8); /* CRC */
+ assertEqualMem(e + 110, "TRAILER!!!\0", 11); /* Name */
+ assertEqualMem(e + 121, "\0\0\0", 3); /* Pad to multiple of 4 bytes */
+ e += 124; /* Must be multiple of four here! */
+
+ assertEqualInt((int)used, e - buff);
+
+ free(buff);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_cpio_odc.c b/archivers/libarchive/files/libarchive/test/test_write_format_cpio_odc.c
new file mode 100644
index 00000000000..e2136f87cfb
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_cpio_odc.c
@@ -0,0 +1,241 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_format_cpio_odc.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+
+static int
+is_octal(const char *p, size_t l)
+{
+ while (l > 0) {
+ if (*p < '0' || *p > '7')
+ return (0);
+ --l;
+ ++p;
+ }
+ return (1);
+}
+
+/*
+ * Detailed verification that cpio 'odc' archives are written with
+ * the correct format.
+ */
+DEFINE_TEST(test_write_format_cpio_odc)
+{
+ struct archive *a;
+ struct archive_entry *entry;
+ char *buff, *e, *file;
+ size_t buffsize = 100000;
+ size_t used;
+
+ buff = malloc(buffsize);
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertEqualIntA(a, 0, archive_write_set_format_cpio(a));
+ assertEqualIntA(a, 0, archive_write_set_compression_none(a));
+ assertEqualIntA(a, 0, archive_write_open_memory(a, buff, buffsize, &used));
+
+ /*
+ * Add various files to it.
+ * TODO: Extend this to cover more filetypes.
+ */
+
+ /* "file" with 10 bytes of content */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 1, 10);
+ archive_entry_set_pathname(entry, "file");
+ archive_entry_set_mode(entry, S_IFREG | 0664);
+ archive_entry_set_size(entry, 10);
+ archive_entry_set_uid(entry, 80);
+ archive_entry_set_gid(entry, 90);
+ archive_entry_set_dev(entry, 12);
+ archive_entry_set_ino(entry, 89);
+ archive_entry_set_nlink(entry, 2);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ assertEqualIntA(a, 10, archive_write_data(a, "1234567890", 10));
+
+ /* Hardlink to "file" with 10 bytes of content */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 1, 10);
+ archive_entry_set_pathname(entry, "linkfile");
+ archive_entry_set_mode(entry, S_IFREG | 0664);
+ archive_entry_set_size(entry, 10);
+ archive_entry_set_uid(entry, 80);
+ archive_entry_set_gid(entry, 90);
+ archive_entry_set_dev(entry, 12);
+ archive_entry_set_ino(entry, 89);
+ archive_entry_set_nlink(entry, 2);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ assertEqualIntA(a, 10, archive_write_data(a, "1234567890", 10));
+
+ /* "dir" */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 2, 20);
+ archive_entry_set_pathname(entry, "dir");
+ archive_entry_set_mode(entry, S_IFDIR | 0775);
+ archive_entry_set_size(entry, 10);
+ archive_entry_set_nlink(entry, 2);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ /* Write of data to dir should fail == zero bytes get written. */
+ assertEqualIntA(a, 0, archive_write_data(a, "1234567890", 10));
+
+ /* "symlink" pointing to "file" */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 3, 30);
+ archive_entry_set_pathname(entry, "symlink");
+ archive_entry_set_mode(entry, 0664);
+ archive_entry_set_filetype(entry, AE_IFLNK);
+ archive_entry_set_symlink(entry,"file");
+ archive_entry_set_size(entry, 0);
+ archive_entry_set_uid(entry, 88);
+ archive_entry_set_gid(entry, 98);
+ archive_entry_set_dev(entry, 12);
+ archive_entry_set_ino(entry, 90);
+ archive_entry_set_nlink(entry, 1);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ /* Write of data to symlink should fail == zero bytes get written. */
+ assertEqualIntA(a, 0, archive_write_data(a, "1234567890", 10));
+
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assert(0 == archive_write_finish(a));
+#endif
+
+ /*
+ * Verify the archive format.
+ *
+ * Notes on the ino validation: cpio does not actually require
+ * that the ino values written to the archive match those read
+ * from disk. It really requires that:
+ * * matching non-zero ino values be written as matching
+ * non-zero values
+ * * non-matching non-zero ino values be written as non-matching
+ * non-zero values
+ * Libarchive further ensures that zero ino values get written
+ * as zeroes. This allows the cpio writer to generate
+ * synthetic ino values for the archive that may be different
+ * than those on disk in order to avoid problems due to truncation.
+ * This is especially needed for odc (POSIX format) that
+ * only supports 18-bit ino values.
+ */
+ e = buff;
+
+ /* "file" */
+ file = e; /* Remember where this starts... */
+ assert(is_octal(e, 76)); /* Entire header is octal digits. */
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assertEqualMem(e + 6, "000014", 6); /* dev */
+ assert(memcmp(e + 12, "000000", 6) != 0); /* ino must be != 0 */
+ assertEqualMem(e + 18, "100664", 6); /* Mode */
+ assertEqualMem(e + 24, "000120", 6); /* uid */
+ assertEqualMem(e + 30, "000132", 6); /* gid */
+ assertEqualMem(e + 36, "000002", 6); /* nlink */
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ assertEqualMem(e + 48, "00000000001", 11); /* mtime */
+ assertEqualMem(e + 59, "000005", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000012", 11); /* File size */
+ assertEqualMem(e + 76, "file\0", 5); /* Name contents */
+ assertEqualMem(e + 81, "1234567890", 10); /* File contents */
+ e += 91;
+
+ /* hardlink to "file" */
+ assert(is_octal(e, 76)); /* Entire header is octal digits. */
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assertEqualMem(e + 6, "000014", 6); /* dev */
+ assertEqualMem(e + 12, file + 12, 6); /* ino must match above */
+ assertEqualMem(e + 18, "100664", 6); /* Mode */
+ assertEqualMem(e + 24, "000120", 6); /* uid */
+ assertEqualMem(e + 30, "000132", 6); /* gid */
+ assertEqualMem(e + 36, "000002", 6); /* nlink */
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ assertEqualMem(e + 48, "00000000001", 11); /* mtime */
+ assertEqualMem(e + 59, "000011", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000012", 11); /* File size */
+ assertEqualMem(e + 76, "linkfile\0", 9); /* Name contents */
+ assertEqualMem(e + 85, "1234567890", 10); /* File contents */
+ e += 95;
+
+ /* "dir" */
+ assert(is_octal(e, 76));
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assertEqualMem(e + 6, "000000", 6); /* dev */
+ assertEqualMem(e + 12, "000000", 6); /* ino */
+ assertEqualMem(e + 18, "040775", 6); /* Mode */
+ assertEqualMem(e + 24, "000000", 6); /* uid */
+ assertEqualMem(e + 30, "000000", 6); /* gid */
+ assertEqualMem(e + 36, "000002", 6); /* Nlink */
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ assertEqualMem(e + 48, "00000000002", 11); /* mtime */
+ assertEqualMem(e + 59, "000004", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000000", 11); /* File size */
+ assertEqualMem(e + 76, "dir\0", 4); /* name */
+ e += 80;
+
+ /* "symlink" pointing to "file" */
+ assert(is_octal(e, 76)); /* Entire header is octal digits. */
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assertEqualMem(e + 6, "000014", 6); /* dev */
+ assert(memcmp(e + 12, file + 12, 6) != 0); /* ino must != file ino */
+ assert(memcmp(e + 12, "000000", 6) != 0); /* ino must != 0 */
+ assertEqualMem(e + 18, "120664", 6); /* Mode */
+ assertEqualMem(e + 24, "000130", 6); /* uid */
+ assertEqualMem(e + 30, "000142", 6); /* gid */
+ assertEqualMem(e + 36, "000001", 6); /* nlink */
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ assertEqualMem(e + 48, "00000000003", 11); /* mtime */
+ assertEqualMem(e + 59, "000010", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000004", 11); /* File size */
+ assertEqualMem(e + 76, "symlink\0", 8); /* Name contents */
+ assertEqualMem(e + 84, "file", 4); /* File contents == link target */
+ e += 88;
+
+ /* TODO: Verify other types of entries. */
+
+ /* Last entry is end-of-archive marker. */
+ assert(is_octal(e, 76));
+ assertEqualMem(e + 0, "070707", 6); /* Magic */
+ assertEqualMem(e + 6, "000000", 6); /* dev */
+ assertEqualMem(e + 12, "000000", 6); /* ino */
+ assertEqualMem(e + 18, "000000", 6); /* Mode */
+ assertEqualMem(e + 24, "000000", 6); /* uid */
+ assertEqualMem(e + 30, "000000", 6); /* gid */
+ assertEqualMem(e + 36, "000001", 6); /* Nlink */
+ assertEqualMem(e + 42, "000000", 6); /* rdev */
+ assertEqualMem(e + 48, "00000000000", 11); /* mtime */
+ assertEqualMem(e + 59, "000013", 6); /* Name size */
+ assertEqualMem(e + 65, "00000000000", 11); /* File size */
+ assertEqualMem(e + 76, "TRAILER!!!\0", 11); /* Name */
+ e += 87;
+
+ assertEqualInt((int)used, e - buff);
+
+ free(buff);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_shar_empty.c b/archivers/libarchive/files/libarchive/test/test_write_format_shar_empty.c
new file mode 100644
index 00000000000..14ee3889a36
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_shar_empty.c
@@ -0,0 +1,58 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/lib/libarchive/test/test_write_format_shar_empty.c,v 1.3 2008/09/01 05:38:33 kientzle Exp $");
+
+/*
+ * Check that an "empty" shar archive is correctly created as an empty file.
+ */
+
+DEFINE_TEST(test_write_format_shar_empty)
+{
+ struct archive *a;
+ char buff[2048];
+ size_t used;
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_shar(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ /* 1-byte block size ensures we see only the required bytes. */
+ /* We're not testing the padding here. */
+ assertA(0 == archive_write_set_bytes_per_block(a, 1));
+ assertA(0 == archive_write_set_bytes_in_last_block(a, 1));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertA(0 == archive_write_finish(a));
+#endif
+
+ failure("Empty shar archive should be exactly 0 bytes, was %d.", used);
+ assert(used == 0);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_tar.c b/archivers/libarchive/files/libarchive/test/test_write_format_tar.c
new file mode 100644
index 00000000000..372fef1f023
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_tar.c
@@ -0,0 +1,114 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_format_tar.c 189308 2009-03-03 17:02:51Z kientzle $");
+
+char buff[1000000];
+char buff2[64];
+
+DEFINE_TEST(test_write_format_tar)
+{
+ struct archive_entry *ae;
+ struct archive *a;
+ char *p;
+ size_t used;
+ size_t blocksize;
+
+ /* Repeat the following for a variety of odd blocksizes. */
+ for (blocksize = 1; blocksize < 100000; blocksize += blocksize + 3) {
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ assertA(0 == archive_write_set_bytes_per_block(a, (int)blocksize));
+ assertA(0 == archive_write_set_bytes_in_last_block(a, (int)blocksize));
+ assertA(blocksize == (size_t)archive_write_get_bytes_in_last_block(a));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+ assertA(blocksize == (size_t)archive_write_get_bytes_in_last_block(a));
+
+ /*
+ * Write a file to it.
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(ae, 1, 10);
+ assert(1 == archive_entry_mtime(ae));
+#if !defined(__INTERIX)
+ assert(10 == archive_entry_mtime_nsec(ae));
+#endif
+ p = strdup("file");
+ archive_entry_copy_pathname(ae, p);
+ strcpy(p, "XXXX");
+ free(p);
+ assertEqualString("file", archive_entry_pathname(ae));
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ assert((S_IFREG | 0755) == archive_entry_mode(ae));
+ archive_entry_set_size(ae, 8);
+
+ assertA(0 == archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assertA(8 == archive_write_data(a, "12345678", 9));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertA(0 == archive_write_finish(a));
+#endif
+ /* This calculation gives "the smallest multiple of
+ * the block size that is at least 2048 bytes". */
+ assert(((2048 - 1)/blocksize+1)*blocksize == used);
+
+ /*
+ * Now, read the data back.
+ */
+ assert((a = archive_read_new()) != NULL);
+ assertA(0 == archive_read_support_format_all(a));
+ assertA(0 == archive_read_support_compression_all(a));
+ assertA(0 == archive_read_open_memory(a, buff, used));
+
+ assertA(0 == archive_read_next_header(a, &ae));
+
+ assert(1 == archive_entry_mtime(ae));
+ /* Not the same as above: ustar doesn't store hi-res times. */
+ assert(0 == archive_entry_mtime_nsec(ae));
+ assert(0 == archive_entry_atime(ae));
+ assert(0 == archive_entry_ctime(ae));
+ assertEqualString("file", archive_entry_pathname(ae));
+ assert((S_IFREG | 0755) == archive_entry_mode(ae));
+ assert(8 == archive_entry_size(ae));
+ assertA(8 == archive_read_data(a, buff2, 10));
+ assert(0 == memcmp(buff2, "12345678", 8));
+
+ /* Verify the end of the archive. */
+ assert(1 == archive_read_next_header(a, &ae));
+ assert(0 == archive_read_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_read_finish(a);
+#else
+ assert(0 == archive_read_finish(a));
+#endif
+ }
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_tar_empty.c b/archivers/libarchive/files/libarchive/test/test_write_format_tar_empty.c
new file mode 100644
index 00000000000..6b40f0767f3
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_tar_empty.c
@@ -0,0 +1,92 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_format_tar_empty.c 189308 2009-03-03 17:02:51Z kientzle $");
+
+/*
+ * Check that an "empty" tar archive is correctly created.
+ */
+
+DEFINE_TEST(test_write_format_tar_empty)
+{
+ struct archive *a;
+ char buff[2048];
+ size_t used;
+ unsigned int i;
+
+ /* USTAR format: Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ assertA(0 == archive_write_set_bytes_per_block(a, 512));
+ assertA(0 == archive_write_set_bytes_in_last_block(a, 512));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertA(0 == archive_write_finish(a));
+#endif
+
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ /* Earlier versions wrote 0-length files for empty tar archives. */
+ skipping("empty tar archive size");
+#else
+ assert(used == 1024);
+#endif
+ for (i = 0; i < used; i++) {
+ failure("Empty tar archive should be all nulls.");
+ assert(buff[i] == 0);
+ }
+
+ /* PAX format: Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_pax(a));
+ assertA(0 == archive_write_set_compression_none(a));
+ assertA(0 == archive_write_set_bytes_per_block(a, 512));
+ assertA(0 == archive_write_set_bytes_in_last_block(a, 512));
+ assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used));
+
+ /* Close out the archive. */
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assertA(0 == archive_write_finish(a));
+#endif
+
+#if ARCHIVE_VERSION_NUMBER < 1009000
+ /* Earlier versions wrote 0-length files for empty tar archives. */
+ skipping("empty tar archive size");
+#else
+ assertEqualInt((int)used, 1024);
+#endif
+ for (i = 0; i < used; i++) {
+ failure("Empty tar archive should be all nulls.");
+ assert(buff[i] == 0);
+ }
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_format_tar_ustar.c b/archivers/libarchive/files/libarchive/test/test_write_format_tar_ustar.c
new file mode 100644
index 00000000000..29968dfb331
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_format_tar_ustar.c
@@ -0,0 +1,347 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_format_tar_ustar.c 201247 2009-12-30 05:59:21Z kientzle $");
+
+static int
+is_null(const char *p, size_t l)
+{
+ while (l > 0) {
+ if (*p != '\0')
+ return (0);
+ --l;
+ ++p;
+ }
+ return (1);
+}
+
+/* Verify the contents, then erase them to NUL bytes. */
+/* Tar requires all "unused" bytes be set to NUL; this allows us
+ * to easily verify that by invoking is_null() over the entire header
+ * after verifying each field. */
+#define myAssertEqualMem(a,b,s) assertEqualMem(a, b, s); memset(a, 0, s)
+
+/*
+ * Detailed verification that 'ustar' archives are written with
+ * the correct format.
+ */
+DEFINE_TEST(test_write_format_tar_ustar)
+{
+ struct archive *a;
+ struct archive_entry *entry;
+ char *buff, *e;
+ size_t buffsize = 100000;
+ size_t used;
+ int i;
+ char f99[100];
+ char f100[101];
+ char f256[257];
+
+ for (i = 0; i < 99; ++i)
+ f99[i] = 'a' + i % 26;
+ f99[99] = '\0';
+
+ for (i = 0; i < 100; ++i)
+ f100[i] = 'A' + i % 26;
+ f100[100] = '\0';
+
+ for (i = 0; i < 256; ++i)
+ f256[i] = 'A' + i % 26;
+ f256[155] = '/';
+ f256[256] = '\0';
+
+ buff = malloc(buffsize);
+
+ /* Create a new archive in memory. */
+ assert((a = archive_write_new()) != NULL);
+ assertEqualIntA(a, 0, archive_write_set_format_ustar(a));
+ assertEqualIntA(a, 0, archive_write_set_compression_none(a));
+ assertEqualIntA(a, 0, archive_write_open_memory(a, buff, buffsize, &used));
+
+ /*
+ * Add various files to it.
+ * TODO: Extend this to cover more filetypes.
+ */
+
+ /* "file" with 10 bytes of content */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 1, 10);
+ archive_entry_set_pathname(entry, "file");
+ archive_entry_set_mode(entry, S_IFREG | 0664);
+ archive_entry_set_size(entry, 10);
+ archive_entry_set_uid(entry, 80);
+ archive_entry_set_gid(entry, 90);
+ archive_entry_set_dev(entry, 12);
+ archive_entry_set_ino(entry, 89);
+ archive_entry_set_nlink(entry, 2);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ assertEqualIntA(a, 10, archive_write_data(a, "1234567890", 10));
+
+ /* Hardlink to "file" with 10 bytes of content */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 1, 10);
+ archive_entry_set_pathname(entry, "linkfile");
+ archive_entry_set_mode(entry, S_IFREG | 0664);
+ /* TODO: Put this back and fix the bug. */
+ /* archive_entry_set_size(entry, 10); */
+ archive_entry_set_uid(entry, 80);
+ archive_entry_set_gid(entry, 90);
+ archive_entry_set_dev(entry, 12);
+ archive_entry_set_ino(entry, 89);
+ archive_entry_set_nlink(entry, 2);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ /* Write of data to dir should fail == zero bytes get written. */
+ assertEqualIntA(a, 0, archive_write_data(a, "1234567890", 10));
+
+ /* "dir" */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 2, 20);
+ archive_entry_set_pathname(entry, "dir");
+ archive_entry_set_mode(entry, S_IFDIR | 0775);
+ archive_entry_set_size(entry, 10);
+ archive_entry_set_nlink(entry, 2);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ /* Write of data to dir should fail == zero bytes get written. */
+ assertEqualIntA(a, 0, archive_write_data(a, "1234567890", 10));
+
+ /* "symlink" pointing to "file" */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 3, 30);
+ archive_entry_set_pathname(entry, "symlink");
+ archive_entry_set_mode(entry, 0664);
+ archive_entry_set_filetype(entry, AE_IFLNK);
+ archive_entry_set_symlink(entry,"file");
+ archive_entry_set_size(entry, 0);
+ archive_entry_set_uid(entry, 88);
+ archive_entry_set_gid(entry, 98);
+ archive_entry_set_dev(entry, 12);
+ archive_entry_set_ino(entry, 90);
+ archive_entry_set_nlink(entry, 1);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+ /* Write of data to symlink should fail == zero bytes get written. */
+ assertEqualIntA(a, 0, archive_write_data(a, "1234567890", 10));
+
+ /* file with 99-char filename. */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 1, 10);
+ archive_entry_set_pathname(entry, f99);
+ archive_entry_set_mode(entry, S_IFREG | 0664);
+ archive_entry_set_size(entry, 0);
+ archive_entry_set_uid(entry, 82);
+ archive_entry_set_gid(entry, 93);
+ archive_entry_set_dev(entry, 102);
+ archive_entry_set_ino(entry, 7);
+ archive_entry_set_nlink(entry, 1);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+ /* file with 100-char filename. */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 1, 10);
+ archive_entry_set_pathname(entry, f100);
+ archive_entry_set_mode(entry, S_IFREG | 0664);
+ archive_entry_set_size(entry, 0);
+ archive_entry_set_uid(entry, 82);
+ archive_entry_set_gid(entry, 93);
+ archive_entry_set_dev(entry, 102);
+ archive_entry_set_ino(entry, 7);
+ archive_entry_set_nlink(entry, 1);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+ /* file with 256-char filename. */
+ assert((entry = archive_entry_new()) != NULL);
+ archive_entry_set_mtime(entry, 1, 10);
+ archive_entry_set_pathname(entry, f256);
+ archive_entry_set_mode(entry, S_IFREG | 0664);
+ archive_entry_set_size(entry, 0);
+ archive_entry_set_uid(entry, 82);
+ archive_entry_set_gid(entry, 93);
+ archive_entry_set_dev(entry, 102);
+ archive_entry_set_ino(entry, 7);
+ archive_entry_set_nlink(entry, 1);
+ assertEqualIntA(a, 0, archive_write_header(a, entry));
+ archive_entry_free(entry);
+
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assert(0 == archive_write_finish(a));
+#endif
+
+ /*
+ * Verify the archive format.
+ */
+ e = buff;
+
+ /* "file" */
+ myAssertEqualMem(e + 0, "file", 5); /* Filename */
+ myAssertEqualMem(e + 100, "000664 ", 8); /* mode */
+ myAssertEqualMem(e + 108, "000120 ", 8); /* uid */
+ myAssertEqualMem(e + 116, "000132 ", 8); /* gid */
+ myAssertEqualMem(e + 124, "00000000012 ", 12); /* size */
+ myAssertEqualMem(e + 136, "00000000001 ", 12); /* mtime */
+ myAssertEqualMem(e + 148, "010034\0 ", 8); /* checksum */
+ myAssertEqualMem(e + 156, "0", 1); /* linkflag */
+ myAssertEqualMem(e + 157, "", 1); /* linkname */
+ myAssertEqualMem(e + 257, "ustar\000000", 8); /* signature/version */
+ myAssertEqualMem(e + 265, "", 1); /* uname */
+ myAssertEqualMem(e + 297, "", 1); /* gname */
+ myAssertEqualMem(e + 329, "000000 ", 8); /* devmajor */
+ myAssertEqualMem(e + 337, "000000 ", 8); /* devminor */
+ myAssertEqualMem(e + 345, "", 1); /* prefix */
+ assert(is_null(e + 0, 512));
+ myAssertEqualMem(e + 512, "1234567890", 10);
+ assert(is_null(e + 512, 512));
+ e += 1024;
+
+ /* hardlink to "file" */
+ myAssertEqualMem(e + 0, "linkfile", 9); /* Filename */
+ myAssertEqualMem(e + 100, "000664 ", 8); /* mode */
+ myAssertEqualMem(e + 108, "000120 ", 8); /* uid */
+ myAssertEqualMem(e + 116, "000132 ", 8); /* gid */
+ myAssertEqualMem(e + 124, "00000000000 ", 12); /* size */
+ myAssertEqualMem(e + 136, "00000000001 ", 12); /* mtime */
+ myAssertEqualMem(e + 148, "010707\0 ", 8); /* checksum */
+ myAssertEqualMem(e + 156, "0", 1); /* linkflag */
+ myAssertEqualMem(e + 157, "", 1); /* linkname */
+ myAssertEqualMem(e + 257, "ustar\000000", 8); /* signature/version */
+ myAssertEqualMem(e + 265, "", 1); /* uname */
+ myAssertEqualMem(e + 297, "", 1); /* gname */
+ myAssertEqualMem(e + 329, "000000 ", 8); /* devmajor */
+ myAssertEqualMem(e + 337, "000000 ", 8); /* devminor */
+ myAssertEqualMem(e + 345, "", 1); /* prefix */
+ assert(is_null(e + 0, 512));
+ e += 512;
+
+ /* "dir" */
+ myAssertEqualMem(e + 0, "dir/", 4); /* Filename */
+ myAssertEqualMem(e + 100, "000775 ", 8); /* mode */
+ myAssertEqualMem(e + 108, "000000 ", 8); /* uid */
+ myAssertEqualMem(e + 116, "000000 ", 8); /* gid */
+ myAssertEqualMem(e + 124, "00000000000 ", 12); /* size */
+ myAssertEqualMem(e + 136, "00000000002 ", 12); /* mtime */
+ myAssertEqualMem(e + 148, "007747\0 ", 8); /* checksum */
+ myAssertEqualMem(e + 156, "5", 1); /* typeflag */
+ myAssertEqualMem(e + 157, "", 1); /* linkname */
+ myAssertEqualMem(e + 257, "ustar\000000", 8); /* signature/version */
+ myAssertEqualMem(e + 265, "", 1); /* uname */
+ myAssertEqualMem(e + 297, "", 1); /* gname */
+ myAssertEqualMem(e + 329, "000000 ", 8); /* devmajor */
+ myAssertEqualMem(e + 337, "000000 ", 8); /* devminor */
+ myAssertEqualMem(e + 345, "", 1); /* prefix */
+ assert(is_null(e + 0, 512));
+ e += 512;
+
+ /* "symlink" pointing to "file" */
+ myAssertEqualMem(e + 0, "symlink", 8); /* Filename */
+ myAssertEqualMem(e + 100, "000664 ", 8); /* mode */
+ myAssertEqualMem(e + 108, "000130 ", 8); /* uid */
+ myAssertEqualMem(e + 116, "000142 ", 8); /* gid */
+ myAssertEqualMem(e + 124, "00000000000 ", 12); /* size */
+ myAssertEqualMem(e + 136, "00000000003 ", 12); /* mtime */
+ myAssertEqualMem(e + 148, "011446\0 ", 8); /* checksum */
+ myAssertEqualMem(e + 156, "2", 1); /* linkflag */
+ myAssertEqualMem(e + 157, "file", 5); /* linkname */
+ myAssertEqualMem(e + 257, "ustar\000000", 8); /* signature/version */
+ myAssertEqualMem(e + 265, "", 1); /* uname */
+ myAssertEqualMem(e + 297, "", 1); /* gname */
+ myAssertEqualMem(e + 329, "000000 ", 8); /* devmajor */
+ myAssertEqualMem(e + 337, "000000 ", 8); /* devminor */
+ myAssertEqualMem(e + 345, "", 1); /* prefix */
+ assert(is_null(e + 0, 512));
+ e += 512;
+
+ /* File with 99-char filename */
+ myAssertEqualMem(e + 0, f99, 100); /* Filename */
+ myAssertEqualMem(e + 100, "000664 ", 8); /* mode */
+ myAssertEqualMem(e + 108, "000122 ", 8); /* uid */
+ myAssertEqualMem(e + 116, "000135 ", 8); /* gid */
+ myAssertEqualMem(e + 124, "00000000000 ", 12); /* size */
+ myAssertEqualMem(e + 136, "00000000001 ", 12); /* mtime */
+ myAssertEqualMem(e + 148, "034242\0 ", 8); /* checksum */
+ myAssertEqualMem(e + 156, "0", 1); /* linkflag */
+ myAssertEqualMem(e + 157, "", 1); /* linkname */
+ myAssertEqualMem(e + 257, "ustar\000000", 8); /* signature/version */
+ myAssertEqualMem(e + 265, "", 1); /* uname */
+ myAssertEqualMem(e + 297, "", 1); /* gname */
+ myAssertEqualMem(e + 329, "000000 ", 8); /* devmajor */
+ myAssertEqualMem(e + 337, "000000 ", 8); /* devminor */
+ myAssertEqualMem(e + 345, "", 1); /* prefix */
+ assert(is_null(e + 0, 512));
+ e += 512;
+
+ /* File with 100-char filename */
+ myAssertEqualMem(e + 0, f100, 100); /* Filename */
+ myAssertEqualMem(e + 100, "000664 ", 8); /* mode */
+ myAssertEqualMem(e + 108, "000122 ", 8); /* uid */
+ myAssertEqualMem(e + 116, "000135 ", 8); /* gid */
+ myAssertEqualMem(e + 124, "00000000000 ", 12); /* size */
+ myAssertEqualMem(e + 136, "00000000001 ", 12); /* mtime */
+ myAssertEqualMem(e + 148, "026230\0 ", 8); /* checksum */
+ myAssertEqualMem(e + 156, "0", 1); /* linkflag */
+ myAssertEqualMem(e + 157, "", 1); /* linkname */
+ myAssertEqualMem(e + 257, "ustar\000000", 8); /* signature/version */
+ myAssertEqualMem(e + 265, "", 1); /* uname */
+ myAssertEqualMem(e + 297, "", 1); /* gname */
+ myAssertEqualMem(e + 329, "000000 ", 8); /* devmajor */
+ myAssertEqualMem(e + 337, "000000 ", 8); /* devminor */
+ myAssertEqualMem(e + 345, "", 1); /* prefix */
+ assert(is_null(e + 0, 512));
+ e += 512;
+
+ /* File with 256-char filename */
+ myAssertEqualMem(e + 0, f256 + 156, 100); /* Filename */
+ myAssertEqualMem(e + 100, "000664 ", 8); /* mode */
+ myAssertEqualMem(e + 108, "000122 ", 8); /* uid */
+ myAssertEqualMem(e + 116, "000135 ", 8); /* gid */
+ myAssertEqualMem(e + 124, "00000000000 ", 12); /* size */
+ myAssertEqualMem(e + 136, "00000000001 ", 12); /* mtime */
+ myAssertEqualMem(e + 148, "055570\0 ", 8); /* checksum */
+ myAssertEqualMem(e + 156, "0", 1); /* linkflag */
+ myAssertEqualMem(e + 157, "", 1); /* linkname */
+ myAssertEqualMem(e + 257, "ustar\000000", 8); /* signature/version */
+ myAssertEqualMem(e + 265, "", 1); /* uname */
+ myAssertEqualMem(e + 297, "", 1); /* gname */
+ myAssertEqualMem(e + 329, "000000 ", 8); /* devmajor */
+ myAssertEqualMem(e + 337, "000000 ", 8); /* devminor */
+ myAssertEqualMem(e + 345, f256, 155); /* prefix */
+ assert(is_null(e + 0, 512));
+ e += 512;
+
+ /* TODO: Verify other types of entries. */
+
+ /* Last entry is end-of-archive marker. */
+ assert(is_null(e, 1024));
+ e += 1024;
+
+ assertEqualInt((int)used, e - buff);
+
+ free(buff);
+}
diff --git a/archivers/libarchive/files/libarchive/test/test_write_open_memory.c b/archivers/libarchive/files/libarchive/test/test_write_open_memory.c
new file mode 100644
index 00000000000..696db6c963a
--- /dev/null
+++ b/archivers/libarchive/files/libarchive/test/test_write_open_memory.c
@@ -0,0 +1,76 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_open_memory.c 189308 2009-03-03 17:02:51Z kientzle $");
+
+/* Try to force archive_write_open_memory.c to write past the end of an array. */
+static unsigned char buff[16384];
+
+DEFINE_TEST(test_write_open_memory)
+{
+ unsigned int i;
+ struct archive *a;
+ struct archive_entry *ae;
+ const char *name="/tmp/test";
+
+ /* Create a simple archive_entry. */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_set_pathname(ae, name);
+ archive_entry_set_mode(ae, S_IFREG);
+ assertEqualString(archive_entry_pathname(ae), name);
+
+ /* Try writing with different buffer sizes. */
+ /* Make sure that we get failure on too-small buffers, success on
+ * large enough ones. */
+ for (i = 100; i < 1600; i++) {
+ size_t s;
+ size_t blocksize = 94;
+ assert((a = archive_write_new()) != NULL);
+ assertA(0 == archive_write_set_format_ustar(a));
+ assertA(0 == archive_write_set_bytes_in_last_block(a, 1));
+ assertA(0 == archive_write_set_bytes_per_block(a, (int)blocksize));
+ buff[i] = 0xAE;
+ assertA(0 == archive_write_open_memory(a, buff, i, &s));
+ /* If buffer is smaller than a tar header, this should fail. */
+ if (i < (511/blocksize)*blocksize)
+ assertA(ARCHIVE_FATAL == archive_write_header(a,ae));
+ else
+ assertA(0 == archive_write_header(a, ae));
+ /* If buffer is smaller than a tar header plus 1024 byte
+ * end-of-archive marker, then this should fail. */
+ if (i < 1536)
+ assertA(ARCHIVE_FATAL == archive_write_close(a));
+ else
+ assertA(0 == archive_write_close(a));
+#if ARCHIVE_VERSION_NUMBER < 2000000
+ archive_write_finish(a);
+#else
+ assert(0 == archive_write_finish(a));
+#endif
+ assert(buff[i] == 0xAE);
+ assert(s <= i);
+ }
+ archive_entry_free(ae);
+}
diff --git a/archivers/libarchive/files/tar/bsdtar.1 b/archivers/libarchive/files/tar/bsdtar.1
new file mode 100644
index 00000000000..67cac1099a0
--- /dev/null
+++ b/archivers/libarchive/files/tar/bsdtar.1
@@ -0,0 +1,921 @@
+.\" 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 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: src/usr.bin/tar/bsdtar.1,v 1.46 2008/12/06 07:37:55 kientzle Exp $
+.\"
+.Dd Oct 12, 2009
+.Dt BSDTAR 1
+.Os
+.Sh NAME
+.Nm tar
+.Nd manipulate tape archives
+.Sh SYNOPSIS
+.Nm
+.Op Ar bundled-flags Ao args Ac
+.Op Ao Ar file Ac | Ao Ar pattern Ac ...
+.Nm
+.Brq Fl c
+.Op Ar options
+.Op Ar files | Ar directories
+.Nm
+.Brq Fl r | Fl u
+.Fl f Ar archive-file
+.Op Ar options
+.Op Ar files | Ar directories
+.Nm
+.Brq Fl t | Fl x
+.Op Ar options
+.Op Ar patterns
+.Sh DESCRIPTION
+.Nm
+creates and manipulates streaming archive files.
+This implementation can extract from tar, pax, cpio, zip, jar, ar,
+and ISO 9660 cdrom images and can create tar, pax, cpio, ar,
+and shar archives.
+.Pp
+The first synopsis form shows a
+.Dq bundled
+option word.
+This usage is provided for compatibility with historical implementations.
+See COMPATIBILITY below for details.
+.Pp
+The other synopsis forms show the preferred usage.
+The first option to
+.Nm
+is a mode indicator from the following list:
+.Bl -tag -compact -width indent
+.It Fl c
+Create a new archive containing the specified items.
+.It Fl r
+Like
+.Fl c ,
+but new entries are appended to the archive.
+Note that this only works on uncompressed archives stored in regular files.
+The
+.Fl f
+option is required.
+.It Fl t
+List archive contents to stdout.
+.It Fl u
+Like
+.Fl r ,
+but new entries are added only if they have a modification date
+newer than the corresponding entry in the archive.
+Note that this only works on uncompressed archives stored in regular files.
+The
+.Fl f
+option is required.
+.It Fl x
+Extract to disk from the archive.
+If a file with the same name appears more than once in the archive,
+each copy will be extracted, with later copies overwriting (replacing)
+earlier copies.
+.El
+.Pp
+In
+.Fl c ,
+.Fl r ,
+or
+.Fl u
+mode, each specified file or directory is added to the
+archive in the order specified on the command line.
+By default, the contents of each directory are also archived.
+.Pp
+In extract or list mode, the entire command line
+is read and parsed before the archive is opened.
+The pathnames or patterns on the command line indicate
+which items in the archive should be processed.
+Patterns are shell-style globbing patterns as
+documented in
+.Xr tcsh 1 .
+.Sh OPTIONS
+Unless specifically stated otherwise, options are applicable in
+all operating modes.
+.Bl -tag -width indent
+.It Cm @ Ns Pa archive
+(c and r mode only)
+The specified archive is opened and the entries
+in it will be appended to the current archive.
+As a simple example,
+.Dl Nm Fl c Fl f Pa - Pa newfile Cm @ Ns Pa original.tar
+writes a new archive to standard output containing a file
+.Pa newfile
+and all of the entries from
+.Pa original.tar .
+In contrast,
+.Dl Nm Fl c Fl f Pa - Pa newfile Pa original.tar
+creates a new archive with only two entries.
+Similarly,
+.Dl Nm Fl czf Pa - Fl -format Cm pax Cm @ Ns Pa -
+reads an archive from standard input (whose format will be determined
+automatically) and converts it into a gzip-compressed
+pax-format archive on stdout.
+In this way,
+.Nm
+can be used to convert archives from one format to another.
+.It Fl b Ar blocksize
+Specify the block size, in 512-byte records, for tape drive I/O.
+As a rule, this argument is only needed when reading from or writing
+to tape drives, and usually not even then as the default block size of
+20 records (10240 bytes) is very common.
+.It Fl C Ar directory
+In c and r mode, this changes the directory before adding
+the following files.
+In x mode, change directories after opening the archive
+but before extracting entries from the archive.
+.It Fl -check-links
+(c and r modes only)
+Issue a warning message unless all links to each file are archived.
+.It Fl -chroot
+(x mode only)
+.Fn chroot
+to the current directory after processing any
+.Fl C
+options and before extracting any files.
+.It Fl -exclude Ar pattern
+Do not process files or directories that match the
+specified pattern.
+Note that exclusions take precedence over patterns or filenames
+specified on the command line.
+.It Fl -format Ar format
+(c, r, u mode only)
+Use the specified format for the created archive.
+Supported formats include
+.Dq cpio ,
+.Dq pax ,
+.Dq shar ,
+and
+.Dq ustar .
+Other formats may also be supported; see
+.Xr libarchive-formats 5
+for more information about currently-supported formats.
+In r and u modes, when extending an existing archive, the format specified
+here must be compatible with the format of the existing archive on disk.
+.It Fl f Ar file
+Read the archive from or write the archive to the specified file.
+The filename can be
+.Pa -
+for standard input or standard output.
+If not specified, the default tape device will be used.
+(On
+.Fx ,
+the default tape device is
+.Pa /dev/sa0 . )
+.It Fl H
+(c and r mode only)
+Symbolic links named on the command line will be followed; the
+target of the link will be archived, not the link itself.
+.It Fl h
+(c and r mode only)
+Synonym for
+.Fl L .
+.It Fl I
+Synonym for
+.Fl T .
+.It Fl -include Ar pattern
+Process only files or directories that match the specified pattern.
+Note that exclusions specified with
+.Fl -exclude
+take precedence over inclusions.
+If no inclusions are explicitly specified, all entries are processed by
+default.
+The
+.Fl -include
+option is especially useful when filtering archives.
+For example, the command
+.Dl Nm Fl c Fl f Pa new.tar Fl -include='*foo*' Cm @ Ns Pa old.tgz
+creates a new archive
+.Pa new.tar
+containing only the entries from
+.Pa old.tgz
+containing the string
+.Sq foo .
+.It Fl j
+(c mode only)
+Compress the resulting archive with
+.Xr bzip2 1 .
+In extract or list modes, this option is ignored.
+Note that, unlike other
+.Nm tar
+implementations, this implementation recognizes bzip2 compression
+automatically when reading archives.
+.It Fl k
+(x mode only)
+Do not overwrite existing files.
+In particular, if a file appears more than once in an archive,
+later copies will not overwrite earlier copies.
+.It Fl -keep-newer-files
+(x mode only)
+Do not overwrite existing files that are newer than the
+versions appearing in the archive being extracted.
+.It Fl L
+(c and r mode only)
+All symbolic links will be followed.
+Normally, symbolic links are archived as such.
+With this option, the target of the link will be archived instead.
+.It Fl l
+This is a synonym for the
+.Fl -check-links
+option.
+.It Fl m
+(x mode only)
+Do not extract modification time.
+By default, the modification time is set to the time stored in the archive.
+.It Fl n
+(c, r, u modes only)
+Do not recursively archive the contents of directories.
+.It Fl -newer Ar date
+(c, r, u modes only)
+Only include files and directories newer than the specified date.
+This compares ctime entries.
+.It Fl -newer-mtime Ar date
+(c, r, u modes only)
+Like
+.Fl -newer ,
+except it compares mtime entries instead of ctime entries.
+.It Fl -newer-than Pa file
+(c, r, u modes only)
+Only include files and directories newer than the specified file.
+This compares ctime entries.
+.It Fl -newer-mtime-than Pa file
+(c, r, u modes only)
+Like
+.Fl -newer-than ,
+except it compares mtime entries instead of ctime entries.
+.It Fl -nodump
+(c and r modes only)
+Honor the nodump file flag by skipping this file.
+.It Fl -null
+(use with
+.Fl I ,
+.Fl T ,
+or
+.Fl X )
+Filenames or patterns are separated by null characters,
+not by newlines.
+This is often used to read filenames output by the
+.Fl print0
+option to
+.Xr find 1 .
+.It Fl -numeric-owner
+(x mode only)
+Ignore symbolic user and group names when restoring archives to disk,
+only numeric uid and gid values will be obeyed.
+.It Fl O
+(x, t modes only)
+In extract (-x) mode, files will be written to standard out rather than
+being extracted to disk.
+In list (-t) mode, the file listing will be written to stderr rather than
+the usual stdout.
+.It Fl o
+(x mode)
+Use the user and group of the user running the program rather
+than those specified in the archive.
+Note that this has no significance unless
+.Fl p
+is specified, and the program is being run by the root user.
+In this case, the file modes and flags from
+the archive will be restored, but ACLs or owner information in
+the archive will be discarded.
+.It Fl o
+(c, r, u mode)
+A synonym for
+.Fl -format Ar ustar
+.It Fl -one-file-system
+(c, r, and u modes)
+Do not cross mount points.
+.It Fl -options Ar options
+Select optional behaviors for particular modules.
+The argument is a text string containing comma-separated
+keywords and values.
+These are passed to the modules that handle particular
+formats to control how those formats will behave.
+Each option has one of the following forms:
+.Bl -tag -compact -width indent
+.It Ar key=value
+The key will be set to the specified value in every module that supports it.
+Modules that do not support this key will ignore it.
+.It Ar key
+The key will be enabled in every module that supports it.
+This is equivalent to
+.Ar key Ns Cm =1 .
+.It Ar !key
+The key will be disabled in every module that supports it.
+.It Ar module:key=value , Ar module:key , Ar module:!key
+As above, but the corresponding key and value will be provided
+only to modules whose name matches
+.Ar module .
+.El
+The currently supported modules and keys are:
+.Bl -tag -compact -width indent
+.It Cm iso9660:joliet
+Support Joliet extensions.
+This is enabled by default, use
+.Cm !joliet
+or
+.Cm iso9660:!joliet
+to disable.
+.It Cm iso9660:rockridge
+Support Rock Ridge extensions.
+This is enabled by default, use
+.Cm !rockridge
+or
+.Cm iso9660:!rockridge
+to disable.
+.It Cm gzip:compression-level
+A decimal integer from 0 to 9 specifying the gzip compression level.
+.It Cm xz:compression-level
+A decimal integer from 0 to 9 specifying the xz compression level.
+.It Cm mtree: Ns Ar keyword
+The mtree writer module allows you to specify which mtree keywords
+will be included in the output.
+Supported keywords include:
+.Cm cksum , Cm device , Cm flags , Cm gid , Cm gname , Cm indent ,
+.Cm link , Cm md5 , Cm mode , Cm nlink , Cm rmd160 , Cm sha1 , Cm sha256 ,
+.Cm sha384 , Cm sha512 , Cm size , Cm time , Cm uid , Cm uname .
+The default is equivalent to:
+.Dq device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname .
+.It Cm mtree:all
+Enables all of the above keywords.
+You can also use
+.Cm mtree:!all
+to disable all keywords.
+.It Cm mtree:use-set
+Enable generation of
+.Cm /set
+lines in the output.
+.It Cm mtree:indent
+Produce human-readable output by indenting options and splitting lines
+to fit into 80 columns.
+.It Cm zip:compression Ns = Ns Ar type
+Use
+.Ar type
+as compression method.
+Supported values are store (uncompressed) and deflate (gzip algorithm).
+.El
+If a provided option is not supported by any module, that
+is a fatal error.
+.It Fl P
+Preserve pathnames.
+By default, absolute pathnames (those that begin with a /
+character) have the leading slash removed both when creating archives
+and extracting from them.
+Also,
+.Nm
+will refuse to extract archive entries whose pathnames contain
+.Pa ..
+or whose target directory would be altered by a symlink.
+This option suppresses these behaviors.
+.It Fl p
+(x mode only)
+Preserve file permissions.
+Attempt to restore the full permissions, including owner, file modes, file
+flags and ACLs, if available, for each item extracted from the archive.
+By default, newly-created files are owned by the user running
+.Nm ,
+the file mode is restored for newly-created regular files, and
+all other types of entries receive default permissions.
+If
+.Nm
+is being run by root, the default is to restore the owner unless the
+.Fl o
+option is also specified.
+.It Fl q ( Fl -fast-read )
+(x and t mode only)
+Extract or list only the first archive entry that matches each pattern
+or filename operand.
+Exit as soon as each specified pattern or filename has been matched.
+By default, the archive is always read to the very end, since
+there can be multiple entries with the same name and, by convention,
+later entries overwrite earlier entries.
+This option is provided as a performance optimization.
+.It Fl S
+(x mode only)
+Extract files as sparse files.
+For every block on disk, check first if it contains only NULL bytes and seek
+over it otherwise.
+This works similiar to the conv=sparse option of dd.
+.It Fl -strip-components Ar count
+(x mode only)
+Remove the specified number of leading path elements.
+Pathnames with fewer elements will be silently skipped.
+Note that the pathname is edited after checking inclusion/exclusion patterns
+but before security checks.
+.It Fl s Ar pattern
+Modify file or archive member names according to
+.Pa pattern .
+The pattern has the format
+.Ar /old/new/ Ns Op gps
+where
+.Ar old
+is a basic regular expression,
+.Ar new
+is the replacement string of the matched part,
+and the optional trailing letters modify
+how the replacement is handled.
+If
+.Ar old
+is not matched, the pattern is skipped.
+Within
+.Ar new ,
+~ is substituted with the match, \1 to \9 with the content of
+the corresponding captured group.
+The optional trailing g specifies that matching should continue
+after the matched part and stopped on the first unmatched pattern.
+The optional trailing s specifies that the pattern applies to the value
+of symbolic links.
+The optional trailing p specifies that after a successful substitution
+the original path name and the new path name should be printed to
+standard error.
+.It Fl T Ar filename
+In x or t mode,
+.Nm
+will read the list of names to be extracted from
+.Pa filename .
+In c mode,
+.Nm
+will read names to be archived from
+.Pa filename .
+The special name
+.Dq -C
+on a line by itself will cause the current directory to be changed to
+the directory specified on the following line.
+Names are terminated by newlines unless
+.Fl -null
+is specified.
+Note that
+.Fl -null
+also disables the special handling of lines containing
+.Dq -C .
+.It Fl U
+(x mode only)
+Unlink files before creating them.
+Without this option,
+.Nm
+overwrites existing files, which preserves existing hardlinks.
+With this option, existing hardlinks will be broken, as will any
+symlink that would affect the location of an extracted file.
+.It Fl -use-compress-program Ar program
+Pipe the input (in x or t mode) or the output (in c mode) through
+.Pa program
+instead of using the builtin compression support.
+.It Fl v
+Produce verbose output.
+In create and extract modes,
+.Nm
+will list each file name as it is read from or written to
+the archive.
+In list mode,
+.Nm
+will produce output similar to that of
+.Xr ls 1 .
+Additional
+.Fl v
+options will provide additional detail.
+.It Fl -version
+Print version of
+.Nm
+and
+.Nm libarchive ,
+and exit.
+.It Fl w
+Ask for confirmation for every action.
+.It Fl X Ar filename
+Read a list of exclusion patterns from the specified file.
+See
+.Fl -exclude
+for more information about the handling of exclusions.
+.It Fl y
+(c mode only)
+Compress the resulting archive with
+.Xr bzip2 1 .
+In extract or list modes, this option is ignored.
+Note that, unlike other
+.Nm tar
+implementations, this implementation recognizes bzip2 compression
+automatically when reading archives.
+.It Fl z
+(c mode only)
+Compress the resulting archive with
+.Xr gzip 1 .
+In extract or list modes, this option is ignored.
+Note that, unlike other
+.Nm tar
+implementations, this implementation recognizes gzip compression
+automatically when reading archives.
+.It Fl Z
+(c mode only)
+Compress the resulting archive with
+.Xr compress 1 .
+In extract or list modes, this option is ignored.
+Note that, unlike other
+.Nm tar
+implementations, this implementation recognizes compress compression
+automatically when reading archives.
+.El
+.Sh ENVIRONMENT
+The following environment variables affect the execution of
+.Nm :
+.Bl -tag -width ".Ev BLOCKSIZE"
+.It Ev LANG
+The locale to use.
+See
+.Xr environ 7
+for more information.
+.It Ev TAPE
+The default tape device.
+The
+.Fl f
+option overrides this.
+.It Ev TZ
+The timezone to use when displaying dates.
+See
+.Xr environ 7
+for more information.
+.El
+.Sh FILES
+.Bl -tag -width ".Ev BLOCKSIZE"
+.It Pa /dev/sa0
+The default tape device, if not overridden by the
+.Ev TAPE
+environment variable or the
+.Fl f
+option.
+.El
+.Sh EXIT STATUS
+.Ex -std
+.Sh EXAMPLES
+The following creates a new archive
+called
+.Ar file.tar.gz
+that contains two files
+.Ar source.c
+and
+.Ar source.h :
+.Dl Nm Fl czf Pa file.tar.gz Pa source.c Pa source.h
+.Pp
+To view a detailed table of contents for this
+archive:
+.Dl Nm Fl tvf Pa file.tar.gz
+.Pp
+To extract all entries from the archive on
+the default tape drive:
+.Dl Nm Fl x
+.Pp
+To examine the contents of an ISO 9660 cdrom image:
+.Dl Nm Fl tf Pa image.iso
+.Pp
+To move file hierarchies, invoke
+.Nm
+as
+.Dl Nm Fl cf Pa - Fl C Pa srcdir\ . | Nm Fl xpf Pa - Fl C Pa destdir
+or more traditionally
+.Dl cd srcdir \&; Nm Fl cf Pa -\ . | ( cd destdir \&; Nm Fl xpf Pa - )
+.Pp
+In create mode, the list of files and directories to be archived
+can also include directory change instructions of the form
+.Cm -C Ns Pa foo/baz
+and archive inclusions of the form
+.Cm @ Ns Pa archive-file .
+For example, the command line
+.Dl Nm Fl c Fl f Pa new.tar Pa foo1 Cm @ Ns Pa old.tgz Cm -C Ns Pa /tmp Pa foo2
+will create a new archive
+.Pa new.tar .
+.Nm
+will read the file
+.Pa foo1
+from the current directory and add it to the output archive.
+It will then read each entry from
+.Pa old.tgz
+and add those entries to the output archive.
+Finally, it will switch to the
+.Pa /tmp
+directory and add
+.Pa foo2
+to the output archive.
+.Pp
+An input file in
+.Xr mtree 5
+format can be used to create an output archive with arbitrary ownership,
+permissions, or names that differ from existing data on disk:
+.Pp
+.Dl $ cat input.mtree
+.Dl #mtree
+.Dl usr/bin uid=0 gid=0 mode=0755 type=dir
+.Dl usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls
+.Dl $ tar -cvf output.tar @input.mtree
+.Pp
+The
+.Fl -newer
+and
+.Fl -newer-mtime
+switches accept a variety of common date and time specifications, including
+.Dq 12 Mar 2005 7:14:29pm ,
+.Dq 2005-03-12 19:14 ,
+.Dq 5 minutes ago ,
+and
+.Dq 19:14 PST May 1 .
+.Pp
+The
+.Fl -options
+argument can be used to control various details of archive generation
+or reading.
+For example, you can generate mtree output which only contains
+.Cm type , Cm time ,
+and
+.Cm uid
+keywords:
+.Dl Nm Fl cf Pa file.tar Fl -format=mtree Fl -options='!all,type,time,uid' Pa dir
+or you can set the compression level used by gzip or xz compression:
+.Dl Nm Fl czf Pa file.tar Fl -options='compression-level=9' .
+For more details, see the explanation of the
+.Fn archive_read_set_options
+and
+.Fn archive_write_set_options
+API calls that are described in
+.Xr archive_read 3
+and
+.Xr archive_write 3 .
+.Sh COMPATIBILITY
+The bundled-arguments format is supported for compatibility
+with historic implementations.
+It consists of an initial word (with no leading - character) in which
+each character indicates an option.
+Arguments follow as separate words.
+The order of the arguments must match the order
+of the corresponding characters in the bundled command word.
+For example,
+.Dl Nm Cm tbf 32 Pa file.tar
+specifies three flags
+.Cm t ,
+.Cm b ,
+and
+.Cm f .
+The
+.Cm b
+and
+.Cm f
+flags both require arguments,
+so there must be two additional items
+on the command line.
+The
+.Ar 32
+is the argument to the
+.Cm b
+flag, and
+.Ar file.tar
+is the argument to the
+.Cm f
+flag.
+.Pp
+The mode options c, r, t, u, and x and the options
+b, f, l, m, o, v, and w comply with SUSv2.
+.Pp
+For maximum portability, scripts that invoke
+.Nm tar
+should use the bundled-argument format above, should limit
+themselves to the
+.Cm c ,
+.Cm t ,
+and
+.Cm x
+modes, and the
+.Cm b ,
+.Cm f ,
+.Cm m ,
+.Cm v ,
+and
+.Cm w
+options.
+.Pp
+Additional long options are provided to improve compatibility with other
+tar implementations.
+.Sh SECURITY
+Certain security issues are common to many archiving programs, including
+.Nm .
+In particular, carefully-crafted archives can request that
+.Nm
+extract files to locations outside of the target directory.
+This can potentially be used to cause unwitting users to overwrite
+files they did not intend to overwrite.
+If the archive is being extracted by the superuser, any file
+on the system can potentially be overwritten.
+There are three ways this can happen.
+Although
+.Nm
+has mechanisms to protect against each one,
+savvy users should be aware of the implications:
+.Bl -bullet -width indent
+.It
+Archive entries can have absolute pathnames.
+By default,
+.Nm
+removes the leading
+.Pa /
+character from filenames before restoring them to guard against this problem.
+.It
+Archive entries can have pathnames that include
+.Pa ..
+components.
+By default,
+.Nm
+will not extract files containing
+.Pa ..
+components in their pathname.
+.It
+Archive entries can exploit symbolic links to restore
+files to other directories.
+An archive can restore a symbolic link to another directory,
+then use that link to restore a file into that directory.
+To guard against this,
+.Nm
+checks each extracted path for symlinks.
+If the final path element is a symlink, it will be removed
+and replaced with the archive entry.
+If
+.Fl U
+is specified, any intermediate symlink will also be unconditionally removed.
+If neither
+.Fl U
+nor
+.Fl P
+is specified,
+.Nm
+will refuse to extract the entry.
+.El
+To protect yourself, you should be wary of any archives that
+come from untrusted sources.
+You should examine the contents of an archive with
+.Dl Nm Fl tf Pa filename
+before extraction.
+You should use the
+.Fl k
+option to ensure that
+.Nm
+will not overwrite any existing files or the
+.Fl U
+option to remove any pre-existing files.
+You should generally not extract archives while running with super-user
+privileges.
+Note that the
+.Fl P
+option to
+.Nm
+disables the security checks above and allows you to extract
+an archive while preserving any absolute pathnames,
+.Pa ..
+components, or symlinks to other directories.
+.Sh SEE ALSO
+.Xr bzip2 1 ,
+.Xr compress 1 ,
+.Xr cpio 1 ,
+.Xr gzip 1 ,
+.Xr mt 1 ,
+.Xr pax 1 ,
+.Xr shar 1 ,
+.Xr libarchive 3 ,
+.Xr libarchive-formats 5 ,
+.Xr tar 5
+.Sh STANDARDS
+There is no current POSIX standard for the tar command; it appeared
+in
+.St -p1003.1-96
+but was dropped from
+.St -p1003.1-2001 .
+The options used by this implementation were developed by surveying a
+number of existing tar implementations as well as the old POSIX specification
+for tar and the current POSIX specification for pax.
+.Pp
+The ustar and pax interchange file formats are defined by
+.St -p1003.1-2001
+for the pax command.
+.Sh HISTORY
+A
+.Nm tar
+command appeared in Seventh Edition Unix, which was released in January, 1979.
+There have been numerous other implementations,
+many of which extended the file format.
+John Gilmore's
+.Nm pdtar
+public-domain implementation (circa November, 1987)
+was quite influential, and formed the basis of GNU tar.
+GNU tar was included as the standard system tar
+in
+.Fx
+beginning with
+.Fx 1.0 .
+.Pp
+This is a complete re-implementation based on the
+.Xr libarchive 3
+library.
+.Sh BUGS
+This program follows
+.St -p1003.1-96
+for the definition of the
+.Fl l
+option.
+Note that GNU tar prior to version 1.15 treated
+.Fl l
+as a synonym for the
+.Fl -one-file-system
+option.
+.Pp
+The
+.Fl C Pa dir
+option may differ from historic implementations.
+.Pp
+All archive output is written in correctly-sized blocks, even
+if the output is being compressed.
+Whether or not the last output block is padded to a full
+block size varies depending on the format and the
+output device.
+For tar and cpio formats, the last block of output is padded
+to a full block size if the output is being
+written to standard output or to a character or block device such as
+a tape drive.
+If the output is being written to a regular file, the last block
+will not be padded.
+Many compressors, including
+.Xr gzip 1
+and
+.Xr bzip2 1 ,
+complain about the null padding when decompressing an archive created by
+.Nm ,
+although they still extract it correctly.
+.Pp
+The compression and decompression is implemented internally, so
+there may be insignificant differences between the compressed output
+generated by
+.Dl Nm Fl czf Pa - file
+and that generated by
+.Dl Nm Fl cf Pa - file | Nm gzip
+.Pp
+The default should be to read and write archives to the standard I/O paths,
+but tradition (and POSIX) dictates otherwise.
+.Pp
+The
+.Cm r
+and
+.Cm u
+modes require that the archive be uncompressed
+and located in a regular file on disk.
+Other archives can be modified using
+.Cm c
+mode with the
+.Pa @archive-file
+extension.
+.Pp
+To archive a file called
+.Pa @foo
+or
+.Pa -foo
+you must specify it as
+.Pa ./@foo
+or
+.Pa ./-foo ,
+respectively.
+.Pp
+In create mode, a leading
+.Pa ./
+is always removed.
+A leading
+.Pa /
+is stripped unless the
+.Fl P
+option is specified.
+.Pp
+There needs to be better support for file selection on both create
+and extract.
+.Pp
+There is not yet any support for multi-volume archives or for archiving
+sparse files.
+.Pp
+Converting between dissimilar archive formats (such as tar and cpio) using the
+.Cm @ Ns Pa -
+convention can cause hard link information to be lost.
+(This is a consequence of the incompatible ways that different archive
+formats store hardlink information.)
+.Pp
+There are alternative long options for many of the short options that
+are deliberately not documented.
diff --git a/archivers/libarchive/files/tar/bsdtar.c b/archivers/libarchive/files/tar/bsdtar.c
new file mode 100644
index 00000000000..d8f8286842e
--- /dev/null
+++ b/archivers/libarchive/files/tar/bsdtar.c
@@ -0,0 +1,734 @@
+/*-
+ * 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.
+ */
+
+#include "bsdtar_platform.h"
+__FBSDID("$FreeBSD: src/usr.bin/tar/bsdtar.c,v 1.93 2008/11/08 04:43:24 kientzle Exp $");
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_LANGINFO_H
+#include <langinfo.h>
+#endif
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+#ifdef HAVE_PATHS_H
+#include <paths.h>
+#endif
+#ifdef HAVE_SIGNAL_H
+#include <signal.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if HAVE_ZLIB_H
+#include <zlib.h>
+#endif
+
+#include "bsdtar.h"
+#include "err.h"
+
+/*
+ * Per POSIX.1-1988, tar defaults to reading/writing archives to/from
+ * the default tape device for the system. Pick something reasonable here.
+ */
+#ifdef __linux
+#define _PATH_DEFTAPE "/dev/st0"
+#endif
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define _PATH_DEFTAPE "\\\\.\\tape0"
+#endif
+
+#ifndef _PATH_DEFTAPE
+#define _PATH_DEFTAPE "/dev/tape"
+#endif
+
+#ifdef __MINGW32__
+int _CRT_glob = 0; /* Disable broken CRT globbing. */
+#endif
+
+static struct bsdtar *_bsdtar;
+
+#if defined(HAVE_SIGACTION) && (defined(SIGINFO) || defined(SIGUSR1))
+static volatile int siginfo_occurred;
+
+static void
+siginfo_handler(int sig)
+{
+ (void)sig; /* UNUSED */
+ siginfo_occurred = 1;
+}
+
+int
+need_report(void)
+{
+ int r = siginfo_occurred;
+ siginfo_occurred = 0;
+ return (r);
+}
+#else
+int
+need_report(void)
+{
+ return (0);
+}
+#endif
+
+/* External function to parse a date/time string */
+time_t get_date(time_t, const char *);
+
+static void long_help(void);
+static void only_mode(struct bsdtar *, const char *opt,
+ const char *valid);
+static void set_mode(struct bsdtar *, char opt);
+static void version(void);
+
+/* A basic set of security flags to request from libarchive. */
+#define SECURITY \
+ (ARCHIVE_EXTRACT_SECURE_SYMLINKS \
+ | ARCHIVE_EXTRACT_SECURE_NODOTDOT)
+
+int
+main(int argc, char **argv)
+{
+ struct bsdtar *bsdtar, bsdtar_storage;
+ int opt, t;
+ char option_o;
+ char possible_help_request;
+ char buff[16];
+ time_t now;
+
+ /*
+ * Use a pointer for consistency, but stack-allocated storage
+ * for ease of cleanup.
+ */
+ _bsdtar = bsdtar = &bsdtar_storage;
+ memset(bsdtar, 0, sizeof(*bsdtar));
+ bsdtar->fd = -1; /* Mark as "unused" */
+ option_o = 0;
+
+#if defined(HAVE_SIGACTION) && (defined(SIGINFO) || defined(SIGUSR1))
+ { /* Catch SIGINFO and SIGUSR1, if they exist. */
+ struct sigaction sa;
+ sa.sa_handler = siginfo_handler;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+#ifdef SIGINFO
+ if (sigaction(SIGINFO, &sa, NULL))
+ lafe_errc(1, errno, "sigaction(SIGINFO) failed");
+#endif
+#ifdef SIGUSR1
+ /* ... and treat SIGUSR1 the same way as SIGINFO. */
+ if (sigaction(SIGUSR1, &sa, NULL))
+ lafe_errc(1, errno, "sigaction(SIGUSR1) failed");
+#endif
+ }
+#endif
+
+
+ /* Need lafe_progname before calling lafe_warnc. */
+ if (*argv == NULL)
+ lafe_progname = "bsdtar";
+ else {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ lafe_progname = strrchr(*argv, '\\');
+#else
+ lafe_progname = strrchr(*argv, '/');
+#endif
+ if (lafe_progname != NULL)
+ lafe_progname++;
+ else
+ lafe_progname = *argv;
+ }
+
+ time(&now);
+
+#if HAVE_SETLOCALE
+ if (setlocale(LC_ALL, "") == NULL)
+ lafe_warnc(0, "Failed to set default locale");
+#endif
+#if defined(HAVE_NL_LANGINFO) && defined(HAVE_D_MD_ORDER)
+ bsdtar->day_first = (*nl_langinfo(D_MD_ORDER) == 'd');
+#endif
+ possible_help_request = 0;
+
+ /* Look up uid of current user for future reference */
+ bsdtar->user_uid = geteuid();
+
+ /* Default: open tape drive. */
+ bsdtar->filename = getenv("TAPE");
+ if (bsdtar->filename == NULL)
+ bsdtar->filename = _PATH_DEFTAPE;
+
+ /* Default: preserve mod time on extract */
+ bsdtar->extract_flags = ARCHIVE_EXTRACT_TIME;
+
+ /* Default: Perform basic security checks. */
+ bsdtar->extract_flags |= SECURITY;
+
+#ifndef _WIN32
+ /* On POSIX systems, assume --same-owner and -p when run by
+ * the root user. This doesn't make any sense on Windows. */
+ if (bsdtar->user_uid == 0) {
+ /* --same-owner */
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_OWNER;
+ /* -p */
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_PERM;
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_ACL;
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_XATTR;
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_FFLAGS;
+ }
+#endif
+
+ bsdtar->argv = argv;
+ bsdtar->argc = argc;
+
+ /*
+ * Comments following each option indicate where that option
+ * originated: SUSv2, POSIX, GNU tar, star, etc. If there's
+ * no such comment, then I don't know of anyone else who
+ * implements that option.
+ */
+ while ((opt = bsdtar_getopt(bsdtar)) != -1) {
+ switch (opt) {
+ case 'B': /* GNU tar */
+ /* libarchive doesn't need this; just ignore it. */
+ break;
+ case 'b': /* SUSv2 */
+ t = atoi(bsdtar->optarg);
+ if (t <= 0 || t > 8192)
+ lafe_errc(1, 0,
+ "Argument to -b is out of range (1..8192)");
+ bsdtar->bytes_per_block = 512 * t;
+ break;
+ case 'C': /* GNU tar */
+ set_chdir(bsdtar, bsdtar->optarg);
+ break;
+ case 'c': /* SUSv2 */
+ set_mode(bsdtar, opt);
+ break;
+ case OPTION_CHECK_LINKS: /* GNU tar */
+ bsdtar->option_warn_links = 1;
+ break;
+ case OPTION_CHROOT: /* NetBSD */
+ bsdtar->option_chroot = 1;
+ break;
+ case OPTION_EXCLUDE: /* GNU tar */
+ if (lafe_exclude(&bsdtar->matching, bsdtar->optarg))
+ lafe_errc(1, 0,
+ "Couldn't exclude %s\n", bsdtar->optarg);
+ break;
+ case OPTION_FORMAT: /* GNU tar, others */
+ bsdtar->create_format = bsdtar->optarg;
+ break;
+ case OPTION_OPTIONS:
+ bsdtar->option_options = bsdtar->optarg;
+ break;
+ case 'f': /* SUSv2 */
+ bsdtar->filename = bsdtar->optarg;
+ if (strcmp(bsdtar->filename, "-") == 0)
+ bsdtar->filename = NULL;
+ break;
+ case 'H': /* BSD convention */
+ bsdtar->symlink_mode = 'H';
+ break;
+ case 'h': /* Linux Standards Base, gtar; synonym for -L */
+ bsdtar->symlink_mode = 'L';
+ /* Hack: -h by itself is the "help" command. */
+ possible_help_request = 1;
+ break;
+ case OPTION_HELP: /* GNU tar, others */
+ long_help();
+ exit(0);
+ break;
+ case 'I': /* GNU tar */
+ /*
+ * TODO: Allow 'names' to come from an archive,
+ * not just a text file. Design a good UI for
+ * allowing names and mode/owner to be read
+ * from an archive, with contents coming from
+ * disk. This can be used to "refresh" an
+ * archive or to design archives with special
+ * permissions without having to create those
+ * permissions on disk.
+ */
+ bsdtar->names_from_file = bsdtar->optarg;
+ break;
+ case OPTION_INCLUDE:
+ /*
+ * Noone else has the @archive extension, so
+ * noone else needs this to filter entries
+ * when transforming archives.
+ */
+ if (lafe_include(&bsdtar->matching, bsdtar->optarg))
+ lafe_errc(1, 0,
+ "Failed to add %s to inclusion list",
+ bsdtar->optarg);
+ break;
+ case 'j': /* GNU tar */
+ if (bsdtar->create_compression != '\0')
+ lafe_errc(1, 0,
+ "Can't specify both -%c and -%c", opt,
+ bsdtar->create_compression);
+ bsdtar->create_compression = opt;
+ break;
+ case 'J': /* GNU tar 1.21 and later */
+ if (bsdtar->create_compression != '\0')
+ lafe_errc(1, 0,
+ "Can't specify both -%c and -%c", opt,
+ bsdtar->create_compression);
+ bsdtar->create_compression = opt;
+ break;
+ case 'k': /* GNU tar */
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE;
+ break;
+ case OPTION_KEEP_NEWER_FILES: /* GNU tar */
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER;
+ break;
+ case 'L': /* BSD convention */
+ bsdtar->symlink_mode = 'L';
+ break;
+ case 'l': /* SUSv2 and GNU tar beginning with 1.16 */
+ /* GNU tar 1.13 used -l for --one-file-system */
+ bsdtar->option_warn_links = 1;
+ break;
+ case OPTION_LZMA:
+ if (bsdtar->create_compression != '\0')
+ lafe_errc(1, 0,
+ "Can't specify both -%c and -%c", opt,
+ bsdtar->create_compression);
+ bsdtar->create_compression = opt;
+ break;
+ case 'm': /* SUSv2 */
+ bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_TIME;
+ break;
+ case 'n': /* GNU tar */
+ bsdtar->option_no_subdirs = 1;
+ break;
+ /*
+ * Selecting files by time:
+ * --newer-?time='date' Only files newer than 'date'
+ * --newer-?time-than='file' Only files newer than time
+ * on specified file (useful for incremental backups)
+ * TODO: Add corresponding "older" options to reverse these.
+ */
+ case OPTION_NEWER_CTIME: /* GNU tar */
+ bsdtar->newer_ctime_sec = get_date(now, bsdtar->optarg);
+ break;
+ case OPTION_NEWER_CTIME_THAN:
+ {
+ struct stat st;
+ if (stat(bsdtar->optarg, &st) != 0)
+ lafe_errc(1, 0,
+ "Can't open file %s", bsdtar->optarg);
+ bsdtar->newer_ctime_sec = st.st_ctime;
+ bsdtar->newer_ctime_nsec =
+ ARCHIVE_STAT_CTIME_NANOS(&st);
+ }
+ break;
+ case OPTION_NEWER_MTIME: /* GNU tar */
+ bsdtar->newer_mtime_sec = get_date(now, bsdtar->optarg);
+ break;
+ case OPTION_NEWER_MTIME_THAN:
+ {
+ struct stat st;
+ if (stat(bsdtar->optarg, &st) != 0)
+ lafe_errc(1, 0,
+ "Can't open file %s", bsdtar->optarg);
+ bsdtar->newer_mtime_sec = st.st_mtime;
+ bsdtar->newer_mtime_nsec =
+ ARCHIVE_STAT_MTIME_NANOS(&st);
+ }
+ break;
+ case OPTION_NODUMP: /* star */
+ bsdtar->option_honor_nodump = 1;
+ break;
+ case OPTION_NO_SAME_OWNER: /* GNU tar */
+ bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_OWNER;
+ break;
+ case OPTION_NO_SAME_PERMISSIONS: /* GNU tar */
+ bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_PERM;
+ bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_ACL;
+ bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_XATTR;
+ bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_FFLAGS;
+ break;
+ case OPTION_NULL: /* GNU tar */
+ bsdtar->option_null++;
+ break;
+ case OPTION_NUMERIC_OWNER: /* GNU tar */
+ bsdtar->option_numeric_owner++;
+ break;
+ case 'O': /* GNU tar */
+ bsdtar->option_stdout = 1;
+ break;
+ case 'o': /* SUSv2 and GNU conflict here, but not fatally */
+ option_o = 1; /* Record it and resolve it later. */
+ break;
+ case OPTION_ONE_FILE_SYSTEM: /* GNU tar */
+ bsdtar->option_dont_traverse_mounts = 1;
+ break;
+#if 0
+ /*
+ * The common BSD -P option is not necessary, since
+ * our default is to archive symlinks, not follow
+ * them. This is convenient, as -P conflicts with GNU
+ * tar anyway.
+ */
+ case 'P': /* BSD convention */
+ /* Default behavior, no option necessary. */
+ break;
+#endif
+ case 'P': /* GNU tar */
+ bsdtar->extract_flags &= ~SECURITY;
+ bsdtar->option_absolute_paths = 1;
+ break;
+ case 'p': /* GNU tar, star */
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_PERM;
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_ACL;
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_XATTR;
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_FFLAGS;
+ break;
+ case OPTION_POSIX: /* GNU tar */
+ bsdtar->create_format = "pax";
+ break;
+ case 'q': /* FreeBSD GNU tar --fast-read, NetBSD -q */
+ bsdtar->option_fast_read = 1;
+ break;
+ case 'r': /* SUSv2 */
+ set_mode(bsdtar, opt);
+ break;
+ case 'S': /* NetBSD pax-as-tar */
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_SPARSE;
+ break;
+ case 's': /* NetBSD pax-as-tar */
+#if HAVE_REGEX_H
+ add_substitution(bsdtar, bsdtar->optarg);
+#else
+ lafe_warnc(0,
+ "-s is not supported by this version of bsdtar");
+ usage();
+#endif
+ break;
+ case OPTION_SAME_OWNER: /* GNU tar */
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_OWNER;
+ break;
+ case OPTION_STRIP_COMPONENTS: /* GNU tar 1.15 */
+ bsdtar->strip_components = atoi(bsdtar->optarg);
+ break;
+ case 'T': /* GNU tar */
+ bsdtar->names_from_file = bsdtar->optarg;
+ break;
+ case 't': /* SUSv2 */
+ set_mode(bsdtar, opt);
+ bsdtar->verbose++;
+ break;
+ case OPTION_TOTALS: /* GNU tar */
+ bsdtar->option_totals++;
+ break;
+ case 'U': /* GNU tar */
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_UNLINK;
+ bsdtar->option_unlink_first = 1;
+ break;
+ case 'u': /* SUSv2 */
+ set_mode(bsdtar, opt);
+ break;
+ case 'v': /* SUSv2 */
+ bsdtar->verbose++;
+ break;
+ case OPTION_VERSION: /* GNU convention */
+ version();
+ break;
+#if 0
+ /*
+ * The -W longopt feature is handled inside of
+ * bsdtar_getopt(), so -W is not available here.
+ */
+ case 'W': /* Obscure GNU convention. */
+ break;
+#endif
+ case 'w': /* SUSv2 */
+ bsdtar->option_interactive = 1;
+ break;
+ case 'X': /* GNU tar */
+ if (lafe_exclude_from_file(&bsdtar->matching, bsdtar->optarg))
+ lafe_errc(1, 0,
+ "failed to process exclusions from file %s",
+ bsdtar->optarg);
+ break;
+ case 'x': /* SUSv2 */
+ set_mode(bsdtar, opt);
+ break;
+ case 'y': /* FreeBSD version of GNU tar */
+ if (bsdtar->create_compression != '\0')
+ lafe_errc(1, 0,
+ "Can't specify both -%c and -%c", opt,
+ bsdtar->create_compression);
+ bsdtar->create_compression = opt;
+ break;
+ case 'Z': /* GNU tar */
+ if (bsdtar->create_compression != '\0')
+ lafe_errc(1, 0,
+ "Can't specify both -%c and -%c", opt,
+ bsdtar->create_compression);
+ bsdtar->create_compression = opt;
+ break;
+ case 'z': /* GNU tar, star, many others */
+ if (bsdtar->create_compression != '\0')
+ lafe_errc(1, 0,
+ "Can't specify both -%c and -%c", opt,
+ bsdtar->create_compression);
+ bsdtar->create_compression = opt;
+ break;
+ case OPTION_USE_COMPRESS_PROGRAM:
+ bsdtar->compress_program = bsdtar->optarg;
+ break;
+ default:
+ usage();
+ }
+ }
+
+ /*
+ * Sanity-check options.
+ */
+
+ /* If no "real" mode was specified, treat -h as --help. */
+ if ((bsdtar->mode == '\0') && possible_help_request) {
+ long_help();
+ exit(0);
+ }
+
+ /* Otherwise, a mode is required. */
+ if (bsdtar->mode == '\0')
+ lafe_errc(1, 0,
+ "Must specify one of -c, -r, -t, -u, -x");
+
+ /* Check boolean options only permitted in certain modes. */
+ if (bsdtar->option_dont_traverse_mounts)
+ only_mode(bsdtar, "--one-file-system", "cru");
+ if (bsdtar->option_fast_read)
+ only_mode(bsdtar, "--fast-read", "xt");
+ if (bsdtar->option_honor_nodump)
+ only_mode(bsdtar, "--nodump", "cru");
+ if (option_o > 0) {
+ switch (bsdtar->mode) {
+ case 'c':
+ /*
+ * In GNU tar, -o means "old format." The
+ * "ustar" format is the closest thing
+ * supported by libarchive.
+ */
+ bsdtar->create_format = "ustar";
+ /* TODO: bsdtar->create_format = "v7"; */
+ break;
+ case 'x':
+ /* POSIX-compatible behavior. */
+ bsdtar->option_no_owner = 1;
+ bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_OWNER;
+ break;
+ default:
+ only_mode(bsdtar, "-o", "xc");
+ break;
+ }
+ }
+ if (bsdtar->option_no_subdirs)
+ only_mode(bsdtar, "-n", "cru");
+ if (bsdtar->option_stdout)
+ only_mode(bsdtar, "-O", "xt");
+ if (bsdtar->option_unlink_first)
+ only_mode(bsdtar, "-U", "x");
+ if (bsdtar->option_warn_links)
+ only_mode(bsdtar, "--check-links", "cr");
+
+ /* Check other parameters only permitted in certain modes. */
+ if (bsdtar->create_compression != '\0') {
+ strcpy(buff, "-?");
+ buff[1] = bsdtar->create_compression;
+ only_mode(bsdtar, buff, "cxt");
+ }
+ if (bsdtar->create_format != NULL)
+ only_mode(bsdtar, "--format", "cru");
+ if (bsdtar->symlink_mode != '\0') {
+ strcpy(buff, "-?");
+ buff[1] = bsdtar->symlink_mode;
+ only_mode(bsdtar, buff, "cru");
+ }
+ if (bsdtar->strip_components != 0)
+ only_mode(bsdtar, "--strip-components", "xt");
+
+ switch(bsdtar->mode) {
+ case 'c':
+ tar_mode_c(bsdtar);
+ break;
+ case 'r':
+ tar_mode_r(bsdtar);
+ break;
+ case 't':
+ tar_mode_t(bsdtar);
+ break;
+ case 'u':
+ tar_mode_u(bsdtar);
+ break;
+ case 'x':
+ tar_mode_x(bsdtar);
+ break;
+ }
+
+ lafe_cleanup_exclusions(&bsdtar->matching);
+#if HAVE_REGEX_H
+ cleanup_substitution(bsdtar);
+#endif
+
+ if (bsdtar->return_value != 0)
+ lafe_warnc(0,
+ "Error exit delayed from previous errors.");
+ return (bsdtar->return_value);
+}
+
+static void
+set_mode(struct bsdtar *bsdtar, char opt)
+{
+ if (bsdtar->mode != '\0' && bsdtar->mode != opt)
+ lafe_errc(1, 0,
+ "Can't specify both -%c and -%c", opt, bsdtar->mode);
+ bsdtar->mode = opt;
+}
+
+/*
+ * Verify that the mode is correct.
+ */
+static void
+only_mode(struct bsdtar *bsdtar, const char *opt, const char *valid_modes)
+{
+ if (strchr(valid_modes, bsdtar->mode) == NULL)
+ lafe_errc(1, 0,
+ "Option %s is not permitted in mode -%c",
+ opt, bsdtar->mode);
+}
+
+
+void
+usage(void)
+{
+ const char *p;
+
+ p = lafe_progname;
+
+ fprintf(stderr, "Usage:\n");
+ fprintf(stderr, " List: %s -tf <archive-filename>\n", p);
+ fprintf(stderr, " Extract: %s -xf <archive-filename>\n", p);
+ fprintf(stderr, " Create: %s -cf <archive-filename> [filenames...]\n", p);
+ fprintf(stderr, " Help: %s --help\n", p);
+ exit(1);
+}
+
+static void
+version(void)
+{
+ printf("bsdtar %s - %s\n",
+ BSDTAR_VERSION_STRING,
+ archive_version());
+ exit(0);
+}
+
+static const char *long_help_msg =
+ "First option must be a mode specifier:\n"
+ " -c Create -r Add/Replace -t List -u Update -x Extract\n"
+ "Common Options:\n"
+ " -b # Use # 512-byte records per I/O block\n"
+ " -f <filename> Location of archive (default " _PATH_DEFTAPE ")\n"
+ " -v Verbose\n"
+ " -w Interactive\n"
+ "Create: %p -c [options] [<file> | <dir> | @<archive> | -C <dir> ]\n"
+ " <file>, <dir> add these items to archive\n"
+ " -z, -j, -J, --lzma Compress archive with gzip/bzip2/xz/lzma\n"
+ " --format {ustar|pax|cpio|shar} Select archive format\n"
+ " --exclude <pattern> Skip files that match pattern\n"
+ " -C <dir> Change to <dir> before processing remaining files\n"
+ " @<archive> Add entries from <archive> to output\n"
+ "List: %p -t [options] [<patterns>]\n"
+ " <patterns> If specified, list only entries that match\n"
+ "Extract: %p -x [options] [<patterns>]\n"
+ " <patterns> If specified, extract only entries that match\n"
+ " -k Keep (don't overwrite) existing files\n"
+ " -m Don't restore modification times\n"
+ " -O Write entries to stdout, don't restore to disk\n"
+ " -p Restore permissions (including ACLs, owner, file flags)\n";
+
+
+/*
+ * Note that the word 'bsdtar' will always appear in the first line
+ * of output.
+ *
+ * In particular, /bin/sh scripts that need to test for the presence
+ * of bsdtar can use the following template:
+ *
+ * if (tar --help 2>&1 | grep bsdtar >/dev/null 2>&1 ) then \
+ * echo bsdtar; else echo not bsdtar; fi
+ */
+static void
+long_help(void)
+{
+ const char *prog;
+ const char *p;
+
+ prog = lafe_progname;
+
+ fflush(stderr);
+
+ p = (strcmp(prog,"bsdtar") != 0) ? "(bsdtar)" : "";
+ printf("%s%s: manipulate archive files\n", prog, p);
+
+ for (p = long_help_msg; *p != '\0'; p++) {
+ if (*p == '%') {
+ if (p[1] == 'p') {
+ fputs(prog, stdout);
+ p++;
+ } else
+ putchar('%');
+ } else
+ putchar(*p);
+ }
+ version();
+}
diff --git a/archivers/libarchive/files/tar/bsdtar.h b/archivers/libarchive/files/tar/bsdtar.h
new file mode 100644
index 00000000000..5e8dc7f89ec
--- /dev/null
+++ b/archivers/libarchive/files/tar/bsdtar.h
@@ -0,0 +1,158 @@
+/*-
+ * 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.h,v 1.37 2008/12/06 07:37:14 kientzle Exp $
+ */
+
+#include "bsdtar_platform.h"
+#include <stdio.h>
+
+#include "matching.h"
+
+#define DEFAULT_BYTES_PER_BLOCK (20*512)
+
+/*
+ * The internal state for the "bsdtar" program.
+ *
+ * Keeping all of the state in a structure like this simplifies memory
+ * leak testing (at exit, anything left on the heap is suspect). A
+ * pointer to this structure is passed to most bsdtar internal
+ * functions.
+ */
+struct bsdtar {
+ /* Options */
+ const char *filename; /* -f filename */
+ const char *create_format; /* -F format */
+ char *pending_chdir; /* -C dir */
+ const char *names_from_file; /* -T file */
+ time_t newer_ctime_sec; /* --newer/--newer-than */
+ long newer_ctime_nsec; /* --newer/--newer-than */
+ time_t newer_mtime_sec; /* --newer-mtime */
+ long newer_mtime_nsec; /* --newer-mtime-than */
+ int bytes_per_block; /* -b block_size */
+ int verbose; /* -v */
+ int extract_flags; /* Flags for extract operation */
+ int strip_components; /* Remove this many leading dirs */
+ char mode; /* Program mode: 'c', 't', 'r', 'u', 'x' */
+ char symlink_mode; /* H or L, per BSD conventions */
+ char create_compression; /* j, y, or z */
+ const char *compress_program;
+ char option_absolute_paths; /* -P */
+ char option_chroot; /* --chroot */
+ char option_dont_traverse_mounts; /* --one-file-system */
+ char option_fast_read; /* --fast-read */
+ const char *option_options; /* --options */
+ char option_honor_nodump; /* --nodump */
+ char option_interactive; /* -w */
+ char option_no_owner; /* -o */
+ char option_no_subdirs; /* -n */
+ char option_null; /* --null */
+ char option_numeric_owner; /* --numeric-owner */
+ char option_stdout; /* -O */
+ char option_totals; /* --totals */
+ char option_unlink_first; /* -U */
+ char option_warn_links; /* --check-links */
+ char day_first; /* show day before month in -tv output */
+
+ /* If >= 0, then close this when done. */
+ int fd;
+
+ /* Miscellaneous state information */
+ int argc;
+ char **argv;
+ const char *optarg;
+ size_t gs_width; /* For 'list_item' in read.c */
+ size_t u_width; /* for 'list_item' in read.c */
+ uid_t user_uid; /* UID running this program */
+ int return_value; /* Value returned by main() */
+ char warned_lead_slash; /* Already displayed warning */
+ char next_line_is_dir; /* Used for -C parsing in -cT */
+
+ /*
+ * Data for various subsystems. Full definitions are located in
+ * the file where they are used.
+ */
+ struct archive *diskreader; /* for write.c */
+ struct archive_entry_linkresolver *resolver; /* for write.c */
+ struct archive_dir *archive_dir; /* for write.c */
+ struct name_cache *gname_cache; /* for write.c */
+ char *buff; /* for write.c */
+ struct lafe_matching *matching; /* for matching.c */
+ struct security *security; /* for read.c */
+ struct name_cache *uname_cache; /* for write.c */
+ struct siginfo_data *siginfo; /* for siginfo.c */
+ struct substitution *substitution; /* for subst.c */
+};
+
+/* Fake short equivalents for long options that otherwise lack them. */
+enum {
+ OPTION_CHECK_LINKS = 1,
+ OPTION_CHROOT,
+ OPTION_EXCLUDE,
+ OPTION_FORMAT,
+ OPTION_OPTIONS,
+ OPTION_HELP,
+ OPTION_INCLUDE,
+ OPTION_KEEP_NEWER_FILES,
+ OPTION_LZMA,
+ OPTION_NEWER_CTIME,
+ OPTION_NEWER_CTIME_THAN,
+ OPTION_NEWER_MTIME,
+ OPTION_NEWER_MTIME_THAN,
+ OPTION_NODUMP,
+ OPTION_NO_SAME_OWNER,
+ OPTION_NO_SAME_PERMISSIONS,
+ OPTION_NULL,
+ OPTION_NUMERIC_OWNER,
+ OPTION_ONE_FILE_SYSTEM,
+ OPTION_POSIX,
+ OPTION_SAME_OWNER,
+ OPTION_STRIP_COMPONENTS,
+ OPTION_TOTALS,
+ OPTION_USE_COMPRESS_PROGRAM,
+ OPTION_VERSION
+};
+
+
+int bsdtar_getopt(struct bsdtar *);
+void do_chdir(struct bsdtar *);
+int edit_pathname(struct bsdtar *, struct archive_entry *);
+int need_report(void);
+int pathcmp(const char *a, const char *b);
+void safe_fprintf(FILE *, const char *fmt, ...);
+void set_chdir(struct bsdtar *, const char *newdir);
+const char *tar_i64toa(int64_t);
+void tar_mode_c(struct bsdtar *bsdtar);
+void tar_mode_r(struct bsdtar *bsdtar);
+void tar_mode_t(struct bsdtar *bsdtar);
+void tar_mode_u(struct bsdtar *bsdtar);
+void tar_mode_x(struct bsdtar *bsdtar);
+void usage(void);
+int yes(const char *fmt, ...);
+
+#if HAVE_REGEX_H
+void add_substitution(struct bsdtar *, const char *);
+int apply_substitution(struct bsdtar *, const char *, char **, int);
+void cleanup_substitution(struct bsdtar *);
+#endif
diff --git a/archivers/libarchive/files/tar/bsdtar_platform.h b/archivers/libarchive/files/tar/bsdtar_platform.h
new file mode 100644
index 00000000000..fce9c99815a
--- /dev/null
+++ b/archivers/libarchive/files/tar/bsdtar_platform.h
@@ -0,0 +1,132 @@
+/*-
+ * 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 BSDTAR_PLATFORM_H_INCLUDED
+#define BSDTAR_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
+
+#ifdef HAVE_LIBACL
+#include <acl/libacl.h>
+#endif
+
+/*
+ * Include "dirent.h" (or it's equivalent on several different platforms).
+ *
+ * This is slightly modified from the GNU autoconf recipe.
+ * In particular, FreeBSD includes d_namlen in it's dirent structure,
+ * so my configure script includes an explicit test for the d_namlen
+ * field.
+ */
+#if HAVE_DIRENT_H
+# include <dirent.h>
+# if HAVE_DIRENT_D_NAMLEN
+# define DIRENT_NAMLEN(dirent) (dirent)->d_namlen
+# else
+# define DIRENT_NAMLEN(dirent) strlen((dirent)->d_name)
+# endif
+#else
+# define dirent direct
+# define DIRENT_NAMLEN(dirent) (dirent)->d_namlen
+# if HAVE_SYS_NDIR_H
+# include <sys/ndir.h>
+# endif
+# if HAVE_SYS_DIR_H
+# include <sys/dir.h>
+# endif
+# if HAVE_NDIR_H
+# include <ndir.h>
+# endif
+#endif
+
+#if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
+#define ARCHIVE_STAT_CTIME_NANOS(st) (st)->st_ctimespec.tv_nsec
+#define ARCHIVE_STAT_MTIME_NANOS(st) (st)->st_mtimespec.tv_nsec
+#elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC
+#define ARCHIVE_STAT_CTIME_NANOS(st) (st)->st_ctim.tv_nsec
+#define ARCHIVE_STAT_MTIME_NANOS(st) (st)->st_mtim.tv_nsec
+#elif HAVE_STRUCT_STAT_ST_MTIME_N
+#define ARCHIVE_STAT_CTIME_NANOS(st) (st)->st_ctime_n
+#define ARCHIVE_STAT_MTIME_NANOS(st) (st)->st_mtime_n
+#elif HAVE_STRUCT_STAT_ST_UMTIME
+#define ARCHIVE_STAT_CTIME_NANOS(st) (st)->st_uctime * 1000
+#define ARCHIVE_STAT_MTIME_NANOS(st) (st)->st_umtime * 1000
+#elif HAVE_STRUCT_STAT_ST_MTIME_USEC
+#define ARCHIVE_STAT_CTIME_NANOS(st) (st)->st_ctime_usec * 1000
+#define ARCHIVE_STAT_MTIME_NANOS(st) (st)->st_mtime_usec * 1000
+#else
+#define ARCHIVE_STAT_CTIME_NANOS(st) (0)
+#define ARCHIVE_STAT_MTIME_NANOS(st) (0)
+#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
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#include "bsdtar_windows.h"
+#endif
+
+#endif /* !BSDTAR_PLATFORM_H_INCLUDED */
diff --git a/archivers/libarchive/files/tar/getdate.c b/archivers/libarchive/files/tar/getdate.c
new file mode 100644
index 00000000000..ffaa679ba1a
--- /dev/null
+++ b/archivers/libarchive/files/tar/getdate.c
@@ -0,0 +1,1037 @@
+/*
+ * This code is in the public domain and has no copyright.
+ *
+ * This is a plain C recursive-descent translation of an old
+ * public-domain YACC grammar that has been used for parsing dates in
+ * very many open-source projects.
+ *
+ * Since the original authors were generous enough to donate their
+ * work to the public domain, I feel compelled to match their
+ * generosity.
+ *
+ * Tim Kientzle, February 2009.
+ */
+
+/*
+ * Header comment from original getdate.y:
+ */
+
+/*
+** Originally written by Steven M. Bellovin <smb@research.att.com> while
+** at the University of North Carolina at Chapel Hill. Later tweaked by
+** a couple of people on Usenet. Completely overhauled by Rich $alz
+** <rsalz@bbn.com> and Jim Berets <jberets@bbn.com> in August, 1990;
+**
+** This grammar has 10 shift/reduce conflicts.
+**
+** This code is in the public domain and has no copyright.
+*/
+
+#ifdef __FreeBSD__
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+#endif
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+/* This file defines a single public function. */
+time_t get_date(time_t now, char *);
+
+/* Basic time units. */
+#define EPOCH 1970
+#define MINUTE (60L)
+#define HOUR (60L * MINUTE)
+#define DAY (24L * HOUR)
+
+/* Daylight-savings mode: on, off, or not yet known. */
+enum DSTMODE { DSTon, DSToff, DSTmaybe };
+/* Meridian: am or pm. */
+enum { tAM, tPM };
+/* Token types returned by nexttoken() */
+enum { tAGO = 260, tDAY, tDAYZONE, tAMPM, tMONTH, tMONTH_UNIT, tSEC_UNIT,
+ tUNUMBER, tZONE, tDST };
+struct token { int token; time_t value; };
+
+/*
+ * Parser state.
+ */
+struct gdstate {
+ struct token *tokenp; /* Pointer to next token. */
+ /* HaveXxxx counts how many of this kind of phrase we've seen;
+ * it's a fatal error to have more than one time, zone, day,
+ * or date phrase. */
+ int HaveYear;
+ int HaveMonth;
+ int HaveDay;
+ int HaveWeekDay; /* Day of week */
+ int HaveTime; /* Hour/minute/second */
+ int HaveZone; /* timezone and/or DST info */
+ int HaveRel; /* time offset; we can have more than one */
+ /* Absolute time values. */
+ time_t Timezone; /* Seconds offset from GMT */
+ time_t Day;
+ time_t Hour;
+ time_t Minutes;
+ time_t Month;
+ time_t Seconds;
+ time_t Year;
+ /* DST selection */
+ enum DSTMODE DSTmode;
+ /* Day of week accounting, e.g., "3rd Tuesday" */
+ time_t DayOrdinal; /* "3" in "3rd Tuesday" */
+ time_t DayNumber; /* "Tuesday" in "3rd Tuesday" */
+ /* Relative time values: hour/day/week offsets are measured in
+ * seconds, month/year are counted in months. */
+ time_t RelMonth;
+ time_t RelSeconds;
+};
+
+/*
+ * A series of functions that recognize certain common time phrases.
+ * Each function returns 1 if it managed to make sense of some of the
+ * tokens, zero otherwise.
+ */
+
+/*
+ * hour:minute or hour:minute:second with optional AM, PM, or numeric
+ * timezone offset
+ */
+static int
+timephrase(struct gdstate *gds)
+{
+ if (gds->tokenp[0].token == tUNUMBER
+ && gds->tokenp[1].token == ':'
+ && gds->tokenp[2].token == tUNUMBER
+ && gds->tokenp[3].token == ':'
+ && gds->tokenp[4].token == tUNUMBER) {
+ /* "12:14:18" or "22:08:07" */
+ ++gds->HaveTime;
+ gds->Hour = gds->tokenp[0].value;
+ gds->Minutes = gds->tokenp[2].value;
+ gds->Seconds = gds->tokenp[4].value;
+ gds->tokenp += 5;
+ }
+ else if (gds->tokenp[0].token == tUNUMBER
+ && gds->tokenp[1].token == ':'
+ && gds->tokenp[2].token == tUNUMBER) {
+ /* "12:14" or "22:08" */
+ ++gds->HaveTime;
+ gds->Hour = gds->tokenp[0].value;
+ gds->Minutes = gds->tokenp[2].value;
+ gds->Seconds = 0;
+ gds->tokenp += 3;
+ }
+ else if (gds->tokenp[0].token == tUNUMBER
+ && gds->tokenp[1].token == tAMPM) {
+ /* "7" is a time if it's followed by "am" or "pm" */
+ ++gds->HaveTime;
+ gds->Hour = gds->tokenp[0].value;
+ gds->Minutes = gds->Seconds = 0;
+ /* We'll handle the AM/PM below. */
+ gds->tokenp += 1;
+ } else {
+ /* We can't handle this. */
+ return 0;
+ }
+
+ if (gds->tokenp[0].token == tAMPM) {
+ /* "7:12pm", "12:20:13am" */
+ if (gds->Hour == 12)
+ gds->Hour = 0;
+ if (gds->tokenp[0].value == tPM)
+ gds->Hour += 12;
+ gds->tokenp += 1;
+ }
+ if (gds->tokenp[0].token == '+'
+ && gds->tokenp[1].token == tUNUMBER) {
+ /* "7:14+0700" */
+ gds->HaveZone++;
+ gds->DSTmode = DSToff;
+ gds->Timezone = - ((gds->tokenp[1].value / 100) * HOUR
+ + (gds->tokenp[1].value % 100) * MINUTE);
+ gds->tokenp += 2;
+ }
+ if (gds->tokenp[0].token == '-'
+ && gds->tokenp[1].token == tUNUMBER) {
+ /* "19:14:12-0530" */
+ gds->HaveZone++;
+ gds->DSTmode = DSToff;
+ gds->Timezone = + ((gds->tokenp[1].value / 100) * HOUR
+ + (gds->tokenp[1].value % 100) * MINUTE);
+ gds->tokenp += 2;
+ }
+ return 1;
+}
+
+/*
+ * Timezone name, possibly including DST.
+ */
+static int
+zonephrase(struct gdstate *gds)
+{
+ if (gds->tokenp[0].token == tZONE
+ && gds->tokenp[1].token == tDST) {
+ gds->HaveZone++;
+ gds->Timezone = gds->tokenp[0].value;
+ gds->DSTmode = DSTon;
+ gds->tokenp += 1;
+ return 1;
+ }
+
+ if (gds->tokenp[0].token == tZONE) {
+ gds->HaveZone++;
+ gds->Timezone = gds->tokenp[0].value;
+ gds->DSTmode = DSToff;
+ gds->tokenp += 1;
+ return 1;
+ }
+
+ if (gds->tokenp[0].token == tDAYZONE) {
+ gds->HaveZone++;
+ gds->Timezone = gds->tokenp[0].value;
+ gds->DSTmode = DSTon;
+ gds->tokenp += 1;
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ * Year/month/day in various combinations.
+ */
+static int
+datephrase(struct gdstate *gds)
+{
+ if (gds->tokenp[0].token == tUNUMBER
+ && gds->tokenp[1].token == '/'
+ && gds->tokenp[2].token == tUNUMBER
+ && gds->tokenp[3].token == '/'
+ && gds->tokenp[4].token == tUNUMBER) {
+ gds->HaveYear++;
+ gds->HaveMonth++;
+ gds->HaveDay++;
+ if (gds->tokenp[0].value >= 13) {
+ /* First number is big: 2004/01/29, 99/02/17 */
+ gds->Year = gds->tokenp[0].value;
+ gds->Month = gds->tokenp[2].value;
+ gds->Day = gds->tokenp[4].value;
+ } else if ((gds->tokenp[4].value >= 13)
+ || (gds->tokenp[2].value >= 13)) {
+ /* Last number is big: 01/07/98 */
+ /* Middle number is big: 01/29/04 */
+ gds->Month = gds->tokenp[0].value;
+ gds->Day = gds->tokenp[2].value;
+ gds->Year = gds->tokenp[4].value;
+ } else {
+ /* No significant clues: 02/03/04 */
+ gds->Month = gds->tokenp[0].value;
+ gds->Day = gds->tokenp[2].value;
+ gds->Year = gds->tokenp[4].value;
+ }
+ gds->tokenp += 5;
+ return 1;
+ }
+
+ if (gds->tokenp[0].token == tUNUMBER
+ && gds->tokenp[1].token == '/'
+ && gds->tokenp[2].token == tUNUMBER) {
+ /* "1/15" */
+ gds->HaveMonth++;
+ gds->HaveDay++;
+ gds->Month = gds->tokenp[0].value;
+ gds->Day = gds->tokenp[2].value;
+ gds->tokenp += 3;
+ return 1;
+ }
+
+ if (gds->tokenp[0].token == tUNUMBER
+ && gds->tokenp[1].token == '-'
+ && gds->tokenp[2].token == tUNUMBER
+ && gds->tokenp[3].token == '-'
+ && gds->tokenp[4].token == tUNUMBER) {
+ /* ISO 8601 format. yyyy-mm-dd. */
+ gds->HaveYear++;
+ gds->HaveMonth++;
+ gds->HaveDay++;
+ gds->Year = gds->tokenp[0].value;
+ gds->Month = gds->tokenp[2].value;
+ gds->Day = gds->tokenp[4].value;
+ gds->tokenp += 5;
+ return 1;
+ }
+
+ if (gds->tokenp[0].token == tUNUMBER
+ && gds->tokenp[1].token == '-'
+ && gds->tokenp[2].token == tMONTH
+ && gds->tokenp[3].token == '-'
+ && gds->tokenp[4].token == tUNUMBER) {
+ gds->HaveYear++;
+ gds->HaveMonth++;
+ gds->HaveDay++;
+ if (gds->tokenp[0].value > 31) {
+ /* e.g. 1992-Jun-17 */
+ gds->Year = gds->tokenp[0].value;
+ gds->Month = gds->tokenp[2].value;
+ gds->Day = gds->tokenp[4].value;
+ } else {
+ /* e.g. 17-JUN-1992. */
+ gds->Day = gds->tokenp[0].value;
+ gds->Month = gds->tokenp[2].value;
+ gds->Year = gds->tokenp[4].value;
+ }
+ gds->tokenp += 5;
+ return 1;
+ }
+
+ if (gds->tokenp[0].token == tMONTH
+ && gds->tokenp[1].token == tUNUMBER
+ && gds->tokenp[2].token == ','
+ && gds->tokenp[3].token == tUNUMBER) {
+ /* "June 17, 2001" */
+ gds->HaveYear++;
+ gds->HaveMonth++;
+ gds->HaveDay++;
+ gds->Month = gds->tokenp[0].value;
+ gds->Day = gds->tokenp[1].value;
+ gds->Year = gds->tokenp[3].value;
+ gds->tokenp += 4;
+ return 1;
+ }
+
+ if (gds->tokenp[0].token == tMONTH
+ && gds->tokenp[1].token == tUNUMBER) {
+ /* "May 3" */
+ gds->HaveMonth++;
+ gds->HaveDay++;
+ gds->Month = gds->tokenp[0].value;
+ gds->Day = gds->tokenp[1].value;
+ gds->tokenp += 2;
+ return 1;
+ }
+
+ if (gds->tokenp[0].token == tUNUMBER
+ && gds->tokenp[1].token == tMONTH
+ && gds->tokenp[2].token == tUNUMBER) {
+ /* "12 Sept 1997" */
+ gds->HaveYear++;
+ gds->HaveMonth++;
+ gds->HaveDay++;
+ gds->Day = gds->tokenp[0].value;
+ gds->Month = gds->tokenp[1].value;
+ gds->Year = gds->tokenp[2].value;
+ gds->tokenp += 3;
+ return 1;
+ }
+
+ if (gds->tokenp[0].token == tUNUMBER
+ && gds->tokenp[1].token == tMONTH) {
+ /* "12 Sept" */
+ gds->HaveMonth++;
+ gds->HaveDay++;
+ gds->Day = gds->tokenp[0].value;
+ gds->Month = gds->tokenp[1].value;
+ gds->tokenp += 2;
+ return 1;
+ }
+
+ return 0;
+}
+
+/*
+ * Relative time phrase: "tomorrow", "yesterday", "+1 hour", etc.
+ */
+static int
+relunitphrase(struct gdstate *gds)
+{
+ if (gds->tokenp[0].token == '-'
+ && gds->tokenp[1].token == tUNUMBER
+ && gds->tokenp[2].token == tSEC_UNIT) {
+ /* "-3 hours" */
+ gds->HaveRel++;
+ gds->RelSeconds -= gds->tokenp[1].value * gds->tokenp[2].value;
+ gds->tokenp += 3;
+ return 1;
+ }
+ if (gds->tokenp[0].token == '+'
+ && gds->tokenp[1].token == tUNUMBER
+ && gds->tokenp[2].token == tSEC_UNIT) {
+ /* "+1 minute" */
+ gds->HaveRel++;
+ gds->RelSeconds += gds->tokenp[1].value * gds->tokenp[2].value;
+ gds->tokenp += 3;
+ return 1;
+ }
+ if (gds->tokenp[0].token == tUNUMBER
+ && gds->tokenp[1].token == tSEC_UNIT) {
+ /* "1 day" */
+ gds->HaveRel++;
+ gds->RelSeconds += gds->tokenp[1].value * gds->tokenp[2].value;
+ gds->tokenp += 3;
+ return 1;
+ }
+ if (gds->tokenp[0].token == '-'
+ && gds->tokenp[1].token == tUNUMBER
+ && gds->tokenp[2].token == tMONTH_UNIT) {
+ /* "-3 months" */
+ gds->HaveRel++;
+ gds->RelMonth -= gds->tokenp[1].value * gds->tokenp[2].value;
+ gds->tokenp += 3;
+ return 1;
+ }
+ if (gds->tokenp[0].token == '+'
+ && gds->tokenp[1].token == tUNUMBER
+ && gds->tokenp[2].token == tMONTH_UNIT) {
+ /* "+5 years" */
+ gds->HaveRel++;
+ gds->RelMonth += gds->tokenp[1].value * gds->tokenp[2].value;
+ gds->tokenp += 3;
+ return 1;
+ }
+ if (gds->tokenp[0].token == tUNUMBER
+ && gds->tokenp[1].token == tMONTH_UNIT) {
+ /* "2 years" */
+ gds->HaveRel++;
+ gds->RelMonth += gds->tokenp[0].value * gds->tokenp[1].value;
+ gds->tokenp += 2;
+ return 1;
+ }
+ if (gds->tokenp[0].token == tSEC_UNIT) {
+ /* "now", "tomorrow" */
+ gds->HaveRel++;
+ gds->RelSeconds += gds->tokenp[0].value;
+ ++gds->tokenp;
+ return 1;
+ }
+ if (gds->tokenp[0].token == tMONTH_UNIT) {
+ /* "month" */
+ gds->HaveRel++;
+ gds->RelMonth += gds->tokenp[0].value;
+ gds->tokenp += 1;
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ * Day of the week specification.
+ */
+static int
+dayphrase(struct gdstate *gds)
+{
+ if (gds->tokenp[0].token == tDAY) {
+ /* "tues", "wednesday," */
+ gds->HaveWeekDay++;
+ gds->DayOrdinal = 1;
+ gds->DayNumber = gds->tokenp[0].value;
+ gds->tokenp += 1;
+ if (gds->tokenp[0].token == ',')
+ gds->tokenp += 1;
+ return 1;
+ }
+ if (gds->tokenp[0].token == tUNUMBER
+ && gds->tokenp[1].token == tDAY) {
+ /* "second tues" "3 wed" */
+ gds->HaveWeekDay++;
+ gds->DayOrdinal = gds->tokenp[0].value;
+ gds->DayNumber = gds->tokenp[1].value;
+ gds->tokenp += 2;
+ return 1;
+ }
+ return 0;
+}
+
+/*
+ * Try to match a phrase using one of the above functions.
+ * This layer also deals with a couple of generic issues.
+ */
+static int
+phrase(struct gdstate *gds)
+{
+ if (timephrase(gds))
+ return 1;
+ if (zonephrase(gds))
+ return 1;
+ if (datephrase(gds))
+ return 1;
+ if (dayphrase(gds))
+ return 1;
+ if (relunitphrase(gds)) {
+ if (gds->tokenp[0].token == tAGO) {
+ gds->RelSeconds = -gds->RelSeconds;
+ gds->RelMonth = -gds->RelMonth;
+ gds->tokenp += 1;
+ }
+ return 1;
+ }
+
+ /* Bare numbers sometimes have meaning. */
+ if (gds->tokenp[0].token == tUNUMBER) {
+ if (gds->HaveTime && !gds->HaveYear && !gds->HaveRel) {
+ gds->HaveYear++;
+ gds->Year = gds->tokenp[0].value;
+ gds->tokenp += 1;
+ return 1;
+ }
+
+ if(gds->tokenp[0].value > 10000) {
+ /* "20040301" */
+ gds->HaveYear++;
+ gds->HaveMonth++;
+ gds->HaveDay++;
+ gds->Day= (gds->tokenp[0].value)%100;
+ gds->Month= (gds->tokenp[0].value/100)%100;
+ gds->Year = gds->tokenp[0].value/10000;
+ gds->tokenp += 1;
+ return 1;
+ }
+
+ if (gds->tokenp[0].value < 24) {
+ gds->HaveTime++;
+ gds->Hour = gds->tokenp[0].value;
+ gds->Minutes = 0;
+ gds->Seconds = 0;
+ gds->tokenp += 1;
+ return 1;
+ }
+
+ if ((gds->tokenp[0].value / 100 < 24)
+ && (gds->tokenp[0].value % 100 < 60)) {
+ /* "513" is same as "5:13" */
+ gds->Hour = gds->tokenp[0].value / 100;
+ gds->Minutes = gds->tokenp[0].value % 100;
+ gds->Seconds = 0;
+ gds->tokenp += 1;
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
+/*
+ * A dictionary of time words.
+ */
+static struct LEXICON {
+ size_t abbrev;
+ const char *name;
+ int type;
+ time_t value;
+} const TimeWords[] = {
+ /* am/pm */
+ { 0, "am", tAMPM, tAM },
+ { 0, "pm", tAMPM, tPM },
+
+ /* Month names. */
+ { 3, "january", tMONTH, 1 },
+ { 3, "february", tMONTH, 2 },
+ { 3, "march", tMONTH, 3 },
+ { 3, "april", tMONTH, 4 },
+ { 3, "may", tMONTH, 5 },
+ { 3, "june", tMONTH, 6 },
+ { 3, "july", tMONTH, 7 },
+ { 3, "august", tMONTH, 8 },
+ { 3, "september", tMONTH, 9 },
+ { 3, "october", tMONTH, 10 },
+ { 3, "november", tMONTH, 11 },
+ { 3, "december", tMONTH, 12 },
+
+ /* Days of the week. */
+ { 2, "sunday", tDAY, 0 },
+ { 3, "monday", tDAY, 1 },
+ { 2, "tuesday", tDAY, 2 },
+ { 3, "wednesday", tDAY, 3 },
+ { 2, "thursday", tDAY, 4 },
+ { 2, "friday", tDAY, 5 },
+ { 2, "saturday", tDAY, 6 },
+
+ /* Timezones: Offsets are in seconds. */
+ { 0, "gmt", tZONE, 0*HOUR }, /* Greenwich Mean */
+ { 0, "ut", tZONE, 0*HOUR }, /* Universal (Coordinated) */
+ { 0, "utc", tZONE, 0*HOUR },
+ { 0, "wet", tZONE, 0*HOUR }, /* Western European */
+ { 0, "bst", tDAYZONE, 0*HOUR }, /* British Summer */
+ { 0, "wat", tZONE, 1*HOUR }, /* West Africa */
+ { 0, "at", tZONE, 2*HOUR }, /* Azores */
+ /* { 0, "bst", tZONE, 3*HOUR }, */ /* Brazil Standard: Conflict */
+ /* { 0, "gst", tZONE, 3*HOUR }, */ /* Greenland Standard: Conflict*/
+ { 0, "nft", tZONE, 3*HOUR+30*MINUTE }, /* Newfoundland */
+ { 0, "nst", tZONE, 3*HOUR+30*MINUTE }, /* Newfoundland Standard */
+ { 0, "ndt", tDAYZONE, 3*HOUR+30*MINUTE }, /* Newfoundland Daylight */
+ { 0, "ast", tZONE, 4*HOUR }, /* Atlantic Standard */
+ { 0, "adt", tDAYZONE, 4*HOUR }, /* Atlantic Daylight */
+ { 0, "est", tZONE, 5*HOUR }, /* Eastern Standard */
+ { 0, "edt", tDAYZONE, 5*HOUR }, /* Eastern Daylight */
+ { 0, "cst", tZONE, 6*HOUR }, /* Central Standard */
+ { 0, "cdt", tDAYZONE, 6*HOUR }, /* Central Daylight */
+ { 0, "mst", tZONE, 7*HOUR }, /* Mountain Standard */
+ { 0, "mdt", tDAYZONE, 7*HOUR }, /* Mountain Daylight */
+ { 0, "pst", tZONE, 8*HOUR }, /* Pacific Standard */
+ { 0, "pdt", tDAYZONE, 8*HOUR }, /* Pacific Daylight */
+ { 0, "yst", tZONE, 9*HOUR }, /* Yukon Standard */
+ { 0, "ydt", tDAYZONE, 9*HOUR }, /* Yukon Daylight */
+ { 0, "hst", tZONE, 10*HOUR }, /* Hawaii Standard */
+ { 0, "hdt", tDAYZONE, 10*HOUR }, /* Hawaii Daylight */
+ { 0, "cat", tZONE, 10*HOUR }, /* Central Alaska */
+ { 0, "ahst", tZONE, 10*HOUR }, /* Alaska-Hawaii Standard */
+ { 0, "nt", tZONE, 11*HOUR }, /* Nome */
+ { 0, "idlw", tZONE, 12*HOUR }, /* Intl Date Line West */
+ { 0, "cet", tZONE, -1*HOUR }, /* Central European */
+ { 0, "met", tZONE, -1*HOUR }, /* Middle European */
+ { 0, "mewt", tZONE, -1*HOUR }, /* Middle European Winter */
+ { 0, "mest", tDAYZONE, -1*HOUR }, /* Middle European Summer */
+ { 0, "swt", tZONE, -1*HOUR }, /* Swedish Winter */
+ { 0, "sst", tDAYZONE, -1*HOUR }, /* Swedish Summer */
+ { 0, "fwt", tZONE, -1*HOUR }, /* French Winter */
+ { 0, "fst", tDAYZONE, -1*HOUR }, /* French Summer */
+ { 0, "eet", tZONE, -2*HOUR }, /* Eastern Eur, USSR Zone 1 */
+ { 0, "bt", tZONE, -3*HOUR }, /* Baghdad, USSR Zone 2 */
+ { 0, "it", tZONE, -3*HOUR-30*MINUTE },/* Iran */
+ { 0, "zp4", tZONE, -4*HOUR }, /* USSR Zone 3 */
+ { 0, "zp5", tZONE, -5*HOUR }, /* USSR Zone 4 */
+ { 0, "ist", tZONE, -5*HOUR-30*MINUTE },/* Indian Standard */
+ { 0, "zp6", tZONE, -6*HOUR }, /* USSR Zone 5 */
+ /* { 0, "nst", tZONE, -6.5*HOUR }, */ /* North Sumatra: Conflict */
+ /* { 0, "sst", tZONE, -7*HOUR }, */ /* So Sumatra, USSR 6: Conflict */
+ { 0, "wast", tZONE, -7*HOUR }, /* West Australian Standard */
+ { 0, "wadt", tDAYZONE, -7*HOUR }, /* West Australian Daylight */
+ { 0, "jt", tZONE, -7*HOUR-30*MINUTE },/* Java (3pm in Cronusland!)*/
+ { 0, "cct", tZONE, -8*HOUR }, /* China Coast, USSR Zone 7 */
+ { 0, "jst", tZONE, -9*HOUR }, /* Japan Std, USSR Zone 8 */
+ { 0, "cast", tZONE, -9*HOUR-30*MINUTE },/* Ctrl Australian Std */
+ { 0, "cadt", tDAYZONE, -9*HOUR-30*MINUTE },/* Ctrl Australian Daylt */
+ { 0, "east", tZONE, -10*HOUR }, /* Eastern Australian Std */
+ { 0, "eadt", tDAYZONE, -10*HOUR }, /* Eastern Australian Daylt */
+ { 0, "gst", tZONE, -10*HOUR }, /* Guam Std, USSR Zone 9 */
+ { 0, "nzt", tZONE, -12*HOUR }, /* New Zealand */
+ { 0, "nzst", tZONE, -12*HOUR }, /* New Zealand Standard */
+ { 0, "nzdt", tDAYZONE, -12*HOUR }, /* New Zealand Daylight */
+ { 0, "idle", tZONE, -12*HOUR }, /* Intl Date Line East */
+
+ { 0, "dst", tDST, 0 },
+
+ /* Time units. */
+ { 4, "years", tMONTH_UNIT, 12 },
+ { 5, "months", tMONTH_UNIT, 1 },
+ { 9, "fortnights", tSEC_UNIT, 14 * DAY },
+ { 4, "weeks", tSEC_UNIT, 7 * DAY },
+ { 3, "days", tSEC_UNIT, DAY },
+ { 4, "hours", tSEC_UNIT, HOUR },
+ { 3, "minutes", tSEC_UNIT, MINUTE },
+ { 3, "seconds", tSEC_UNIT, 1 },
+
+ /* Relative-time words. */
+ { 0, "tomorrow", tSEC_UNIT, DAY },
+ { 0, "yesterday", tSEC_UNIT, -DAY },
+ { 0, "today", tSEC_UNIT, 0 },
+ { 0, "now", tSEC_UNIT, 0 },
+ { 0, "last", tUNUMBER, -1 },
+ { 0, "this", tSEC_UNIT, 0 },
+ { 0, "next", tUNUMBER, 2 },
+ { 0, "first", tUNUMBER, 1 },
+ { 0, "1st", tUNUMBER, 1 },
+/* { 0, "second", tUNUMBER, 2 }, */
+ { 0, "2nd", tUNUMBER, 2 },
+ { 0, "third", tUNUMBER, 3 },
+ { 0, "3rd", tUNUMBER, 3 },
+ { 0, "fourth", tUNUMBER, 4 },
+ { 0, "4th", tUNUMBER, 4 },
+ { 0, "fifth", tUNUMBER, 5 },
+ { 0, "5th", tUNUMBER, 5 },
+ { 0, "sixth", tUNUMBER, 6 },
+ { 0, "seventh", tUNUMBER, 7 },
+ { 0, "eighth", tUNUMBER, 8 },
+ { 0, "ninth", tUNUMBER, 9 },
+ { 0, "tenth", tUNUMBER, 10 },
+ { 0, "eleventh", tUNUMBER, 11 },
+ { 0, "twelfth", tUNUMBER, 12 },
+ { 0, "ago", tAGO, 1 },
+
+ /* Military timezones. */
+ { 0, "a", tZONE, 1*HOUR },
+ { 0, "b", tZONE, 2*HOUR },
+ { 0, "c", tZONE, 3*HOUR },
+ { 0, "d", tZONE, 4*HOUR },
+ { 0, "e", tZONE, 5*HOUR },
+ { 0, "f", tZONE, 6*HOUR },
+ { 0, "g", tZONE, 7*HOUR },
+ { 0, "h", tZONE, 8*HOUR },
+ { 0, "i", tZONE, 9*HOUR },
+ { 0, "k", tZONE, 10*HOUR },
+ { 0, "l", tZONE, 11*HOUR },
+ { 0, "m", tZONE, 12*HOUR },
+ { 0, "n", tZONE, -1*HOUR },
+ { 0, "o", tZONE, -2*HOUR },
+ { 0, "p", tZONE, -3*HOUR },
+ { 0, "q", tZONE, -4*HOUR },
+ { 0, "r", tZONE, -5*HOUR },
+ { 0, "s", tZONE, -6*HOUR },
+ { 0, "t", tZONE, -7*HOUR },
+ { 0, "u", tZONE, -8*HOUR },
+ { 0, "v", tZONE, -9*HOUR },
+ { 0, "w", tZONE, -10*HOUR },
+ { 0, "x", tZONE, -11*HOUR },
+ { 0, "y", tZONE, -12*HOUR },
+ { 0, "z", tZONE, 0*HOUR },
+
+ /* End of table. */
+ { 0, NULL, 0, 0 }
+};
+
+/*
+ * Year is either:
+ * = A number from 0 to 99, which means a year from 1970 to 2069, or
+ * = The actual year (>=100).
+ */
+static time_t
+Convert(time_t Month, time_t Day, time_t Year,
+ time_t Hours, time_t Minutes, time_t Seconds,
+ time_t Timezone, enum DSTMODE DSTmode)
+{
+ static int DaysInMonth[12] = {
+ 31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
+ };
+ time_t Julian;
+ int i;
+
+ if (Year < 69)
+ Year += 2000;
+ else if (Year < 100)
+ Year += 1900;
+ DaysInMonth[1] = Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0)
+ ? 29 : 28;
+ /* Checking for 2038 bogusly assumes that time_t is 32 bits. But
+ I'm too lazy to try to check for time_t overflow in another way. */
+ if (Year < EPOCH || Year > 2038
+ || Month < 1 || Month > 12
+ /* Lint fluff: "conversion from long may lose accuracy" */
+ || Day < 1 || Day > DaysInMonth[(int)--Month]
+ || Hours < 0 || Hours > 23
+ || Minutes < 0 || Minutes > 59
+ || Seconds < 0 || Seconds > 59)
+ return -1;
+
+ Julian = Day - 1;
+ for (i = 0; i < Month; i++)
+ Julian += DaysInMonth[i];
+ for (i = EPOCH; i < Year; i++)
+ Julian += 365 + (i % 4 == 0);
+ Julian *= DAY;
+ Julian += Timezone;
+ Julian += Hours * HOUR + Minutes * MINUTE + Seconds;
+ if (DSTmode == DSTon
+ || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst))
+ Julian -= HOUR;
+ return Julian;
+}
+
+
+static time_t
+DSTcorrect(time_t Start, time_t Future)
+{
+ time_t StartDay;
+ time_t FutureDay;
+
+ StartDay = (localtime(&Start)->tm_hour + 1) % 24;
+ FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
+ return (Future - Start) + (StartDay - FutureDay) * HOUR;
+}
+
+
+static time_t
+RelativeDate(time_t Start, time_t zone, int dstmode,
+ time_t DayOrdinal, time_t DayNumber)
+{
+ struct tm *tm;
+ time_t t, now;
+
+ t = Start - zone;
+ tm = gmtime(&t);
+ now = Start;
+ now += DAY * ((DayNumber - tm->tm_wday + 7) % 7);
+ now += 7 * DAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1);
+ if (dstmode == DSTmaybe)
+ return DSTcorrect(Start, now);
+ return now - Start;
+}
+
+
+static time_t
+RelativeMonth(time_t Start, time_t Timezone, time_t RelMonth)
+{
+ struct tm *tm;
+ time_t Month;
+ time_t Year;
+
+ if (RelMonth == 0)
+ return 0;
+ tm = localtime(&Start);
+ Month = 12 * (tm->tm_year + 1900) + tm->tm_mon + RelMonth;
+ Year = Month / 12;
+ Month = Month % 12 + 1;
+ return DSTcorrect(Start,
+ Convert(Month, (time_t)tm->tm_mday, Year,
+ (time_t)tm->tm_hour, (time_t)tm->tm_min, (time_t)tm->tm_sec,
+ Timezone, DSTmaybe));
+}
+
+/*
+ * Tokenizer.
+ */
+static int
+nexttoken(char **in, time_t *value)
+{
+ char c;
+ char buff[64];
+
+ for ( ; ; ) {
+ while (isspace((unsigned char)**in))
+ ++*in;
+
+ /* Skip parenthesized comments. */
+ if (**in == '(') {
+ int Count = 0;
+ do {
+ c = *(*in)++;
+ if (c == '\0')
+ return c;
+ if (c == '(')
+ Count++;
+ else if (c == ')')
+ Count--;
+ } while (Count > 0);
+ continue;
+ }
+
+ /* Try the next token in the word table first. */
+ /* This allows us to match "2nd", for example. */
+ {
+ char *src = *in;
+ const struct LEXICON *tp;
+ unsigned i = 0;
+
+ /* Force to lowercase and strip '.' characters. */
+ while (*src != '\0'
+ && (isalnum((unsigned char)*src) || *src == '.')
+ && i < sizeof(buff)-1) {
+ if (*src != '.') {
+ if (isupper((unsigned char)*src))
+ buff[i++] = tolower((unsigned char)*src);
+ else
+ buff[i++] = *src;
+ }
+ src++;
+ }
+ buff[i] = '\0';
+
+ /*
+ * Find the first match. If the word can be
+ * abbreviated, make sure we match at least
+ * the minimum abbreviation.
+ */
+ for (tp = TimeWords; tp->name; tp++) {
+ size_t abbrev = tp->abbrev;
+ if (abbrev == 0)
+ abbrev = strlen(tp->name);
+ if (strlen(buff) >= abbrev
+ && strncmp(tp->name, buff, strlen(buff))
+ == 0) {
+ /* Skip over token. */
+ *in = src;
+ /* Return the match. */
+ *value = tp->value;
+ return tp->type;
+ }
+ }
+ }
+
+ /*
+ * Not in the word table, maybe it's a number. Note:
+ * Because '-' and '+' have other special meanings, I
+ * don't deal with signed numbers here.
+ */
+ if (isdigit((unsigned char)(c = **in))) {
+ for (*value = 0; isdigit((unsigned char)(c = *(*in)++)); )
+ *value = 10 * *value + c - '0';
+ (*in)--;
+ return (tUNUMBER);
+ }
+
+ return *(*in)++;
+ }
+}
+
+#define TM_YEAR_ORIGIN 1900
+
+/* Yield A - B, measured in seconds. */
+static long
+difftm (struct tm *a, struct tm *b)
+{
+ int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
+ int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
+ int days = (
+ /* difference in day of year */
+ a->tm_yday - b->tm_yday
+ /* + intervening leap days */
+ + ((ay >> 2) - (by >> 2))
+ - (ay/100 - by/100)
+ + ((ay/100 >> 2) - (by/100 >> 2))
+ /* + difference in years * 365 */
+ + (long)(ay-by) * 365
+ );
+ return (days * DAY + (a->tm_hour - b->tm_hour) * HOUR
+ + (a->tm_min - b->tm_min) * MINUTE
+ + (a->tm_sec - b->tm_sec));
+}
+
+/*
+ *
+ * The public function.
+ *
+ * TODO: tokens[] array should be dynamically sized.
+ */
+time_t
+get_date(time_t now, char *p)
+{
+ struct token tokens[256];
+ struct gdstate _gds;
+ struct token *lasttoken;
+ struct gdstate *gds;
+ struct tm local, *tm;
+ struct tm gmt, *gmt_ptr;
+ time_t Start;
+ time_t tod;
+ long tzone;
+
+ /* Clear out the parsed token array. */
+ memset(tokens, 0, sizeof(tokens));
+ /* Initialize the parser state. */
+ memset(&_gds, 0, sizeof(_gds));
+ gds = &_gds;
+
+ /* Look up the current time. */
+ memset(&local, 0, sizeof(local));
+ tm = localtime (&now);
+ if (tm == NULL)
+ return -1;
+ local = *tm;
+
+ /* Look up UTC if we can and use that to determine the current
+ * timezone offset. */
+ memset(&gmt, 0, sizeof(gmt));
+ gmt_ptr = gmtime (&now);
+ if (gmt_ptr != NULL) {
+ /* Copy, in case localtime and gmtime use the same buffer. */
+ gmt = *gmt_ptr;
+ }
+ if (gmt_ptr != NULL)
+ tzone = difftm (&gmt, &local);
+ else
+ /* This system doesn't understand timezones; fake it. */
+ tzone = 0;
+ if(local.tm_isdst)
+ tzone += HOUR;
+
+ /* Tokenize the input string. */
+ lasttoken = tokens;
+ while ((lasttoken->token = nexttoken(&p, &lasttoken->value)) != 0) {
+ ++lasttoken;
+ if (lasttoken > tokens + 255)
+ return -1;
+ }
+ gds->tokenp = tokens;
+
+ /* Match phrases until we run out of input tokens. */
+ while (gds->tokenp < lasttoken) {
+ if (!phrase(gds))
+ return -1;
+ }
+
+ /* Use current local timezone if none was specified. */
+ if (!gds->HaveZone) {
+ gds->Timezone = tzone;
+ gds->DSTmode = DSTmaybe;
+ }
+
+ /* If a timezone was specified, use that for generating the default
+ * time components instead of the local timezone. */
+ if (gds->HaveZone && gmt_ptr != NULL) {
+ now -= gds->Timezone;
+ gmt_ptr = gmtime (&now);
+ if (gmt_ptr != NULL)
+ local = *gmt_ptr;
+ now += gds->Timezone;
+ }
+
+ if (!gds->HaveYear)
+ gds->Year = local.tm_year + 1900;
+ if (!gds->HaveMonth)
+ gds->Month = local.tm_mon + 1;
+ if (!gds->HaveDay)
+ gds->Day = local.tm_mday;
+ /* Note: No default for hour/min/sec; a specifier that just
+ * gives date always refers to 00:00 on that date. */
+
+ /* If we saw more than one time, timezone, weekday, year, month,
+ * or day, then give up. */
+ if (gds->HaveTime > 1 || gds->HaveZone > 1 || gds->HaveWeekDay > 1
+ || gds->HaveYear > 1 || gds->HaveMonth > 1 || gds->HaveDay > 1)
+ return -1;
+
+ /* Compute an absolute time based on whatever absolute information
+ * we collected. */
+ if (gds->HaveYear || gds->HaveMonth || gds->HaveDay
+ || gds->HaveTime || gds->HaveWeekDay) {
+ Start = Convert(gds->Month, gds->Day, gds->Year,
+ gds->Hour, gds->Minutes, gds->Seconds,
+ gds->Timezone, gds->DSTmode);
+ if (Start < 0)
+ return -1;
+ } else {
+ Start = now;
+ if (!gds->HaveRel)
+ Start -= local.tm_hour * HOUR + local.tm_min * MINUTE
+ + local.tm_sec;
+ }
+
+ /* Add the relative offset. */
+ Start += gds->RelSeconds;
+ Start += RelativeMonth(Start, gds->Timezone, gds->RelMonth);
+
+ /* Adjust for day-of-week offsets. */
+ if (gds->HaveWeekDay
+ && !(gds->HaveYear || gds->HaveMonth || gds->HaveDay)) {
+ tod = RelativeDate(Start, gds->Timezone,
+ gds->DSTmode, gds->DayOrdinal, gds->DayNumber);
+ Start += tod;
+ }
+
+ /* -1 is an error indicator, so return 0 instead of -1 if
+ * that's the actual time. */
+ return Start == -1 ? 0 : Start;
+}
+
+
+#if defined(TEST)
+
+/* ARGSUSED */
+int
+main(int argc, char **argv)
+{
+ time_t d;
+
+ while (*++argv != NULL) {
+ (void)printf("Input: %s\n", *argv);
+ d = get_date(*argv);
+ if (d == -1)
+ (void)printf("Bad format - couldn't convert.\n");
+ else
+ (void)printf("Output: %s\n", ctime(&d));
+ }
+ exit(0);
+ /* NOTREACHED */
+}
+#endif /* defined(TEST) */
diff --git a/archivers/libarchive/files/tar/read.c b/archivers/libarchive/files/tar/read.c
new file mode 100644
index 00000000000..aaaacac0dca
--- /dev/null
+++ b/archivers/libarchive/files/tar/read.c
@@ -0,0 +1,437 @@
+/*-
+ * 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 "bsdtar_platform.h"
+__FBSDID("$FreeBSD: src/usr.bin/tar/read.c,v 1.40 2008/08/21 06:41:14 kientzle Exp $");
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "bsdtar.h"
+#include "err.h"
+
+struct progress_data {
+ struct bsdtar *bsdtar;
+ struct archive *archive;
+ struct archive_entry *entry;
+};
+
+static void list_item_verbose(struct bsdtar *, FILE *,
+ struct archive_entry *);
+static void read_archive(struct bsdtar *bsdtar, char mode);
+
+void
+tar_mode_t(struct bsdtar *bsdtar)
+{
+ read_archive(bsdtar, 't');
+ if (lafe_unmatched_inclusions_warn(bsdtar->matching, "Not found in archive") != 0)
+ bsdtar->return_value = 1;
+}
+
+void
+tar_mode_x(struct bsdtar *bsdtar)
+{
+ read_archive(bsdtar, 'x');
+
+ if (lafe_unmatched_inclusions_warn(bsdtar->matching, "Not found in archive") != 0)
+ bsdtar->return_value = 1;
+}
+
+static void
+progress_func(void *cookie)
+{
+ struct progress_data *progress_data = cookie;
+ struct bsdtar *bsdtar = progress_data->bsdtar;
+ struct archive *a = progress_data->archive;
+ struct archive_entry *entry = progress_data->entry;
+ uint64_t comp, uncomp;
+
+ if (!need_report())
+ return;
+
+ if (bsdtar->verbose)
+ fprintf(stderr, "\n");
+ if (a != NULL) {
+ comp = archive_position_compressed(a);
+ uncomp = archive_position_uncompressed(a);
+ fprintf(stderr,
+ "In: %s bytes, compression %d%%;",
+ tar_i64toa(comp), (int)((uncomp - comp) * 100 / uncomp));
+ fprintf(stderr, " Out: %d files, %s bytes\n",
+ archive_file_count(a), tar_i64toa(uncomp));
+ }
+ if (entry != NULL) {
+ safe_fprintf(stderr, "Current: %s",
+ archive_entry_pathname(entry));
+ fprintf(stderr, " (%s bytes)\n",
+ tar_i64toa(archive_entry_size(entry)));
+ }
+}
+
+/*
+ * Handle 'x' and 't' modes.
+ */
+static void
+read_archive(struct bsdtar *bsdtar, char mode)
+{
+ struct progress_data progress_data;
+ FILE *out;
+ struct archive *a;
+ struct archive_entry *entry;
+ const struct stat *st;
+ int r;
+
+ while (*bsdtar->argv) {
+ lafe_include(&bsdtar->matching, *bsdtar->argv);
+ bsdtar->argv++;
+ }
+
+ if (bsdtar->names_from_file != NULL)
+ lafe_include_from_file(&bsdtar->matching,
+ bsdtar->names_from_file, bsdtar->option_null);
+
+ a = archive_read_new();
+ if (bsdtar->compress_program != NULL)
+ archive_read_support_compression_program(a, bsdtar->compress_program);
+ else
+ archive_read_support_compression_all(a);
+ archive_read_support_format_all(a);
+ if (ARCHIVE_OK != archive_read_set_options(a, bsdtar->option_options))
+ lafe_errc(1, 0, "%s", archive_error_string(a));
+ if (archive_read_open_file(a, bsdtar->filename,
+ bsdtar->bytes_per_block != 0 ? bsdtar->bytes_per_block :
+ DEFAULT_BYTES_PER_BLOCK))
+ lafe_errc(1, 0, "Error opening archive: %s",
+ archive_error_string(a));
+
+ do_chdir(bsdtar);
+
+ if (mode == 'x') {
+ /* Set an extract callback so that we can handle SIGINFO. */
+ progress_data.bsdtar = bsdtar;
+ progress_data.archive = a;
+ archive_read_extract_set_progress_callback(a, progress_func,
+ &progress_data);
+ }
+
+ if (mode == 'x' && bsdtar->option_chroot) {
+#if HAVE_CHROOT
+ if (chroot(".") != 0)
+ lafe_errc(1, errno, "Can't chroot to \".\"");
+#else
+ lafe_errc(1, 0,
+ "chroot isn't supported on this platform");
+#endif
+ }
+
+ for (;;) {
+ /* Support --fast-read option */
+ if (bsdtar->option_fast_read &&
+ lafe_unmatched_inclusions(bsdtar->matching) == 0)
+ break;
+
+ r = archive_read_next_header(a, &entry);
+ progress_data.entry = entry;
+ if (r == ARCHIVE_EOF)
+ break;
+ if (r < ARCHIVE_OK)
+ lafe_warnc(0, "%s", archive_error_string(a));
+ if (r <= ARCHIVE_WARN)
+ bsdtar->return_value = 1;
+ if (r == ARCHIVE_RETRY) {
+ /* Retryable error: try again */
+ lafe_warnc(0, "Retrying...");
+ continue;
+ }
+ if (r == ARCHIVE_FATAL)
+ break;
+
+ if (bsdtar->option_numeric_owner) {
+ archive_entry_set_uname(entry, NULL);
+ archive_entry_set_gname(entry, NULL);
+ }
+
+ /*
+ * Exclude entries that are too old.
+ */
+ st = archive_entry_stat(entry);
+ if (bsdtar->newer_ctime_sec > 0) {
+ if (st->st_ctime < bsdtar->newer_ctime_sec)
+ continue; /* Too old, skip it. */
+ if (st->st_ctime == bsdtar->newer_ctime_sec
+ && ARCHIVE_STAT_CTIME_NANOS(st)
+ <= bsdtar->newer_ctime_nsec)
+ continue; /* Too old, skip it. */
+ }
+ if (bsdtar->newer_mtime_sec > 0) {
+ if (st->st_mtime < bsdtar->newer_mtime_sec)
+ continue; /* Too old, skip it. */
+ if (st->st_mtime == bsdtar->newer_mtime_sec
+ && ARCHIVE_STAT_MTIME_NANOS(st)
+ <= bsdtar->newer_mtime_nsec)
+ continue; /* Too old, skip it. */
+ }
+
+ /*
+ * Note that pattern exclusions are checked before
+ * pathname rewrites are handled. This gives more
+ * control over exclusions, since rewrites always lose
+ * information. (For example, consider a rewrite
+ * s/foo[0-9]/foo/. If we check exclusions after the
+ * rewrite, there would be no way to exclude foo1/bar
+ * while allowing foo2/bar.)
+ */
+ if (lafe_excluded(bsdtar->matching, archive_entry_pathname(entry)))
+ continue; /* Excluded by a pattern test. */
+
+ if (mode == 't') {
+ /* Perversely, gtar uses -O to mean "send to stderr"
+ * when used with -t. */
+ out = bsdtar->option_stdout ? stderr : stdout;
+
+ /*
+ * TODO: Provide some reasonable way to
+ * preview rewrites. gtar always displays
+ * the unedited path in -t output, which means
+ * you cannot easily preview rewrites.
+ */
+ if (bsdtar->verbose < 2)
+ safe_fprintf(out, "%s",
+ archive_entry_pathname(entry));
+ else
+ list_item_verbose(bsdtar, out, entry);
+ fflush(out);
+ r = archive_read_data_skip(a);
+ if (r == ARCHIVE_WARN) {
+ fprintf(out, "\n");
+ lafe_warnc(0, "%s",
+ archive_error_string(a));
+ }
+ if (r == ARCHIVE_RETRY) {
+ fprintf(out, "\n");
+ lafe_warnc(0, "%s",
+ archive_error_string(a));
+ }
+ if (r == ARCHIVE_FATAL) {
+ fprintf(out, "\n");
+ lafe_warnc(0, "%s",
+ archive_error_string(a));
+ bsdtar->return_value = 1;
+ break;
+ }
+ fprintf(out, "\n");
+ } else {
+ /* Note: some rewrite failures prevent extraction. */
+ if (edit_pathname(bsdtar, entry))
+ continue; /* Excluded by a rewrite failure. */
+
+ if (bsdtar->option_interactive &&
+ !yes("extract '%s'", archive_entry_pathname(entry)))
+ continue;
+
+ /*
+ * Format here is from SUSv2, including the
+ * deferred '\n'.
+ */
+ if (bsdtar->verbose) {
+ safe_fprintf(stderr, "x %s",
+ archive_entry_pathname(entry));
+ fflush(stderr);
+ }
+
+ // TODO siginfo_printinfo(bsdtar, 0);
+
+ if (bsdtar->option_stdout)
+ r = archive_read_data_into_fd(a, 1);
+ else
+ r = archive_read_extract(a, entry,
+ bsdtar->extract_flags);
+ if (r != ARCHIVE_OK) {
+ if (!bsdtar->verbose)
+ safe_fprintf(stderr, "%s",
+ archive_entry_pathname(entry));
+ safe_fprintf(stderr, ": %s",
+ archive_error_string(a));
+ if (!bsdtar->verbose)
+ fprintf(stderr, "\n");
+ bsdtar->return_value = 1;
+ }
+ if (bsdtar->verbose)
+ fprintf(stderr, "\n");
+ if (r == ARCHIVE_FATAL)
+ break;
+ }
+ }
+
+
+ r = archive_read_close(a);
+ if (r != ARCHIVE_OK)
+ lafe_warnc(0, "%s", archive_error_string(a));
+ if (r <= ARCHIVE_WARN)
+ bsdtar->return_value = 1;
+
+ if (bsdtar->verbose > 2)
+ fprintf(stdout, "Archive Format: %s, Compression: %s\n",
+ archive_format_name(a), archive_compression_name(a));
+
+ archive_read_finish(a);
+}
+
+
+/*
+ * Display information about the current file.
+ *
+ * The format here roughly duplicates the output of 'ls -l'.
+ * This is based on SUSv2, where 'tar tv' is documented as
+ * listing additional information in an "unspecified format,"
+ * and 'pax -l' is documented as using the same format as 'ls -l'.
+ */
+static void
+list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry)
+{
+ char tmp[100];
+ size_t w;
+ const char *p;
+ const char *fmt;
+ time_t tim;
+ static time_t now;
+
+ /*
+ * We avoid collecting the entire list in memory at once by
+ * listing things as we see them. However, that also means we can't
+ * just pre-compute the field widths. Instead, we start with guesses
+ * and just widen them as necessary. These numbers are completely
+ * arbitrary.
+ */
+ if (!bsdtar->u_width) {
+ bsdtar->u_width = 6;
+ bsdtar->gs_width = 13;
+ }
+ if (!now)
+ time(&now);
+ fprintf(out, "%s %d ",
+ archive_entry_strmode(entry),
+ archive_entry_nlink(entry));
+
+ /* Use uname if it's present, else uid. */
+ p = archive_entry_uname(entry);
+ if ((p == NULL) || (*p == '\0')) {
+ sprintf(tmp, "%lu ",
+ (unsigned long)archive_entry_uid(entry));
+ p = tmp;
+ }
+ w = strlen(p);
+ if (w > bsdtar->u_width)
+ bsdtar->u_width = w;
+ fprintf(out, "%-*s ", (int)bsdtar->u_width, p);
+
+ /* Use gname if it's present, else gid. */
+ p = archive_entry_gname(entry);
+ if (p != NULL && p[0] != '\0') {
+ fprintf(out, "%s", p);
+ w = strlen(p);
+ } else {
+ sprintf(tmp, "%lu",
+ (unsigned long)archive_entry_gid(entry));
+ w = strlen(tmp);
+ fprintf(out, "%s", tmp);
+ }
+
+ /*
+ * Print device number or file size, right-aligned so as to make
+ * total width of group and devnum/filesize fields be gs_width.
+ * If gs_width is too small, grow it.
+ */
+ if (archive_entry_filetype(entry) == AE_IFCHR
+ || archive_entry_filetype(entry) == AE_IFBLK) {
+ sprintf(tmp, "%lu,%lu",
+ (unsigned long)archive_entry_rdevmajor(entry),
+ (unsigned long)archive_entry_rdevminor(entry));
+ } else {
+ strcpy(tmp, tar_i64toa(archive_entry_size(entry)));
+ }
+ if (w + strlen(tmp) >= bsdtar->gs_width)
+ bsdtar->gs_width = w+strlen(tmp)+1;
+ fprintf(out, "%*s", (int)(bsdtar->gs_width - w), tmp);
+
+ /* Format the time using 'ls -l' conventions. */
+ tim = archive_entry_mtime(entry);
+#define HALF_YEAR (time_t)365 * 86400 / 2
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define DAY_FMT "%d" /* Windows' strftime function does not support %e format. */
+#else
+#define DAY_FMT "%e" /* Day number without leading zeros */
+#endif
+ if (tim < now - HALF_YEAR || tim > now + HALF_YEAR)
+ fmt = bsdtar->day_first ? DAY_FMT " %b %Y" : "%b " DAY_FMT " %Y";
+ else
+ fmt = bsdtar->day_first ? DAY_FMT " %b %H:%M" : "%b " DAY_FMT " %H:%M";
+ strftime(tmp, sizeof(tmp), fmt, localtime(&tim));
+ fprintf(out, " %s ", tmp);
+ safe_fprintf(out, "%s", archive_entry_pathname(entry));
+
+ /* Extra information for links. */
+ if (archive_entry_hardlink(entry)) /* Hard link */
+ safe_fprintf(out, " link to %s",
+ archive_entry_hardlink(entry));
+ else if (archive_entry_symlink(entry)) /* Symbolic link */
+ safe_fprintf(out, " -> %s", archive_entry_symlink(entry));
+}
diff --git a/archivers/libarchive/files/tar/subst.c b/archivers/libarchive/files/tar/subst.c
new file mode 100644
index 00000000000..3982054193c
--- /dev/null
+++ b/archivers/libarchive/files/tar/subst.c
@@ -0,0 +1,289 @@
+/*-
+ * Copyright (c) 2008 Joerg Sonnenberger
+ * 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 "bsdtar_platform.h"
+__FBSDID("$FreeBSD: src/usr.bin/tar/subst.c,v 1.4 2008/06/15 10:08:16 kientzle Exp $");
+
+#if HAVE_REGEX_H
+#include "bsdtar.h"
+
+#include <errno.h>
+#include <regex.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef REG_BASIC
+#define REG_BASIC 0
+#endif
+
+#include "err.h"
+
+struct subst_rule {
+ struct subst_rule *next;
+ regex_t re;
+ char *result;
+ unsigned int global:1, print:1, symlink:1;
+};
+
+struct substitution {
+ struct subst_rule *first_rule, *last_rule;
+};
+
+static void
+init_substitution(struct bsdtar *bsdtar)
+{
+ struct substitution *subst;
+
+ bsdtar->substitution = subst = malloc(sizeof(*subst));
+ if (subst == NULL)
+ lafe_errc(1, errno, "Out of memory");
+ subst->first_rule = subst->last_rule = NULL;
+}
+
+void
+add_substitution(struct bsdtar *bsdtar, const char *rule_text)
+{
+ struct subst_rule *rule;
+ struct substitution *subst;
+ const char *end_pattern, *start_subst;
+ char *pattern;
+ int r;
+
+ if ((subst = bsdtar->substitution) == NULL) {
+ init_substitution(bsdtar);
+ subst = bsdtar->substitution;
+ }
+
+ rule = malloc(sizeof(*rule));
+ if (rule == NULL)
+ lafe_errc(1, errno, "Out of memory");
+ rule->next = NULL;
+
+ if (subst->last_rule == NULL)
+ subst->first_rule = rule;
+ else
+ subst->last_rule->next = rule;
+ subst->last_rule = rule;
+
+ if (*rule_text == '\0')
+ lafe_errc(1, 0, "Empty replacement string");
+ end_pattern = strchr(rule_text + 1, *rule_text);
+ if (end_pattern == NULL)
+ lafe_errc(1, 0, "Invalid replacement string");
+
+ pattern = malloc(end_pattern - rule_text);
+ if (pattern == NULL)
+ lafe_errc(1, errno, "Out of memory");
+ memcpy(pattern, rule_text + 1, end_pattern - rule_text - 1);
+ pattern[end_pattern - rule_text - 1] = '\0';
+
+ if ((r = regcomp(&rule->re, pattern, REG_BASIC)) != 0) {
+ char buf[80];
+ regerror(r, &rule->re, buf, sizeof(buf));
+ lafe_errc(1, 0, "Invalid regular expression: %s", buf);
+ }
+ free(pattern);
+
+ start_subst = end_pattern + 1;
+ end_pattern = strchr(start_subst, *rule_text);
+ if (end_pattern == NULL)
+ lafe_errc(1, 0, "Invalid replacement string");
+
+ rule->result = malloc(end_pattern - start_subst + 1);
+ if (rule->result == NULL)
+ lafe_errc(1, errno, "Out of memory");
+ memcpy(rule->result, start_subst, end_pattern - start_subst);
+ rule->result[end_pattern - start_subst] = '\0';
+
+ rule->global = 0;
+ rule->print = 0;
+ rule->symlink = 0;
+
+ while (*++end_pattern) {
+ switch (*end_pattern) {
+ case 'g':
+ case 'G':
+ rule->global = 1;
+ break;
+ case 'p':
+ case 'P':
+ rule->print = 1;
+ break;
+ case 's':
+ case 'S':
+ rule->symlink = 1;
+ break;
+ default:
+ lafe_errc(1, 0, "Invalid replacement flag %c", *end_pattern);
+ }
+ }
+}
+
+static void
+realloc_strncat(char **str, const char *append, size_t len)
+{
+ char *new_str;
+ size_t old_len;
+
+ if (*str == NULL)
+ old_len = 0;
+ else
+ old_len = strlen(*str);
+
+ new_str = malloc(old_len + len + 1);
+ if (new_str == NULL)
+ lafe_errc(1, errno, "Out of memory");
+ memcpy(new_str, *str, old_len);
+ memcpy(new_str + old_len, append, len);
+ new_str[old_len + len] = '\0';
+ free(*str);
+ *str = new_str;
+}
+
+static void
+realloc_strcat(char **str, const char *append)
+{
+ char *new_str;
+ size_t old_len;
+
+ if (*str == NULL)
+ old_len = 0;
+ else
+ old_len = strlen(*str);
+
+ new_str = malloc(old_len + strlen(append) + 1);
+ if (new_str == NULL)
+ lafe_errc(1, errno, "Out of memory");
+ memcpy(new_str, *str, old_len);
+ strcpy(new_str + old_len, append);
+ free(*str);
+ *str = new_str;
+}
+
+int
+apply_substitution(struct bsdtar *bsdtar, const char *name, char **result, int symlink_only)
+{
+ const char *path = name;
+ regmatch_t matches[10];
+ size_t i, j;
+ struct subst_rule *rule;
+ struct substitution *subst;
+ int c, got_match, print_match;
+
+ *result = NULL;
+
+ if ((subst = bsdtar->substitution) == NULL)
+ return 0;
+
+ got_match = 0;
+ print_match = 0;
+
+ for (rule = subst->first_rule; rule != NULL; rule = rule->next) {
+ if (symlink_only && !rule->symlink)
+ continue;
+ if (regexec(&rule->re, name, 10, matches, 0))
+ continue;
+
+ got_match = 1;
+ print_match |= rule->print;
+ realloc_strncat(result, name, matches[0].rm_so);
+
+ for (i = 0, j = 0; rule->result[i] != '\0'; ++i) {
+ if (rule->result[i] == '~') {
+ realloc_strncat(result, rule->result + j, i - j);
+ realloc_strncat(result, name, matches[0].rm_eo);
+ j = i + 1;
+ continue;
+ }
+ if (rule->result[i] != '\\')
+ continue;
+
+ ++i;
+ c = rule->result[i];
+ switch (c) {
+ case '~':
+ case '\\':
+ realloc_strncat(result, rule->result + j, i - j - 1);
+ j = i;
+ break;
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9':
+ realloc_strncat(result, rule->result + j, i - j - 1);
+ if ((size_t)(c - '0') > (size_t)(rule->re.re_nsub)) {
+ free(*result);
+ *result = NULL;
+ return -1;
+ }
+ realloc_strncat(result, name + matches[c - '0'].rm_so, matches[c - '0'].rm_eo - matches[c - '0'].rm_so);
+ j = i + 1;
+ break;
+ default:
+ /* Just continue; */
+ break;
+ }
+
+ }
+
+ realloc_strcat(result, rule->result + j);
+
+ name += matches[0].rm_eo;
+
+ if (!rule->global)
+ break;
+ }
+
+ if (got_match)
+ realloc_strcat(result, name);
+
+ if (print_match)
+ fprintf(stderr, "%s >> %s\n", path, *result);
+
+ return got_match;
+}
+
+void
+cleanup_substitution(struct bsdtar *bsdtar)
+{
+ struct subst_rule *rule;
+ struct substitution *subst;
+
+ if ((subst = bsdtar->substitution) == NULL)
+ return;
+
+ while ((rule = subst->first_rule) != NULL) {
+ subst->first_rule = rule->next;
+ free(rule->result);
+ free(rule);
+ }
+ free(subst);
+}
+#endif /* HAVE_REGEX_H */
diff --git a/archivers/libarchive/files/tar/test/main.c b/archivers/libarchive/files/tar/test/main.c
new file mode 100644
index 00000000000..6028d7789a4
--- /dev/null
+++ b/archivers/libarchive/files/tar/test/main.c
@@ -0,0 +1,2226 @@
+/*
+ * Copyright (c) 2003-2009 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"
+#include <errno.h>
+#include <locale.h>
+#include <stdarg.h>
+#include <time.h>
+
+/*
+ * This same file is used pretty much verbatim for all test harnesses.
+ *
+ * The next few lines are the only differences.
+ * TODO: Move this into a separate configuration header, have all test
+ * suites share one copy of this file.
+ */
+__FBSDID("$FreeBSD: src/usr.bin/tar/test/main.c,v 1.6 2008/11/05 06:40:53 kientzle Exp $");
+#define KNOWNREF "test_patterns_2.tar.uu"
+#define ENVBASE "BSDTAR" /* Prefix for environment variables. */
+#define PROGRAM "bsdtar" /* Name of program being tested. */
+#undef LIBRARY /* Not testing a library. */
+#undef EXTRA_DUMP /* How to dump extra data */
+/* How to generate extra version info. */
+#define EXTRA_VERSION (systemf("%s --version", testprog) ? "" : "")
+
+/*
+ *
+ * Windows support routines
+ *
+ * Note: Configuration is a tricky issue. Using HAVE_* feature macros
+ * in the test harness is dangerous because they cover up
+ * configuration errors. The classic example of this is omitting a
+ * configure check. If libarchive and libarchive_test both look for
+ * the same feature macro, such errors are hard to detect. Platform
+ * macros (e.g., _WIN32 or __GNUC__) are a little better, but can
+ * easily lead to very messy code. It's best to limit yourself
+ * to only the most generic programming techniques in the test harness
+ * and thus avoid conditionals altogether. Where that's not possible,
+ * try to minimize conditionals by grouping platform-specific tests in
+ * one place (e.g., test_acl_freebsd) or by adding new assert()
+ * functions (e.g., assertMakeHardlink()) to cover up platform
+ * differences. Platform-specific coding in libarchive_test is often
+ * a symptom that some capability is missing from libarchive itself.
+ */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#include <io.h>
+#include <windows.h>
+#ifndef F_OK
+#define F_OK (0)
+#endif
+#ifndef S_ISDIR
+#define S_ISDIR(m) ((m) & _S_IFDIR)
+#endif
+#ifndef S_ISREG
+#define S_ISREG(m) ((m) & _S_IFREG)
+#endif
+#if !defined(__BORLANDC__)
+#define access _access
+#undef chdir
+#define chdir _chdir
+#endif
+#ifndef fileno
+#define fileno _fileno
+#endif
+/*#define fstat _fstat64*/
+#if !defined(__BORLANDC__)
+#define getcwd _getcwd
+#endif
+#define lstat stat
+/*#define lstat _stat64*/
+/*#define stat _stat64*/
+#define rmdir _rmdir
+#if !defined(__BORLANDC__)
+#define strdup _strdup
+#define umask _umask
+#endif
+#define int64_t __int64
+#endif
+
+#if defined(HAVE__CrtSetReportMode)
+# include <crtdbg.h>
+#endif
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+void *GetFunctionKernel32(const char *name)
+{
+ static HINSTANCE lib;
+ static int set;
+ if (!set) {
+ set = 1;
+ lib = LoadLibrary("kernel32.dll");
+ }
+ if (lib == NULL) {
+ fprintf(stderr, "Can't load kernel32.dll?!\n");
+ exit(1);
+ }
+ return (void *)GetProcAddress(lib, name);
+}
+
+static int
+my_CreateSymbolicLinkA(const char *linkname, const char *target, int flags)
+{
+ static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, DWORD);
+ static int set;
+ if (!set) {
+ set = 1;
+ f = GetFunctionKernel32("CreateSymbolicLinkA");
+ }
+ return f == NULL ? 0 : (*f)(linkname, target, flags);
+}
+
+static int
+my_CreateHardLinkA(const char *linkname, const char *target)
+{
+ static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES);
+ static int set;
+ if (!set) {
+ set = 1;
+ f = GetFunctionKernel32("CreateHardLinkA");
+ }
+ return f == NULL ? 0 : (*f)(linkname, target, NULL);
+}
+
+int
+my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi)
+{
+ HANDLE h;
+ int r;
+
+ memset(bhfi, 0, sizeof(*bhfi));
+ h = CreateFile(path, FILE_READ_ATTRIBUTES, 0, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (h == INVALID_HANDLE_VALUE)
+ return (0);
+ r = GetFileInformationByHandle(h, bhfi);
+ CloseHandle(h);
+ return (r);
+}
+#endif
+
+#if defined(HAVE__CrtSetReportMode)
+static void
+invalid_parameter_handler(const wchar_t * expression,
+ const wchar_t * function, const wchar_t * file,
+ unsigned int line, uintptr_t pReserved)
+{
+ /* nop */
+}
+#endif
+
+/*
+ *
+ * OPTIONS FLAGS
+ *
+ */
+
+/* Enable core dump on failure. */
+static int dump_on_failure = 0;
+/* Default is to remove temp dirs and log data for successful tests. */
+static int keep_temp_files = 0;
+/* Default is to just report pass/fail for each test. */
+static int verbosity = 0;
+#define VERBOSITY_SUMMARY_ONLY -1 /* -q */
+#define VERBOSITY_PASSFAIL 0 /* Default */
+#define VERBOSITY_LIGHT_REPORT 1 /* -v */
+#define VERBOSITY_FULL 2 /* -vv */
+/* A few places generate even more output for verbosity > VERBOSITY_FULL,
+ * mostly for debugging the test harness itself. */
+/* Cumulative count of assertion failures. */
+static int failures = 0;
+/* Cumulative count of reported skips. */
+static int skips = 0;
+/* Cumulative count of assertions checked. */
+static int assertions = 0;
+
+/* Directory where uuencoded reference files can be found. */
+static const char *refdir;
+
+/*
+ * Report log information selectively to console and/or disk log.
+ */
+static int log_console = 0;
+static FILE *logfile;
+static void
+vlogprintf(const char *fmt, va_list ap)
+{
+#ifdef va_copy
+ va_list lfap;
+ va_copy(lfap, ap);
+#endif
+ if (log_console)
+ vfprintf(stdout, fmt, ap);
+ if (logfile != NULL)
+#ifdef va_copy
+ vfprintf(logfile, fmt, lfap);
+ va_end(lfap);
+#else
+ vfprintf(logfile, fmt, ap);
+#endif
+}
+
+static void
+logprintf(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vlogprintf(fmt, ap);
+ va_end(ap);
+}
+
+/* Set up a message to display only if next assertion fails. */
+static char msgbuff[4096];
+static const char *msg, *nextmsg;
+void
+failure(const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vsprintf(msgbuff, fmt, ap);
+ va_end(ap);
+ nextmsg = msgbuff;
+}
+
+/*
+ * Copy arguments into file-local variables.
+ * This was added to permit vararg assert() functions without needing
+ * variadic wrapper macros. Turns out that the vararg capability is almost
+ * never used, so almost all of the vararg assertions can be simplified
+ * by removing the vararg capability and reworking the wrapper macro to
+ * pass __FILE__, __LINE__ directly into the function instead of using
+ * this hook. I suspect this machinery is used so rarely that we
+ * would be better off just removing it entirely. That would simplify
+ * the code here noticably.
+ */
+static const char *test_filename;
+static int test_line;
+static void *test_extra;
+void assertion_setup(const char *filename, int line)
+{
+ test_filename = filename;
+ test_line = line;
+}
+
+/* Called at the beginning of each assert() function. */
+static void
+assertion_count(const char *file, int line)
+{
+ (void)file; /* UNUSED */
+ (void)line; /* UNUSED */
+ ++assertions;
+ /* Proper handling of "failure()" message. */
+ msg = nextmsg;
+ nextmsg = NULL;
+ /* Uncomment to print file:line after every assertion.
+ * Verbose, but occasionally useful in tracking down crashes. */
+ /* printf("Checked %s:%d\n", file, line); */
+}
+
+/*
+ * For each test source file, we remember how many times each
+ * assertion was reported. Cleared before each new test,
+ * used by test_summarize().
+ */
+static struct line {
+ int count;
+ int skip;
+} failed_lines[10000];
+
+/* Count this failure, setup up log destination and handle initial report. */
+static void
+failure_start(const char *filename, int line, const char *fmt, ...)
+{
+ va_list ap;
+
+ /* Record another failure for this line. */
+ ++failures;
+ /* test_filename = filename; */
+ failed_lines[line].count++;
+
+ /* Determine whether to log header to console. */
+ switch (verbosity) {
+ case VERBOSITY_FULL:
+ log_console = 1;
+ break;
+ case VERBOSITY_LIGHT_REPORT:
+ log_console = (failed_lines[line].count < 2);
+ break;
+ default:
+ log_console = 0;
+ }
+
+ /* Log file:line header for this failure */
+ va_start(ap, fmt);
+#if _MSC_VER
+ logprintf("%s(%d): ", filename, line);
+#else
+ logprintf("%s:%d: ", filename, line);
+#endif
+ vlogprintf(fmt, ap);
+ va_end(ap);
+ logprintf("\n");
+
+ if (msg != NULL && msg[0] != '\0') {
+ logprintf(" Description: %s\n", msg);
+ msg = NULL;
+ }
+
+ /* Determine whether to log details to console. */
+ if (verbosity == VERBOSITY_LIGHT_REPORT)
+ log_console = 0;
+}
+
+/* Complete reporting of failed tests. */
+/*
+ * The 'extra' hook here is used by libarchive to include libarchive
+ * error messages with assertion failures. It could also be used
+ * to add strerror() output, for example. Just define the EXTRA_DUMP()
+ * macro appropriately.
+ */
+static void
+failure_finish(void *extra)
+{
+ (void)extra; /* UNUSED (maybe) */
+#ifdef EXTRA_DUMP
+ if (extra != NULL)
+ logprintf(" detail: %s\n", EXTRA_DUMP(extra));
+#endif
+
+ if (dump_on_failure) {
+ fprintf(stderr,
+ " *** forcing core dump so failure can be debugged ***\n");
+ *(char *)(NULL) = 0;
+ exit(1);
+ }
+}
+
+/* Inform user that we're skipping some checks. */
+void
+test_skipping(const char *fmt, ...)
+{
+ char buff[1024];
+ va_list ap;
+
+ va_start(ap, fmt);
+ vsprintf(buff, fmt, ap);
+ va_end(ap);
+ /* failure_start() isn't quite right, but is awfully convenient. */
+ failure_start(test_filename, test_line, "SKIPPING: %s", buff);
+ --failures; /* Undo failures++ in failure_start() */
+ /* Don't failure_finish() here. */
+ /* Mark as skip, so doesn't count as failed test. */
+ failed_lines[test_line].skip = 1;
+ ++skips;
+}
+
+/*
+ *
+ * ASSERTIONS
+ *
+ */
+
+/* Generic assert() just displays the failed condition. */
+int
+assertion_assert(const char *file, int line, int value,
+ const char *condition, void *extra)
+{
+ assertion_count(file, line);
+ if (!value) {
+ failure_start(file, line, "Assertion failed: %s", condition);
+ failure_finish(extra);
+ }
+ return (value);
+}
+
+/* chdir() and report any errors */
+int
+assertion_chdir(const char *file, int line, const char *pathname)
+{
+ assertion_count(file, line);
+ if (chdir(pathname) == 0)
+ return (1);
+ failure_start(file, line, "chdir(\"%s\")", pathname);
+ failure_finish(NULL);
+ return (0);
+
+}
+
+/* Verify two integers are equal. */
+int
+assertion_equal_int(const char *file, int line,
+ long long v1, const char *e1, long long v2, const char *e2, void *extra)
+{
+ assertion_count(file, line);
+ if (v1 == v2)
+ return (1);
+ failure_start(file, line, "%s != %s", e1, e2);
+ logprintf(" %s=%lld (0x%llx, 0%llo)\n", e1, v1, v1, v1);
+ logprintf(" %s=%lld (0x%llx, 0%llo)\n", e2, v2, v2, v2);
+ failure_finish(extra);
+ return (0);
+}
+
+static void strdump(const char *e, const char *p)
+{
+ const char *q = p;
+
+ logprintf(" %s = ", e);
+ if (p == NULL) {
+ logprintf("NULL");
+ return;
+ }
+ logprintf("\"");
+ while (*p != '\0') {
+ unsigned int c = 0xff & *p++;
+ switch (c) {
+ case '\a': printf("\a"); break;
+ case '\b': printf("\b"); break;
+ case '\n': printf("\n"); break;
+ case '\r': printf("\r"); break;
+ default:
+ if (c >= 32 && c < 127)
+ logprintf("%c", c);
+ else
+ logprintf("\\x%02X", c);
+ }
+ }
+ logprintf("\"");
+ logprintf(" (length %d)\n", q == NULL ? -1 : (int)strlen(q));
+}
+
+/* Verify two strings are equal, dump them if not. */
+int
+assertion_equal_string(const char *file, int line,
+ const char *v1, const char *e1,
+ const char *v2, const char *e2,
+ void *extra)
+{
+ assertion_count(file, line);
+ if (v1 == v2 || (v1 != NULL && v2 != NULL && strcmp(v1, v2) == 0))
+ return (1);
+ failure_start(file, line, "%s != %s", e1, e2);
+ strdump(e1, v1);
+ strdump(e2, v2);
+ failure_finish(extra);
+ return (0);
+}
+
+static void
+wcsdump(const char *e, const wchar_t *w)
+{
+ logprintf(" %s = ", e);
+ if (w == NULL) {
+ logprintf("(null)");
+ return;
+ }
+ logprintf("\"");
+ while (*w != L'\0') {
+ unsigned int c = *w++;
+ if (c >= 32 && c < 127)
+ logprintf("%c", c);
+ else if (c < 256)
+ logprintf("\\x%02X", c);
+ else if (c < 0x10000)
+ logprintf("\\u%04X", c);
+ else
+ logprintf("\\U%08X", c);
+ }
+ logprintf("\"\n");
+}
+
+/* Verify that two wide strings are equal, dump them if not. */
+int
+assertion_equal_wstring(const char *file, int line,
+ const wchar_t *v1, const char *e1,
+ const wchar_t *v2, const char *e2,
+ void *extra)
+{
+ assertion_count(file, line);
+ if (v1 == v2 || wcscmp(v1, v2) == 0)
+ return (1);
+ failure_start(file, line, "%s != %s", e1, e2);
+ wcsdump(e1, v1);
+ wcsdump(e2, v2);
+ failure_finish(extra);
+ return (0);
+}
+
+/*
+ * Pretty standard hexdump routine. As a bonus, if ref != NULL, then
+ * any bytes in p that differ from ref will be highlighted with '_'
+ * before and after the hex value.
+ */
+static void
+hexdump(const char *p, const char *ref, size_t l, size_t offset)
+{
+ size_t i, j;
+ char sep;
+
+ if (p == NULL) {
+ logprintf("(null)\n");
+ return;
+ }
+ for(i=0; i < l; i+=16) {
+ logprintf("%04x", (unsigned)(i + offset));
+ sep = ' ';
+ for (j = 0; j < 16 && i + j < l; j++) {
+ if (ref != NULL && p[i + j] != ref[i + j])
+ sep = '_';
+ logprintf("%c%02x", sep, 0xff & (int)p[i+j]);
+ if (ref != NULL && p[i + j] == ref[i + j])
+ sep = ' ';
+ }
+ for (; j < 16; j++) {
+ logprintf("%c ", sep);
+ sep = ' ';
+ }
+ logprintf("%c", sep);
+ for (j=0; j < 16 && i + j < l; j++) {
+ int c = p[i + j];
+ if (c >= ' ' && c <= 126)
+ logprintf("%c", c);
+ else
+ logprintf(".");
+ }
+ logprintf("\n");
+ }
+}
+
+/* Verify that two blocks of memory are the same, display the first
+ * block of differences if they're not. */
+int
+assertion_equal_mem(const char *file, int line,
+ const void *_v1, const char *e1,
+ const void *_v2, const char *e2,
+ size_t l, const char *ld, void *extra)
+{
+ const char *v1 = (const char *)_v1;
+ const char *v2 = (const char *)_v2;
+ size_t offset;
+
+ assertion_count(file, line);
+ if (v1 == v2 || (v1 != NULL && v2 != NULL && memcmp(v1, v2, l) == 0))
+ return (1);
+
+ failure_start(file, line, "%s != %s", e1, e2);
+ logprintf(" size %s = %d\n", ld, (int)l);
+ /* Dump 48 bytes (3 lines) so that the first difference is
+ * in the second line. */
+ offset = 0;
+ while (l > 64 && memcmp(v1, v2, 32) == 0) {
+ /* Two lines agree, so step forward one line. */
+ v1 += 16;
+ v2 += 16;
+ l -= 16;
+ offset += 16;
+ }
+ logprintf(" Dump of %s\n", e1);
+ hexdump(v1, v2, l < 64 ? l : 64, offset);
+ logprintf(" Dump of %s\n", e2);
+ hexdump(v2, v1, l < 64 ? l : 64, offset);
+ logprintf("\n");
+ failure_finish(extra);
+ return (0);
+}
+
+/* Verify that the named file exists and is empty. */
+int
+assertion_empty_file(const char *f1fmt, ...)
+{
+ char buff[1024];
+ char f1[1024];
+ struct stat st;
+ va_list ap;
+ ssize_t s;
+ FILE *f;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, f1fmt);
+ vsprintf(f1, f1fmt, ap);
+ va_end(ap);
+
+ if (stat(f1, &st) != 0) {
+ failure_start(test_filename, test_line, "Stat failed: %s", f1);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (st.st_size == 0)
+ return (1);
+
+ failure_start(test_filename, test_line, "File should be empty: %s", f1);
+ logprintf(" File size: %d\n", (int)st.st_size);
+ logprintf(" Contents:\n");
+ f = fopen(f1, "rb");
+ if (f == NULL) {
+ logprintf(" Unable to open %s\n", f1);
+ } else {
+ s = ((off_t)sizeof(buff) < st.st_size) ?
+ (ssize_t)sizeof(buff) : (ssize_t)st.st_size;
+ s = fread(buff, 1, s, f);
+ hexdump(buff, NULL, s, 0);
+ fclose(f);
+ }
+ failure_finish(NULL);
+ return (0);
+}
+
+/* Verify that the named file exists and is not empty. */
+int
+assertion_non_empty_file(const char *f1fmt, ...)
+{
+ char f1[1024];
+ struct stat st;
+ va_list ap;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, f1fmt);
+ vsprintf(f1, f1fmt, ap);
+ va_end(ap);
+
+ if (stat(f1, &st) != 0) {
+ failure_start(test_filename, test_line, "Stat failed: %s", f1);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (st.st_size == 0) {
+ failure_start(test_filename, test_line, "File empty: %s", f1);
+ failure_finish(NULL);
+ return (0);
+ }
+ return (1);
+}
+
+/* Verify that two files have the same contents. */
+/* TODO: hexdump the first bytes that actually differ. */
+int
+assertion_equal_file(const char *fn1, const char *f2pattern, ...)
+{
+ char fn2[1024];
+ va_list ap;
+ char buff1[1024];
+ char buff2[1024];
+ FILE *f1, *f2;
+ int n1, n2;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, f2pattern);
+ vsprintf(fn2, f2pattern, ap);
+ va_end(ap);
+
+ f1 = fopen(fn1, "rb");
+ f2 = fopen(fn2, "rb");
+ for (;;) {
+ n1 = fread(buff1, 1, sizeof(buff1), f1);
+ n2 = fread(buff2, 1, sizeof(buff2), f2);
+ if (n1 != n2)
+ break;
+ if (n1 == 0 && n2 == 0) {
+ fclose(f1);
+ fclose(f2);
+ return (1);
+ }
+ if (memcmp(buff1, buff2, n1) != 0)
+ break;
+ }
+ fclose(f1);
+ fclose(f2);
+ failure_start(test_filename, test_line, "Files not identical");
+ logprintf(" file1=\"%s\"\n", fn1);
+ logprintf(" file2=\"%s\"\n", fn2);
+ failure_finish(test_extra);
+ return (0);
+}
+
+/* Verify that the named file does exist. */
+int
+assertion_file_exists(const char *fpattern, ...)
+{
+ char f[1024];
+ va_list ap;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, fpattern);
+ vsprintf(f, fpattern, ap);
+ va_end(ap);
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ if (!_access(f, 0))
+ return (1);
+#else
+ if (!access(f, F_OK))
+ return (1);
+#endif
+ failure_start(test_filename, test_line, "File should exist: %s", f);
+ failure_finish(test_extra);
+ return (0);
+}
+
+/* Verify that the named file doesn't exist. */
+int
+assertion_file_not_exists(const char *fpattern, ...)
+{
+ char f[1024];
+ va_list ap;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, fpattern);
+ vsprintf(f, fpattern, ap);
+ va_end(ap);
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ if (_access(f, 0))
+ return (1);
+#else
+ if (access(f, F_OK))
+ return (1);
+#endif
+ failure_start(test_filename, test_line, "File should not exist: %s", f);
+ failure_finish(test_extra);
+ return (0);
+}
+
+/* Compare the contents of a file to a block of memory. */
+int
+assertion_file_contents(const void *buff, int s, const char *fpattern, ...)
+{
+ char fn[1024];
+ va_list ap;
+ char *contents;
+ FILE *f;
+ int n;
+
+ assertion_count(test_filename, test_line);
+ va_start(ap, fpattern);
+ vsprintf(fn, fpattern, ap);
+ va_end(ap);
+
+ f = fopen(fn, "rb");
+ if (f == NULL) {
+ failure_start(test_filename, test_line,
+ "File should exist: %s", fn);
+ failure_finish(test_extra);
+ return (0);
+ }
+ contents = malloc(s * 2);
+ n = fread(contents, 1, s * 2, f);
+ fclose(f);
+ if (n == s && memcmp(buff, contents, s) == 0) {
+ free(contents);
+ return (1);
+ }
+ failure_start(test_filename, test_line, "File contents don't match");
+ logprintf(" file=\"%s\"\n", fn);
+ if (n > 0)
+ hexdump(contents, buff, n > 512 ? 512 : n, 0);
+ else {
+ logprintf(" File empty, contents should be:\n");
+ hexdump(buff, NULL, s > 512 ? 512 : s, 0);
+ }
+ failure_finish(test_extra);
+ free(contents);
+ return (0);
+}
+
+/* Check the contents of a text file, being tolerant of line endings. */
+int
+assertion_text_file_contents(const char *buff, const char *fn)
+{
+ char *contents;
+ const char *btxt, *ftxt;
+ FILE *f;
+ int n, s;
+
+ assertion_count(test_filename, test_line);
+ f = fopen(fn, "r");
+ s = strlen(buff);
+ contents = malloc(s * 2 + 128);
+ n = fread(contents, 1, s * 2 + 128 - 1, f);
+ if (n >= 0)
+ contents[n] = '\0';
+ fclose(f);
+ /* Compare texts. */
+ btxt = buff;
+ ftxt = (const char *)contents;
+ while (*btxt != '\0' && *ftxt != '\0') {
+ if (*btxt == *ftxt) {
+ ++btxt;
+ ++ftxt;
+ continue;
+ }
+ if (btxt[0] == '\n' && ftxt[0] == '\r' && ftxt[1] == '\n') {
+ /* Pass over different new line characters. */
+ ++btxt;
+ ftxt += 2;
+ continue;
+ }
+ break;
+ }
+ if (*btxt == '\0' && *ftxt == '\0') {
+ free(contents);
+ return (1);
+ }
+ failure_start(test_filename, test_line, "Contents don't match");
+ logprintf(" file=\"%s\"\n", fn);
+ if (n > 0)
+ hexdump(contents, buff, n, 0);
+ else {
+ logprintf(" File empty, contents should be:\n");
+ hexdump(buff, NULL, s, 0);
+ }
+ failure_finish(test_extra);
+ free(contents);
+ return (0);
+}
+
+/* Verify that a text file contains the specified lines, regardless of order */
+/* This could be more efficient if we sorted both sets of lines, etc, but
+ * since this is used only for testing and only ever deals with a dozen or so
+ * lines at a time, this relatively crude approach is just fine. */
+int
+assertion_file_contains_lines_any_order(const char *file, int line,
+ const char *pathname, const char *lines[])
+{
+ char *buff;
+ size_t buff_size;
+ size_t expected_count, actual_count, i, j;
+ char **expected;
+ char *p, **actual;
+ char c;
+ int expected_failure = 0, actual_failure = 0;
+
+ assertion_count(file, line);
+
+ buff = slurpfile(&buff_size, "%s", pathname);
+ if (buff == NULL) {
+ failure_start(pathname, line, "Can't read file: %s", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+
+ // Make a copy of the provided lines and count up the expected file size.
+ expected_count = 0;
+ for (i = 0; lines[i] != NULL; ++i) {
+ }
+ expected_count = i;
+ expected = malloc(sizeof(char *) * expected_count);
+ for (i = 0; lines[i] != NULL; ++i) {
+ expected[i] = strdup(lines[i]);
+ }
+
+ // Break the file into lines
+ actual_count = 0;
+ for (c = '\0', p = buff; p < buff + buff_size; ++p) {
+ if (*p == '\x0d' || *p == '\x0a')
+ *p = '\0';
+ if (c == '\0' && *p != '\0')
+ ++actual_count;
+ c = *p;
+ }
+ actual = malloc(sizeof(char *) * actual_count);
+ for (j = 0, p = buff; p < buff + buff_size; p += 1 + strlen(p)) {
+ if (*p != '\0') {
+ actual[j] = p;
+ ++j;
+ }
+ }
+
+ // Erase matching lines from both lists
+ for (i = 0; i < expected_count; ++i) {
+ if (expected[i] == NULL)
+ continue;
+ for (j = 0; j < actual_count; ++j) {
+ if (actual[j] == NULL)
+ continue;
+ if (strcmp(expected[i], actual[j]) == 0) {
+ free(expected[i]);
+ expected[i] = NULL;
+ actual[j] = NULL;
+ break;
+ }
+ }
+ }
+
+ // If there's anything left, it's a failure
+ for (i = 0; i < expected_count; ++i) {
+ if (expected[i] != NULL)
+ ++expected_failure;
+ }
+ for (j = 0; j < actual_count; ++j) {
+ if (actual[j] != NULL)
+ ++actual_failure;
+ }
+ if (expected_failure == 0 && actual_failure == 0) {
+ free(buff);
+ free(expected);
+ free(actual);
+ return (1);
+ }
+ failure_start(file, line, "File doesn't match: %s", pathname);
+ for (i = 0; i < expected_count; ++i) {
+ if (expected[i] != NULL) {
+ logprintf(" Expected but not present: %s\n", expected[i]);
+ free(expected[i]);
+ }
+ }
+ for (j = 0; j < actual_count; ++j) {
+ if (actual[j] != NULL)
+ logprintf(" Present but not expected: %s\n", actual[j]);
+ }
+ failure_finish(NULL);
+ free(buff);
+ free(expected);
+ free(actual);
+ return (0);
+}
+
+/* Test that two paths point to the same file. */
+/* As a side-effect, asserts that both files exist. */
+static int
+is_hardlink(const char *file, int line,
+ const char *path1, const char *path2)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ BY_HANDLE_FILE_INFORMATION bhfi1, bhfi2;
+ int r;
+
+ assertion_count(file, line);
+ r = my_GetFileInformationByName(path1, &bhfi1);
+ if (r == 0) {
+ failure_start(file, line, "File %s can't be inspected?", path1);
+ failure_finish(NULL);
+ return (0);
+ }
+ r = my_GetFileInformationByName(path2, &bhfi2);
+ if (r == 0) {
+ failure_start(file, line, "File %s can't be inspected?", path2);
+ failure_finish(NULL);
+ return (0);
+ }
+ return (bhfi1.dwVolumeSerialNumber == bhfi2.dwVolumeSerialNumber
+ && bhfi1.nFileIndexHigh == bhfi2.nFileIndexHigh
+ && bhfi1.nFileIndexLow == bhfi2.nFileIndexLow);
+#else
+ struct stat st1, st2;
+ int r;
+
+ assertion_count(file, line);
+ r = lstat(path1, &st1);
+ if (r != 0) {
+ failure_start(file, line, "File should exist: %s", path1);
+ failure_finish(NULL);
+ return (0);
+ }
+ r = lstat(path2, &st2);
+ if (r != 0) {
+ failure_start(file, line, "File should exist: %s", path2);
+ failure_finish(NULL);
+ return (0);
+ }
+ return (st1.st_ino == st2.st_ino && st1.st_dev == st2.st_dev);
+#endif
+}
+
+int
+assertion_is_hardlink(const char *file, int line,
+ const char *path1, const char *path2)
+{
+ if (is_hardlink(file, line, path1, path2))
+ return (1);
+ failure_start(file, line,
+ "Files %s and %s are not hardlinked", path1, path2);
+ failure_finish(NULL);
+ return (0);
+}
+
+int
+assertion_is_not_hardlink(const char *file, int line,
+ const char *path1, const char *path2)
+{
+ if (!is_hardlink(file, line, path1, path2))
+ return (1);
+ failure_start(file, line,
+ "Files %s and %s should not be hardlinked", path1, path2);
+ failure_finish(NULL);
+ return (0);
+}
+
+/* Verify a/b/mtime of 'pathname'. */
+/* If 'recent', verify that it's within last 10 seconds. */
+static int
+assertion_file_time(const char *file, int line,
+ const char *pathname, long t, long nsec, char type, int recent)
+{
+ long long filet, filet_nsec;
+ int r;
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define EPOC_TIME (116444736000000000ULL)
+ FILETIME ftime, fbirthtime, fatime, fmtime;
+ ULARGE_INTEGER wintm;
+ HANDLE h;
+ ftime.dwLowDateTime = 0;
+ ftime.dwHighDateTime = 0;
+
+ assertion_count(file, line);
+ h = CreateFile(pathname, FILE_READ_ATTRIBUTES, 0, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
+ if (h == INVALID_HANDLE_VALUE) {
+ failure_start(file, line, "Can't access %s\n", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ r = GetFileTime(h, &fbirthtime, &fatime, &fmtime);
+ switch (type) {
+ case 'a': ftime = fatime; break;
+ case 'b': ftime = fbirthtime; break;
+ case 'm': ftime = fmtime; break;
+ }
+ CloseHandle(h);
+ if (r == 0) {
+ failure_start(file, line, "Can't GetFileTime %s\n", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ wintm.LowPart = ftime.dwLowDateTime;
+ wintm.HighPart = ftime.dwHighDateTime;
+ filet = (wintm.QuadPart - EPOC_TIME) / 10000000;
+ filet_nsec = ((wintm.QuadPart - EPOC_TIME) % 10000000) * 100;
+ nsec = (nsec / 100) * 100; /* Round the request */
+#else
+ struct stat st;
+
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r != 0) {
+ failure_start(file, line, "Can't stat %s\n", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ switch (type) {
+ case 'a': filet = st.st_atime; break;
+ case 'm': filet = st.st_mtime; break;
+ case 'b': filet = 0; break;
+ default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type);
+ exit(1);
+ }
+#if defined(__FreeBSD__)
+ switch (type) {
+ case 'a': filet_nsec = st.st_atimespec.tv_nsec; break;
+ case 'b': filet = st.st_birthtime;
+ filet_nsec = st.st_birthtimespec.tv_nsec; break;
+ case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break;
+ default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type);
+ exit(1);
+ }
+ /* FreeBSD generally only stores to microsecond res, so round. */
+ filet_nsec = (filet_nsec / 1000) * 1000;
+ nsec = (nsec / 1000) * 1000;
+#else
+ filet_nsec = nsec = 0; /* Generic POSIX only has whole seconds. */
+ if (type == 'b') return (1); /* Generic POSIX doesn't have birthtime */
+#if defined(__HAIKU__)
+ if (type == 'a') return (1); /* Haiku doesn't have atime. */
+#endif
+#endif
+#endif
+ if (recent) {
+ /* Check that requested time is up-to-date. */
+ time_t now = time(NULL);
+ if (filet < now - 10 || filet > now + 1) {
+ failure_start(file, line,
+ "File %s has %ctime %ld, %ld seconds ago\n",
+ pathname, type, filet, now - filet);
+ failure_finish(NULL);
+ return (0);
+ }
+ } else if (filet != t || filet_nsec != nsec) {
+ failure_start(file, line,
+ "File %s has %ctime %ld.%09ld, expected %ld.%09ld",
+ pathname, type, filet, filet_nsec, t, nsec);
+ failure_finish(NULL);
+ return (0);
+ }
+ return (1);
+}
+
+/* Verify atime of 'pathname'. */
+int
+assertion_file_atime(const char *file, int line,
+ const char *pathname, long t, long nsec)
+{
+ return assertion_file_time(file, line, pathname, t, nsec, 'a', 0);
+}
+
+/* Verify atime of 'pathname' is up-to-date. */
+int
+assertion_file_atime_recent(const char *file, int line, const char *pathname)
+{
+ return assertion_file_time(file, line, pathname, 0, 0, 'a', 1);
+}
+
+/* Verify birthtime of 'pathname'. */
+int
+assertion_file_birthtime(const char *file, int line,
+ const char *pathname, long t, long nsec)
+{
+ return assertion_file_time(file, line, pathname, t, nsec, 'b', 0);
+}
+
+/* Verify birthtime of 'pathname' is up-to-date. */
+int
+assertion_file_birthtime_recent(const char *file, int line,
+ const char *pathname)
+{
+ return assertion_file_time(file, line, pathname, 0, 0, 'b', 1);
+}
+
+/* Verify mtime of 'pathname'. */
+int
+assertion_file_mtime(const char *file, int line,
+ const char *pathname, long t, long nsec)
+{
+ return assertion_file_time(file, line, pathname, t, nsec, 'm', 0);
+}
+
+/* Verify mtime of 'pathname' is up-to-date. */
+int
+assertion_file_mtime_recent(const char *file, int line, const char *pathname)
+{
+ return assertion_file_time(file, line, pathname, 0, 0, 'm', 1);
+}
+
+/* Verify number of links to 'pathname'. */
+int
+assertion_file_nlinks(const char *file, int line,
+ const char *pathname, int nlinks)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ BY_HANDLE_FILE_INFORMATION bhfi;
+ int r;
+
+ assertion_count(file, line);
+ r = my_GetFileInformationByName(pathname, &bhfi);
+ if (r != 0 && bhfi.nNumberOfLinks == (DWORD)nlinks)
+ return (1);
+ failure_start(file, line, "File %s has %d links, expected %d",
+ pathname, bhfi.nNumberOfLinks, nlinks);
+ failure_finish(NULL);
+ return (0);
+#else
+ struct stat st;
+ int r;
+
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r == 0 && st.st_nlink == nlinks)
+ return (1);
+ failure_start(file, line, "File %s has %d links, expected %d",
+ pathname, st.st_nlink, nlinks);
+ failure_finish(NULL);
+ return (0);
+#endif
+}
+
+/* Verify size of 'pathname'. */
+int
+assertion_file_size(const char *file, int line, const char *pathname, long size)
+{
+ int64_t filesize;
+ int r;
+
+ assertion_count(file, line);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ {
+ BY_HANDLE_FILE_INFORMATION bhfi;
+ r = !my_GetFileInformationByName(pathname, &bhfi);
+ filesize = ((int64_t)bhfi.nFileSizeHigh << 32) + bhfi.nFileSizeLow;
+ }
+#else
+ {
+ struct stat st;
+ r = lstat(pathname, &st);
+ filesize = st.st_size;
+ }
+#endif
+ if (r == 0 && filesize == size)
+ return (1);
+ failure_start(file, line, "File %s has size %ld, expected %ld",
+ pathname, (long)filesize, (long)size);
+ failure_finish(NULL);
+ return (0);
+}
+
+/* Assert that 'pathname' is a dir. If mode >= 0, verify that too. */
+int
+assertion_is_dir(const char *file, int line, const char *pathname, int mode)
+{
+ struct stat st;
+ int r;
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ (void)mode; /* UNUSED */
+#endif
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r != 0) {
+ failure_start(file, line, "Dir should exist: %s", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (!S_ISDIR(st.st_mode)) {
+ failure_start(file, line, "%s is not a dir", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ /* Windows doesn't handle permissions the same way as POSIX,
+ * so just ignore the mode tests. */
+ /* TODO: Can we do better here? */
+ if (mode >= 0 && mode != (st.st_mode & 07777)) {
+ failure_start(file, line, "Dir %s has wrong mode", pathname);
+ logprintf(" Expected: 0%3o\n", mode);
+ logprintf(" Found: 0%3o\n", st.st_mode & 07777);
+ failure_finish(NULL);
+ return (0);
+ }
+#endif
+ return (1);
+}
+
+/* Verify that 'pathname' is a regular file. If 'mode' is >= 0,
+ * verify that too. */
+int
+assertion_is_reg(const char *file, int line, const char *pathname, int mode)
+{
+ struct stat st;
+ int r;
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ (void)mode; /* UNUSED */
+#endif
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r != 0 || !S_ISREG(st.st_mode)) {
+ failure_start(file, line, "File should exist: %s", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ /* Windows doesn't handle permissions the same way as POSIX,
+ * so just ignore the mode tests. */
+ /* TODO: Can we do better here? */
+ if (mode >= 0 && mode != (st.st_mode & 07777)) {
+ failure_start(file, line, "File %s has wrong mode", pathname);
+ logprintf(" Expected: 0%3o\n", mode);
+ logprintf(" Found: 0%3o\n", st.st_mode & 07777);
+ failure_finish(NULL);
+ return (0);
+ }
+#endif
+ return (1);
+}
+
+/* Check whether 'pathname' is a symbolic link. If 'contents' is
+ * non-NULL, verify that the symlink has those contents. */
+static int
+is_symlink(const char *file, int line,
+ const char *pathname, const char *contents)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ (void)pathname; /* UNUSED */
+ (void)contents; /* UNUSED */
+ assertion_count(file, line);
+ /* Windows sort-of has real symlinks, but they're only usable
+ * by privileged users and are crippled even then, so there's
+ * really not much point in bothering with this. */
+ return (0);
+#else
+ char buff[300];
+ struct stat st;
+ ssize_t linklen;
+ int r;
+
+ assertion_count(file, line);
+ r = lstat(pathname, &st);
+ if (r != 0) {
+ failure_start(file, line,
+ "Symlink should exist: %s", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (!S_ISLNK(st.st_mode))
+ return (0);
+ if (contents == NULL)
+ return (1);
+ linklen = readlink(pathname, buff, sizeof(buff));
+ if (linklen < 0) {
+ failure_start(file, line, "Can't read symlink %s", pathname);
+ failure_finish(NULL);
+ return (0);
+ }
+ buff[linklen] = '\0';
+ if (strcmp(buff, contents) != 0)
+ return (0);
+ return (1);
+#endif
+}
+
+/* Assert that path is a symlink that (optionally) contains contents. */
+int
+assertion_is_symlink(const char *file, int line,
+ const char *path, const char *contents)
+{
+ if (is_symlink(file, line, path, contents))
+ return (1);
+ if (contents)
+ failure_start(file, line, "File %s is not a symlink to %s",
+ path, contents);
+ else
+ failure_start(file, line, "File %s is not a symlink", path);
+ failure_finish(NULL);
+ return (0);
+}
+
+
+/* Create a directory and report any errors. */
+int
+assertion_make_dir(const char *file, int line, const char *dirname, int mode)
+{
+ assertion_count(file, line);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ (void)mode; /* UNUSED */
+ if (0 == _mkdir(dirname))
+ return (1);
+#else
+ if (0 == mkdir(dirname, mode))
+ return (1);
+#endif
+ failure_start(file, line, "Could not create directory %s", dirname);
+ failure_finish(NULL);
+ return(0);
+}
+
+/* Create a file with the specified contents and report any failures. */
+int
+assertion_make_file(const char *file, int line,
+ const char *path, int mode, const char *contents)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* TODO: Rework this to set file mode as well. */
+ FILE *f;
+ (void)mode; /* UNUSED */
+ assertion_count(file, line);
+ f = fopen(path, "wb");
+ if (f == NULL) {
+ failure_start(file, line, "Could not create file %s", path);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (contents != NULL) {
+ if (strlen(contents)
+ != fwrite(contents, 1, strlen(contents), f)) {
+ fclose(f);
+ failure_start(file, line,
+ "Could not write file %s", path);
+ failure_finish(NULL);
+ return (0);
+ }
+ }
+ fclose(f);
+ return (1);
+#else
+ int fd;
+ assertion_count(file, line);
+ fd = open(path, O_CREAT | O_WRONLY, mode >= 0 ? mode : 0644);
+ if (fd < 0) {
+ failure_start(file, line, "Could not create %s", path);
+ failure_finish(NULL);
+ return (0);
+ }
+ if (contents != NULL) {
+ if ((ssize_t)strlen(contents)
+ != write(fd, contents, strlen(contents))) {
+ close(fd);
+ failure_start(file, line, "Could not write to %s", path);
+ failure_finish(NULL);
+ return (0);
+ }
+ }
+ close(fd);
+ return (1);
+#endif
+}
+
+/* Create a hardlink and report any failures. */
+int
+assertion_make_hardlink(const char *file, int line,
+ const char *newpath, const char *linkto)
+{
+ int succeeded;
+
+ assertion_count(file, line);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ succeeded = my_CreateHardLinkA(newpath, linkto);
+#elif HAVE_LINK
+ succeeded = !link(linkto, newpath);
+#else
+ succeeded = 0;
+#endif
+ if (succeeded)
+ return (1);
+ failure_start(file, line, "Could not create hardlink");
+ logprintf(" New link: %s\n", newpath);
+ logprintf(" Old name: %s\n", linkto);
+ failure_finish(NULL);
+ return(0);
+}
+
+/* Create a symlink and report any failures. */
+int
+assertion_make_symlink(const char *file, int line,
+ const char *newpath, const char *linkto)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ int targetIsDir = 0; /* TODO: Fix this */
+ assertion_count(file, line);
+ if (my_CreateSymbolicLinkA(newpath, linkto, targetIsDir))
+ return (1);
+#elif HAVE_SYMLINK
+ assertion_count(file, line);
+ if (0 == symlink(linkto, newpath))
+ return (1);
+#endif
+ failure_start(file, line, "Could not create symlink");
+ logprintf(" New link: %s\n", newpath);
+ logprintf(" Old name: %s\n", linkto);
+ failure_finish(NULL);
+ return(0);
+}
+
+/* Set umask, report failures. */
+int
+assertion_umask(const char *file, int line, int mask)
+{
+ assertion_count(file, line);
+ (void)file; /* UNUSED */
+ (void)line; /* UNUSED */
+ umask(mask);
+ return (1);
+}
+
+/*
+ *
+ * UTILITIES for use by tests.
+ *
+ */
+
+/*
+ * Check whether platform supports symlinks. This is intended
+ * for tests to use in deciding whether to bother testing symlink
+ * support; if the platform doesn't support symlinks, there's no point
+ * in checking whether the program being tested can create them.
+ *
+ * Note that the first time this test is called, we actually go out to
+ * disk to create and verify a symlink. This is necessary because
+ * symlink support is actually a property of a particular filesystem
+ * and can thus vary between directories on a single system. After
+ * the first call, this returns the cached result from memory, so it's
+ * safe to call it as often as you wish.
+ */
+int
+canSymlink(void)
+{
+ /* Remember the test result */
+ static int value = 0, tested = 0;
+ if (tested)
+ return (value);
+
+ ++tested;
+ assertion_make_file(__FILE__, __LINE__, "canSymlink.0", 0644, "a");
+ /* Note: Cygwin has its own symlink() emulation that does not
+ * use the Win32 CreateSymbolicLink() function. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ value = my_CreateSymbolicLinkA("canSymlink.1", "canSymlink.0", 0)
+ && is_symlink(__FILE__, __LINE__, "canSymlink.1", "canSymlink.0");
+#elif HAVE_SYMLINK
+ value = (0 == symlink("canSymlink.0", "canSymlink.1"))
+ && is_symlink(__FILE__, __LINE__, "canSymlink.1","canSymlink.0");
+#endif
+ return (value);
+}
+
+/*
+ * Can this platform run the gzip program?
+ */
+/* Platform-dependent options for hiding the output of a subcommand. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+static const char *redirectArgs = ">NUL 2>NUL"; /* Win32 cmd.exe */
+#else
+static const char *redirectArgs = ">/dev/null 2>/dev/null"; /* POSIX 'sh' */
+#endif
+int
+canGzip(void)
+{
+ static int tested = 0, value = 0;
+ if (!tested) {
+ tested = 1;
+ if (systemf("gzip -V %s", redirectArgs) == 0)
+ value = 1;
+ }
+ return (value);
+}
+
+/*
+ * Can this platform run the gunzip program?
+ */
+int
+canGunzip(void)
+{
+ static int tested = 0, value = 0;
+ if (!tested) {
+ tested = 1;
+ if (systemf("gunzip -V %s", redirectArgs) == 0)
+ value = 1;
+ }
+ return (value);
+}
+
+/*
+ * Sleep as needed; useful for verifying disk timestamp changes by
+ * ensuring that the wall-clock time has actually changed before we
+ * go back to re-read something from disk.
+ */
+void
+sleepUntilAfter(time_t t)
+{
+ while (t >= time(NULL))
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ Sleep(500);
+#else
+ sleep(1);
+#endif
+}
+
+/*
+ * Call standard system() call, but build up the command line using
+ * sprintf() conventions.
+ */
+int
+systemf(const char *fmt, ...)
+{
+ char buff[8192];
+ va_list ap;
+ int r;
+
+ va_start(ap, fmt);
+ vsprintf(buff, fmt, ap);
+ if (verbosity > VERBOSITY_FULL)
+ logprintf("Cmd: %s\n", buff);
+ r = system(buff);
+ va_end(ap);
+ return (r);
+}
+
+/*
+ * Slurp a file into memory for ease of comparison and testing.
+ * Returns size of file in 'sizep' if non-NULL, null-terminates
+ * data in memory for ease of use.
+ */
+char *
+slurpfile(size_t * sizep, const char *fmt, ...)
+{
+ char filename[8192];
+ struct stat st;
+ va_list ap;
+ char *p;
+ ssize_t bytes_read;
+ FILE *f;
+ int r;
+
+ va_start(ap, fmt);
+ vsprintf(filename, fmt, ap);
+ va_end(ap);
+
+ f = fopen(filename, "rb");
+ if (f == NULL) {
+ /* Note: No error; non-existent file is okay here. */
+ return (NULL);
+ }
+ r = fstat(fileno(f), &st);
+ if (r != 0) {
+ logprintf("Can't stat file %s\n", filename);
+ fclose(f);
+ return (NULL);
+ }
+ p = malloc((size_t)st.st_size + 1);
+ if (p == NULL) {
+ logprintf("Can't allocate %ld bytes of memory to read file %s\n",
+ (long int)st.st_size, filename);
+ fclose(f);
+ return (NULL);
+ }
+ bytes_read = fread(p, 1, (size_t)st.st_size, f);
+ if (bytes_read < st.st_size) {
+ logprintf("Can't read file %s\n", filename);
+ fclose(f);
+ free(p);
+ return (NULL);
+ }
+ p[st.st_size] = '\0';
+ if (sizep != NULL)
+ *sizep = (size_t)st.st_size;
+ fclose(f);
+ return (p);
+}
+
+/* Read a uuencoded file from the reference directory, decode, and
+ * write the result into the current directory. */
+#define UUDECODE(c) (((c) - 0x20) & 0x3f)
+void
+extract_reference_file(const char *name)
+{
+ char buff[1024];
+ FILE *in, *out;
+
+ sprintf(buff, "%s/%s.uu", refdir, name);
+ in = fopen(buff, "r");
+ failure("Couldn't open reference file %s", buff);
+ assert(in != NULL);
+ if (in == NULL)
+ return;
+ /* Read up to and including the 'begin' line. */
+ for (;;) {
+ if (fgets(buff, sizeof(buff), in) == NULL) {
+ /* TODO: This is a failure. */
+ return;
+ }
+ if (memcmp(buff, "begin ", 6) == 0)
+ break;
+ }
+ /* Now, decode the rest and write it. */
+ /* Not a lot of error checking here; the input better be right. */
+ out = fopen(name, "wb");
+ while (fgets(buff, sizeof(buff), in) != NULL) {
+ char *p = buff;
+ int bytes;
+
+ if (memcmp(buff, "end", 3) == 0)
+ break;
+
+ bytes = UUDECODE(*p++);
+ while (bytes > 0) {
+ int n = 0;
+ /* Write out 1-3 bytes from that. */
+ if (bytes > 0) {
+ n = UUDECODE(*p++) << 18;
+ n |= UUDECODE(*p++) << 12;
+ fputc(n >> 16, out);
+ --bytes;
+ }
+ if (bytes > 0) {
+ n |= UUDECODE(*p++) << 6;
+ fputc((n >> 8) & 0xFF, out);
+ --bytes;
+ }
+ if (bytes > 0) {
+ n |= UUDECODE(*p++);
+ fputc(n & 0xFF, out);
+ --bytes;
+ }
+ }
+ }
+ fclose(out);
+ fclose(in);
+}
+
+/*
+ *
+ * TEST management
+ *
+ */
+
+/*
+ * "list.h" is simply created by "grep DEFINE_TEST test_*.c"; it has
+ * a line like
+ * DEFINE_TEST(test_function)
+ * for each test.
+ */
+
+/* Use "list.h" to declare all of the test functions. */
+#undef DEFINE_TEST
+#define DEFINE_TEST(name) void name(void);
+#include "list.h"
+
+/* Use "list.h" to create a list of all tests (functions and names). */
+#undef DEFINE_TEST
+#define DEFINE_TEST(n) { n, #n, 0 },
+struct { void (*func)(void); const char *name; int failures; } tests[] = {
+ #include "list.h"
+};
+
+/*
+ * Summarize repeated failures in the just-completed test.
+ */
+static void
+test_summarize(const char *filename, int failed)
+{
+ unsigned int i;
+
+ switch (verbosity) {
+ case VERBOSITY_SUMMARY_ONLY:
+ printf(failed ? "E" : ".");
+ fflush(stdout);
+ break;
+ case VERBOSITY_PASSFAIL:
+ printf(failed ? "FAIL\n" : "ok\n");
+ break;
+ }
+
+ log_console = (verbosity == VERBOSITY_LIGHT_REPORT);
+
+ for (i = 0; i < sizeof(failed_lines)/sizeof(failed_lines[0]); i++) {
+ if (failed_lines[i].count > 1 && !failed_lines[i].skip)
+ logprintf("%s:%d: Summary: Failed %d times\n",
+ filename, i, failed_lines[i].count);
+ }
+ /* Clear the failure history for the next file. */
+ memset(failed_lines, 0, sizeof(failed_lines));
+}
+
+/*
+ * Actually run a single test, with appropriate setup and cleanup.
+ */
+static int
+test_run(int i, const char *tmpdir)
+{
+ char logfilename[64];
+ int failures_before = failures;
+ int oldumask;
+
+ switch (verbosity) {
+ case VERBOSITY_SUMMARY_ONLY: /* No per-test reports at all */
+ break;
+ case VERBOSITY_PASSFAIL: /* rest of line will include ok/FAIL marker */
+ printf("%3d: %-50s", i, tests[i].name);
+ fflush(stdout);
+ break;
+ default: /* Title of test, details will follow */
+ printf("%3d: %s\n", i, tests[i].name);
+ }
+
+ /* Chdir to the top-level work directory. */
+ if (!assertChdir(tmpdir)) {
+ fprintf(stderr,
+ "ERROR: Can't chdir to top work dir %s\n", tmpdir);
+ exit(1);
+ }
+ /* Create a log file for this test. */
+ sprintf(logfilename, "%s.log", tests[i].name);
+ logfile = fopen(logfilename, "w");
+ fprintf(logfile, "%s\n\n", tests[i].name);
+ /* Chdir() to a work dir for this specific test. */
+ if (!assertMakeDir(tests[i].name, 0755)
+ || !assertChdir(tests[i].name)) {
+ fprintf(stderr,
+ "ERROR: Can't chdir to work dir %s/%s\n",
+ tmpdir, tests[i].name);
+ exit(1);
+ }
+ /* Explicitly reset the locale before each test. */
+ setlocale(LC_ALL, "C");
+ /* Record the umask before we run the test. */
+ umask(oldumask = umask(0));
+ /*
+ * Run the actual test.
+ */
+ (*tests[i].func)();
+ /*
+ * Clean up and report afterwards.
+ */
+ /* Restore umask */
+ umask(oldumask);
+ /* Reset locale. */
+ setlocale(LC_ALL, "C");
+ /* Reset directory. */
+ if (!assertChdir(tmpdir)) {
+ fprintf(stderr, "ERROR: Couldn't chdir to temp dir %s\n",
+ tmpdir);
+ exit(1);
+ }
+ /* Report per-test summaries. */
+ tests[i].failures = failures - failures_before;
+ test_summarize(test_filename, tests[i].failures);
+ /* Close the per-test log file. */
+ fclose(logfile);
+ logfile = NULL;
+ /* If there were no failures, we can remove the work dir and logfile. */
+ if (tests[i].failures == 0) {
+ if (!keep_temp_files && assertChdir(tmpdir)) {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Make sure not to leave empty directories.
+ * Sometimes a processing of closing files used by tests
+ * is not done, then rmdir will be failed and it will
+ * leave a empty test directory. So we should wait a few
+ * seconds and retry rmdir. */
+ int r, t;
+ for (t = 0; t < 10; t++) {
+ if (t > 0)
+ Sleep(1000);
+ r = systemf("rmdir /S /Q %s", tests[i].name);
+ if (r == 0)
+ break;
+ }
+ systemf("del %s", logfilename);
+#else
+ systemf("rm -rf %s", tests[i].name);
+ systemf("rm %s", logfilename);
+#endif
+ }
+ }
+ /* Return appropriate status. */
+ return (tests[i].failures);
+}
+
+/*
+ *
+ *
+ * MAIN and support routines.
+ *
+ *
+ */
+
+static void
+usage(const char *program)
+{
+ static const int limit = sizeof(tests) / sizeof(tests[0]);
+ int i;
+
+ printf("Usage: %s [options] <test> <test> ...\n", program);
+ printf("Default is to run all tests.\n");
+ printf("Otherwise, specify the numbers of the tests you wish to run.\n");
+ printf("Options:\n");
+ printf(" -d Dump core after any failure, for debugging.\n");
+ printf(" -k Keep all temp files.\n");
+ printf(" Default: temp files for successful tests deleted.\n");
+#ifdef PROGRAM
+ printf(" -p <path> Path to executable to be tested.\n");
+ printf(" Default: path taken from " ENVBASE " environment variable.\n");
+#endif
+ printf(" -q Quiet.\n");
+ printf(" -r <dir> Path to dir containing reference files.\n");
+ printf(" Default: Current directory.\n");
+ printf(" -v Verbose.\n");
+ printf("Available tests:\n");
+ for (i = 0; i < limit; i++)
+ printf(" %d: %s\n", i, tests[i].name);
+ exit(1);
+}
+
+static char *
+get_refdir(const char *d)
+{
+ char tried[512] = { '\0' };
+ char buff[128];
+ char *pwd, *p;
+
+ /* If a dir was specified, try that */
+ if (d != NULL) {
+ pwd = NULL;
+ snprintf(buff, sizeof(buff), "%s", d);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+ goto failure;
+ }
+
+ /* Get the current dir. */
+ pwd = getcwd(NULL, 0);
+ while (pwd[strlen(pwd) - 1] == '\n')
+ pwd[strlen(pwd) - 1] = '\0';
+
+ /* Look for a known file. */
+ snprintf(buff, sizeof(buff), "%s", pwd);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+
+ snprintf(buff, sizeof(buff), "%s/test", pwd);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+
+#if defined(LIBRARY)
+ snprintf(buff, sizeof(buff), "%s/%s/test", pwd, LIBRARY);
+#else
+ snprintf(buff, sizeof(buff), "%s/%s/test", pwd, PROGRAM);
+#endif
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+
+ if (memcmp(pwd, "/usr/obj", 8) == 0) {
+ snprintf(buff, sizeof(buff), "%s", pwd + 8);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+
+ snprintf(buff, sizeof(buff), "%s/test", pwd + 8);
+ p = slurpfile(NULL, "%s/%s", buff, KNOWNREF);
+ if (p != NULL) goto success;
+ strncat(tried, buff, sizeof(tried) - strlen(tried) - 1);
+ strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1);
+ }
+
+failure:
+ printf("Unable to locate known reference file %s\n", KNOWNREF);
+ printf(" Checked following directories:\n%s\n", tried);
+#if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG)
+ DebugBreak();
+#endif
+ exit(1);
+
+success:
+ free(p);
+ free(pwd);
+ return strdup(buff);
+}
+
+int
+main(int argc, char **argv)
+{
+ static const int limit = sizeof(tests) / sizeof(tests[0]);
+ int i, tests_run = 0, tests_failed = 0, option;
+ time_t now;
+ char *refdir_alloc = NULL;
+ const char *progname;
+ const char *tmp, *option_arg, *p;
+ char tmpdir[256];
+ char tmpdir_timestamp[256];
+
+ (void)argc; /* UNUSED */
+
+#if defined(HAVE__CrtSetReportMode)
+ /* To stop to run the default invalid parameter handler. */
+ _set_invalid_parameter_handler(invalid_parameter_handler);
+ /* Disable annoying assertion message box. */
+ _CrtSetReportMode(_CRT_ASSERT, 0);
+#endif
+
+ /*
+ * Name of this program, used to build root of our temp directory
+ * tree.
+ */
+ progname = p = argv[0];
+ while (*p != '\0') {
+ /* Support \ or / dir separators for Windows compat. */
+ if (*p == '/' || *p == '\\')
+ progname = p + 1;
+ ++p;
+ }
+
+#ifdef PROGRAM
+ /* Get the target program from environment, if available. */
+ testprogfile = getenv(ENVBASE);
+#endif
+
+ if (getenv("TMPDIR") != NULL)
+ tmp = getenv("TMPDIR");
+ else if (getenv("TMP") != NULL)
+ tmp = getenv("TMP");
+ else if (getenv("TEMP") != NULL)
+ tmp = getenv("TEMP");
+ else if (getenv("TEMPDIR") != NULL)
+ tmp = getenv("TEMPDIR");
+ else
+ tmp = "/tmp";
+
+ /* Allow -d to be controlled through the environment. */
+ if (getenv(ENVBASE "_DEBUG") != NULL)
+ dump_on_failure = 1;
+
+ /* Get the directory holding test files from environment. */
+ refdir = getenv(ENVBASE "_TEST_FILES");
+
+ /*
+ * Parse options, without using getopt(), which isn't available
+ * on all platforms.
+ */
+ ++argv; /* Skip program name */
+ while (*argv != NULL) {
+ if (**argv != '-')
+ break;
+ p = *argv++;
+ ++p; /* Skip '-' */
+ while (*p != '\0') {
+ option = *p++;
+ option_arg = NULL;
+ /* If 'opt' takes an argument, parse that. */
+ if (option == 'p' || option == 'r') {
+ if (*p != '\0')
+ option_arg = p;
+ else if (*argv == NULL) {
+ fprintf(stderr,
+ "Option -%c requires argument.\n",
+ option);
+ usage(progname);
+ } else
+ option_arg = *argv++;
+ p = ""; /* End of this option word. */
+ }
+
+ /* Now, handle the option. */
+ switch (option) {
+ case 'd':
+ dump_on_failure = 1;
+ break;
+ case 'k':
+ keep_temp_files = 1;
+ break;
+ case 'p':
+#ifdef PROGRAM
+ testprogfile = option_arg;
+#else
+ fprintf(stderr, "-p option not permitted\n");
+ usage(progname);
+#endif
+ break;
+ case 'q':
+ verbosity--;
+ break;
+ case 'r':
+ refdir = option_arg;
+ break;
+ case 'v':
+ verbosity++;
+ break;
+ default:
+ fprintf(stderr, "Unrecognized option '%c'\n",
+ option);
+ usage(progname);
+ }
+ }
+ }
+
+ /*
+ * Sanity-check that our options make sense.
+ */
+#ifdef PROGRAM
+ if (testprogfile == NULL) {
+ fprintf(stderr, "Program executable required\n");
+ usage(progname);
+ }
+
+ {
+ char *testprg;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* Command.com sometimes rejects '/' separators. */
+ testprg = strdup(testprogfile);
+ for (i = 0; testprg[i] != '\0'; i++) {
+ if (testprg[i] == '/')
+ testprg[i] = '\\';
+ }
+ testprogfile = testprg;
+#endif
+ /* Quote the name that gets put into shell command lines. */
+ testprg = malloc(strlen(testprogfile) + 3);
+ strcpy(testprg, "\"");
+ strcat(testprg, testprogfile);
+ strcat(testprg, "\"");
+ testprog = testprg;
+ }
+#endif
+
+ /*
+ * Create a temp directory for the following tests.
+ * Include the time the tests started as part of the name,
+ * to make it easier to track the results of multiple tests.
+ */
+ now = time(NULL);
+ for (i = 0; ; i++) {
+ strftime(tmpdir_timestamp, sizeof(tmpdir_timestamp),
+ "%Y-%m-%dT%H.%M.%S",
+ localtime(&now));
+ sprintf(tmpdir, "%s/%s.%s-%03d", tmp, progname,
+ tmpdir_timestamp, i);
+ if (assertMakeDir(tmpdir,0755))
+ break;
+ if (i >= 999) {
+ fprintf(stderr,
+ "ERROR: Unable to create temp directory %s\n",
+ tmpdir);
+ exit(1);
+ }
+ }
+
+ /*
+ * If the user didn't specify a directory for locating
+ * reference files, try to find the reference files in
+ * the "usual places."
+ */
+ refdir = refdir_alloc = get_refdir(refdir);
+
+ /*
+ * Banner with basic information.
+ */
+ printf("\n");
+ printf("If tests fail or crash, details will be in:\n");
+ printf(" %s\n", tmpdir);
+ printf("\n");
+ if (verbosity > VERBOSITY_SUMMARY_ONLY) {
+ printf("Reference files will be read from: %s\n", refdir);
+#ifdef PROGRAM
+ printf("Running tests on: %s\n", testprog);
+#endif
+ printf("Exercising: ");
+ fflush(stdout);
+ printf("%s\n", EXTRA_VERSION);
+ } else {
+ printf("Running ");
+ fflush(stdout);
+ }
+
+ /*
+ * Run some or all of the individual tests.
+ */
+ if (*argv == NULL) {
+ /* Default: Run all tests. */
+ for (i = 0; i < limit; i++) {
+ if (test_run(i, tmpdir))
+ tests_failed++;
+ tests_run++;
+ }
+ } else {
+ while (*(argv) != NULL) {
+ if (**argv >= '0' && **argv <= '9') {
+ i = atoi(*argv);
+ if (i < 0 || i >= limit) {
+ printf("*** INVALID Test %s\n", *argv);
+ free(refdir_alloc);
+ usage(progname);
+ /* usage() never returns */
+ }
+ } else {
+ for (i = 0; i < limit; ++i) {
+ if (strcmp(*argv, tests[i].name) == 0)
+ break;
+ }
+ if (i >= limit) {
+ printf("*** INVALID Test ``%s''\n",
+ *argv);
+ free(refdir_alloc);
+ usage(progname);
+ /* usage() never returns */
+ }
+ }
+ if (test_run(i, tmpdir))
+ tests_failed++;
+ tests_run++;
+ argv++;
+ }
+ }
+
+ /*
+ * Report summary statistics.
+ */
+ if (verbosity > VERBOSITY_SUMMARY_ONLY) {
+ printf("\n");
+ printf("Totals:\n");
+ printf(" Tests run: %8d\n", tests_run);
+ printf(" Tests failed: %8d\n", tests_failed);
+ printf(" Assertions checked:%8d\n", assertions);
+ printf(" Assertions failed: %8d\n", failures);
+ printf(" Skips reported: %8d\n", skips);
+ }
+ if (failures) {
+ printf("\n");
+ printf("Failing tests:\n");
+ for (i = 0; i < limit; ++i) {
+ if (tests[i].failures)
+ printf(" %d: %s (%d failures)\n", i,
+ tests[i].name, tests[i].failures);
+ }
+ printf("\n");
+ printf("Details for failing tests: %s\n", tmpdir);
+ printf("\n");
+ } else {
+ if (verbosity == VERBOSITY_SUMMARY_ONLY)
+ printf("\n");
+ printf("%d tests passed, no failures\n", tests_run);
+ }
+
+ free(refdir_alloc);
+
+ /* If the final tmpdir is empty, we can remove it. */
+ /* This should be the usual case when all tests succeed. */
+ assertChdir("..");
+ rmdir(tmpdir);
+
+ return (tests_failed ? 1 : 0);
+}
diff --git a/archivers/libarchive/files/tar/test/test.h b/archivers/libarchive/files/tar/test/test.h
new file mode 100644
index 00000000000..54c8b8b10c9
--- /dev/null
+++ b/archivers/libarchive/files/tar/test/test.h
@@ -0,0 +1,289 @@
+/*
+ * 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: src/usr.bin/tar/test/test.h,v 1.4 2008/08/21 07:04:57 kientzle Exp $
+ */
+
+/* Every test program should #include "test.h" as the first thing. */
+
+/*
+ * The goal of this file (and the matching test.c) is to
+ * simplify the very repetitive test-*.c test programs.
+ */
+#if defined(HAVE_CONFIG_H)
+/* Most POSIX platforms use the 'configure' script to build config.h */
+#include "config.h"
+#elif defined(__FreeBSD__)
+/* Building as part of FreeBSD system requires a pre-built config.h. */
+#include "config_freebsd.h"
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+/* Win32 can't run the 'configure' script. */
+#include "config_windows.h"
+#else
+/* Warn if the library hasn't been (automatically or manually) configured. */
+#error Oops: No config.h and no pre-built configuration in test.h.
+#endif
+
+#include <sys/types.h> /* Windows requires this before sys/stat.h */
+#include <sys/stat.h>
+
+#ifdef USE_DMALLOC
+#include <dmalloc.h>
+#endif
+#if HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+#ifdef HAVE_DIRECT_H
+#include <direct.h>
+#define dirent direct
+#endif
+#include <errno.h>
+#include <fcntl.h>
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <wchar.h>
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
+
+/*
+ * System-specific tweaks. We really want to minimize these
+ * as much as possible, since they make it harder to understand
+ * the mainline code.
+ */
+
+/* Windows (including Visual Studio and MinGW but not Cygwin) */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#include "../bsdtar_windows.h"
+#if !defined(__BORLANDC__)
+#define strdup _strdup
+#endif
+#define LOCALE_DE "deu"
+#else
+#define LOCALE_DE "de_DE.UTF-8"
+#endif
+
+/* Visual Studio */
+#ifdef _MSC_VER
+#define snprintf sprintf_s
+#endif
+
+/* Cygwin */
+#if defined(__CYGWIN__)
+/* Cygwin-1.7.x is lazy about populating nlinks, so don't
+ * expect it to be accurate. */
+# define NLINKS_INACCURATE_FOR_DIRS
+#endif
+
+/* Haiku OS */
+#if defined(__HAIKU__)
+/* Haiku has typedefs in stdint.h (needed for int64_t) */
+#include <stdint.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
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+/*
+ * Redefine DEFINE_TEST for use in defining the test functions.
+ */
+#undef DEFINE_TEST
+#define DEFINE_TEST(name) void name(void); void name(void)
+
+/* An implementation of the standard assert() macro */
+#define assert(e) assertion_assert(__FILE__, __LINE__, (e), #e, NULL)
+/* chdir() and error if it fails */
+#define assertChdir(path) \
+ assertion_chdir(__FILE__, __LINE__, path)
+/* Assert two integers are the same. Reports value of each one if not. */
+#define assertEqualInt(v1,v2) \
+ assertion_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
+/* Assert two strings are the same. Reports value of each one if not. */
+#define assertEqualString(v1,v2) \
+ assertion_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
+/* As above, but v1 and v2 are wchar_t * */
+#define assertEqualWString(v1,v2) \
+ assertion_equal_wstring(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL)
+/* As above, but raw blocks of bytes. */
+#define assertEqualMem(v1, v2, l) \
+ assertion_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL)
+/* Assert two files are the same; allow printf-style expansion of second name.
+ * See below for comments about variable arguments here...
+ */
+#define assertEqualFile \
+ assertion_setup(__FILE__, __LINE__);assertion_equal_file
+/* Assert that a file is empty; supports printf-style arguments. */
+#define assertEmptyFile \
+ assertion_setup(__FILE__, __LINE__);assertion_empty_file
+/* Assert that a file is not empty; supports printf-style arguments. */
+#define assertNonEmptyFile \
+ assertion_setup(__FILE__, __LINE__);assertion_non_empty_file
+#define assertFileAtime(pathname, sec, nsec) \
+ assertion_file_atime(__FILE__, __LINE__, pathname, sec, nsec)
+#define assertFileAtimeRecent(pathname) \
+ assertion_file_atime_recent(__FILE__, __LINE__, pathname)
+#define assertFileBirthtime(pathname, sec, nsec) \
+ assertion_file_birthtime(__FILE__, __LINE__, pathname, sec, nsec)
+#define assertFileBirthtimeRecent(pathname) \
+ assertion_file_birthtime_recent(__FILE__, __LINE__, pathname)
+/* Assert that a file exists; supports printf-style arguments. */
+#define assertFileExists \
+ assertion_setup(__FILE__, __LINE__);assertion_file_exists
+/* Assert that a file exists; supports printf-style arguments. */
+#define assertFileNotExists \
+ assertion_setup(__FILE__, __LINE__);assertion_file_not_exists
+/* Assert that file contents match a string; supports printf-style arguments. */
+#define assertFileContents \
+ assertion_setup(__FILE__, __LINE__);assertion_file_contents
+#define assertFileMtime(pathname, sec, nsec) \
+ assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec)
+#define assertFileMtimeRecent(pathname) \
+ assertion_file_mtime_recent(__FILE__, __LINE__, pathname)
+#define assertFileNLinks(pathname, nlinks) \
+ assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks)
+#define assertFileSize(pathname, size) \
+ assertion_file_size(__FILE__, __LINE__, pathname, size)
+#define assertTextFileContents \
+ assertion_setup(__FILE__, __LINE__);assertion_text_file_contents
+#define assertFileContainsLinesAnyOrder(pathname, lines) \
+ assertion_file_contains_lines_any_order(__FILE__, __LINE__, pathname, lines)
+#define assertIsDir(pathname, mode) \
+ assertion_is_dir(__FILE__, __LINE__, pathname, mode)
+#define assertIsHardlink(path1, path2) \
+ assertion_is_hardlink(__FILE__, __LINE__, path1, path2)
+#define assertIsNotHardlink(path1, path2) \
+ assertion_is_not_hardlink(__FILE__, __LINE__, path1, path2)
+#define assertIsReg(pathname, mode) \
+ assertion_is_reg(__FILE__, __LINE__, pathname, mode)
+#define assertIsSymlink(pathname, contents) \
+ assertion_is_symlink(__FILE__, __LINE__, pathname, contents)
+/* Create a directory, report error if it fails. */
+#define assertMakeDir(dirname, mode) \
+ assertion_make_dir(__FILE__, __LINE__, dirname, mode)
+#define assertMakeFile(path, mode, contents) \
+ assertion_make_file(__FILE__, __LINE__, path, mode, contents)
+#define assertMakeHardlink(newfile, oldfile) \
+ assertion_make_hardlink(__FILE__, __LINE__, newfile, oldfile)
+#define assertMakeSymlink(newfile, linkto) \
+ assertion_make_symlink(__FILE__, __LINE__, newfile, linkto)
+#define assertUmask(mask) \
+ assertion_umask(__FILE__, __LINE__, mask)
+
+/*
+ * This would be simple with C99 variadic macros, but I don't want to
+ * require that. Instead, I insert a function call before each
+ * skipping() call to pass the file and line information down. Crude,
+ * but effective.
+ */
+#define skipping \
+ assertion_setup(__FILE__, __LINE__);test_skipping
+
+/* Function declarations. These are defined in test_utility.c. */
+void failure(const char *fmt, ...);
+int assertion_assert(const char *, int, int, const char *, void *);
+int assertion_chdir(const char *, int, const char *);
+int assertion_empty_file(const char *, ...);
+int assertion_equal_file(const char *, const char *, ...);
+int assertion_equal_int(const char *, int, long long, const char *, long long, const char *, void *);
+int assertion_equal_mem(const char *, int, const void *, const char *, const void *, const char *, size_t, const char *, void *);
+int assertion_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *);
+int assertion_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *);
+int assertion_file_atime(const char *, int, const char *, long, long);
+int assertion_file_atime_recent(const char *, int, const char *);
+int assertion_file_birthtime(const char *, int, const char *, long, long);
+int assertion_file_birthtime_recent(const char *, int, const char *);
+int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **);
+int assertion_file_contents(const void *, int, const char *, ...);
+int assertion_file_exists(const char *, ...);
+int assertion_file_mtime(const char *, int, const char *, long, long);
+int assertion_file_mtime_recent(const char *, int, const char *);
+int assertion_file_nlinks(const char *, int, const char *, int);
+int assertion_file_not_exists(const char *, ...);
+int assertion_file_size(const char *, int, const char *, long);
+int assertion_is_dir(const char *, int, const char *, int);
+int assertion_is_hardlink(const char *, int, const char *, const char *);
+int assertion_is_not_hardlink(const char *, int, const char *, const char *);
+int assertion_is_reg(const char *, int, const char *, int);
+int assertion_is_symlink(const char *, int, const char *, const char *);
+int assertion_make_dir(const char *, int, const char *, int);
+int assertion_make_file(const char *, int, const char *, int, const char *);
+int assertion_make_hardlink(const char *, int, const char *newpath, const char *);
+int assertion_make_symlink(const char *, int, const char *newpath, const char *);
+int assertion_non_empty_file(const char *, ...);
+int assertion_text_file_contents(const char *buff, const char *f);
+int assertion_umask(const char *, int, int);
+void assertion_setup(const char *, int);
+
+void test_skipping(const char *fmt, ...);
+
+/* Like sprintf, then system() */
+int systemf(const char * fmt, ...);
+
+/* Delay until time() returns a value after this. */
+void sleepUntilAfter(time_t);
+
+/* Return true if this platform can create symlinks. */
+int canSymlink(void);
+
+/* Return true if this platform can run the "gzip" program. */
+int canGzip(void);
+
+/* Return true if this platform can run the "gunzip" program. */
+int canGunzip(void);
+
+/* Suck file into string allocated via malloc(). Call free() when done. */
+/* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */
+char *slurpfile(size_t *, const char *fmt, ...);
+
+/* Extracts named reference file to the current directory. */
+void extract_reference_file(const char *);
+
+/*
+ * Special interfaces for program test harness.
+ */
+
+/* Pathname of exe to be tested. */
+const char *testprogfile;
+/* Name of exe to use in printf-formatted command strings. */
+/* On Windows, this includes leading/trailing quotes. */
+const char *testprog;
diff --git a/archivers/libarchive/files/tar/test/test_0.c b/archivers/libarchive/files/tar/test/test_0.c
new file mode 100644
index 00000000000..c9277da16bc
--- /dev/null
+++ b/archivers/libarchive/files/tar/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"
+__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_0.c,v 1.2 2008/05/26 17:10:10 kientzle Exp $");
+
+/*
+ * 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)))
+ exit(1);
+
+ failure("%s is not executable?!", testprog);
+ if (!assert((st.st_mode & 0111) != 0))
+ exit(1);
+
+ /*
+ * Try to succesfully run the program; this requires that
+ * we know some option that will succeed.
+ */
+ if (0 == systemf("%s --version >" DEV_NULL, testprog)) {
+ /* This worked. */
+ } else if (0 == systemf("%s -W version >" DEV_NULL, testprog)) {
+ /* This worked. */
+ } else {
+ failure("Unable to successfully run any of the following:\n"
+ " * %s --version\n"
+ " * %s -W version\n",
+ testprog, testprog);
+ assert(0);
+ }
+
+ /* TODO: Ensure that our reference files are available. */
+}
diff --git a/archivers/libarchive/files/tar/test/test_basic.c b/archivers/libarchive/files/tar/test/test_basic.c
new file mode 100644
index 00000000000..4dc7cf6364f
--- /dev/null
+++ b/archivers/libarchive/files/tar/test/test_basic.c
@@ -0,0 +1,115 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_basic.c,v 1.2 2008/05/26 17:10:10 kientzle Exp $");
+
+
+static void
+basic_tar(const char *target, const char *pack_options,
+ const char *unpack_options, const char *flist)
+{
+ int r;
+
+ assertMakeDir(target, 0775);
+
+ /* Use the tar program to create an archive. */
+ r = systemf("%s cf - %s %s >%s/archive 2>%s/pack.err", testprog, pack_options, flist, target, target);
+ failure("Error invoking %s cf -", testprog, pack_options);
+ assertEqualInt(r, 0);
+
+ assertChdir(target);
+
+ /* Verify that nothing went to stderr. */
+ assertEmptyFile("pack.err");
+
+ /*
+ * Use tar to unpack the archive into another directory.
+ */
+ r = systemf("%s xf archive %s >unpack.out 2>unpack.err", testprog, unpack_options);
+ failure("Error invoking %s xf archive %s", testprog, unpack_options);
+ assertEqualInt(r, 0);
+
+ /* Verify that nothing went to stderr. */
+ assertEmptyFile("unpack.err");
+
+ /*
+ * Verify unpacked files.
+ */
+
+ /* Regular file with 2 links. */
+ assertIsReg("file", -1);
+ assertFileSize("file", 10);
+ failure("%s", target);
+ assertFileNLinks("file", 2);
+
+ /* Another name for the same file. */
+ assertIsReg("linkfile", -1);
+ assertFileSize("linkfile", 10);
+ assertFileNLinks("linkfile", 2);
+ assertIsHardlink("file", "linkfile");
+
+ /* Symlink */
+ if (canSymlink())
+ assertIsSymlink("symlink", "file");
+
+ /* dir */
+ assertIsDir("dir", 0775);
+ assertChdir("..");
+}
+
+DEFINE_TEST(test_basic)
+{
+ FILE *f;
+ const char *flist;
+
+ assertUmask(0);
+
+ /* File with 10 bytes content. */
+ f = fopen("file", "wb");
+ assert(f != NULL);
+ assertEqualInt(10, fwrite("123456789", 1, 10, f));
+ fclose(f);
+
+ /* hardlink to above file. */
+ assertMakeHardlink("linkfile", "file");
+ assertIsHardlink("file", "linkfile");
+
+ /* Symlink to above file. */
+ if (canSymlink())
+ assertMakeSymlink("symlink", "file");
+
+ /* Directory. */
+ assertMakeDir("dir", 0775);
+
+ if (canSymlink())
+ flist = "file linkfile symlink dir";
+ else
+ flist = "file linkfile dir";
+ /* Archive/dearchive with a variety of options. */
+ basic_tar("copy", "", "", flist);
+ /* tar doesn't handle cpio symlinks correctly */
+ /* basic_tar("copy_odc", "--format=odc", ""); */
+ basic_tar("copy_ustar", "--format=ustar", "", flist);
+}
diff --git a/archivers/libarchive/files/tar/test/test_copy.c b/archivers/libarchive/files/tar/test/test_copy.c
new file mode 100644
index 00000000000..69112900e53
--- /dev/null
+++ b/archivers/libarchive/files/tar/test/test_copy.c
@@ -0,0 +1,372 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_copy.c,v 1.3 2008/08/15 06:12:02 kientzle Exp $");
+
+#if defined(__CYGWIN__)
+# include <limits.h>
+# include <sys/cygwin.h>
+#endif
+
+/*
+ * Try to figure out how deep we can go in our tests. Assumes that
+ * the first call to this function has the longest starting cwd (which
+ * is currently "<testdir>/original"). This is mostly to work around
+ * limits in our Win32 support.
+ *
+ * Background: On Posix systems, PATH_MAX is merely a limit on the
+ * length of the string passed into a system call. By repeatedly
+ * calling chdir(), you can work with arbitrarily long paths on such
+ * systems. In contrast, Win32 APIs apply PATH_MAX limits to the full
+ * absolute path, so the permissible length of a system call argument
+ * varies with the cwd. Some APIs actually enforce limits
+ * significantly less than PATH_MAX to ensure that you can create
+ * files within the current working directory. The Win32 limits also
+ * apply to Cygwin before 1.7.
+ *
+ * Someday, I want to convert the Win32 support to use newer
+ * wide-character paths with '\\?\' prefix, which has a 32k PATH_MAX
+ * instead of the rather anemic 260 character limit of the older
+ * system calls. Then we can drop this mess (unless we want to
+ * continue to special-case Cygwin 1.5 and earlier).
+ */
+static int
+compute_loop_max(void)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ static int LOOP_MAX = 0;
+ char buf[MAX_PATH];
+ size_t cwdlen;
+
+ if (LOOP_MAX == 0) {
+ assert(_getcwd(buf, MAX_PATH) != NULL);
+ cwdlen = strlen(buf);
+ /* 12 characters = length of 8.3 filename */
+ /* 4 characters = length of "/../" used in symlink tests */
+ /* 1 character = length of extra "/" separator */
+ LOOP_MAX = MAX_PATH - (int)cwdlen - 12 - 4 - 1;
+ }
+ return LOOP_MAX;
+#elif defined(__CYGWIN__) && !defined(HAVE_CYGWIN_CONV_PATH)
+ static int LOOP_MAX = 0;
+ if (LOOP_MAX == 0) {
+ char wbuf[PATH_MAX];
+ char pbuf[PATH_MAX];
+ size_t wcwdlen;
+ size_t pcwdlen;
+ size_t cwdlen;
+ assert(getcwd(pbuf, PATH_MAX) != NULL);
+ pcwdlen = strlen(pbuf);
+ cygwin_conv_to_full_win32_path(pbuf, wbuf);
+ wcwdlen = strlen(wbuf);
+ cwdlen = ((wcwdlen > pcwdlen) ? wcwdlen : pcwdlen);
+ /* Cygwin helper needs an extra few characters. */
+ LOOP_MAX = PATH_MAX - (int)cwdlen - 12 - 4 - 4;
+ }
+ return LOOP_MAX;
+#else
+ /* cygwin-1.7 ends up here, along with "normal" unix */
+ return 200; /* restore pre-r278 depth */
+#endif
+}
+
+/* filenames[i] is a distinctive filename of length i. */
+/* To simplify interpreting failures, each filename ends with a
+ * decimal integer which is the length of the filename. E.g., A
+ * filename ending in "_92" is 92 characters long. To detect errors
+ * which drop or misplace characters, the filenames use a repeating
+ * "abcdefghijklmnopqrstuvwxyz..." pattern. */
+static char *filenames[201];
+
+static void
+compute_filenames(void)
+{
+ char buff[250];
+ size_t i,j;
+
+ filenames[0] = strdup("");
+ filenames[1] = strdup("1");
+ filenames[2] = strdup("a2");
+ for (i = 3; i < sizeof(filenames)/sizeof(filenames[0]); ++i) {
+ /* Fill with "abcdefghij..." */
+ for (j = 0; j < i; ++j)
+ buff[j] = 'a' + (j % 26);
+ buff[j--] = '\0';
+ /* Work from the end to fill in the number portion. */
+ buff[j--] = '0' + (i % 10);
+ if (i > 9) {
+ buff[j--] = '0' + ((i / 10) % 10);
+ if (i > 99)
+ buff[j--] = '0' + (i / 100);
+ }
+ buff[j] = '_';
+ /* Guard against obvious screwups in the above code. */
+ assertEqualInt(strlen(buff), i);
+ filenames[i] = strdup(buff);
+ }
+}
+
+static void
+create_tree(void)
+{
+ char buff[260];
+ char buff2[260];
+ int i;
+ int LOOP_MAX;
+
+ compute_filenames();
+
+ /* Log that we'll be omitting some checks. */
+ if (!canSymlink()) {
+ skipping("Symlink checks");
+ }
+
+ assertMakeDir("original", 0775);
+ assertEqualInt(0, chdir("original"));
+ LOOP_MAX = compute_loop_max();
+
+ assertMakeDir("f", 0775);
+ assertMakeDir("l", 0775);
+ assertMakeDir("m", 0775);
+ assertMakeDir("s", 0775);
+ assertMakeDir("d", 0775);
+
+ for (i = 1; i < LOOP_MAX; i++) {
+ failure("Internal sanity check failed: i = %d", i);
+ assert(filenames[i] != NULL);
+
+ sprintf(buff, "f/%s", filenames[i]);
+ assertMakeFile(buff, 0777, buff);
+
+ /* Create a link named "l/abcdef..." to the above. */
+ sprintf(buff2, "l/%s", filenames[i]);
+ assertMakeHardlink(buff2, buff);
+
+ /* Create a link named "m/abcdef..." to the above. */
+ sprintf(buff2, "m/%s", filenames[i]);
+ assertMakeHardlink(buff2, buff);
+
+ if (canSymlink()) {
+ /* Create a symlink named "s/abcdef..." to the above. */
+ sprintf(buff, "s/%s", filenames[i]);
+ sprintf(buff2, "../f/%s", filenames[i]);
+ failure("buff=\"%s\" buff2=\"%s\"", buff, buff2);
+ assertMakeSymlink(buff, buff2);
+ }
+ /* Create a dir named "d/abcdef...". */
+ buff[0] = 'd';
+ failure("buff=\"%s\"", buff);
+ assertMakeDir(buff, 0775);
+ }
+
+ assertEqualInt(0, chdir(".."));
+}
+
+#define LIMIT_NONE 200
+#define LIMIT_USTAR 100
+
+static void
+verify_tree(size_t limit)
+{
+ char name1[260];
+ char name2[260];
+ size_t i, LOOP_MAX;
+
+ LOOP_MAX = compute_loop_max();
+
+ /* Generate the names we know should be there and verify them. */
+ for (i = 1; i < LOOP_MAX; i++) {
+ /* Verify a file named "f/abcdef..." */
+ sprintf(name1, "f/%s", filenames[i]);
+ if (i <= limit) {
+ assertFileExists(name1);
+ assertFileContents(name1, strlen(name1), name1);
+ }
+
+ sprintf(name2, "l/%s", filenames[i]);
+ if (i + 2 <= limit) {
+ /* Verify hardlink "l/abcdef..." */
+ assertIsHardlink(name1, name2);
+ /* Verify hardlink "m/abcdef..." */
+ name2[0] = 'm';
+ assertIsHardlink(name1, name2);
+ }
+
+ if (canSymlink()) {
+ /* Verify symlink "s/abcdef..." */
+ sprintf(name1, "s/%s", filenames[i]);
+ sprintf(name2, "../f/%s", filenames[i]);
+ if (strlen(name2) <= limit)
+ assertIsSymlink(name1, name2);
+ }
+
+ /* Verify dir "d/abcdef...". */
+ sprintf(name1, "d/%s", filenames[i]);
+ if (i + 1 <= limit) { /* +1 for trailing slash */
+ if (assertIsDir(name1, -1)) {
+ /* TODO: opendir/readdir this
+ * directory and make sure
+ * it's empty.
+ */
+ }
+ }
+ }
+
+#if !defined(_WIN32) || defined(__CYGWIN__)
+ {
+ const char *dp;
+ /* Now make sure nothing is there that shouldn't be. */
+ for (dp = "dflms"; *dp != '\0'; ++dp) {
+ DIR *d;
+ struct dirent *de;
+ char dir[2];
+ dir[0] = *dp; dir[1] = '\0';
+ d = opendir(dir);
+ failure("Unable to open dir '%s'", dir);
+ if (!assert(d != NULL))
+ continue;
+ while ((de = readdir(d)) != NULL) {
+ char *p = de->d_name;
+ if (p[0] == '.')
+ continue;
+ switch(dp[0]) {
+ case 'l': case 'm': case 'd':
+ failure("strlen(p)=%d", strlen(p));
+ assert(strlen(p) < limit);
+ assertEqualString(p,
+ filenames[strlen(p)]);
+ break;
+ case 'f': case 's':
+ failure("strlen(p)=%d", strlen(p));
+ assert(strlen(p) < limit + 1);
+ assertEqualString(p,
+ filenames[strlen(p)]);
+ break;
+ default:
+ failure("File %s shouldn't be here", p);
+ assert(0);
+ }
+ }
+ closedir(d);
+ }
+ }
+#endif
+}
+
+static void
+copy_basic(void)
+{
+ int r;
+
+ /* NOTE: for proper operation on cygwin-1.5 and windows, the
+ * length of the name of the directory below, "plain", must be
+ * less than or equal to the lengthe of the name of the original
+ * directory, "original" This restriction derives from the
+ * extremely limited pathname lengths on those platforms.
+ */
+ assertMakeDir("plain", 0775);
+ assertEqualInt(0, chdir("plain"));
+
+ /*
+ * Use the tar program to create an archive.
+ */
+ r = systemf("%s cf archive -C ../original f d l m s >pack.out 2>pack.err",
+ testprog);
+ failure("Error invoking \"%s cf\"", testprog);
+ assertEqualInt(r, 0);
+
+ /* Verify that nothing went to stdout or stderr. */
+ assertEmptyFile("pack.err");
+ assertEmptyFile("pack.out");
+
+ /*
+ * Use tar to unpack the archive into another directory.
+ */
+ r = systemf("%s xf archive >unpack.out 2>unpack.err", testprog);
+ failure("Error invoking %s xf archive", testprog);
+ assertEqualInt(r, 0);
+
+ /* Verify that nothing went to stdout or stderr. */
+ assertEmptyFile("unpack.err");
+ assertEmptyFile("unpack.out");
+
+ verify_tree(LIMIT_NONE);
+ assertEqualInt(0, chdir(".."));
+}
+
+static void
+copy_ustar(void)
+{
+ const char *target = "ustar";
+ int r;
+
+ /* NOTE: for proper operation on cygwin-1.5 and windows, the
+ * length of the name of the directory below, "ustar", must be
+ * less than or equal to the lengthe of the name of the original
+ * directory, "original" This restriction derives from the
+ * extremely limited pathname lengths on those platforms.
+ */
+ assertMakeDir(target, 0775);
+ assertEqualInt(0, chdir(target));
+
+ /*
+ * Use the tar program to create an archive.
+ */
+ r = systemf("%s cf archive --format=ustar -C ../original f d l m s >pack.out 2>pack.err",
+ testprog);
+ failure("Error invoking \"%s cf archive --format=ustar\"", testprog);
+ assertEqualInt(r, 0);
+
+ /* Verify that nothing went to stdout. */
+ assertEmptyFile("pack.out");
+ /* Stderr is non-empty, since there are a bunch of files
+ * with filenames too long to archive. */
+
+ /*
+ * Use tar to unpack the archive into another directory.
+ */
+ r = systemf("%s xf archive >unpack.out 2>unpack.err", testprog);
+ failure("Error invoking %s xf archive", testprog);
+ assertEqualInt(r, 0);
+
+ /* Verify that nothing went to stdout or stderr. */
+ assertEmptyFile("unpack.err");
+ assertEmptyFile("unpack.out");
+
+ verify_tree(LIMIT_USTAR);
+ assertEqualInt(0, chdir("../.."));
+}
+
+DEFINE_TEST(test_copy)
+{
+ assertUmask(0);
+ create_tree(); /* Create sample files in "original" dir. */
+
+ /* Test simple "tar -c | tar -x" pipeline copy. */
+ copy_basic();
+
+ /* Same, but constrain to ustar format. */
+ copy_ustar();
+}
diff --git a/archivers/libarchive/files/tar/test/test_getdate.c b/archivers/libarchive/files/tar/test/test_getdate.c
new file mode 100644
index 00000000000..eac571049fe
--- /dev/null
+++ b/archivers/libarchive/files/tar/test/test_getdate.c
@@ -0,0 +1,80 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_getdate.c,v 1.2 2008/05/26 17:10:10 kientzle Exp $");
+
+#include <time.h>
+
+/*
+ * Verify that the getdate() function works.
+ */
+
+time_t get_date(time_t, const char *);
+
+DEFINE_TEST(test_getdate)
+{
+ time_t now = time(NULL);
+
+ assertEqualInt(get_date(now, "Jan 1, 1970 UTC"), 0);
+ assertEqualInt(get_date(now, "7:12:18-0530 4 May 1983"), 420900138);
+ assertEqualInt(get_date(now, "2004/01/29 513 mest"), 1075345980);
+ assertEqualInt(get_date(now, "99/02/17 7pm utc"), 919278000);
+ assertEqualInt(get_date(now, "02/17/99 7:11am est"), 919253460);
+ /* It's important that we handle ctime() format. */
+ assertEqualInt(get_date(now, "Sun Feb 22 17:38:26 PST 2009"),
+ 1235353106);
+ /* Basic relative offsets. */
+ /* If we use the actual current time as the reference, then
+ * these tests break around DST changes, so it's actually
+ * important to use a specific reference time here. */
+ assertEqualInt(get_date(0, "tomorrow"), 24 * 60 * 60);
+ assertEqualInt(get_date(0, "yesterday"), - 24 * 60 * 60);
+ assertEqualInt(get_date(0, "now + 1 hour"), 60 * 60);
+ assertEqualInt(get_date(0, "now + 1 hour + 1 minute"), 60 * 60 + 60);
+ /* Repeat the above for a different start time. */
+ now = 1231113600; /* Jan 5, 2009 00:00 UTC */
+ assertEqualInt(get_date(0, "Jan 5, 2009 00:00 UTC"), now);
+ assertEqualInt(get_date(now, "tomorrow"), now + 24 * 60 * 60);
+ assertEqualInt(get_date(now, "yesterday"), now - 24 * 60 * 60);
+ assertEqualInt(get_date(now, "now + 1 hour"), now + 60 * 60);
+ assertEqualInt(get_date(now, "now + 1 hour + 1 minute"),
+ now + 60 * 60 + 60);
+ assertEqualInt(get_date(now, "tomorrow 5:16am UTC"),
+ now + 24 * 60 * 60 + 5 * 60 * 60 + 16 * 60);
+ assertEqualInt(get_date(now, "UTC 5:16am tomorrow"),
+ now + 24 * 60 * 60 + 5 * 60 * 60 + 16 * 60);
+
+ /* Jan 5, 2009 was a Monday. */
+ assertEqualInt(get_date(now, "monday UTC"), now);
+ assertEqualInt(get_date(now, "sunday UTC"), now + 6 * 24 * 60 * 60);
+ assertEqualInt(get_date(now, "tuesday UTC"), now + 24 * 60 * 60);
+ /* "next tuesday" is one week after "tuesday" */
+ assertEqualInt(get_date(now, "UTC next tuesday"),
+ now + 8 * 24 * 60 * 60);
+ /* "last tuesday" is one week before "tuesday" */
+ assertEqualInt(get_date(now, "last tuesday UTC"),
+ now - 6 * 24 * 60 * 60);
+ /* TODO: Lots more tests here. */
+}
diff --git a/archivers/libarchive/files/tar/test/test_help.c b/archivers/libarchive/files/tar/test/test_help.c
new file mode 100644
index 00000000000..3bb517d00cd
--- /dev/null
+++ b/archivers/libarchive/files/tar/test/test_help.c
@@ -0,0 +1,84 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_help.c,v 1.2 2008/05/26 17:10:10 kientzle Exp $");
+
+/*
+ * 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 'bsdtar': %s", p);
+ assert(in_first_line(p, "bsdtar"));
+ /*
+ * 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");
+
+ /* -W help should be another synonym. */
+ r = systemf("%s -W help >Whelp.stdout 2>Whelp.stderr", testprog);
+ assertEqualInt(r, 0);
+ failure("-W help should generate nothing to stderr.");
+ assertEmptyFile("Whelp.stderr");
+ failure("stdout should be same for -W help and --help");
+ assertEqualFile("Whelp.stdout", "help.stdout");
+}
diff --git a/archivers/libarchive/files/tar/test/test_patterns.c b/archivers/libarchive/files/tar/test/test_patterns.c
new file mode 100644
index 00000000000..fee98be9b27
--- /dev/null
+++ b/archivers/libarchive/files/tar/test/test_patterns.c
@@ -0,0 +1,184 @@
+/*-
+ * Copyright (c) 2009 Michihiro NAKAJIMA
+ * 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"
+__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_patterns.c,v 1.6 2008/08/21 22:28:00 kientzle Exp $");
+
+DEFINE_TEST(test_patterns)
+{
+ FILE *f;
+ int r;
+ const char *reffile2 = "test_patterns_2.tar";
+ const char *reffile3 = "test_patterns_3.tar";
+ const char *reffile4 = "test_patterns_4.tar";
+
+ const char *tar2aExpected[] = {
+ "/tmp/foo/bar/",
+ "/tmp/foo/bar/baz",
+ NULL
+ };
+
+ /*
+ * Test basic command-line pattern handling.
+ */
+
+ /*
+ * Test 1: Files on the command line that don't get matched
+ * didn't produce an error.
+ *
+ * John Baldwin reported this problem in PR bin/121598
+ */
+ f = fopen("foo", "w");
+ assert(f != NULL);
+ fclose(f);
+ r = systemf("%s cfv tar1.tgz foo > tar1a.out 2> tar1a.err", testprog);
+ assertEqualInt(r, 0);
+ r = systemf("%s xv --no-same-owner -f tar1.tgz foo bar > tar1b.out 2> tar1b.err", testprog);
+ failure("tar should return non-zero because a file was given on the command line that's not in the archive");
+ assert(r != 0);
+
+ /*
+ * Test 2: Check basic matching of full paths that start with /
+ */
+ extract_reference_file(reffile2);
+
+ r = systemf("%s tf %s /tmp/foo/bar > tar2a.out 2> tar2a.err",
+ testprog, reffile2);
+ assertEqualInt(r, 0);
+ assertFileContainsLinesAnyOrder("tar2a.out", tar2aExpected);
+ assertEmptyFile("tar2a.err");
+
+ /*
+ * Test 3 archive has some entries starting with '/' and some not.
+ */
+ extract_reference_file(reffile3);
+
+ /* Test 3a: Pattern tmp/foo/bar should not match /tmp/foo/bar */
+ r = systemf("%s x --no-same-owner -f %s tmp/foo/bar > tar3a.out 2> tar3a.err",
+ testprog, reffile3);
+ assert(r != 0);
+ assertEmptyFile("tar3a.out");
+
+ /* Test 3b: Pattern /tmp/foo/baz should not match tmp/foo/baz */
+ assertNonEmptyFile("tar3a.err");
+ /* Again, with the '/' */
+ r = systemf("%s x --no-same-owner -f %s /tmp/foo/baz > tar3b.out 2> tar3b.err",
+ testprog, reffile3);
+ assert(r != 0);
+ assertEmptyFile("tar3b.out");
+ assertNonEmptyFile("tar3b.err");
+
+ /* Test 3c: ./tmp/foo/bar should not match /tmp/foo/bar */
+ r = systemf("%s x --no-same-owner -f %s ./tmp/foo/bar > tar3c.out 2> tar3c.err",
+ testprog, reffile3);
+ assert(r != 0);
+ assertEmptyFile("tar3c.out");
+ assertNonEmptyFile("tar3c.err");
+
+ /* Test 3d: ./tmp/foo/baz should match tmp/foo/baz */
+ r = systemf("%s x --no-same-owner -f %s ./tmp/foo/baz > tar3d.out 2> tar3d.err",
+ testprog, reffile3);
+ assertEqualInt(r, 0);
+ assertEmptyFile("tar3d.out");
+ assertEmptyFile("tar3d.err");
+ assertFileExists("tmp/foo/baz/bar");
+
+ /*
+ * Test 4 archive has some entries starting with windows drive letters
+ * such as 'c:\', '//./c:/' or '//?/c:/'.
+ */
+ extract_reference_file(reffile4);
+
+ r = systemf("%s x --no-same-owner -f %s -C tmp > tar4.out 2> tar4.err",
+ testprog, reffile4);
+ assert(r != 0);
+ assertEmptyFile("tar4.out");
+ assertNonEmptyFile("tar4.err");
+
+ for (r = 1; r <= 54; r++) {
+ char file_a[] = "tmp/fileXX";
+ char file_b1[] = "tmp/server/share/fileXX";
+ char file_b2[] = "tmp/server\\share\\fileXX";
+ char file_c[] = "tmp/../fileXX";
+ char *filex;
+ int xsize;
+
+ switch (r) {
+ case 15: case 18:
+ /*
+ * Including server and share names.
+ * //?/UNC/server/share/file15
+ * //?/unc/server/share/file18
+ */
+ filex = file_b1;
+ xsize = sizeof(file_b1);
+ break;
+ case 35: case 38: case 52:
+ /*
+ * Including server and share names.
+ * \\?\UNC\server\share\file35
+ * \\?\unc\server\share\file38
+ * \/?/uNc/server\share\file52
+ */
+ filex = file_b2;
+ xsize = sizeof(file_b2);
+ break;
+ default:
+ filex = file_a;
+ xsize = sizeof(file_a);
+ break;
+ }
+ filex[xsize-3] = '0' + r / 10;
+ filex[xsize-2] = '0' + r % 10;
+ switch (r) {
+ case 5: case 6: case 17: case 20: case 25:
+ case 26: case 37: case 40: case 43: case 54:
+ /*
+ * Not extracted patterns.
+ * D:../file05
+ * c:../../file06
+ * //?/UNC/../file17
+ * //?/unc/../file20
+ * z:..\file25
+ * c:..\..\file26
+ * \\?\UNC\..\file37
+ * \\?\unc\..\file40
+ * c:../..\file43
+ * \/?\UnC\../file54
+ */
+ assertFileNotExists(filex);
+ filex = file_c;
+ xsize = sizeof(file_c);
+ filex[xsize-3] = '0' + r / 10;
+ filex[xsize-2] = '0' + r % 10;
+ assertFileNotExists(filex);
+ break;
+ default:
+ /* Extracted patterns. */
+ assertFileExists(filex);
+ break;
+ }
+ }
+}
diff --git a/archivers/libarchive/files/tar/test/test_stdio.c b/archivers/libarchive/files/tar/test/test_stdio.c
new file mode 100644
index 00000000000..b95a4e30542
--- /dev/null
+++ b/archivers/libarchive/files/tar/test/test_stdio.c
@@ -0,0 +1,125 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_stdio.c,v 1.2 2008/05/26 17:10:10 kientzle Exp $");
+
+DEFINE_TEST(test_stdio)
+{
+ FILE *filelist;
+ char *p;
+ size_t s;
+ int r;
+
+ assertUmask(0);
+
+ /*
+ * Create a couple of files on disk.
+ */
+ /* File */
+ assertMakeFile("f", 0755, "abc");
+ /* Link to above file. */
+ assertMakeHardlink("l", "f");
+
+ /* Create file list (text mode here) */
+ filelist = fopen("filelist", "w");
+ assert(filelist != NULL);
+ fprintf(filelist, "f\n");
+ fprintf(filelist, "l\n");
+ fclose(filelist);
+
+ /*
+ * Archive/dearchive with a variety of options, verifying
+ * stdio paths.
+ */
+
+ /* 'cf' should generate no output unless there's an error. */
+ r = systemf("%s cf archive f l >cf.out 2>cf.err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("cf.out");
+ assertEmptyFile("cf.err");
+
+ /* 'cvf' should generate file list on stderr, empty stdout. */
+ r = systemf("%s cvf archive f l >cvf.out 2>cvf.err", testprog);
+ assertEqualInt(r, 0);
+ failure("'cv' writes filenames to stderr, nothing to stdout (SUSv2)\n"
+ "Note that GNU tar writes the file list to stdout by default.");
+ assertEmptyFile("cvf.out");
+ /* TODO: Verify cvf.err has file list in SUSv2-prescribed format. */
+
+ /* 'cvf -' should generate file list on stderr, archive on stdout. */
+ r = systemf("%s cvf - f l >cvf-.out 2>cvf-.err", testprog);
+ assertEqualInt(r, 0);
+ failure("cvf - should write archive to stdout");
+ /* TODO: Verify cvf-.out has archive. */
+ failure("cvf - should write file list to stderr (SUSv2)");
+ /* TODO: Verify cvf-.err has verbose file list. */
+
+ /* 'tf' should generate file list on stdout, empty stderr. */
+ r = systemf("%s tf archive >tf.out 2>tf.err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("tf.err");
+ failure("'t' mode should write results to stdout");
+ /* TODO: Verify tf.out has file list. */
+
+ /* 'tvf' should generate file list on stdout, empty stderr. */
+ r = systemf("%s tvf archive >tvf.out 2>tvf.err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("tvf.err");
+ failure("'tv' mode should write results to stdout");
+ /* TODO: Verify tvf.out has file list. */
+
+ /* 'tvf -' uses stdin, file list on stdout, empty stderr. */
+ r = systemf("%s tvf - < archive >tvf-.out 2>tvf-.err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("tvf-.err");
+ /* TODO: Verify tvf-.out has file list. */
+
+ /* Basic 'xf' should generate no output on stdout or stderr. */
+ r = systemf("%s xf archive >xf.out 2>xf.err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("xf.err");
+ assertEmptyFile("xf.out");
+
+ /* 'xvf' should generate list on stderr, empty stdout. */
+ r = systemf("%s xvf archive >xvf.out 2>xvf.err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("xvf.out");
+ /* TODO: Verify xvf.err */
+
+ /* 'xvOf' should generate list on stderr, file contents on stdout. */
+ r = systemf("%s xvOf archive >xvOf.out 2>xvOf.err", testprog);
+ assertEqualInt(r, 0);
+ /* Verify xvOf.out is the file contents */
+ p = slurpfile(&s, "xvOf.out");
+ assert(s = 3);
+ assertEqualMem(p, "abc", 3);
+ /* TODO: Verify xvf.err */
+
+ /* 'xvf -' should generate list on stderr, empty stdout. */
+ r = systemf("%s xvf - < archive >xvf-.out 2>xvf-.err", testprog);
+ assertEqualInt(r, 0);
+ assertEmptyFile("xvf-.out");
+ /* TODO: Verify xvf-.err */
+}
diff --git a/archivers/libarchive/files/tar/test/test_version.c b/archivers/libarchive/files/tar/test/test_version.c
new file mode 100644
index 00000000000..42472d1bc26
--- /dev/null
+++ b/archivers/libarchive/files/tar/test/test_version.c
@@ -0,0 +1,97 @@
+/*-
+ * 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"
+__FBSDID("$FreeBSD: src/usr.bin/tar/test/test_version.c,v 1.2 2008/05/26 17:10:10 kientzle Exp $");
+
+/*
+ * Test that --version option works and generates reasonable output.
+ */
+
+DEFINE_TEST(test_version)
+{
+ int r;
+ char *p, *q;
+ size_t s;
+
+
+ r = systemf("%s --version >version.stdout 2>version.stderr", testprog);
+ if (r != 0)
+ r = systemf("%s -W version >version.stdout 2>version.stderr",
+ testprog);
+ failure("Unable to run either %s --version or %s -W version",
+ testprog, testprog);
+ if (!assert(r == 0))
+ return;
+
+ /* --version should generate nothing to stdout. */
+ assertEmptyFile("version.stderr");
+ /* Verify format of version message. */
+ q = p = slurpfile(&s, "version.stdout");
+ /* Version message should start with name of program, then space. */
+ assert(s > 6);
+ failure("Version must start with 'bsdtar': ``%s''", p);
+ if (!assertEqualMem(q, "bsdtar ", 7))
+ return;
+ q += 7; s -= 7;
+ /* Version number is a series of digits and periods. */
+ while (s > 0 && (*q == '.' || (*q >= '0' && *q <= '9'))) {
+ ++q;
+ --s;
+ }
+ /* Version number terminated by space. */
+ failure("No space after bsdtar version: ``%s''", p);
+ assert(s > 1);
+ /* Skip a single trailing a,b,c, or d. */
+ if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd')
+ ++q;
+ failure("No space after bsdtar version: ``%s''", p);
+ assert(*q == ' ');
+ ++q; --s;
+ /* Separator. */
+ failure("No `-' between bsdtar and libarchive versions: ``%s''", p);
+ assertEqualMem(q, "- ", 2);
+ q += 2; s -= 2;
+ /* libarchive name and version number */
+ failure("Not long enough for libarchive version: ``%s''", p);
+ assert(s > 11);
+ failure("Libarchive version must start with `libarchive': ``%s''", p);
+ assertEqualMem(q, "libarchive ", 11);
+ q += 11; s -= 11;
+ /* Version number is a series of digits and periods. */
+ while (s > 0 && (*q == '.' || (*q >= '0' && *q <= '9'))) {
+ ++q;
+ --s;
+ }
+ /* Skip a single trailing a,b,c, or d. */
+ if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd')
+ ++q;
+ /* All terminated by end-of-line. */
+ assert(s >= 1);
+ /* Skip an optional CR character (e.g., Windows) */
+ failure("Version output must end with \\n or \\r\\n");
+ if (*q == '\r') { ++q; --s; }
+ assertEqualMem(q, "\n", 1);
+ free(p);
+}
diff --git a/archivers/libarchive/files/tar/tree.c b/archivers/libarchive/files/tar/tree.c
new file mode 100644
index 00000000000..6504ebf7d06
--- /dev/null
+++ b/archivers/libarchive/files/tar/tree.c
@@ -0,0 +1,821 @@
+/*-
+ * 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.
+ */
+
+/*-
+ * This is a new directory-walking system that addresses a number
+ * of problems I've had with fts(3). In particular, it has no
+ * pathname-length limits (other than the size of 'int'), handles
+ * deep logical traversals, uses considerably less memory, and has
+ * an opaque interface (easier to modify in the future).
+ *
+ * Internally, it keeps a single list of "tree_entry" items that
+ * represent filesystem objects that require further attention.
+ * Non-directories are not kept in memory: they are pulled from
+ * readdir(), returned to the client, then freed as soon as possible.
+ * Any directory entry to be traversed gets pushed onto the stack.
+ *
+ * There is surprisingly little information that needs to be kept for
+ * each item on the stack. Just the name, depth (represented here as the
+ * string length of the parent directory's pathname), and some markers
+ * indicating how to get back to the parent (via chdir("..") for a
+ * regular dir or via fchdir(2) for a symlink).
+ */
+#include "bsdtar_platform.h"
+__FBSDID("$FreeBSD: src/usr.bin/tar/tree.c,v 1.9 2008/11/27 05:49:52 kientzle Exp $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_DIRECT_H
+#include <direct.h>
+#endif
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#if defined(HAVE_WINDOWS_H) && !defined(__CYGWIN__)
+#include <windows.h>
+#endif
+
+#include "tree.h"
+
+/*
+ * TODO:
+ * 1) Loop checking.
+ * 3) Arbitrary logical traversals by closing/reopening intermediate fds.
+ */
+
+struct tree_entry {
+ int depth;
+ struct tree_entry *next;
+ struct tree_entry *parent;
+ char *name;
+ size_t dirname_length;
+ dev_t dev;
+ ino_t ino;
+ int flags;
+ /* How to return back to the parent of a symlink. */
+#ifdef HAVE_FCHDIR
+ int symlink_parent_fd;
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+ char *symlink_parent_path;
+#else
+#error fchdir function required.
+#endif
+};
+
+/* Definitions for tree_entry.flags bitmap. */
+#define isDir 1 /* This entry is a regular directory. */
+#define isDirLink 2 /* This entry is a symbolic link to a directory. */
+#define needsFirstVisit 4 /* This is an initial entry. */
+#define needsDescent 8 /* This entry needs to be previsited. */
+#define needsOpen 16 /* This is a directory that needs to be opened. */
+#define needsAscent 32 /* This entry needs to be postvisited. */
+
+/*
+ * On Windows, "first visit" is handled as a pattern to be handed to
+ * _findfirst(). This is consistent with Windows conventions that
+ * file patterns are handled within the application. On Posix,
+ * "first visit" is just returned to the client.
+ */
+
+/*
+ * Local data for this package.
+ */
+struct tree {
+ struct tree_entry *stack;
+ struct tree_entry *current;
+#if defined(HAVE_WINDOWS_H) && !defined(__CYGWIN__)
+ HANDLE d;
+ BY_HANDLE_FILE_INFORMATION fileInfo;
+#define INVALID_DIR_HANDLE INVALID_HANDLE_VALUE
+ WIN32_FIND_DATA _findData;
+ WIN32_FIND_DATA *findData;
+#else
+ DIR *d;
+#define INVALID_DIR_HANDLE NULL
+ struct dirent *de;
+#endif
+ int flags;
+ int visit_type;
+ int tree_errno; /* Error code from last failed operation. */
+
+ /* Dynamically-sized buffer for holding path */
+ char *buff;
+ size_t buff_length;
+
+ const char *basename; /* Last path element */
+ size_t dirname_length; /* Leading dir length */
+ size_t path_length; /* Total path length */
+
+ int depth;
+ int openCount;
+ int maxOpenCount;
+
+ struct stat lst;
+ struct stat st;
+};
+
+/* Definitions for tree.flags bitmap. */
+#define hasStat 16 /* The st entry is valid. */
+#define hasLstat 32 /* The lst entry is valid. */
+#define hasFileInfo 64 /* The Windows fileInfo entry is valid. */
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+static int
+tree_dir_next_windows(struct tree *t, const char *pattern);
+#else
+static int
+tree_dir_next_posix(struct tree *t);
+#endif
+
+#ifdef HAVE_DIRENT_D_NAMLEN
+/* BSD extension; avoids need for a strlen() call. */
+#define D_NAMELEN(dp) (dp)->d_namlen
+#else
+#define D_NAMELEN(dp) (strlen((dp)->d_name))
+#endif
+
+#include <stdio.h>
+void
+tree_dump(struct tree *t, FILE *out)
+{
+ char buff[300];
+ struct tree_entry *te;
+
+ fprintf(out, "\tdepth: %d\n", t->depth);
+ fprintf(out, "\tbuff: %s\n", t->buff);
+ fprintf(out, "\tpwd: %s\n", getcwd(buff, sizeof(buff)));
+ fprintf(out, "\tbasename: %s\n", t->basename);
+ fprintf(out, "\tstack:\n");
+ for (te = t->stack; te != NULL; te = te->next) {
+ fprintf(out, "\t\t%s%d:\"%s\" %s%s%s%s%s%s\n",
+ t->current == te ? "*" : " ",
+ te->depth,
+ te->name,
+ te->flags & needsFirstVisit ? "V" : "",
+ te->flags & needsDescent ? "D" : "",
+ te->flags & needsOpen ? "O" : "",
+ te->flags & needsAscent ? "A" : "",
+ te->flags & isDirLink ? "L" : "",
+ (t->current == te && t->d) ? "+" : ""
+ );
+ }
+}
+
+/*
+ * Add a directory path to the current stack.
+ */
+static void
+tree_push(struct tree *t, const char *path)
+{
+ struct tree_entry *te;
+
+ te = malloc(sizeof(*te));
+ memset(te, 0, sizeof(*te));
+ te->next = t->stack;
+ te->parent = t->current;
+ if (te->parent)
+ te->depth = te->parent->depth + 1;
+ t->stack = te;
+#ifdef HAVE_FCHDIR
+ te->symlink_parent_fd = -1;
+ te->name = strdup(path);
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+ te->symlink_parent_path = NULL;
+ te->name = strdup(path);
+#endif
+ te->flags = needsDescent | needsOpen | needsAscent;
+ te->dirname_length = t->dirname_length;
+}
+
+/*
+ * Append a name to the current dir path.
+ */
+static void
+tree_append(struct tree *t, const char *name, size_t name_length)
+{
+ char *p;
+ size_t size_needed;
+
+ if (t->buff != NULL)
+ t->buff[t->dirname_length] = '\0';
+ /* Strip trailing '/' from name, unless entire name is "/". */
+ while (name_length > 1 && name[name_length - 1] == '/')
+ name_length--;
+
+ /* Resize pathname buffer as needed. */
+ size_needed = name_length + 1 + t->dirname_length;
+ if (t->buff_length < size_needed) {
+ if (t->buff_length < 1024)
+ t->buff_length = 1024;
+ while (t->buff_length < size_needed)
+ t->buff_length *= 2;
+ t->buff = realloc(t->buff, t->buff_length);
+ }
+ if (t->buff == NULL)
+ abort();
+ p = t->buff + t->dirname_length;
+ t->path_length = t->dirname_length + name_length;
+ /* Add a separating '/' if it's needed. */
+ if (t->dirname_length > 0 && p[-1] != '/') {
+ *p++ = '/';
+ t->path_length ++;
+ }
+#if HAVE_STRNCPY_S
+ strncpy_s(p, t->buff_length - (p - t->buff), name, name_length);
+#else
+ strncpy(p, name, name_length);
+#endif
+ p[name_length] = '\0';
+ t->basename = p;
+}
+
+/*
+ * Open a directory tree for traversal.
+ */
+struct tree *
+tree_open(const char *path)
+{
+#ifdef HAVE_FCHDIR
+ struct tree *t;
+
+ t = malloc(sizeof(*t));
+ memset(t, 0, sizeof(*t));
+ /* First item is set up a lot like a symlink traversal. */
+ tree_push(t, path);
+ t->stack->flags = needsFirstVisit | isDirLink | needsAscent;
+ t->stack->symlink_parent_fd = open(".", O_RDONLY);
+ t->openCount++;
+ t->d = INVALID_DIR_HANDLE;
+ return (t);
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+ struct tree *t;
+ char *cwd = _getcwd(NULL, 0);
+ char *pathname = strdup(path), *p, *base;
+
+ if (pathname == NULL)
+ abort();
+ for (p = pathname; *p != '\0'; ++p) {
+ if (*p == '\\')
+ *p = '/';
+ }
+ base = pathname;
+
+ t = malloc(sizeof(*t));
+ memset(t, 0, sizeof(*t));
+ /* First item is set up a lot like a symlink traversal. */
+ /* printf("Looking for wildcard in %s\n", path); */
+ /* TODO: wildcard detection here screws up on \\?\c:\ UNC names */
+ if (strchr(base, '*') || strchr(base, '?')) {
+ // It has a wildcard in it...
+ // Separate the last element.
+ p = strrchr(base, '/');
+ if (p != NULL) {
+ *p = '\0';
+ chdir(base);
+ tree_append(t, base, p - base);
+ t->dirname_length = t->path_length;
+ base = p + 1;
+ }
+ }
+ tree_push(t, base);
+ free(pathname);
+ t->stack->flags = needsFirstVisit | isDirLink | needsAscent;
+ t->stack->symlink_parent_path = cwd;
+ t->d = INVALID_DIR_HANDLE;
+ return (t);
+#endif
+}
+
+/*
+ * We've finished a directory; ascend back to the parent.
+ */
+static int
+tree_ascend(struct tree *t)
+{
+ struct tree_entry *te;
+ int r = 0;
+
+ te = t->stack;
+ t->depth--;
+ if (te->flags & isDirLink) {
+#ifdef HAVE_FCHDIR
+ if (fchdir(te->symlink_parent_fd) != 0) {
+ t->tree_errno = errno;
+ r = TREE_ERROR_FATAL;
+ }
+ close(te->symlink_parent_fd);
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+ if (SetCurrentDirectory(te->symlink_parent_path) == 0) {
+ t->tree_errno = errno;
+ r = TREE_ERROR_FATAL;
+ }
+ free(te->symlink_parent_path);
+ te->symlink_parent_path = NULL;
+#endif
+ t->openCount--;
+ } else {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ if (SetCurrentDirectory("..") == 0) {
+#else
+ if (chdir("..") != 0) {
+#endif
+ t->tree_errno = errno;
+ r = TREE_ERROR_FATAL;
+ }
+ }
+ return (r);
+}
+
+/*
+ * Pop the working stack.
+ */
+static void
+tree_pop(struct tree *t)
+{
+ struct tree_entry *te;
+
+ if (t->buff)
+ t->buff[t->dirname_length] = '\0';
+ if (t->stack == t->current && t->current != NULL)
+ t->current = t->current->parent;
+ te = t->stack;
+ t->stack = te->next;
+ t->dirname_length = te->dirname_length;
+ if (t->buff) {
+ t->basename = t->buff + t->dirname_length;
+ while (t->basename[0] == '/')
+ t->basename++;
+ }
+ free(te->name);
+ free(te);
+}
+
+/*
+ * Get the next item in the tree traversal.
+ */
+int
+tree_next(struct tree *t)
+{
+ int r;
+
+ /* If we're called again after a fatal error, that's an API
+ * violation. Just crash now. */
+ if (t->visit_type == TREE_ERROR_FATAL) {
+ fprintf(stderr, "Unable to continue traversing"
+ " directory heirarchy after a fatal error.");
+ abort();
+ }
+
+ while (t->stack != NULL) {
+ /* If there's an open dir, get the next entry from there. */
+ if (t->d != INVALID_DIR_HANDLE) {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ r = tree_dir_next_windows(t, NULL);
+#else
+ r = tree_dir_next_posix(t);
+#endif
+ if (r == 0)
+ continue;
+ return (r);
+ }
+
+ if (t->stack->flags & needsFirstVisit) {
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ char *d = t->stack->name;
+ t->stack->flags &= ~needsFirstVisit;
+ if (strchr(d, '*') || strchr(d, '?')) {
+ r = tree_dir_next_windows(t, d);
+ if (r == 0)
+ continue;
+ return (r);
+ }
+ // Not a pattern, handle it as-is...
+#endif
+ /* Top stack item needs a regular visit. */
+ t->current = t->stack;
+ tree_append(t, t->stack->name, strlen(t->stack->name));
+ //t->dirname_length = t->path_length;
+ //tree_pop(t);
+ t->stack->flags &= ~needsFirstVisit;
+ return (t->visit_type = TREE_REGULAR);
+ } else if (t->stack->flags & needsDescent) {
+ /* Top stack item is dir to descend into. */
+ t->current = t->stack;
+ tree_append(t, t->stack->name, strlen(t->stack->name));
+ t->stack->flags &= ~needsDescent;
+ /* If it is a link, set up fd for the ascent. */
+ if (t->stack->flags & isDirLink) {
+#ifdef HAVE_FCHDIR
+ t->stack->symlink_parent_fd = open(".", O_RDONLY);
+ t->openCount++;
+ if (t->openCount > t->maxOpenCount)
+ t->maxOpenCount = t->openCount;
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+ t->stack->symlink_parent_path = _getcwd(NULL, 0);
+#endif
+ }
+ t->dirname_length = t->path_length;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ if (t->path_length == 259 || !SetCurrentDirectory(t->stack->name) != 0)
+#else
+ if (chdir(t->stack->name) != 0)
+#endif
+ {
+ /* chdir() failed; return error */
+ tree_pop(t);
+ t->tree_errno = errno;
+ return (t->visit_type = TREE_ERROR_DIR);
+ }
+ t->depth++;
+ return (t->visit_type = TREE_POSTDESCENT);
+ } else if (t->stack->flags & needsOpen) {
+ t->stack->flags &= ~needsOpen;
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ r = tree_dir_next_windows(t, "*");
+#else
+ r = tree_dir_next_posix(t);
+#endif
+ if (r == 0)
+ continue;
+ return (r);
+ } else if (t->stack->flags & needsAscent) {
+ /* Top stack item is dir and we're done with it. */
+ r = tree_ascend(t);
+ tree_pop(t);
+ t->visit_type = r != 0 ? r : TREE_POSTASCENT;
+ return (t->visit_type);
+ } else {
+ /* Top item on stack is dead. */
+ tree_pop(t);
+ t->flags &= ~hasLstat;
+ t->flags &= ~hasStat;
+ }
+ }
+ return (t->visit_type = 0);
+}
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+static int
+tree_dir_next_windows(struct tree *t, const char *pattern)
+{
+ const char *name;
+ size_t namelen;
+ int r;
+
+ for (;;) {
+ if (pattern != NULL) {
+ t->d = FindFirstFile(pattern, &t->_findData);
+ if (t->d == INVALID_DIR_HANDLE) {
+ r = tree_ascend(t); /* Undo "chdir" */
+ tree_pop(t);
+ t->tree_errno = errno;
+ t->visit_type = r != 0 ? r : TREE_ERROR_DIR;
+ return (t->visit_type);
+ }
+ t->findData = &t->_findData;
+ pattern = NULL;
+ } else if (!FindNextFile(t->d, &t->_findData)) {
+ FindClose(t->d);
+ t->d = INVALID_DIR_HANDLE;
+ t->findData = NULL;
+ return (0);
+ }
+ name = t->findData->cFileName;
+ namelen = strlen(name);
+ t->flags &= ~hasLstat;
+ t->flags &= ~hasStat;
+ if (name[0] == '.' && name[1] == '\0')
+ continue;
+ if (name[0] == '.' && name[1] == '.' && name[2] == '\0')
+ continue;
+ tree_append(t, name, namelen);
+ return (t->visit_type = TREE_REGULAR);
+ }
+}
+#else
+static int
+tree_dir_next_posix(struct tree *t)
+{
+ int r;
+ const char *name;
+ size_t namelen;
+
+ if (t->d == NULL) {
+ if ((t->d = opendir(".")) == NULL) {
+ r = tree_ascend(t); /* Undo "chdir" */
+ tree_pop(t);
+ t->tree_errno = errno;
+ t->visit_type = r != 0 ? r : TREE_ERROR_DIR;
+ return (t->visit_type);
+ }
+ }
+ for (;;) {
+ t->de = readdir(t->d);
+ if (t->de == NULL) {
+ closedir(t->d);
+ t->d = INVALID_DIR_HANDLE;
+ return (0);
+ }
+ name = t->de->d_name;
+ namelen = D_NAMELEN(t->de);
+ t->flags &= ~hasLstat;
+ t->flags &= ~hasStat;
+ if (name[0] == '.' && name[1] == '\0')
+ continue;
+ if (name[0] == '.' && name[1] == '.' && name[2] == '\0')
+ continue;
+ tree_append(t, name, namelen);
+ return (t->visit_type = TREE_REGULAR);
+ }
+}
+#endif
+
+/*
+ * Return error code.
+ */
+int
+tree_errno(struct tree *t)
+{
+ return (t->tree_errno);
+}
+
+/*
+ * Called by the client to mark the directory just returned from
+ * tree_next() as needing to be visited.
+ */
+void
+tree_descend(struct tree *t)
+{
+ if (t->visit_type != TREE_REGULAR)
+ return;
+
+ if (tree_current_is_physical_dir(t)) {
+ tree_push(t, t->basename);
+ t->stack->flags |= isDir;
+ } else if (tree_current_is_dir(t)) {
+ tree_push(t, t->basename);
+ t->stack->flags |= isDirLink;
+ }
+}
+
+/*
+ * Get the stat() data for the entry just returned from tree_next().
+ */
+const struct stat *
+tree_current_stat(struct tree *t)
+{
+ if (!(t->flags & hasStat)) {
+ if (stat(tree_current_access_path(t), &t->st) != 0)
+ return NULL;
+ t->flags |= hasStat;
+ }
+ return (&t->st);
+}
+
+#if defined(HAVE_WINDOWS_H) && !defined(__CYGWIN__)
+const BY_HANDLE_FILE_INFORMATION *
+tree_current_file_information(struct tree *t)
+{
+ if (!(t->flags & hasFileInfo)) {
+ HANDLE h = CreateFile(tree_current_access_path(t),
+ 0, 0, NULL,
+ OPEN_EXISTING,
+ FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
+ NULL);
+ if (h == INVALID_HANDLE_VALUE)
+ return NULL;
+ if (!GetFileInformationByHandle(h, &t->fileInfo)) {
+ CloseHandle(h);
+ return NULL;
+ }
+ CloseHandle(h);
+ t->flags |= hasFileInfo;
+ }
+ return (&t->fileInfo);
+}
+#endif
+/*
+ * Get the lstat() data for the entry just returned from tree_next().
+ */
+const struct stat *
+tree_current_lstat(struct tree *t)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ return (tree_current_stat(t));
+#else
+ if (!(t->flags & hasLstat)) {
+ if (lstat(tree_current_access_path(t), &t->lst) != 0)
+ return NULL;
+ t->flags |= hasLstat;
+ }
+ return (&t->lst);
+#endif
+}
+
+/*
+ * Test whether current entry is a dir or link to a dir.
+ */
+int
+tree_current_is_dir(struct tree *t)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ if (t->findData)
+ return (t->findData->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
+ if (tree_current_file_information(t))
+ return (t->fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY);
+ return (0);
+#else
+ const struct stat *st;
+ /*
+ * If we already have lstat() info, then try some
+ * cheap tests to determine if this is a dir.
+ */
+ if (t->flags & hasLstat) {
+ /* If lstat() says it's a dir, it must be a dir. */
+ if (S_ISDIR(tree_current_lstat(t)->st_mode))
+ return 1;
+ /* Not a dir; might be a link to a dir. */
+ /* If it's not a link, then it's not a link to a dir. */
+ if (!S_ISLNK(tree_current_lstat(t)->st_mode))
+ return 0;
+ /*
+ * It's a link, but we don't know what it's a link to,
+ * so we'll have to use stat().
+ */
+ }
+
+ st = tree_current_stat(t);
+ /* If we can't stat it, it's not a dir. */
+ if (st == NULL)
+ return 0;
+ /* Use the definitive test. Hopefully this is cached. */
+ return (S_ISDIR(st->st_mode));
+#endif
+}
+
+/*
+ * Test whether current entry is a physical directory. Usually, we
+ * already have at least one of stat() or lstat() in memory, so we
+ * use tricks to try to avoid an extra trip to the disk.
+ */
+int
+tree_current_is_physical_dir(struct tree *t)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ if (tree_current_is_physical_link(t))
+ return (0);
+ return (tree_current_is_dir(t));
+#else
+ const struct stat *st;
+
+ /*
+ * If stat() says it isn't a dir, then it's not a dir.
+ * If stat() data is cached, this check is free, so do it first.
+ */
+ if ((t->flags & hasStat)
+ && (!S_ISDIR(tree_current_stat(t)->st_mode)))
+ return 0;
+
+ /*
+ * Either stat() said it was a dir (in which case, we have
+ * to determine whether it's really a link to a dir) or
+ * stat() info wasn't available. So we use lstat(), which
+ * hopefully is already cached.
+ */
+
+ st = tree_current_lstat(t);
+ /* If we can't stat it, it's not a dir. */
+ if (st == NULL)
+ return 0;
+ /* Use the definitive test. Hopefully this is cached. */
+ return (S_ISDIR(st->st_mode));
+#endif
+}
+
+/*
+ * Test whether current entry is a symbolic link.
+ */
+int
+tree_current_is_physical_link(struct tree *t)
+{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#ifndef IO_REPARSE_TAG_SYMLINK
+/* Old SDKs do not provide IO_REPARSE_TAG_SYMLINK */
+#define IO_REPARSE_TAG_SYMLINK 0xA000000CL
+#endif
+ if (t->findData)
+ return ((t->findData->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)
+ && (t->findData->dwReserved0 == IO_REPARSE_TAG_SYMLINK));
+ return (0);
+#else
+ const struct stat *st = tree_current_lstat(t);
+ if (st == NULL)
+ return 0;
+ return (S_ISLNK(st->st_mode));
+#endif
+}
+
+/*
+ * Return the access path for the entry just returned from tree_next().
+ */
+const char *
+tree_current_access_path(struct tree *t)
+{
+ return (t->basename);
+}
+
+/*
+ * Return the full path for the entry just returned from tree_next().
+ */
+const char *
+tree_current_path(struct tree *t)
+{
+ return (t->buff);
+}
+
+/*
+ * Return the length of the path for the entry just returned from tree_next().
+ */
+size_t
+tree_current_pathlen(struct tree *t)
+{
+ return (t->path_length);
+}
+
+/*
+ * Return the nesting depth of the entry just returned from tree_next().
+ */
+int
+tree_current_depth(struct tree *t)
+{
+ return (t->depth);
+}
+
+/*
+ * Terminate the traversal and release any resources.
+ */
+void
+tree_close(struct tree *t)
+{
+ /* Release anything remaining in the stack. */
+ while (t->stack != NULL)
+ tree_pop(t);
+ free(t->buff);
+ /* TODO: Ensure that premature close() resets cwd */
+#if 0
+#ifdef HAVE_FCHDIR
+ if (t->initialDirFd >= 0) {
+ int s = fchdir(t->initialDirFd);
+ (void)s; /* UNUSED */
+ close(t->initialDirFd);
+ t->initialDirFd = -1;
+ }
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+ if (t->initialDir != NULL) {
+ SetCurrentDir(t->initialDir);
+ free(t->initialDir);
+ t->initialDir = NULL;
+ }
+#endif
+#endif
+ free(t);
+}
diff --git a/archivers/libarchive/files/tar/tree.h b/archivers/libarchive/files/tar/tree.h
new file mode 100644
index 00000000000..9a7e0d30744
--- /dev/null
+++ b/archivers/libarchive/files/tar/tree.h
@@ -0,0 +1,141 @@
+/*-
+ * 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/tree.h,v 1.4 2008/11/27 05:49:52 kientzle Exp $
+ */
+
+/*-
+ * A set of routines for traversing directory trees.
+ * Similar in concept to the fts library, but with a few
+ * important differences:
+ * * Uses less memory. In particular, fts stores an entire directory
+ * in memory at a time. This package only keeps enough subdirectory
+ * information in memory to track the traversal. Information
+ * about non-directories is discarded as soon as possible.
+ * * Supports very deep logical traversals. The fts package
+ * uses "non-chdir" approach for logical traversals. This
+ * package does use a chdir approach for logical traversals
+ * and can therefore handle pathnames much longer than PATH_MAX.
+ * * Supports deep physical traversals "out of the box."
+ * Due to the memory optimizations above, there's no need to
+ * limit dir names to 32k.
+ */
+
+#include <sys/stat.h>
+#include <stdio.h>
+
+struct tree;
+
+/* Initiate/terminate a tree traversal. */
+struct tree *tree_open(const char * /* pathname */);
+void tree_close(struct tree *);
+
+/*
+ * tree_next() returns Zero if there is no next entry, non-zero if
+ * there is. Note that directories are visited three times.
+ * Directories are always visited first as part of enumerating their
+ * parent; that is a "regular" visit. If tree_descend() is invoked at
+ * that time, the directory is added to a work list and will
+ * subsequently be visited two more times: once just after descending
+ * into the directory ("postdescent") and again just after ascending
+ * back to the parent ("postascent").
+ *
+ * TREE_ERROR_DIR is returned if the descent failed (because the
+ * directory couldn't be opened, for instance). This is returned
+ * instead of TREE_POSTDESCENT/TREE_POSTASCENT. TREE_ERROR_DIR is not a
+ * fatal error, but it does imply that the relevant subtree won't be
+ * visited. TREE_ERROR_FATAL is returned for an error that left the
+ * traversal completely hosed. Right now, this is only returned for
+ * chdir() failures during ascent.
+ */
+#define TREE_REGULAR 1
+#define TREE_POSTDESCENT 2
+#define TREE_POSTASCENT 3
+#define TREE_ERROR_DIR -1
+#define TREE_ERROR_FATAL -2
+
+int tree_next(struct tree *);
+
+/* Errno value associated with the last traversal error. */
+int tree_errno(struct tree *);
+
+/*
+ * Request that current entry be visited. If you invoke it on every
+ * directory, you'll get a physical traversal. This is ignored if the
+ * current entry isn't a directory or a link to a directory. So, if
+ * you invoke this on every returned path, you'll get a full logical
+ * traversal.
+ */
+void tree_descend(struct tree *);
+
+/*
+ * Return information about the current entry.
+ */
+
+/* Current depth in the traversal. */
+int tree_current_depth(struct tree *);
+
+/*
+ * The current full pathname, length of the full pathname, and a name
+ * that can be used to access the file. Because tree does use chdir
+ * extensively, the access path is almost never the same as the full
+ * current path.
+ *
+ * TODO: Flesh out this interface to provide other information. In
+ * particular, Windows can provide file size, mode, and some permission
+ * information without invoking stat() at all.
+ *
+ * TODO: On platforms that support it, use openat()-style operations
+ * to eliminate the chdir() operations entirely while still supporting
+ * arbitrarily deep traversals. This makes access_path troublesome to
+ * support, of course, which means we'll need a rich enough interface
+ * that clients can function without it. (In particular, we'll need
+ * tree_current_open() that returns an open file descriptor.)
+ *
+ * TODO: Provide tree_current_archive_entry().
+ */
+const char *tree_current_path(struct tree *);
+size_t tree_current_pathlen(struct tree *);
+const char *tree_current_access_path(struct tree *);
+
+/*
+ * Request the lstat() or stat() data for the current path. Since the
+ * tree package needs to do some of this anyway, and caches the
+ * results, you should take advantage of it here if you need it rather
+ * than make a redundant stat() or lstat() call of your own.
+ */
+const struct stat *tree_current_stat(struct tree *);
+const struct stat *tree_current_lstat(struct tree *);
+
+/* The following functions use tricks to avoid a certain number of
+ * stat()/lstat() calls. */
+/* "is_physical_dir" is equivalent to S_ISDIR(tree_current_lstat()->st_mode) */
+int tree_current_is_physical_dir(struct tree *);
+/* "is_physical_link" is equivalent to S_ISLNK(tree_current_lstat()->st_mode) */
+int tree_current_is_physical_link(struct tree *);
+/* "is_dir" is equivalent to S_ISDIR(tree_current_stat()->st_mode) */
+int tree_current_is_dir(struct tree *);
+
+/* For testing/debugging: Dump the internal status to the given filehandle. */
+void tree_dump(struct tree *, FILE *);
diff --git a/archivers/libarchive/files/tar/util.c b/archivers/libarchive/files/tar/util.c
new file mode 100644
index 00000000000..f7232744ec0
--- /dev/null
+++ b/archivers/libarchive/files/tar/util.c
@@ -0,0 +1,559 @@
+/*-
+ * 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 "bsdtar_platform.h"
+__FBSDID("$FreeBSD: src/usr.bin/tar/util.c,v 1.23 2008/12/15 06:00:25 kientzle Exp $");
+
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h> /* Linux doesn't define mode_t, etc. in sys/stat.h. */
+#endif
+#include <ctype.h>
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_WCTYPE_H
+#include <wctype.h>
+#else
+/* If we don't have wctype, we need to hack up some version of iswprint(). */
+#define iswprint isprint
+#endif
+
+#include "bsdtar.h"
+#include "err.h"
+
+static size_t bsdtar_expand_char(char *, size_t, char);
+static const char *strip_components(const char *path, int elements);
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define read _read
+#endif
+
+/* TODO: Hack up a version of mbtowc for platforms with no wide
+ * character support at all. I think the following might suffice,
+ * but it needs careful testing.
+ * #if !HAVE_MBTOWC
+ * #define mbtowc(wcp, p, n) ((*wcp = *p), 1)
+ * #endif
+ */
+
+/*
+ * Print a string, taking care with any non-printable characters.
+ *
+ * Note that we use a stack-allocated buffer to receive the formatted
+ * string if we can. This is partly performance (avoiding a call to
+ * malloc()), partly out of expedience (we have to call vsnprintf()
+ * before malloc() anyway to find out how big a buffer we need; we may
+ * as well point that first call at a small local buffer in case it
+ * works), but mostly for safety (so we can use this to print messages
+ * about out-of-memory conditions).
+ */
+
+void
+safe_fprintf(FILE *f, const char *fmt, ...)
+{
+ char fmtbuff_stack[256]; /* Place to format the printf() string. */
+ char outbuff[256]; /* Buffer for outgoing characters. */
+ char *fmtbuff_heap; /* If fmtbuff_stack is too small, we use malloc */
+ char *fmtbuff; /* Pointer to fmtbuff_stack or fmtbuff_heap. */
+ int fmtbuff_length;
+ int length, n;
+ va_list ap;
+ const char *p;
+ unsigned i;
+ wchar_t wc;
+ char try_wc;
+
+ /* Use a stack-allocated buffer if we can, for speed and safety. */
+ fmtbuff_heap = NULL;
+ fmtbuff_length = sizeof(fmtbuff_stack);
+ fmtbuff = fmtbuff_stack;
+
+ /* Try formatting into the stack buffer. */
+ va_start(ap, fmt);
+ length = vsnprintf(fmtbuff, fmtbuff_length, fmt, ap);
+ va_end(ap);
+
+ /* If the result was too large, allocate a buffer on the heap. */
+ if (length >= fmtbuff_length) {
+ fmtbuff_length = length+1;
+ fmtbuff_heap = malloc(fmtbuff_length);
+
+ /* Reformat the result into the heap buffer if we can. */
+ if (fmtbuff_heap != NULL) {
+ fmtbuff = fmtbuff_heap;
+ va_start(ap, fmt);
+ length = vsnprintf(fmtbuff, fmtbuff_length, fmt, ap);
+ va_end(ap);
+ } else {
+ /* Leave fmtbuff pointing to the truncated
+ * string in fmtbuff_stack. */
+ length = sizeof(fmtbuff_stack) - 1;
+ }
+ }
+
+ /* Note: mbrtowc() has a cleaner API, but mbtowc() seems a bit
+ * more portable, so we use that here instead. */
+ n = mbtowc(NULL, NULL, 1); /* Reset the shift state. */
+
+ /* Write data, expanding unprintable characters. */
+ p = fmtbuff;
+ i = 0;
+ try_wc = 1;
+ while (*p != '\0') {
+
+ /* Convert to wide char, test if the wide
+ * char is printable in the current locale. */
+ if (try_wc && (n = mbtowc(&wc, p, length)) != -1) {
+ length -= n;
+ if (iswprint(wc) && wc != L'\\') {
+ /* Printable, copy the bytes through. */
+ while (n-- > 0)
+ outbuff[i++] = *p++;
+ } else {
+ /* Not printable, format the bytes. */
+ while (n-- > 0)
+ i += (unsigned)bsdtar_expand_char(
+ outbuff, i, *p++);
+ }
+ } else {
+ /* After any conversion failure, don't bother
+ * trying to convert the rest. */
+ i += (unsigned)bsdtar_expand_char(outbuff, i, *p++);
+ try_wc = 0;
+ }
+
+ /* If our output buffer is full, dump it and keep going. */
+ if (i > (sizeof(outbuff) - 20)) {
+ outbuff[i] = '\0';
+ fprintf(f, "%s", outbuff);
+ i = 0;
+ }
+ }
+ outbuff[i] = '\0';
+ fprintf(f, "%s", outbuff);
+
+ /* If we allocated a heap-based formatting buffer, free it now. */
+ if (fmtbuff_heap != NULL)
+ free(fmtbuff_heap);
+}
+
+/*
+ * Render an arbitrary sequence of bytes into printable ASCII characters.
+ */
+static size_t
+bsdtar_expand_char(char *buff, size_t offset, char c)
+{
+ size_t i = offset;
+
+ if (isprint((unsigned char)c) && c != '\\')
+ buff[i++] = c;
+ else {
+ buff[i++] = '\\';
+ switch (c) {
+ case '\a': buff[i++] = 'a'; break;
+ case '\b': buff[i++] = 'b'; break;
+ case '\f': buff[i++] = 'f'; break;
+ case '\n': buff[i++] = 'n'; break;
+#if '\r' != '\n'
+ /* On some platforms, \n and \r are the same. */
+ case '\r': buff[i++] = 'r'; break;
+#endif
+ case '\t': buff[i++] = 't'; break;
+ case '\v': buff[i++] = 'v'; break;
+ case '\\': buff[i++] = '\\'; break;
+ default:
+ sprintf(buff + i, "%03o", 0xFF & (int)c);
+ i += 3;
+ }
+ }
+
+ return (i - offset);
+}
+
+int
+yes(const char *fmt, ...)
+{
+ char buff[32];
+ char *p;
+ ssize_t l;
+
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fprintf(stderr, " (y/N)? ");
+ fflush(stderr);
+
+ l = read(2, buff, sizeof(buff) - 1);
+ if (l <= 0)
+ return (0);
+ buff[l] = 0;
+
+ for (p = buff; *p != '\0'; p++) {
+ if (isspace((unsigned char)*p))
+ continue;
+ switch(*p) {
+ case 'y': case 'Y':
+ return (1);
+ case 'n': case 'N':
+ return (0);
+ default:
+ return (0);
+ }
+ }
+
+ return (0);
+}
+
+/*-
+ * The logic here for -C <dir> attempts to avoid
+ * chdir() as long as possible. For example:
+ * "-C /foo -C /bar file" needs chdir("/bar") but not chdir("/foo")
+ * "-C /foo -C bar file" needs chdir("/foo/bar")
+ * "-C /foo -C bar /file1" does not need chdir()
+ * "-C /foo -C bar /file1 file2" needs chdir("/foo/bar") before file2
+ *
+ * The only correct way to handle this is to record a "pending" chdir
+ * request and combine multiple requests intelligently until we
+ * need to process a non-absolute file. set_chdir() adds the new dir
+ * to the pending list; do_chdir() actually executes any pending chdir.
+ *
+ * This way, programs that build tar command lines don't have to worry
+ * about -C with non-existent directories; such requests will only
+ * fail if the directory must be accessed.
+ *
+ * TODO: Make this handle Windows paths correctly.
+ */
+void
+set_chdir(struct bsdtar *bsdtar, const char *newdir)
+{
+ if (newdir[0] == '/') {
+ /* The -C /foo -C /bar case; dump first one. */
+ free(bsdtar->pending_chdir);
+ bsdtar->pending_chdir = NULL;
+ }
+ if (bsdtar->pending_chdir == NULL)
+ /* Easy case: no previously-saved dir. */
+ bsdtar->pending_chdir = strdup(newdir);
+ else {
+ /* The -C /foo -C bar case; concatenate */
+ char *old_pending = bsdtar->pending_chdir;
+ size_t old_len = strlen(old_pending);
+ bsdtar->pending_chdir = malloc(old_len + strlen(newdir) + 2);
+ if (old_pending[old_len - 1] == '/')
+ old_pending[old_len - 1] = '\0';
+ if (bsdtar->pending_chdir != NULL)
+ sprintf(bsdtar->pending_chdir, "%s/%s",
+ old_pending, newdir);
+ free(old_pending);
+ }
+ if (bsdtar->pending_chdir == NULL)
+ lafe_errc(1, errno, "No memory");
+}
+
+void
+do_chdir(struct bsdtar *bsdtar)
+{
+ if (bsdtar->pending_chdir == NULL)
+ return;
+
+ if (chdir(bsdtar->pending_chdir) != 0) {
+ lafe_errc(1, 0, "could not chdir to '%s'\n",
+ bsdtar->pending_chdir);
+ }
+ free(bsdtar->pending_chdir);
+ bsdtar->pending_chdir = NULL;
+}
+
+static const char *
+strip_components(const char *p, int elements)
+{
+ /* Skip as many elements as necessary. */
+ while (elements > 0) {
+ switch (*p++) {
+ case '/':
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ case '\\': /* Support \ path sep on Windows ONLY. */
+#endif
+ elements--;
+ break;
+ case '\0':
+ /* Path is too short, skip it. */
+ return (NULL);
+ }
+ }
+
+ /* Skip any / characters. This handles short paths that have
+ * additional / termination. This also handles the case where
+ * the logic above stops in the middle of a duplicate //
+ * sequence (which would otherwise get converted to an
+ * absolute path). */
+ for (;;) {
+ switch (*p) {
+ case '/':
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ case '\\': /* Support \ path sep on Windows ONLY. */
+#endif
+ ++p;
+ break;
+ case '\0':
+ return (NULL);
+ default:
+ return (p);
+ }
+ }
+}
+
+/*
+ * Handle --strip-components and any future path-rewriting options.
+ * Returns non-zero if the pathname should not be extracted.
+ *
+ * TODO: Support pax-style regex path rewrites.
+ */
+int
+edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry)
+{
+ const char *name = archive_entry_pathname(entry);
+#if HAVE_REGEX_H
+ char *subst_name;
+ int r;
+#endif
+
+#if HAVE_REGEX_H
+ r = apply_substitution(bsdtar, name, &subst_name, 0);
+ if (r == -1) {
+ lafe_warnc(0, "Invalid substitution, skipping entry");
+ return 1;
+ }
+ if (r == 1) {
+ archive_entry_copy_pathname(entry, subst_name);
+ if (*subst_name == '\0') {
+ free(subst_name);
+ return -1;
+ } else
+ free(subst_name);
+ name = archive_entry_pathname(entry);
+ }
+
+ if (archive_entry_hardlink(entry)) {
+ r = apply_substitution(bsdtar, archive_entry_hardlink(entry), &subst_name, 1);
+ if (r == -1) {
+ lafe_warnc(0, "Invalid substitution, skipping entry");
+ return 1;
+ }
+ if (r == 1) {
+ archive_entry_copy_hardlink(entry, subst_name);
+ free(subst_name);
+ }
+ }
+ if (archive_entry_symlink(entry) != NULL) {
+ r = apply_substitution(bsdtar, archive_entry_symlink(entry), &subst_name, 1);
+ if (r == -1) {
+ lafe_warnc(0, "Invalid substitution, skipping entry");
+ return 1;
+ }
+ if (r == 1) {
+ archive_entry_copy_symlink(entry, subst_name);
+ free(subst_name);
+ }
+ }
+#endif
+
+ /* Strip leading dir names as per --strip-components option. */
+ if (bsdtar->strip_components > 0) {
+ const char *linkname = archive_entry_hardlink(entry);
+
+ name = strip_components(name, bsdtar->strip_components);
+ if (name == NULL)
+ return (1);
+
+ if (linkname != NULL) {
+ linkname = strip_components(linkname,
+ bsdtar->strip_components);
+ if (linkname == NULL)
+ return (1);
+ archive_entry_copy_hardlink(entry, linkname);
+ }
+ }
+
+ /* By default, don't write or restore absolute pathnames. */
+ if (!bsdtar->option_absolute_paths) {
+ const char *rp, *p = name;
+ int slashonly = 1;
+
+ /* Remove leading "//./" or "//?/" or "//?/UNC/"
+ * (absolute path prefixes used by Windows API) */
+ if ((p[0] == '/' || p[0] == '\\') &&
+ (p[1] == '/' || p[1] == '\\') &&
+ (p[2] == '.' || p[2] == '?') &&
+ (p[3] == '/' || p[3] == '\\'))
+ {
+ if (p[2] == '?' &&
+ (p[4] == 'U' || p[4] == 'u') &&
+ (p[5] == 'N' || p[5] == 'n') &&
+ (p[6] == 'C' || p[6] == 'c') &&
+ (p[7] == '/' || p[7] == '\\'))
+ p += 8;
+ else
+ p += 4;
+ slashonly = 0;
+ }
+ do {
+ rp = p;
+ /* Remove leading drive letter from archives created
+ * on Windows. */
+ if (((p[0] >= 'a' && p[0] <= 'z') ||
+ (p[0] >= 'A' && p[0] <= 'Z')) &&
+ p[1] == ':') {
+ p += 2;
+ slashonly = 0;
+ }
+ /* Remove leading "/../", "//", etc. */
+ while (p[0] == '/' || p[0] == '\\') {
+ if (p[1] == '.' && p[2] == '.' &&
+ (p[3] == '/' || p[3] == '\\')) {
+ p += 3; /* Remove "/..", leave "/"
+ * for next pass. */
+ slashonly = 0;
+ } else
+ p += 1; /* Remove "/". */
+ }
+ } while (rp != p);
+
+ if (p != name && !bsdtar->warned_lead_slash) {
+ /* Generate a warning the first time this happens. */
+ if (slashonly)
+ lafe_warnc(0,
+ "Removing leading '%c' from member names",
+ name[0]);
+ else
+ lafe_warnc(0,
+ "Removing leading drive letter from "
+ "member names");
+ bsdtar->warned_lead_slash = 1;
+ }
+
+ /* Special case: Stripping everything yields ".". */
+ if (*p == '\0')
+ name = ".";
+ else
+ name = p;
+ } else {
+ /* Strip redundant leading '/' characters. */
+ while (name[0] == '/' && name[1] == '/')
+ name++;
+ }
+
+ /* Safely replace name in archive_entry. */
+ if (name != archive_entry_pathname(entry)) {
+ char *q = strdup(name);
+ archive_entry_copy_pathname(entry, q);
+ free(q);
+ }
+ return (0);
+}
+
+/*
+ * It would be nice to just use printf() for formatting large numbers,
+ * but the compatibility problems are quite a headache. Hence the
+ * following simple utility function.
+ */
+const char *
+tar_i64toa(int64_t n0)
+{
+ static char buff[24];
+ int64_t n = n0 < 0 ? -n0 : n0;
+ char *p = buff + sizeof(buff);
+
+ *--p = '\0';
+ do {
+ *--p = '0' + (int)(n % 10);
+ n /= 10;
+ } while (n > 0);
+ if (n0 < 0)
+ *--p = '-';
+ return p;
+}
+
+/*
+ * Like strcmp(), but try to be a little more aware of the fact that
+ * we're comparing two paths. Right now, it just handles leading
+ * "./" and trailing '/' specially, so that "a/b/" == "./a/b"
+ *
+ * TODO: Make this better, so that "./a//b/./c/" == "a/b/c"
+ * TODO: After this works, push it down into libarchive.
+ * TODO: Publish the path normalization routines in libarchive so
+ * that bsdtar can normalize paths and use fast strcmp() instead
+ * of this.
+ *
+ * Note: This is currently only used within write.c, so should
+ * not handle \ path separators.
+ */
+
+int
+pathcmp(const char *a, const char *b)
+{
+ /* Skip leading './' */
+ if (a[0] == '.' && a[1] == '/' && a[2] != '\0')
+ a += 2;
+ if (b[0] == '.' && b[1] == '/' && b[2] != '\0')
+ b += 2;
+ /* Find the first difference, or return (0) if none. */
+ while (*a == *b) {
+ if (*a == '\0')
+ return (0);
+ a++;
+ b++;
+ }
+ /*
+ * If one ends in '/' and the other one doesn't,
+ * they're the same.
+ */
+ if (a[0] == '/' && a[1] == '\0' && b[0] == '\0')
+ return (0);
+ if (a[0] == '\0' && b[0] == '/' && b[1] == '\0')
+ return (0);
+ /* They're really different, return the correct sign. */
+ return (*(const unsigned char *)a - *(const unsigned char *)b);
+}
diff --git a/archivers/libarchive/files/tar/write.c b/archivers/libarchive/files/tar/write.c
new file mode 100644
index 00000000000..fcf6eecfce4
--- /dev/null
+++ b/archivers/libarchive/files/tar/write.c
@@ -0,0 +1,1134 @@
+/*-
+ * 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 "bsdtar_platform.h"
+__FBSDID("$FreeBSD: src/usr.bin/tar/write.c,v 1.79 2008/11/27 05:49:52 kientzle Exp $");
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_ATTR_XATTR_H
+#include <attr/xattr.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_LINUX_FS_H
+#include <linux/fs.h> /* for Linux file flags */
+#endif
+/*
+ * Some Linux distributions have both linux/ext2_fs.h and ext2fs/ext2_fs.h.
+ * As the include guards don't agree, the order of include is important.
+ */
+#ifdef HAVE_LINUX_EXT2_FS_H
+#include <linux/ext2_fs.h> /* for Linux file flags */
+#endif
+#if defined(HAVE_EXT2FS_EXT2_FS_H) && !defined(__CYGWIN__)
+/* This header exists but is broken on Cygwin. */
+#include <ext2fs/ext2_fs.h>
+#endif
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "bsdtar.h"
+#include "err.h"
+#include "line_reader.h"
+#include "tree.h"
+
+/* Size of buffer for holding file data prior to writing. */
+#define FILEDATABUFLEN 65536
+
+/* Fixed size of uname/gname caches. */
+#define name_cache_size 101
+
+static const char * const NO_NAME = "(noname)";
+
+struct archive_dir_entry {
+ struct archive_dir_entry *next;
+ time_t mtime_sec;
+ int mtime_nsec;
+ char *name;
+};
+
+struct archive_dir {
+ struct archive_dir_entry *head, *tail;
+};
+
+struct name_cache {
+ int probes;
+ int hits;
+ size_t size;
+ struct {
+ id_t id;
+ const char *name;
+ } cache[name_cache_size];
+};
+
+static void add_dir_list(struct bsdtar *bsdtar, const char *path,
+ time_t mtime_sec, int mtime_nsec);
+static int append_archive(struct bsdtar *, struct archive *,
+ struct archive *ina);
+static int append_archive_filename(struct bsdtar *,
+ struct archive *, const char *fname);
+static void archive_names_from_file(struct bsdtar *bsdtar,
+ struct archive *a);
+static int copy_file_data(struct bsdtar *, struct archive *a,
+ struct archive *ina, struct archive_entry *);
+static int new_enough(struct bsdtar *, const char *path,
+ const struct stat *);
+static void report_write(struct bsdtar *, struct archive *,
+ struct archive_entry *, int64_t progress);
+static void test_for_append(struct bsdtar *);
+static void write_archive(struct archive *, struct bsdtar *);
+static void write_entry_backend(struct bsdtar *, struct archive *,
+ struct archive_entry *);
+static int write_file_data(struct bsdtar *, struct archive *,
+ struct archive_entry *, int fd);
+static void write_hierarchy(struct bsdtar *, struct archive *,
+ const char *);
+
+#if defined(_WIN32) && !defined(__CYGWIN__)
+/* Not a full lseek() emulation, but enough for our needs here. */
+static int
+seek_file(int fd, int64_t offset, int whence)
+{
+ LARGE_INTEGER distance;
+ (void)whence; /* UNUSED */
+ distance.QuadPart = offset;
+ return (SetFilePointerEx((HANDLE)_get_osfhandle(fd),
+ distance, NULL, FILE_BEGIN) ? 1 : -1);
+}
+#define open _open
+#define close _close
+#define read _read
+#define lseek seek_file
+#endif
+
+void
+tar_mode_c(struct bsdtar *bsdtar)
+{
+ struct archive *a;
+ int r;
+
+ if (*bsdtar->argv == NULL && bsdtar->names_from_file == NULL)
+ lafe_errc(1, 0, "no files or directories specified");
+
+ a = archive_write_new();
+
+ /* Support any format that the library supports. */
+ if (bsdtar->create_format == NULL) {
+ r = archive_write_set_format_pax_restricted(a);
+ bsdtar->create_format = "pax restricted";
+ } else {
+ r = archive_write_set_format_by_name(a, bsdtar->create_format);
+ }
+ if (r != ARCHIVE_OK) {
+ fprintf(stderr, "Can't use format %s: %s\n",
+ bsdtar->create_format,
+ archive_error_string(a));
+ usage();
+ }
+
+ /*
+ * If user explicitly set the block size, then assume they
+ * want the last block padded as well. Otherwise, use the
+ * default block size and accept archive_write_open_file()'s
+ * default padding decisions.
+ */
+ if (bsdtar->bytes_per_block != 0) {
+ archive_write_set_bytes_per_block(a, bsdtar->bytes_per_block);
+ archive_write_set_bytes_in_last_block(a,
+ bsdtar->bytes_per_block);
+ } else
+ archive_write_set_bytes_per_block(a, DEFAULT_BYTES_PER_BLOCK);
+
+ if (bsdtar->compress_program) {
+ archive_write_set_compression_program(a, bsdtar->compress_program);
+ } else {
+ switch (bsdtar->create_compression) {
+ case 0:
+ r = archive_write_set_compression_none(a);
+ break;
+ case 'j': case 'y':
+ r = archive_write_set_compression_bzip2(a);
+ break;
+ case 'J':
+ r = archive_write_set_compression_xz(a);
+ break;
+ case OPTION_LZMA:
+ archive_write_set_compression_lzma(a);
+ break;
+ case 'z':
+ r = archive_write_set_compression_gzip(a);
+ break;
+ case 'Z':
+ r = archive_write_set_compression_compress(a);
+ break;
+ default:
+ lafe_errc(1, 0,
+ "Unrecognized compression option -%c",
+ bsdtar->create_compression);
+ }
+ if (r != ARCHIVE_OK) {
+ lafe_errc(1, 0,
+ "Unsupported compression option -%c",
+ bsdtar->create_compression);
+ }
+ }
+
+ if (ARCHIVE_OK != archive_write_set_options(a, bsdtar->option_options))
+ lafe_errc(1, 0, "%s", archive_error_string(a));
+ if (ARCHIVE_OK != archive_write_open_file(a, bsdtar->filename))
+ lafe_errc(1, 0, "%s", archive_error_string(a));
+ write_archive(a, bsdtar);
+}
+
+/*
+ * Same as 'c', except we only support tar or empty formats in
+ * uncompressed files on disk.
+ */
+void
+tar_mode_r(struct bsdtar *bsdtar)
+{
+ int64_t end_offset;
+ int format;
+ struct archive *a;
+ struct archive_entry *entry;
+ int r;
+
+ /* Sanity-test some arguments and the file. */
+ test_for_append(bsdtar);
+
+ format = ARCHIVE_FORMAT_TAR_PAX_RESTRICTED;
+
+#if defined(__BORLANDC__)
+ bsdtar->fd = open(bsdtar->filename, O_RDWR | O_CREAT);
+#else
+ bsdtar->fd = open(bsdtar->filename, O_RDWR | O_CREAT, 0666);
+#endif
+ if (bsdtar->fd < 0)
+ lafe_errc(1, errno,
+ "Cannot open %s", bsdtar->filename);
+
+ a = archive_read_new();
+ archive_read_support_compression_all(a);
+ archive_read_support_format_tar(a);
+ archive_read_support_format_gnutar(a);
+ r = archive_read_open_fd(a, bsdtar->fd, 10240);
+ if (r != ARCHIVE_OK)
+ lafe_errc(1, archive_errno(a),
+ "Can't read archive %s: %s", bsdtar->filename,
+ archive_error_string(a));
+ while (0 == archive_read_next_header(a, &entry)) {
+ if (archive_compression(a) != ARCHIVE_COMPRESSION_NONE) {
+ archive_read_finish(a);
+ close(bsdtar->fd);
+ lafe_errc(1, 0,
+ "Cannot append to compressed archive.");
+ }
+ /* Keep going until we hit end-of-archive */
+ format = archive_format(a);
+ }
+
+ end_offset = archive_read_header_position(a);
+ archive_read_finish(a);
+
+ /* Re-open archive for writing */
+ a = archive_write_new();
+ archive_write_set_compression_none(a);
+ /*
+ * Set the format to be used for writing. To allow people to
+ * extend empty files, we need to allow them to specify the format,
+ * which opens the possibility that they will specify a format that
+ * doesn't match the existing format. Hence, the following bit
+ * of arcane ugliness.
+ */
+
+ if (bsdtar->create_format != NULL) {
+ /* If the user requested a format, use that, but ... */
+ archive_write_set_format_by_name(a,
+ bsdtar->create_format);
+ /* ... complain if it's not compatible. */
+ format &= ARCHIVE_FORMAT_BASE_MASK;
+ if (format != (int)(archive_format(a) & ARCHIVE_FORMAT_BASE_MASK)
+ && format != ARCHIVE_FORMAT_EMPTY) {
+ lafe_errc(1, 0,
+ "Format %s is incompatible with the archive %s.",
+ bsdtar->create_format, bsdtar->filename);
+ }
+ } else {
+ /*
+ * Just preserve the current format, with a little care
+ * for formats that libarchive can't write.
+ */
+ if (format == ARCHIVE_FORMAT_TAR_GNUTAR)
+ /* TODO: When gtar supports pax, use pax restricted. */
+ format = ARCHIVE_FORMAT_TAR_USTAR;
+ if (format == ARCHIVE_FORMAT_EMPTY)
+ format = ARCHIVE_FORMAT_TAR_PAX_RESTRICTED;
+ archive_write_set_format(a, format);
+ }
+ if (lseek(bsdtar->fd, end_offset, SEEK_SET) < 0)
+ lafe_errc(1, errno, "Could not seek to archive end");
+ if (ARCHIVE_OK != archive_write_set_options(a, bsdtar->option_options))
+ lafe_errc(1, 0, "%s", archive_error_string(a));
+ if (ARCHIVE_OK != archive_write_open_fd(a, bsdtar->fd))
+ lafe_errc(1, 0, "%s", archive_error_string(a));
+
+ write_archive(a, bsdtar); /* XXX check return val XXX */
+
+ close(bsdtar->fd);
+ bsdtar->fd = -1;
+}
+
+void
+tar_mode_u(struct bsdtar *bsdtar)
+{
+ int64_t end_offset;
+ struct archive *a;
+ struct archive_entry *entry;
+ int format;
+ struct archive_dir_entry *p;
+ struct archive_dir archive_dir;
+
+ bsdtar->archive_dir = &archive_dir;
+ memset(&archive_dir, 0, sizeof(archive_dir));
+
+ format = ARCHIVE_FORMAT_TAR_PAX_RESTRICTED;
+
+ /* Sanity-test some arguments and the file. */
+ test_for_append(bsdtar);
+
+ bsdtar->fd = open(bsdtar->filename, O_RDWR);
+ if (bsdtar->fd < 0)
+ lafe_errc(1, errno,
+ "Cannot open %s", bsdtar->filename);
+
+ a = archive_read_new();
+ archive_read_support_compression_all(a);
+ archive_read_support_format_tar(a);
+ archive_read_support_format_gnutar(a);
+ if (archive_read_open_fd(a, bsdtar->fd,
+ bsdtar->bytes_per_block != 0 ? bsdtar->bytes_per_block :
+ DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
+ lafe_errc(1, 0,
+ "Can't open %s: %s", bsdtar->filename,
+ archive_error_string(a));
+ }
+
+ /* Build a list of all entries and their recorded mod times. */
+ while (0 == archive_read_next_header(a, &entry)) {
+ if (archive_compression(a) != ARCHIVE_COMPRESSION_NONE) {
+ archive_read_finish(a);
+ close(bsdtar->fd);
+ lafe_errc(1, 0,
+ "Cannot append to compressed archive.");
+ }
+ add_dir_list(bsdtar, archive_entry_pathname(entry),
+ archive_entry_mtime(entry),
+ archive_entry_mtime_nsec(entry));
+ /* Record the last format determination we see */
+ format = archive_format(a);
+ /* Keep going until we hit end-of-archive */
+ }
+
+ end_offset = archive_read_header_position(a);
+ archive_read_finish(a);
+
+ /* Re-open archive for writing. */
+ a = archive_write_new();
+ archive_write_set_compression_none(a);
+ /*
+ * Set format to same one auto-detected above, except that
+ * we don't write GNU tar format, so use ustar instead.
+ */
+ if (format == ARCHIVE_FORMAT_TAR_GNUTAR)
+ format = ARCHIVE_FORMAT_TAR_USTAR;
+ archive_write_set_format(a, format);
+ if (bsdtar->bytes_per_block != 0) {
+ archive_write_set_bytes_per_block(a, bsdtar->bytes_per_block);
+ archive_write_set_bytes_in_last_block(a,
+ bsdtar->bytes_per_block);
+ } else
+ archive_write_set_bytes_per_block(a, DEFAULT_BYTES_PER_BLOCK);
+ if (lseek(bsdtar->fd, end_offset, SEEK_SET) < 0)
+ lafe_errc(1, errno, "Could not seek to archive end");
+ if (ARCHIVE_OK != archive_write_set_options(a, bsdtar->option_options))
+ lafe_errc(1, 0, "%s", archive_error_string(a));
+ if (ARCHIVE_OK != archive_write_open_fd(a, bsdtar->fd))
+ lafe_errc(1, 0, "%s", archive_error_string(a));
+
+ write_archive(a, bsdtar);
+
+ close(bsdtar->fd);
+ bsdtar->fd = -1;
+
+ while (bsdtar->archive_dir->head != NULL) {
+ p = bsdtar->archive_dir->head->next;
+ free(bsdtar->archive_dir->head->name);
+ free(bsdtar->archive_dir->head);
+ bsdtar->archive_dir->head = p;
+ }
+ bsdtar->archive_dir->tail = NULL;
+}
+
+
+/*
+ * Write user-specified files/dirs to opened archive.
+ */
+static void
+write_archive(struct archive *a, struct bsdtar *bsdtar)
+{
+ const char *arg;
+ struct archive_entry *entry, *sparse_entry;
+
+ /* Allocate a buffer for file data. */
+ if ((bsdtar->buff = malloc(FILEDATABUFLEN)) == NULL)
+ lafe_errc(1, 0, "cannot allocate memory");
+
+ if ((bsdtar->resolver = archive_entry_linkresolver_new()) == NULL)
+ lafe_errc(1, 0, "cannot create link resolver");
+ archive_entry_linkresolver_set_strategy(bsdtar->resolver,
+ archive_format(a));
+ if ((bsdtar->diskreader = archive_read_disk_new()) == NULL)
+ lafe_errc(1, 0, "Cannot create read_disk object");
+ archive_read_disk_set_standard_lookup(bsdtar->diskreader);
+
+ if (bsdtar->names_from_file != NULL)
+ archive_names_from_file(bsdtar, a);
+
+ while (*bsdtar->argv) {
+ arg = *bsdtar->argv;
+ if (arg[0] == '-' && arg[1] == 'C') {
+ arg += 2;
+ if (*arg == '\0') {
+ bsdtar->argv++;
+ arg = *bsdtar->argv;
+ if (arg == NULL) {
+ lafe_warnc(0, "%s",
+ "Missing argument for -C");
+ bsdtar->return_value = 1;
+ goto cleanup;
+ }
+ }
+ set_chdir(bsdtar, arg);
+ } else {
+ if (*arg != '/' && (arg[0] != '@' || arg[1] != '/'))
+ do_chdir(bsdtar); /* Handle a deferred -C */
+ if (*arg == '@') {
+ if (append_archive_filename(bsdtar, a,
+ arg + 1) != 0)
+ break;
+ } else
+ write_hierarchy(bsdtar, a, arg);
+ }
+ bsdtar->argv++;
+ }
+
+ entry = NULL;
+ archive_entry_linkify(bsdtar->resolver, &entry, &sparse_entry);
+ while (entry != NULL) {
+ write_entry_backend(bsdtar, a, entry);
+ archive_entry_free(entry);
+ entry = NULL;
+ archive_entry_linkify(bsdtar->resolver, &entry, &sparse_entry);
+ }
+
+ if (archive_write_close(a)) {
+ lafe_warnc(0, "%s", archive_error_string(a));
+ bsdtar->return_value = 1;
+ }
+
+cleanup:
+ /* Free file data buffer. */
+ free(bsdtar->buff);
+ archive_entry_linkresolver_free(bsdtar->resolver);
+ bsdtar->resolver = NULL;
+ archive_read_finish(bsdtar->diskreader);
+ bsdtar->diskreader = NULL;
+
+ if (bsdtar->option_totals) {
+ fprintf(stderr, "Total bytes written: %s\n",
+ tar_i64toa(archive_position_compressed(a)));
+ }
+
+ archive_write_finish(a);
+}
+
+/*
+ * Archive names specified in file.
+ *
+ * Unless --null was specified, a line containing exactly "-C" will
+ * cause the next line to be a directory to pass to chdir(). If
+ * --null is specified, then a line "-C" is just another filename.
+ */
+static void
+archive_names_from_file(struct bsdtar *bsdtar, struct archive *a)
+{
+ struct lafe_line_reader *lr;
+ const char *line;
+
+ bsdtar->next_line_is_dir = 0;
+
+ lr = lafe_line_reader(bsdtar->names_from_file, bsdtar->option_null);
+ while ((line = lafe_line_reader_next(lr)) != NULL) {
+ if (bsdtar->next_line_is_dir) {
+ set_chdir(bsdtar, line);
+ bsdtar->next_line_is_dir = 0;
+ } else if (!bsdtar->option_null && strcmp(line, "-C") == 0)
+ bsdtar->next_line_is_dir = 1;
+ else {
+ if (*line != '/')
+ do_chdir(bsdtar); /* Handle a deferred -C */
+ write_hierarchy(bsdtar, a, line);
+ }
+ }
+ lafe_line_reader_free(lr);
+ if (bsdtar->next_line_is_dir)
+ lafe_errc(1, errno,
+ "Unexpected end of filename list; "
+ "directory expected after -C");
+}
+
+/*
+ * Copy from specified archive to current archive. Returns non-zero
+ * for write errors (which force us to terminate the entire archiving
+ * operation). If there are errors reading the input archive, we set
+ * bsdtar->return_value but return zero, so the overall archiving
+ * operation will complete and return non-zero.
+ */
+static int
+append_archive_filename(struct bsdtar *bsdtar, struct archive *a,
+ const char *filename)
+{
+ struct archive *ina;
+ int rc;
+
+ if (strcmp(filename, "-") == 0)
+ filename = NULL; /* Library uses NULL for stdio. */
+
+ ina = archive_read_new();
+ archive_read_support_format_all(ina);
+ archive_read_support_compression_all(ina);
+ if (archive_read_open_file(ina, filename, 10240)) {
+ lafe_warnc(0, "%s", archive_error_string(ina));
+ bsdtar->return_value = 1;
+ return (0);
+ }
+
+ rc = append_archive(bsdtar, a, ina);
+
+ if (rc != ARCHIVE_OK) {
+ lafe_warnc(0, "Error reading archive %s: %s",
+ filename, archive_error_string(ina));
+ bsdtar->return_value = 1;
+ }
+ archive_read_finish(ina);
+
+ return (rc);
+}
+
+static int
+append_archive(struct bsdtar *bsdtar, struct archive *a, struct archive *ina)
+{
+ struct archive_entry *in_entry;
+ int e;
+
+ while (0 == archive_read_next_header(ina, &in_entry)) {
+ if (!new_enough(bsdtar, archive_entry_pathname(in_entry),
+ archive_entry_stat(in_entry)))
+ continue;
+ if (lafe_excluded(bsdtar->matching, archive_entry_pathname(in_entry)))
+ continue;
+ if (bsdtar->option_interactive &&
+ !yes("copy '%s'", archive_entry_pathname(in_entry)))
+ continue;
+ if (bsdtar->verbose)
+ safe_fprintf(stderr, "a %s",
+ archive_entry_pathname(in_entry));
+ if (need_report())
+ report_write(bsdtar, a, in_entry, 0);
+
+ e = archive_write_header(a, in_entry);
+ if (e != ARCHIVE_OK) {
+ if (!bsdtar->verbose)
+ lafe_warnc(0, "%s: %s",
+ archive_entry_pathname(in_entry),
+ archive_error_string(a));
+ else
+ fprintf(stderr, ": %s", archive_error_string(a));
+ }
+ if (e == ARCHIVE_FATAL)
+ exit(1);
+
+ if (e >= ARCHIVE_WARN) {
+ if (archive_entry_size(in_entry) == 0)
+ archive_read_data_skip(ina);
+ else if (copy_file_data(bsdtar, a, ina, in_entry))
+ exit(1);
+ }
+
+ if (bsdtar->verbose)
+ fprintf(stderr, "\n");
+ }
+
+ /* Note: If we got here, we saw no write errors, so return success. */
+ return (0);
+}
+
+/* Helper function to copy data between archives. */
+static int
+copy_file_data(struct bsdtar *bsdtar, struct archive *a,
+ struct archive *ina, struct archive_entry *entry)
+{
+ ssize_t bytes_read;
+ ssize_t bytes_written;
+ int64_t progress = 0;
+
+ bytes_read = archive_read_data(ina, bsdtar->buff, FILEDATABUFLEN);
+ while (bytes_read > 0) {
+ if (need_report())
+ report_write(bsdtar, a, entry, progress);
+
+ bytes_written = archive_write_data(a, bsdtar->buff,
+ bytes_read);
+ if (bytes_written < bytes_read) {
+ lafe_warnc(0, "%s", archive_error_string(a));
+ return (-1);
+ }
+ progress += bytes_written;
+ bytes_read = archive_read_data(ina, bsdtar->buff,
+ FILEDATABUFLEN);
+ }
+
+ return (0);
+}
+
+/*
+ * Add the file or dir hierarchy named by 'path' to the archive
+ */
+static void
+write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
+{
+ struct archive_entry *entry = NULL, *spare_entry = NULL;
+ struct tree *tree;
+ char symlink_mode = bsdtar->symlink_mode;
+ dev_t first_dev = 0;
+ int dev_recorded = 0;
+ int tree_ret;
+
+ tree = tree_open(path);
+
+ if (!tree) {
+ lafe_warnc(errno, "%s: Cannot open", path);
+ bsdtar->return_value = 1;
+ return;
+ }
+
+ while ((tree_ret = tree_next(tree)) != 0) {
+ int r;
+ const char *name = tree_current_path(tree);
+ const struct stat *st = NULL; /* info to use for this entry */
+ const struct stat *lst = NULL; /* lstat() information */
+ int descend;
+
+ if (tree_ret == TREE_ERROR_FATAL)
+ lafe_errc(1, tree_errno(tree),
+ "%s: Unable to continue traversing directory tree",
+ name);
+ if (tree_ret == TREE_ERROR_DIR) {
+ lafe_warnc(errno,
+ "%s: Couldn't visit directory", name);
+ bsdtar->return_value = 1;
+ }
+ if (tree_ret != TREE_REGULAR)
+ continue;
+
+ /*
+ * If this file/dir is excluded by a filename
+ * pattern, skip it.
+ */
+ if (lafe_excluded(bsdtar->matching, name))
+ continue;
+
+ /*
+ * Get lstat() info from the tree library.
+ */
+ lst = tree_current_lstat(tree);
+ if (lst == NULL) {
+ /* Couldn't lstat(); must not exist. */
+ lafe_warnc(errno, "%s: Cannot stat", name);
+ /* Return error if files disappear during traverse. */
+ bsdtar->return_value = 1;
+ continue;
+ }
+
+ /*
+ * Distinguish 'L'/'P'/'H' symlink following.
+ */
+ switch(symlink_mode) {
+ case 'H':
+ /* 'H': After the first item, rest like 'P'. */
+ symlink_mode = 'P';
+ /* 'H': First item (from command line) like 'L'. */
+ /* FALLTHROUGH */
+ case 'L':
+ /* 'L': Do descend through a symlink to dir. */
+ descend = tree_current_is_dir(tree);
+ /* 'L': Follow symlinks to files. */
+ archive_read_disk_set_symlink_logical(bsdtar->diskreader);
+ /* 'L': Archive symlinks as targets, if we can. */
+ st = tree_current_stat(tree);
+ if (st != NULL)
+ break;
+ /* If stat fails, we have a broken symlink;
+ * in that case, don't follow the link. */
+ /* FALLTHROUGH */
+ default:
+ /* 'P': Don't descend through a symlink to dir. */
+ descend = tree_current_is_physical_dir(tree);
+ /* 'P': Don't follow symlinks to files. */
+ archive_read_disk_set_symlink_physical(bsdtar->diskreader);
+ /* 'P': Archive symlinks as symlinks. */
+ st = lst;
+ break;
+ }
+
+ /*
+ * Are we about to cross to a new filesystem?
+ */
+ if (!dev_recorded) {
+ /* This is the initial file system. */
+ first_dev = lst->st_dev;
+ dev_recorded = 1;
+ } else if (lst->st_dev == first_dev) {
+ /* The starting file system is always acceptable. */
+ } else if (descend == 0) {
+ /* We're not descending, so no need to check. */
+ } else if (bsdtar->option_dont_traverse_mounts) {
+ /* User has asked us not to cross mount points. */
+ descend = 0;
+ } else {
+ /* We're prepared to cross a mount point. */
+
+ /* XXX TODO: check whether this filesystem is
+ * synthetic and/or local. Add a new
+ * --local-only option to skip non-local
+ * filesystems. Skip synthetic filesystems
+ * regardless.
+ *
+ * The results should be cached, since
+ * tree.c doesn't usually visit a directory
+ * and the directory contents together. A simple
+ * move-to-front list should perform quite well.
+ *
+ * This is going to be heavily OS dependent:
+ * FreeBSD's statfs() in conjunction with getvfsbyname()
+ * provides all of this; NetBSD's statvfs() does
+ * most of it; other systems will vary.
+ */
+ }
+
+ /*
+ * In -u mode, check that the file is newer than what's
+ * already in the archive; in all modes, obey --newerXXX flags.
+ */
+ if (!new_enough(bsdtar, name, st))
+ continue;
+
+ archive_entry_free(entry);
+ entry = archive_entry_new();
+
+ archive_entry_set_pathname(entry, name);
+ archive_entry_copy_sourcepath(entry,
+ tree_current_access_path(tree));
+
+ /* Populate the archive_entry with metadata from the disk. */
+ /* XXX TODO: Arrange to open a regular file before
+ * calling this so we can pass in an fd and shorten
+ * the race to query metadata. The linkify dance
+ * makes this more complex than it might sound. */
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ /* TODO: tree.c uses stat(), which is badly broken
+ * on Windows. To fix this, we should
+ * deprecate tree_current_stat() and provide a new
+ * call tree_populate_entry(t, entry). This call
+ * would use stat() internally on POSIX and
+ * GetInfoByFileHandle() internally on Windows.
+ * This would be another step towards a tree-walker
+ * that can be integrated deep into libarchive.
+ * For now, just set st to NULL on Windows;
+ * archive_read_disk_entry_from_file() should
+ * be smart enough to use platform-appropriate
+ * ways to probe file information.
+ */
+ st = NULL;
+#endif
+ r = archive_read_disk_entry_from_file(bsdtar->diskreader,
+ entry, -1, st);
+ if (r != ARCHIVE_OK)
+ lafe_warnc(archive_errno(bsdtar->diskreader),
+ "%s", archive_error_string(bsdtar->diskreader));
+ if (r < ARCHIVE_WARN)
+ continue;
+
+ /* XXX TODO: Just use flag data from entry; avoid the
+ * duplicate check here. */
+
+ /*
+ * If this file/dir is flagged "nodump" and we're
+ * honoring such flags, skip this file/dir.
+ */
+#if defined(HAVE_STRUCT_STAT_ST_FLAGS) && defined(UF_NODUMP)
+ /* BSD systems store flags in struct stat */
+ if (bsdtar->option_honor_nodump &&
+ (lst->st_flags & UF_NODUMP))
+ continue;
+#endif
+
+#if defined(EXT2_IOC_GETFLAGS) && defined(EXT2_NODUMP_FL)
+ /* Linux uses ioctl to read flags. */
+ if (bsdtar->option_honor_nodump) {
+ int fd = open(name, O_RDONLY | O_NONBLOCK);
+ if (fd >= 0) {
+ unsigned long fflags;
+ int r = ioctl(fd, EXT2_IOC_GETFLAGS, &fflags);
+ close(fd);
+ if (r >= 0 && (fflags & EXT2_NODUMP_FL))
+ continue;
+ }
+ }
+#endif
+
+ /*
+ * If the user vetoes this file/directory, skip it.
+ * We want this to be fairly late; if some other
+ * check would veto this file, we shouldn't bother
+ * the user with it.
+ */
+ if (bsdtar->option_interactive &&
+ !yes("add '%s'", name))
+ continue;
+
+ /* Note: if user vetoes, we won't descend. */
+ if (descend && !bsdtar->option_no_subdirs)
+ tree_descend(tree);
+
+ /*
+ * Rewrite the pathname to be archived. If rewrite
+ * fails, skip the entry.
+ */
+ if (edit_pathname(bsdtar, entry))
+ continue;
+
+ /* Display entry as we process it.
+ * This format is required by SUSv2. */
+ if (bsdtar->verbose)
+ safe_fprintf(stderr, "a %s",
+ archive_entry_pathname(entry));
+
+ /* Non-regular files get archived with zero size. */
+ if (archive_entry_filetype(entry) != AE_IFREG)
+ archive_entry_set_size(entry, 0);
+
+ archive_entry_linkify(bsdtar->resolver, &entry, &spare_entry);
+
+ while (entry != NULL) {
+ write_entry_backend(bsdtar, a, entry);
+ archive_entry_free(entry);
+ entry = spare_entry;
+ spare_entry = NULL;
+ }
+
+ if (bsdtar->verbose)
+ fprintf(stderr, "\n");
+ }
+ archive_entry_free(entry);
+ tree_close(tree);
+}
+
+/*
+ * Backend for write_entry.
+ */
+static void
+write_entry_backend(struct bsdtar *bsdtar, struct archive *a,
+ struct archive_entry *entry)
+{
+ int fd = -1;
+ int e;
+
+ if (archive_entry_size(entry) > 0) {
+ const char *pathname = archive_entry_sourcepath(entry);
+ fd = open(pathname, O_RDONLY);
+ if (fd == -1) {
+ if (!bsdtar->verbose)
+ lafe_warnc(errno,
+ "%s: could not open file", pathname);
+ else
+ fprintf(stderr, ": %s", strerror(errno));
+ return;
+ }
+ }
+
+ e = archive_write_header(a, entry);
+ if (e != ARCHIVE_OK) {
+ if (!bsdtar->verbose)
+ lafe_warnc(0, "%s: %s",
+ archive_entry_pathname(entry),
+ archive_error_string(a));
+ else
+ fprintf(stderr, ": %s", archive_error_string(a));
+ }
+
+ if (e == ARCHIVE_FATAL)
+ exit(1);
+
+ /*
+ * If we opened a file earlier, write it out now. Note that
+ * the format handler might have reset the size field to zero
+ * to inform us that the archive body won't get stored. In
+ * that case, just skip the write.
+ */
+ if (e >= ARCHIVE_WARN && fd >= 0 && archive_entry_size(entry) > 0) {
+ if (write_file_data(bsdtar, a, entry, fd))
+ exit(1);
+ }
+
+ /*
+ * If we opened a file, close it now even if there was an error
+ * which made us decide not to write the archive body.
+ */
+ if (fd >= 0)
+ close(fd);
+}
+
+static void
+report_write(struct bsdtar *bsdtar, struct archive *a,
+ struct archive_entry *entry, int64_t progress)
+{
+ uint64_t comp, uncomp;
+ if (bsdtar->verbose)
+ fprintf(stderr, "\n");
+ comp = archive_position_compressed(a);
+ uncomp = archive_position_uncompressed(a);
+ fprintf(stderr, "In: %d files, %s bytes;",
+ archive_file_count(a), tar_i64toa(uncomp));
+ fprintf(stderr,
+ " Out: %s bytes, compression %d%%\n",
+ tar_i64toa(comp), (int)((uncomp - comp) * 100 / uncomp));
+ /* Can't have two calls to tar_i64toa() pending, so split the output. */
+ safe_fprintf(stderr, "Current: %s (%s",
+ archive_entry_pathname(entry),
+ tar_i64toa(progress));
+ fprintf(stderr, "/%s bytes)\n",
+ tar_i64toa(archive_entry_size(entry)));
+}
+
+
+/* Helper function to copy file to archive. */
+static int
+write_file_data(struct bsdtar *bsdtar, struct archive *a,
+ struct archive_entry *entry, int fd)
+{
+ ssize_t bytes_read;
+ ssize_t bytes_written;
+ int64_t progress = 0;
+
+ bytes_read = read(fd, bsdtar->buff, FILEDATABUFLEN);
+ while (bytes_read > 0) {
+ if (need_report())
+ report_write(bsdtar, a, entry, progress);
+
+ bytes_written = archive_write_data(a, bsdtar->buff,
+ bytes_read);
+ if (bytes_written < 0) {
+ /* Write failed; this is bad */
+ lafe_warnc(0, "%s", archive_error_string(a));
+ return (-1);
+ }
+ if (bytes_written < bytes_read) {
+ /* Write was truncated; warn but continue. */
+ lafe_warnc(0,
+ "%s: Truncated write; file may have grown while being archived.",
+ archive_entry_pathname(entry));
+ return (0);
+ }
+ progress += bytes_written;
+ bytes_read = read(fd, bsdtar->buff, FILEDATABUFLEN);
+ }
+ return 0;
+}
+
+/*
+ * Test if the specified file is new enough to include in the archive.
+ */
+static int
+new_enough(struct bsdtar *bsdtar, const char *path, const struct stat *st)
+{
+ struct archive_dir_entry *p;
+
+ /*
+ * If this file/dir is excluded by a time comparison, skip it.
+ */
+ if (bsdtar->newer_ctime_sec > 0) {
+ if (st->st_ctime < bsdtar->newer_ctime_sec)
+ return (0); /* Too old, skip it. */
+ if (st->st_ctime == bsdtar->newer_ctime_sec
+ && ARCHIVE_STAT_CTIME_NANOS(st)
+ <= bsdtar->newer_ctime_nsec)
+ return (0); /* Too old, skip it. */
+ }
+ if (bsdtar->newer_mtime_sec > 0) {
+ if (st->st_mtime < bsdtar->newer_mtime_sec)
+ return (0); /* Too old, skip it. */
+ if (st->st_mtime == bsdtar->newer_mtime_sec
+ && ARCHIVE_STAT_MTIME_NANOS(st)
+ <= bsdtar->newer_mtime_nsec)
+ return (0); /* Too old, skip it. */
+ }
+
+ /*
+ * In -u mode, we only write an entry if it's newer than
+ * what was already in the archive.
+ */
+ if (bsdtar->archive_dir != NULL &&
+ bsdtar->archive_dir->head != NULL) {
+ for (p = bsdtar->archive_dir->head; p != NULL; p = p->next) {
+ if (pathcmp(path, p->name)==0)
+ return (p->mtime_sec < st->st_mtime ||
+ (p->mtime_sec == st->st_mtime &&
+ p->mtime_nsec
+ < ARCHIVE_STAT_MTIME_NANOS(st)));
+ }
+ }
+
+ /* If the file wasn't rejected, include it. */
+ return (1);
+}
+
+/*
+ * Add an entry to the dir list for 'u' mode.
+ *
+ * XXX TODO: Make this fast.
+ */
+static void
+add_dir_list(struct bsdtar *bsdtar, const char *path,
+ time_t mtime_sec, int mtime_nsec)
+{
+ struct archive_dir_entry *p;
+
+ /*
+ * Search entire list to see if this file has appeared before.
+ * If it has, override the timestamp data.
+ */
+ p = bsdtar->archive_dir->head;
+ while (p != NULL) {
+ if (strcmp(path, p->name)==0) {
+ p->mtime_sec = mtime_sec;
+ p->mtime_nsec = mtime_nsec;
+ return;
+ }
+ p = p->next;
+ }
+
+ p = malloc(sizeof(*p));
+ if (p == NULL)
+ lafe_errc(1, ENOMEM, "Can't read archive directory");
+
+ p->name = strdup(path);
+ if (p->name == NULL)
+ lafe_errc(1, ENOMEM, "Can't read archive directory");
+ p->mtime_sec = mtime_sec;
+ p->mtime_nsec = mtime_nsec;
+ p->next = NULL;
+ if (bsdtar->archive_dir->tail == NULL) {
+ bsdtar->archive_dir->head = bsdtar->archive_dir->tail = p;
+ } else {
+ bsdtar->archive_dir->tail->next = p;
+ bsdtar->archive_dir->tail = p;
+ }
+}
+
+static void
+test_for_append(struct bsdtar *bsdtar)
+{
+ struct stat s;
+
+ if (*bsdtar->argv == NULL && bsdtar->names_from_file == NULL)
+ lafe_errc(1, 0, "no files or directories specified");
+ if (bsdtar->filename == NULL)
+ lafe_errc(1, 0, "Cannot append to stdout.");
+
+ if (bsdtar->create_compression != 0)
+ lafe_errc(1, 0,
+ "Cannot append to %s with compression", bsdtar->filename);
+
+ if (stat(bsdtar->filename, &s) != 0)
+ return;
+
+ if (!S_ISREG(s.st_mode) && !S_ISBLK(s.st_mode))
+ lafe_errc(1, 0,
+ "Cannot append to %s: not a regular file.",
+ bsdtar->filename);
+
+/* Is this an appropriate check here on Windows? */
+/*
+ if (GetFileType(handle) != FILE_TYPE_DISK)
+ lafe_errc(1, 0, "Cannot append");
+*/
+
+}